LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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

Reply
 
Search this Thread
Old 06-10-2006, 02:31 PM   #1
ArthurHuang
Member
 
Registered: Jan 2006
Posts: 174

Rep: Reputation: 30
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!
 
Old 06-10-2006, 02:34 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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? :/
 
Old 06-10-2006, 02:40 PM   #3
ArthurHuang
Member
 
Registered: Jan 2006
Posts: 174

Original Poster
Rep: Reputation: 30
-;( do you have a calculator?..
 
Old 06-11-2006, 07:26 AM   #4
ppanyam
Member
 
Registered: Oct 2004
Location: India
Distribution: Redhat
Posts: 88

Rep: Reputation: 15
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?
 
Old 06-11-2006, 09:18 PM   #5
ArthurHuang
Member
 
Registered: Jan 2006
Posts: 174

Original Poster
Rep: Reputation: 30
It hase been solved. I think some calculators has functions of solving SOE.
 
Old 06-11-2006, 10:18 PM   #6
adilturbo
Member
 
Registered: Jun 2006
Location: morocco
Posts: 195

Rep: Reputation: 30
try to clarify ur system.

u can solve it by the GAUSS elemination method
 
Old 06-12-2006, 01:31 PM   #7
QMario
LQ Newbie
 
Registered: Jun 2006
Posts: 3

Rep: Reputation: 0
Lightbulb 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
 
Old 06-12-2006, 01:40 PM   #8
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.
 
Old 06-12-2006, 02:19 PM   #9
elyk1212
Member
 
Registered: Jan 2005
Location: Chandler, AZ USA
Distribution: Mandrake/Mandriva 10.2
Posts: 186

Rep: Reputation: 30
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.
 
Old 06-12-2006, 02:34 PM   #10
elyk1212
Member
 
Registered: Jan 2005
Location: Chandler, AZ USA
Distribution: Mandrake/Mandriva 10.2
Posts: 186

Rep: Reputation: 30
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.
 
Old 06-12-2006, 03:02 PM   #11
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
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).
 
Old 06-12-2006, 06:30 PM   #12
adilturbo
Member
 
Registered: Jun 2006
Location: morocco
Posts: 195

Rep: Reputation: 30
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.
 
Old 06-17-2006, 03:49 PM   #13
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 640

Rep: Reputation: 375Reputation: 375Reputation: 375Reputation: 375
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]
 
Old 06-18-2006, 01:23 PM   #14
ArthurHuang
Member
 
Registered: Jan 2006
Posts: 174

Original Poster
Rep: Reputation: 30
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]
 
Old 06-19-2006, 03:00 AM   #15
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 640

Rep: Reputation: 375Reputation: 375Reputation: 375Reputation: 375
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
numbering equations in lyx bitt_u Linux - Software 1 07-25-2005 03:20 AM
4th of July newinlinux Slackware 8 06-21-2004 08:32 PM
Software to make equations/formulae akudewan Linux - Software 6 06-08-2004 12:37 PM
Is there a way to install The Learning Equations on k12LSTP? scyr Linux - Newbie 1 01-02-2004 11:00 AM
The 4th CD?? shooter Linux - General 2 04-14-2002 10:49 PM


All times are GMT -5. The time now is 08:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration