Previous in Forum: Loading OS on Toshiba TE2100 Laptop   Next in Forum: I want to start learning C++
Close
Close
Close
2 comments
Rate Comments: Nested
Active Contributor

Join Date: Apr 2007
Posts: 24

C++ solving set of linear equations

10/05/2008 8:05 AM

Hello
Our professor has asked us to program a power load flow script.
He said that we are not allowed to use MATLAB! so this is the problem and I don't know how calculate the jacobian matrix or matrix inverse or other calculations when I'm not allowed to use MATLAB
I have some basic knowledge of C++ and want to write my script using C++
The main problem is solving a set of linear equations with n variables and n equations
I used to use MATLAB functions like ( inv => inverse ) to calculate inverse of a matrix and solve the equations. But now how can I solve a set of equations using C++?
any help would be very appreciated.

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Member

Join Date: May 2008
Posts: 5
#1

Re: C++ solving set of linear equations

10/06/2008 1:31 AM

Hey there,

Have a look on the net for Numerical Recipe's in C++, chapter 2 on matrix functions, specifically different methods of solving linear equations.... Its a book really worth buying (will save you days of heartbreak) and comes with the c++ implementations of all their algorithms.

Cheers

Register to Reply
Participant

Join Date: Oct 2008
Posts: 2
#2

Re: C++ solving set of linear equations

10/06/2008 2:06 PM

The Excel spreadsheet has the functions Minverse & Mmult that are used to solve sets of equations. The help function will lead you in setting up the coefficient array & inverting it (be sure to designate the array as an "array function" as explained in help). Then multiply the inverted array by the single col array containing the factors equal to the equations. This will produce the solution to all the unknowns & put in another array. Try this with a simple 2X2 matrix of two equations with known values. When this works scale it up to your problem. Sounds difficult but by following the help functions & possibibly assistance from a spreadsheet pro, this will do the trick - Good Luck.

Register to Reply
Register to Reply 2 comments

Previous in Forum: Loading OS on Toshiba TE2100 Laptop   Next in Forum: I want to start learning C++

Advertisement