Skip to main content
10-Marble
November 9, 2022
Solved

Programming: while loop iteration with matrix input (MathCad Prime 8)

Hi, could someone help me figuring out where I made a mistake in my iteration program? I would like to return a value c for every element from the input matrix, but the output shows only one value so far. I have highlighted the question in the attached sheet. Thank you!

Werner_E
Werner_EAnswer
25-Diamond I
November 9, 2022

In your program you store all results in the very same variable c, one iteration overwriting the value of the previous one. You have to collect the results in a matrix. Furthermore you were missing any initialization of c. I guessed that it should be initialized in the inner loop.

Hope this is something you looking:

Werner_E_0-1668022850697.png

 

4 replies

Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
November 9, 2022

In your program you store all results in the very same variable c, one iteration overwriting the value of the previous one. You have to collect the results in a matrix. Furthermore you were missing any initialization of c. I guessed that it should be initialized in the inner loop.

Hope this is something you looking:

Werner_E_0-1668022850697.png

 

Translate
10-Marble
November 9, 2022

O yes, that looks like what I needed. Thank you very much 🙂 

Translate