Question: renaming variables

I am trying to assign a new value to variable. ie: replace the value of the matrix A by the matrix B.
However, when I try to use the 'new' Matrix A, it doesn't seem to be the value that I expect...

The code:

 restart; with(LinearAlgebra):p:=6;n:=4;A:=Matrix(6,1,[5,4,0,0,0,0]);B:=Matrix(p,1);E[1]:=3;E[2]:=4;E[3]:=5;E[4]:=6;for i from 1 to n doC[i,1]:=A[E[i],1];od;for j from 1 to 1 doB[j,1]:=A[3,1] od;for j from 3 to 3 do B[j,1]:=A[1,1] od;for j from 1 to p doif (j<>3) thenif (j<>1) thenB[j,1]:=A[j,1];fi;fi;od;B;for i from 1 to n doC[i,1]:=B[E[i],1];od;A:=B;for j from 2 to 2 doB[j,1]:=A[4,1] od;
for j from 4 to 4 do B[j,1]:=A[2,1] od;
for j from 1 to p doif (j<>2) thenif (j<>4) thenB[j,1]:=A[j,1];fi;fi;od;B;


Thank you

Please Wait...