"""
Solving three variable linear equation system
The Jama is open source and 100% Java library that provides Linear Algebra primitives (matrices and vectors) and algorithms.
JAMA is comprised of six Java classes:
Matrix, CholeskyDecomposition, LUDecomposition, QRDecomposition,
SingularValueDecomposition and EigenvalueDecomposition.
3x + 2y - z = 1 ---> Eqn(1)
2x - 2y + 4z = -2 ---> Eqn(2)
-x + y/2- z = 0 ---> Eqn(3)
"""
from Jama import *
from java.lang.Math import *
lhs = Matrix([[3, 2, -1], [2, -2, 4], [-1, 0.5, -1]])
rhs = Matrix([1, -2, 0], 3)
#Calculate Solved Matrix
ans = lhs.solve(rhs)
print ans.toString()