Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org How to solvle this 4th system of equations.
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 06-10-2006, 02:31 PM #1 ArthurHuang Member   Registered: Jan 2006 Posts: 174 Rep: How to solvle this 4th system of equations. hi guys, I am solving a 4 system of equations like this. -36 4 4 4 X1 -40 36 32 4 4 X2 -4 4 32 -28 4 X3 = -4 4 4 28 -24 X4 -4 I search but don't find calculator online. Is there any body know any sites can calculate it ? Thanks a lot!
 06-10-2006, 02:34 PM #2 Nylex LQ Addict   Registered: Jul 2003 Location: London, UK Distribution: Slackware Posts: 7,464 Rep: Do it by hand? You can use the normal way of solving simultaneous equations, but there's also a way to do it using matrices (though I can't remember what it is right now). Why is this in programming? :/
 06-10-2006, 02:40 PM #3 ArthurHuang Member   Registered: Jan 2006 Posts: 174 Original Poster Rep: -;( do you have a calculator?..
 06-11-2006, 07:26 AM #4 ppanyam Member   Registered: Oct 2004 Location: India Distribution: Redhat Posts: 88 Rep: The equations do look weird. Where is the "equality" symbol ie '=' in the above equations? I found only one.. What calculator are you talking about?
 06-11-2006, 09:18 PM #5 ArthurHuang Member   Registered: Jan 2006 Posts: 174 Original Poster Rep: It hase been solved. I think some calculators has functions of solving SOE.
 06-11-2006, 10:18 PM #6 adilturbo Member   Registered: Jun 2006 Location: morocco Posts: 195 Rep: try to clarify ur system. u can solve it by the GAUSS elemination method
06-12-2006, 01:31 PM   #7
QMario
LQ Newbie

Registered: Jun 2006
Posts: 3

Rep:
Augmented Matrices

Quote:
 Originally Posted by ArthurHuang hi guys, I am solving a 4 system of equations like this. -36 4 4 4 X1 -40 36 32 4 4 X2 -4 4 32 -28 4 X3 = -4 4 4 28 -24 X4 -4 I search but don't find calculator online. Is there any body know any sites can calculate it ? Thanks a lot!
Use augmented matrices.

[-36 4 4 4 X1 |-40]
[ 36 32 4 4 X2 |-4 ]
[ 4 32 -28 4 X3 |-4 ]
[ 4 4 28 -24 X4 |-4 ]

Then use the RREF function on the matrix.
RREF - reduced row echelon form

 06-12-2006, 01:40 PM #8 Nylex LQ Addict   Registered: Jul 2003 Location: London, UK Distribution: Slackware Posts: 7,464 Rep: You can also use Cramer's rule and do it with determinants. I've never learnt about augmented matrices, so don't know about those.
06-12-2006, 02:19 PM   #9
elyk1212
Member

Registered: Jan 2005
Location: Chandler, AZ USA
Distribution: Mandrake/Mandriva 10.2
Posts: 186

Rep:
Yeah, use augmented matrices. You just reduce to reduced Row echelon from. A graphing calculator can also help solve this equation for you, but keeping track of matrix variables (prevents mistakes) and eases doing row operations.

Look up 'linear programming' on Google, and 'solving systems of linear equations'.

Quote:
 Why is this in programming? :/
Likely because it is considered linear programming, and they did not see the context, but I do not know for sure.

Quote:
 You can also use Cramer's rule and do it with determinants. I've never learnt about augmented matrices, so don't know about those.
An augmented matrix, is one that is just separated, typically to represent equality on one side. Cramer's rule and determinants of matrices are actually more advanced topics than augmented matrices

By the way, I am also curious where the equality symbols are here (only one as mentioned). Am I to assume the others are equal to zero, or that the last number in each equation is the Right Hand Side?

Code:
```-36 4 4 4 X1 -40
36 32 4 4 X2 -4
4 32 -28 4 X3 = -4
4 4 28 -24 X4 -4```
You should place the entire system of equations on here, as is.

Last edited by elyk1212; 06-12-2006 at 02:32 PM.

 06-12-2006, 02:34 PM #10 elyk1212 Member   Registered: Jan 2005 Location: Chandler, AZ USA Distribution: Mandrake/Mandriva 10.2 Posts: 186 Rep: Reduced Row Echelon example (giving answers). Say each row is X1,X2,X3, then given answer matrix: Code: ```[1 0 0 | A] [0 1 0 | B] [0 0 1 | C]``` X1 = A X2 = B X3 = C But in your example, with 5 variables, and 4 equations, you will not get full answers, you will get answers in terms of themselves, as yours in an underdetermined system. Try it out and see! Last edited by elyk1212; 06-12-2006 at 02:39 PM.
06-12-2006, 03:02 PM   #11
osor
HCL Maintainer

Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep:
Quote:
 Originally Posted by Nylex You can also use Cramer's rule and do it with determinants. I've never learnt about augmented matrices, so don't know about those.
