FileDocCategorySizeDatePackage
SolveEquations.javaAPI DocExample1727Wed May 18 09:39:00 BST 2005com.discursive.jccook.math

SolveEquations

public class SolveEquations extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


		double[][] coefficients = { { 3.0, 20.0, 89.0 },
												{ 4.0, 40.0, 298.0 },
												 { 7.0, 21.0, 0.42 } };

		double[] values = { 1324, 2999, 2039 };
		

		RealMatrix matrix = new RealMatrixImpl( coefficients );
		
		double[] answers = matrix.solve( values );

		System.out.println( "Answers: " + ArrayUtils.toString( answers ) );

		double[][] badCoefficients = { { 1, 1, 1 },
								{ 1, 1, 1 },
								{ 1, 1, 1 } };
								
		double[] badValues = { 0, 1, 3 };
		
		matrix = new RealMatrixImpl( badCoefficients );
		
		answers = matrix.solve( badValues );

		System.out.println( "Answers: " + ArrayUtils.toString( answers ) );