Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
hi, i need it in programming, like this,
maybe that way:
Thanks, but its not working for 'zero'
ex:
What did you expect to get with n=0?
My loop runs from 1 to n, not from 0 to n as in your pic!
Reasoning is that n means how often you want to ADD the matrix to itself.
As seen in my example with Rep(test,2) the input matrix is added zwo times, so its seem three times in the result.
There is no error check implemented in my program but of course n=0 make no sense and the same applies to negative or non-real values.
As written above with n=0 you will get the same result as with n=1. To cope with that so you simply get the very same matrix returned with no repetition, you would have to add a simple if r < 1 and put the loop there.
Here is some error checking:
You can use recursion:
I can't use this approach in Mathcad 15, Pse guide & do the needful.
Mathcad111 wrote, "I can't use this approach in Mathcad 15"
What I did should work in Mathcad 15. I can no longer check it, but there is no Prime magic, this works even in Express.
What I did should work in Mathcad 15.
Yes, sure it does 😉
In the last two examples the evaluation resulted in an infinite recursion, of course.
This could be avoided by exchanging the i=0 for i <=0 or for i<1 but I think that the error is OK anyway.
This will solve, thanks everyone for suggestions,