Skip to main content
1-Visitor
January 2, 2025
Solved

Writing a FOR program to solve a rangeof numbers and it only solves one of them.

  • January 2, 2025
  • 2 replies
  • 791 views

We had a formula written in Mathcad 15 that solved a range of numbers and gave a solution of the entire range (see image below). When we convert to Mathcad Prime 9.0 only the last number of the range gets solved (second image). We are looking for a maximum throughout the range so this does not help us very much. Is there a way to write the function in Mathcad Prime 9.0 to give similar results to Mathcad 15? Both files are attached.

BW_12688021_0-1735833945707.png

BW_12688021_1-1735833967333.png

 

Best answer by LucMeekes

The result of a  Mathcad program is the result of the last statement executed, In your case that's the assignment to qSFI5. from one of the two IF branches.

It's really bad that Mathcad 15 apparently behaves differently in this respect.

To correct:

Make sure your program ends with a return statement. You can find 'return' on the programming pallette.

It should end up looking like this:

LucMeekes_0-1735841677184.png

Success!
Luc

2 replies

LucMeekes23-Emerald IVAnswer
23-Emerald IV
January 2, 2025

The result of a  Mathcad program is the result of the last statement executed, In your case that's the assignment to qSFI5. from one of the two IF branches.

It's really bad that Mathcad 15 apparently behaves differently in this respect.

To correct:

Make sure your program ends with a return statement. You can find 'return' on the programming pallette.

It should end up looking like this:

LucMeekes_0-1735841677184.png

Success!
Luc

Community Moderator
January 27, 2025

Hi @BW_12688021,

 

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation. 

 

Thanks,
Anurag