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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Translate the entire conversation x

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

BW_12688021
2-Explorer

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

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

 

ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:BW_12688021)

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

View solution in original post

2 REPLIES 2
LucMeekes
23-Emerald III
(To:BW_12688021)

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

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 
 

Announcements

Top Tags