Back

5.wxmx

/* Solve a system of Homogeneous equations using the Gauss Jordan method.

2x+2y+2z=0

x+2y+z=0

3x+y-z=0*/

equation1:read("enter first equation:");

equation2:read("enter second equation:");

equation3:read("enter third equation:");

Matrix:augcoefmatrix([equation1,equation2,equation3],[x,y,z]);

Echelon:echelon(Matrix);

Oper:row(Echelon,1)-(row(Echelon,2)+row(Echelon,3));

Rref:addrow(Oper,row(Echelon,2),row(Echelon,3));

Solution:linsolve([Echelon[1][1].x=0,Echelon[2][2].y=0,Echelon[3][3].z=0], [x,y,z]);