cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Translate the entire conversation x

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

Hans_Westerweel
10-Marble

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!

ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

4 REPLIES 4

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

 

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

Werner_E
25-Diamond I
(To:Werner_E)

Remark:

I may be wrong, but isn't this simple calculation doing the very same (just with a better precision than just 0,01 in)???

Werner_E_1-1668023439233.png

 

Yes you are right, thanks for adding that. I've been practicing more programming lately, so hadn't considered your easier solution to be honest. 

Announcements

Top Tags