Question: Strange syntax change automatically by Maple

mX(m, isumSD_TOT) := isumSD_REG; 
is changed to: 
mX := (m, isumSD_TOT) -> isumSD_REG;

This clobbers the Matrix mRegResTot. I can't fix it for the Matrix in the lower part. No clue why. 
The syntax works normally inside the do loops. Maple is changing the code if there is a variable that is passed as the first parm, but only outside a do loop. 

Code snippet duplicating 
_________________________________________________________________________________________

restart;
with(Statistics);
with(ArrayTools);
with(LinearAlgebra);
with(plots);
with(plottools);
with(ExcelTools);

mX := Matrix(20, 9);
iDreg := 1;
itSD_DREG := 2;
isumSD_REG := 3;
iDres := 4;
itSD_DRES := 5;
isumSD_RES := 6;
iDtot := 7;
itSD_DTOT := 8;
isumSD_TOT := 9;
for m to 20 do  # Load the matrix with values from 1 to 9. 
    mX(m, iDreg) := iDreg;
    mX(m, itSD_DREG) := itSD_DREG;
    mX(m, isumSD_REG) := isumSD_REG;
    mX(m, iDres) := iDres;
    mX(m, itSD_DRES) := itSD_DRES;
    mX(m, isumSD_RES) := isumSD_RES;
    mX(m, iDtot) := iDtot;
    mX(m, itSD_DTOT) := itSD_DTOT;
    mX(m, isumSD_TOT) := isumSD_TOT;
end do;
mX; # Show the Matrix is loaded. 
mX(5, isumSD_TOT) := itSD_DREG;  #change the last cell in the 5th row. 
mX; # Show the Matrix has row 5 column 9 changed to a 2. 
for m to 5 do #Load the first 5 rows of column 9 to a value of 1.
    mX(m, isumSD_TOT) := iDreg;
end do;
mX; # Show that the Matrix values were changed. 
m := 5;
mX(m, isumSD_TOT) := isumSD_REG;   # See syntax changed to:   mX := (m, isumSD_TOT) -> isumSD_REG;
mX;  # Show that the Matrix has been clobbered. 

 

Please Wait...