Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Matrices with Mathematica 5.1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63327] Re: Matrices with Mathematica 5.1
  • From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 24 Dec 2005 07:18:53 -0500 (EST)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <dogk9i$pqf$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"drizkol" <drizkol at gmail.com> a écrit dans le message de news: 
dogk9i$pqf$1 at smc.vnet.net...
|I would like to solve the system given by:
|
| [1  7  -2  0  -8  -3]
| [0  0  1  1    6   5]
| [0  0  0  1    3   9]
| [0  0  0  0    0   0]
|
| Where the matrix is a typical matrix in the form x1+x2+...+xn = b where
| b is the last item in the row.  For example, row 1 could be written as
| x1 + 7x2 - 2x3 -8x4 = -3.  How could I get mathematica to solve this
| matrix?  I understand how to build a matrix, I just need to know the
| operation to run on it.  I tried to use LinearSolve but I did something
| wrong.  Is there a built-in operation to solve these matrices?  If so,
| please tell.  Thanks.
|

The above matrix is the _augmented_ matrix of the system of linear 
equations. For a system such as m . x == b, Mathematica built-in function 
*LinearSolve* expects two arguments: a matrix m of coefficients of x (a 5 x 
4 matrix in your case) and a column vector b (a 4 x 1 vector in your case) 
corresponding to the values of the RHS of the system. Therefore,

In[1]:= m = {{1, 7, -2, 0, -8}, {0, 0, 1, 1, 6},
    {0, 0, 0, 1, 3}, {0, 0, 0, 0, 0}};

In[2]:= b = {{-3}, {5}, {9}, {0}};

In[3]:= x = LinearSolve[m, b]
Out[3]= {{-11}, {0}, {-4}, {9}, {0}}

In[4]:= m . x == b
Out[4]= True

will do it.

Best regards,
/J.M. 



  • Prev by Date: Re: Gaussian sums (Was: Speeding up simple Mathematica expressions?)
  • Next by Date: Re: Re: Replacement equivalence?
  • Previous by thread: Re: Matrices with Mathematica 5.1
  • Next by thread: Matrix differential equation in NDSolve