In [1]:
from __future__ import division
from sympy import * 
x, y, u, v = symbols('x y u v')
a0, b0, c0, d0 = symbols('a0 b0 c0 d0')
a1, b1, c1, d1 = symbols('a1 b1 c1 d1')
init_printing()
In [2]:
eq1 = x - a0 + b0*u + c0*v + d0*u*v
eq2 = y - a1 + b1*u + c1*v + d1*u*v
In [3]:
sol_u, sol_v = solve([eq1, eq2], [u,v])
In [4]:
sol_u
Out[4]:
$$\left ( \frac{1}{2 b_{0} d_{1} - 2 b_{1} d_{0}} \left(a_{0} d_{1} - a_{1} d_{0} - b_{0} c_{1} + b_{1} c_{0} + d_{0} y - d_{1} x - \sqrt{a_{0}^{2} d_{1}^{2} - 2 a_{0} a_{1} d_{0} d_{1} + 2 a_{0} b_{0} c_{1} d_{1} + 2 a_{0} b_{1} c_{0} d_{1} - 4 a_{0} b_{1} c_{1} d_{0} + 2 a_{0} d_{0} d_{1} y - 2 a_{0} d_{1}^{2} x + a_{1}^{2} d_{0}^{2} - 4 a_{1} b_{0} c_{0} d_{1} + 2 a_{1} b_{0} c_{1} d_{0} + 2 a_{1} b_{1} c_{0} d_{0} - 2 a_{1} d_{0}^{2} y + 2 a_{1} d_{0} d_{1} x + b_{0}^{2} c_{1}^{2} - 2 b_{0} b_{1} c_{0} c_{1} + 4 b_{0} c_{0} d_{1} y - 2 b_{0} c_{1} d_{0} y - 2 b_{0} c_{1} d_{1} x + b_{1}^{2} c_{0}^{2} - 2 b_{1} c_{0} d_{0} y - 2 b_{1} c_{0} d_{1} x + 4 b_{1} c_{1} d_{0} x + d_{0}^{2} y^{2} - 2 d_{0} d_{1} x y + d_{1}^{2} x^{2}}\right), \quad \frac{1}{2 c_{0} d_{1} - 2 c_{1} d_{0}} \left(a_{0} d_{1} - a_{1} d_{0} + b_{0} c_{1} - b_{1} c_{0} + d_{0} y - d_{1} x + \sqrt{a_{0}^{2} d_{1}^{2} - 2 a_{0} a_{1} d_{0} d_{1} + 2 a_{0} b_{0} c_{1} d_{1} + 2 a_{0} b_{1} c_{0} d_{1} - 4 a_{0} b_{1} c_{1} d_{0} + 2 a_{0} d_{0} d_{1} y - 2 a_{0} d_{1}^{2} x + a_{1}^{2} d_{0}^{2} - 4 a_{1} b_{0} c_{0} d_{1} + 2 a_{1} b_{0} c_{1} d_{0} + 2 a_{1} b_{1} c_{0} d_{0} - 2 a_{1} d_{0}^{2} y + 2 a_{1} d_{0} d_{1} x + b_{0}^{2} c_{1}^{2} - 2 b_{0} b_{1} c_{0} c_{1} + 4 b_{0} c_{0} d_{1} y - 2 b_{0} c_{1} d_{0} y - 2 b_{0} c_{1} d_{1} x + b_{1}^{2} c_{0}^{2} - 2 b_{1} c_{0} d_{0} y - 2 b_{1} c_{0} d_{1} x + 4 b_{1} c_{1} d_{0} x + d_{0}^{2} y^{2} - 2 d_{0} d_{1} x y + d_{1}^{2} x^{2}}\right)\right )$$
In [5]:
sol_v
Out[5]:
$$\left ( \frac{1}{2 b_{0} d_{1} - 2 b_{1} d_{0}} \left(a_{0} d_{1} - a_{1} d_{0} - b_{0} c_{1} + b_{1} c_{0} + d_{0} y - d_{1} x + \sqrt{a_{0}^{2} d_{1}^{2} - 2 a_{0} a_{1} d_{0} d_{1} + 2 a_{0} b_{0} c_{1} d_{1} + 2 a_{0} b_{1} c_{0} d_{1} - 4 a_{0} b_{1} c_{1} d_{0} + 2 a_{0} d_{0} d_{1} y - 2 a_{0} d_{1}^{2} x + a_{1}^{2} d_{0}^{2} - 4 a_{1} b_{0} c_{0} d_{1} + 2 a_{1} b_{0} c_{1} d_{0} + 2 a_{1} b_{1} c_{0} d_{0} - 2 a_{1} d_{0}^{2} y + 2 a_{1} d_{0} d_{1} x + b_{0}^{2} c_{1}^{2} - 2 b_{0} b_{1} c_{0} c_{1} + 4 b_{0} c_{0} d_{1} y - 2 b_{0} c_{1} d_{0} y - 2 b_{0} c_{1} d_{1} x + b_{1}^{2} c_{0}^{2} - 2 b_{1} c_{0} d_{0} y - 2 b_{1} c_{0} d_{1} x + 4 b_{1} c_{1} d_{0} x + d_{0}^{2} y^{2} - 2 d_{0} d_{1} x y + d_{1}^{2} x^{2}}\right), \quad \frac{1}{2 c_{0} d_{1} - 2 c_{1} d_{0}} \left(a_{0} d_{1} - a_{1} d_{0} + b_{0} c_{1} - b_{1} c_{0} + d_{0} y - d_{1} x - \sqrt{a_{0}^{2} d_{1}^{2} - 2 a_{0} a_{1} d_{0} d_{1} + 2 a_{0} b_{0} c_{1} d_{1} + 2 a_{0} b_{1} c_{0} d_{1} - 4 a_{0} b_{1} c_{1} d_{0} + 2 a_{0} d_{0} d_{1} y - 2 a_{0} d_{1}^{2} x + a_{1}^{2} d_{0}^{2} - 4 a_{1} b_{0} c_{0} d_{1} + 2 a_{1} b_{0} c_{1} d_{0} + 2 a_{1} b_{1} c_{0} d_{0} - 2 a_{1} d_{0}^{2} y + 2 a_{1} d_{0} d_{1} x + b_{0}^{2} c_{1}^{2} - 2 b_{0} b_{1} c_{0} c_{1} + 4 b_{0} c_{0} d_{1} y - 2 b_{0} c_{1} d_{0} y - 2 b_{0} c_{1} d_{1} x + b_{1}^{2} c_{0}^{2} - 2 b_{1} c_{0} d_{0} y - 2 b_{1} c_{0} d_{1} x + 4 b_{1} c_{1} d_{0} x + d_{0}^{2} y^{2} - 2 d_{0} d_{1} x y + d_{1}^{2} x^{2}}\right)\right )$$