Equation solver in Python
Question: Given a simple equation such as:

    
    
    x = y + z
    

You can get the third variable if you bind the other two (ie: `y = x - z` and
`z = x - y`). A straightforward way to put this in code:

    
    
    def solve(args):
        if 'x' not in args:
            return args['y'] + args['z']
        elif 'z' not in args:
            return args['x'] - args['y']
        elif 'y' not in args:
            return args['x'] - args['z']
        else:
            raise SomeError  
    

I obviously can take an equation, parse it and simplify it to achieve the same
effect. But I believe in doing so I would be re-inventing the wheel. So
where's my ready-made wheel?


Answer: Consider using [Sympy](http://code.google.com/p/sympy/). It includes various
tools to solve equations and a lot more.

The following is an excerpt from the
[docs](http://docs.sympy.org/dev/modules/solvers/solvers.html):

    
    
    >>> from sympy import I, solve
    >>> from sympy.abc import x, y
    
    >>> solve(x**4-1, x)
    [1, -1, -I, I]
    

