[SciPy-User] How to solve a single linear equation

Robert Kern robert.kern@gmail....
Fri Oct 22 11:03:03 CDT 2010


On Fri, Oct 22, 2010 at 10:53, bert wiley <bertwiley@gmail.com> wrote:
> Hello
>    Ive just started using scipy and im learning some algebra. Ive read the
> scipy tutorial and noticed they have an example of solving linear equations
> and it uses 3 of them and takes a matrice for the params and one for the
> constants. How do solve for a single linear equation like this  x+3y+5z =
> 10  ?   ive tried it like this
>
> A = mat('[1 3 5')
> b = mat('[10]')
>
> linalg.solve(A,b)
>
>
> but i get
> raise ValueError, 'expected square matrix'

There is no unique point solution to that one equation. There is a
plane in 3D space comprised of an infinite number of points that
describes the solution to that equation. For three parameters,
linalg.solve() requires three equations. That's why you get the
ValueError saying that it expects a square matrix, 3x3 in this case.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the SciPy-User mailing list