Question: Uncertainties about for loop

Hello, I have a term that do not have the variable 'n' in it, but why is the calculated number different? For example, why is

QQ:=Matrix([[3],[4],[1]]);

for m from 1 to 2 do
for n from 1 to 2 do
QQ:=(QQ*m)+QQ;
end do:
end do:

Answer: QQ:=Matrix([[108],[144],[36]])

 

different from

 

QQ:=Matrix([[3],[4],[1]]);

for m from 1 to 2 do
QQ:=(QQ*m)+QQ;
end do:

Answer: QQ:=Matrix([[18],[24],[6]])

Please Wait...