Linear Algebra
Part 1
Part 2
This chapter address the solution of linear equations. A linear equation is on in whchy unknowns appear to the first order only and are combined with the other unknowns only with addition or subtraction.
Note:
There are typos in the drivers on pages 250 and 251 of the text.
Use drivers provided on this page.

A red line indicates that the class at the end of the arrow creates objects of the other class
Equations
3x1 + 2x2 + 4x3 = 16
2x1 -5x2 - x3 = 6
x1 - 2x2 - 2x3 = 10
Driver
import alpcentauri.*;
class LEQExample
{
public static void main(String[] args)
{
double[ ][ ] a = {{3,2,4}, {2,-5,-1}, {1,-2,-2}};
double[ ] c = {16,6,10};
try
{
LinearEquations systemOf = new LinearEquations (a,c);
DhbVector theSolution = systemOf.solution();
System.out.println(theSolution);
}
catch (DhbIllegalDimension e)
{
}
}
}
Output: Solution Vector
x1, x2, and x3

Equations
3x1 + 2x2 + 4x3 = 16
2x1 -5x2 - x3 = 6
x1 - 2x2 - 2x3 = 10
3x1 + 2x2 + 4x3 = 7
2x1 -5x2 - x3 = 4
x1 - 2x2 - 2x3 = -3
Driver
import alpcentauri.*;
class LEQExample
{
public static void main(String[] args)
{
double[][] a = {{3,2,4}, {2,-5,-1}, {1,-2,-2}};
double[][] c = {{16,6,10},{7,4,-3}};
try
{
LinearEquations systemOf = new LinearEquations (a,c);
DhbVector theSolution1 = systemOf.solution(0);
DhbVector theSolution2 = systemOf.solution(1);
System.out.println("Solution of first vector: "+theSolution1);
System.out.println("Solution of second vector: "+theSolution2);
}
catch (DhbIllegalDimension e)
{
}
}
}
Output
