brad sue
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 in C that computes the following.
I+A+A^2+A^3+....A^k where I=indentity matrix
The sum should stop when all the entries in A^k are less than .00001.
I tried something like:
sum=I;
for(i=0;i<k;i++)
{
intermediary=mult(I,A);
sum+=intermediary;
intermediary=mult(intermediary,A)
}
In fact I need to use a recursive form but I just dont know how to do it.
I have been working on it since friday but I coud not figure out the solution.
It is an assigment that is due Tuesday.
please I need some help to finish this part since there are other parts to work on.
Thank you for your help
B
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 in C that computes the following.
I+A+A^2+A^3+....A^k where I=indentity matrix
The sum should stop when all the entries in A^k are less than .00001.
I tried something like:
sum=I;
for(i=0;i<k;i++)
{
intermediary=mult(I,A);
sum+=intermediary;
intermediary=mult(intermediary,A)
}
In fact I need to use a recursive form but I just dont know how to do it.
I have been working on it since friday but I coud not figure out the solution.
It is an assigment that is due Tuesday.
please I need some help to finish this part since there are other parts to work on.
Thank you for your help
B