import sympy
from sympy import *
from fractions import Fraction
x, u1p, u2p, u3p = symbols('x u1p u2p u3p')
system = Matrix( ( (x, x**2, 1/x, 0),
(1, 2*x, -1/(x**2), 0),
(0, 2, 2/(x**3), 2*x) ) ) # note that the right-hand-side is the one with the coefficient of the highest derivative one
print(solve_linear_system(system, u1p, u2p, u3p))