Question: sum matrix in a loop

Hi, I was trying to do the following but fail. May I know what does the error mean and how could I rectify it please? Thank you very much.

NULLNULL

with(LinearAlgebra)

node := 9

interface(rtablesize = infinity)

M := RandomMatrix(2*node)NULL

A := [seq(Matrix(2*node), i = 1 .. 21)]

P := [seq(Matrix(2*node), i = 1 .. 21)]

(1)

NULL

``

for m to 20 do for i to 20 do Ck[m] := M.A[m+1]+sum(A[i+1].P[m-i+1], i = 1 .. m-1) end do end do

Error, (in sum) summation variable previously assigned, second argument evaluates to 1 = 1 .. 0

 

``

NULL

NULL

NULL



Download Ck3.mw

Please Wait...