how would i go about the following: read in three coefficents and the constant term for three simultaneous equations in three unknowns: aix+biy+ciz=di for i=1,2,3 find the solution (for x,y and z).any help would be very much appreciated!
Printable View
how would i go about the following: read in three coefficents and the constant term for three simultaneous equations in three unknowns: aix+biy+ciz=di for i=1,2,3 find the solution (for x,y and z).any help would be very much appreciated!
use linear algebra. Put the equations in matrix form (Ax = b) and then use gauss elimination. Make sure you get no zeros in the diagonal by using pivoting.
More in-depth info:
http://www.damtp.cam.ac.uk/user/fdl/...h98/linear.htm
If time is critical, you can first split A into two triangular matrices L & R (left triangular and right triangular):
LR = A
Ax = b
LRx = b
L(Rx) = b
Rx = y
Ly= b
First, solve Ly = b, then Rx = y. Since L and R are triangular, solving them will be easier.
ok thanks.i know how to do matrices by hand but how do i incorporate them into a program?i really do not understand programming!please help me!!
Since you know the dimensions:
Code:typedef struct
{
double _11, _12, _13;
double _21, _22, _23;
double _31, _32, _33;
}Matrix3x3;
typedef struct
{
double _1;
double _2;
double _3;
}Matrix1x3;
Matrix3x3 A;
Matrix1x3 b;
Then perhaps you should start with something easier...Quote:
i really do not understand programming