from sympy import symbols xyz 5x 2y 9z 2x-5y x-y n5x 2y 9z n2x-5y nx-y

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
>>> from sympy import *
>>> x, y, z= symbols('xyz')
>>> """
5x+2y+9z=8
2x-5y+z=0
x-y+z=3
"""
'\n5x+2y+9z=8\n2x-5y+z=0\nx-y+z=3\n'
>>> system = Matrix(((5,2,9,8), (2,-5,1,0),(1,-1,1,3)))
>>> solve_linear_system(system, x, y, z)
{x: 109/5, y: 31/5, z: -63/5}
>>>