Question: Maple Programming

Hello:)

Im trying now to make a program that does the same thing as BackwardSubstitutes in maple
I tried 2 things


I tried combining the matrix and the vector in the procedure but its not working

substitutioninverse := proc (matrice, vecteur)
local n, m, j, i, resultat, V, matrice2, a;
matrice2 := [matrice, vecteur];
m, n := Dimension(matrice2);
 V := Vector(m);
for i to m do
 resultat := 0;
for j from n to 1 do
 resultat := resultat+matrice2[i, j]*V[i];
 a := (matrice2[i, m]-resultat)/matrice2[i, i]
end do;
V[i] := a
 end do;
 return V
 end proc

I tried combining the matrix and the vector in the procedure but its not working, im getting this error : Error, (in LinearAlgebra:-Dimension) invalid input: LinearAlgebra:-Dimension expects its 1st argument, A, to be of type {Matrix, Vector} but received [Matrix(3, 3, {(1, 1) = 1, (1, 2) = 1, (1, 3) = 1, (2, 1) = 0, (2, 2) = 1, (2, 3) = -2, (3, 1) = 0, (3, 2) = 0, (3, 3) = 3}), Vector(3, {(1) = 3, (2) = 5, (3) = 21})]


The second thing i tried, the matrix that i plug in the procedure after is already combined with the vector but i dont get the right answer

substitutioninverse := proc (matrice)
local n, m, j, i, resultat, V, a;
 m, n := Dimension(matrice);
 V := Vector(m);
 for i to m do
resultat := 0;
 for j to n do
resultat := resultat+matrice[i, j]*V[i];
 a := (matrice[i, m]-resultat)/matrice[i, i]
end do;
 V[i] := a
 end do;
 return V
 end proc


Thank you.

Please Wait...