Augmented matrices is just a shorthand way of using Gaussian elimination (which, by the way, is much less computationally intensive than Cramer's rule).

 06-12-2006, 06:30 PM #12 adilturbo Member   Registered: Jun 2006 Location: morocco Posts: 195 Rep: i want just to know if ur system like this A*x=b Code: ``` Quote: -36 4 4 4 |-40] |x1] A= 36 32 4 4 b= | -4] x= |x2] 4 32 -28 4 | -4] |x3] 4 4 28 -24 | -4] |x4] ``` if it is the case so: now the new A'=A|b will be : Code: ``` Quote: 36 4 4 4 |-40 A'= 36 32 4 4 | -4 4 32 -28 4 | -4 4 4 28 -24| -4 ``` ok try to use that algo : note: it is an algo without pivoting!!!!!!!! Code: ``` Quote: function A=MEG(A,b) [n,n] = size(A); for k=1:n-1 for i=k+1:n m=A(i,k)/A(k,k) ; for j = k :n A(i,j)=A(i,j)-m *A(k,j); b(i)=b(i)-m*b(k); end end end ``` when ur A will be U which is an upper triangular matrice use that algo to find ur x vector: Code: ``` Quote: function[x]=subs_retro(A,b) [n,n]=size(A); x=zeros(n,1); x(n)=b(n)/A(n,n);//b here is the new b for i=n-1:-1:1 x(i)=(b(i)-A(i,i+1:n)*x(i+1:n))/A(i,i);//b here is the new b end ``` Last edited by adilturbo; 06-12-2006 at 10:02 PM.
 06-17-2006, 03:49 PM #13 firstfire Member   Registered: Mar 2006 Location: Ekaterinburg, Russia Distribution: Debian, Ubuntu Posts: 640 Rep: You can use `axiom': -> a := matrix[[-36,4,4,4],[36,32,4,4],[4,32,-28,4],[4,4,28,-24]] -> b := [-40,-4,-4,-4] -> solve(a, b) ... result: x = [5/6, 6/7, 5/6, 17/21]
06-18-2006, 01:23 PM   #14
ArthurHuang
Member

Registered: Jan 2006
Posts: 174

Original Poster
Rep:
This axiom looks really cool. Now I have a 12X8 matrix of SOE, can I use it ?
Btw: is it a software or library?

Quote:
 Originally Posted by firstfire You can use `axiom': -> a := matrix[[-36,4,4,4],[36,32,4,4],[4,32,-28,4],[4,4,28,-24]] -> b := [-40,-4,-4,-4] -> solve(a, b) ... result: x = [5/6, 6/7, 5/6, 17/21]

 06-19-2006, 03:00 AM #15 firstfire Member   Registered: Mar 2006 Location: Ekaterinburg, Russia Distribution: Debian, Ubuntu Posts: 640 Rep: Hi all. Yes, you can use it for such SOE. If I understand correctly, 12x8 SOE have an infinite set of solutions -- linear space. Axiom give you the basis of this space and a partial solution. Any linear function of basis-vectors will be a solution of uniform equation A*x=0. Any solution of nonuniform SOE A*x=b looks like x = x_part + c*x_base. Example: Code: ```-> a:= matrix [[1/(i+j) for i in 1..12] for j in 1..8] (4) -> +1 1 1 1 1 1 1 1 1 1 1 1+ |- - - - - - - - -- -- -- --| |2 3 4 5 6 7 8 9 10 11 12 13| | | |1 1 1 1 1 1 1 1 1 1 1 1| |- - - - - - - -- -- -- -- --| |3 4 5 6 7 8 9 10 11 12 13 14| | | |1 1 1 1 1 1 1 1 1 1 1 1| |- - - - - - -- -- -- -- -- --| |4 5 6 7 8 9 10 11 12 13 14 15| | | |1 1 1 1 1 1 1 1 1 1 1 1| |- - - - - -- -- -- -- -- -- --| |5 6 7 8 9 10 11 12 13 14 15 16| (4) | | |1 1 1 1 1 1 1 1 1 1 1 1| |- - - - -- -- -- -- -- -- -- --| |6 7 8 9 10 11 12 13 14 15 16 17| | | |1 1 1 1 1 1 1 1 1 1 1 1| |- - - -- -- -- -- -- -- -- -- --| |7 8 9 10 11 12 13 14 15 16 17 18| | | |1 1 1 1 1 1 1 1 1 1 1 1| |- - -- -- -- -- -- -- -- -- -- --| |8 9 10 11 12 13 14 15 16 17 18 19| | | |1 1 1 1 1 1 1 1 1 1 1 1| |- -- -- -- -- -- -- -- -- -- -- --| +9 10 11 12 13 14 15 16 17 18 19 20+ Type: Matrix Fraction Integer (7) -> b:= [i for i in 1..8] (7) -> (7) [1,2,3,4,5,6,7,8] Type: List PositiveInteger (8) -> s:= solve (a,b) (8) -> (8) [ particular = [- 5112, 176400, - 1912680, 9424800, - 24144120, 33297264, - 23423400, 6589440, 0, 0, 0, 0] , basis = 9 36 42 252 63 588 126 72 [[-----,- ----,---,- ---,--,- ---,---,- --,1,0,0,0], 24310 2431 221 221 17 85 17 17 4 315 180 1050 252 441 420 180 [----,- ----,---,- ----,---,- ---,---,- ---,0,1,0,0], 2431 4862 221 221 17 17 17 17 18 700 17325 49500 11550 19404 17325 6600 [----,- ----,-----,- -----,-----,- -----,-----,- ----,0,0,1,0], 4199 4199 8398 4199 323 323 323 323 36 1386 16940 190575 21780 35574 30492 10890 [----,- ----,-----,- ------,-----,- -----,-----,- -----,0,0,0,1]] 4199 4199 4199 8398 323 323 323 323 ] Type: Record(particular: Union(Vector Fraction Integer,"failed"),basis: List Vector Fraction Integer) (16) -> -- test (comment) (16) -> a*s.particular (16) -> (16) [1,2,3,4,5,6,7,8] Type: Vector Fraction Integer (17) -> a*s.basis.1 (17) -> (17) [0,0,0,0,0,0,0,0] Type: Vector Fraction Integer (18) -> a*(s.particular + 100 * s.basis.1) (18) -> (18) [1,2,3,4,5,6,7,8] Type: Vector Fraction Integer``` I think you interested in partial solution. Axiom is a free (at this moment, I meant it was proprietary, but released as free) software, not library. Last edited by firstfire; 06-19-2006 at 03:04 AM.