Solving linear equations w. three variables using numpy
<p>I'm currently in need of a class, which must be able to display and solve an equation system like this one:</p>

<pre><code>| 2x-4y+4z=8  |
| 34x+3y-z=30 |
| x+y+z=108   |
</code></pre>

<p>I thought it would be a good idea to write a class to transform the left-side things of the eqation system into a matrix-like object, here is the self-made-matrix for this system:</p>

<pre><code>/2  -4  4\
|34 3  -1|
\1  1   1/
</code></pre>

<p>I have written this currently:</p>

<pre><code>class mymatrix(object):
    def __init__(self):
        o11 = None
        o12 = None
        o12 = None
        o21 = None
        o22 = None
        o23 = None
        o31 = None
        o32 = None
        o33 = None

    def set(row, column, value):
        string = 'o'+str(row)+str(column)+' = '+str(value)
        exec(string)

    def solve(self, listwithrightsidethings):
        #Here I want to solve the system. This code should read  the three    
        #values out of the list and solves the system It should return the
        #values for x, y and z in a tuple: (x, y, z)
        pass
</code></pre>

<p>I searched a module to solve linear algebra pronlems, and I found numpy. I've searched in the manual but didn't find quite my solution of my problem</p>

<p>How can I write the <code>solve</code> functoin?</p>

<p>Edit:</p>

<p>python should interprete it like this</p>

<pre><code>/o11, o21, o31\   123
|o21, o22, o32| = 456
\o31, o32, o33/   789
</code></pre>

<p>Edit: I want to solve it w exactly 3 vars, and return it as a <strong>tuple</strong></p>