Re: Solving linear systems in matrix notation?
- To: mathgroup at smc.vnet.net
- Subject: [mg68248] Re: Solving linear systems in matrix notation?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 30 Jul 2006 04:48:40 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <eaeq6a$52u$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ben wrote:
> I have been following a tutorial that says to solve systems of linear equations like so:
>
> Solve[{2x + 4y == -4, 5x + 7y == 11}, {x, y}]
>
> I am wondering if there is a shorthand way to do it by just entering the co-efficients of each equation, i.e. matrix style:
>
> Solve??[{2,4,-4},{5,7,11}]
LinearSolve [1] does what you are looking for.
m = {{2, 4}, {5, 7}}
b = {-4, 11}
LinearSolve[m, b]
returns the vector {12, -7}.
In addition, the function LinearEquationsToMatrices from the standard
package LinearAlgebra`MatrixManipulation` might be of interest.
Best regards,
Jean-Marc
[1] http://documents.wolfram.com/mathematica/functions/LinearSolve