Hi ,

I want to compute a geomtric series with matrices. I have the following functions:

add (matrix1,matix2)=function to add 2 matrices.

mult(matirx1,matrix2)=function to multiply two matrices.

I want to create this function that computes the following.

I(indentity matrix)

I+A+A^2+A^3+....A^k

I tried

but it does not work.Code:sum=I; for(i=0;i<k;i++) { intermediary=mult(I,A); sum+=intermediary; intermediary=mult(intermediary,A) }

Please, What is wrong here?

Thank you for yout help