Solving system of linear equations using Jama
Code: "matrix_lin_eq.py". Programming language: Python DMelt Version 1. Last modified: 09/15/2015. License: Pro
https://datamelt.org/code/cache/matrix_lin_eq_2178.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



"""

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


You see the box below because you did not login.