
"""
<h1>Solving three variable linear equation system</h1>
      The <a href="http://datamelt.org/api/doc.php/Jama/package-summary">Jama</a> is open source and 100% Java library that provides <a href="http://mathworld.wolfram.com/LinearAlgebra.html">Linear Algebra</a> primitives (matrices and vectors) and algorithms. 

<p>
JAMA is comprised of six Java classes: 
Matrix, CholeskyDecomposition, LUDecomposition, QRDecomposition, 
SingularValueDecomposition and EigenvalueDecomposition.

<p>
3x + 2y -  z =  1 ---&gt; Eqn(1) <br> 
2x - 2y + 4z = -2 ---&gt; Eqn(2) <br> 
-x + y/2-  z =  0 ---&gt; Eqn(3) <br> 

"""

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()
