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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

What is this Mathcad function?

mappleby811
5-Regular Member

What is this Mathcad function?

I'm following the attached example design, but I can't tell what function/tool in Mathcad they're using. I understand the purpose of the section and what values it should return, I'm just not sure how to make Mathcad do it. It kind of looks like a programming block, but it doesn't have the bar on the right and it isn't formatted the same inside. What's tripping me up is that the value if "x" isn't constant, it's variable so I can't use simple if/else programming. I only have the file in PDF format.

1 ACCEPTED SOLUTION

Accepted Solutions


@mappleby811 wrote:

I'm following the attached example design, but I can't tell what function/tool in Mathcad they're using. I understand the purpose of the section and what values it should return, I'm just not sure how to make Mathcad do it. It kind of looks like a programming block, but it doesn't have the bar on the right and it isn't formatted the same inside.


Yes, you are right - its a programming block. but its made with real Mathcad, a version prior to Prime (maybe Mathcad 15 or older). Thats the reason a programming block looks differently.

There is only a single vertical line indicating a programing block, if there is only one command in an "if", the if-statement is condensed to just one line instead of spreading over two and instead of "else" the older Mathcad versions used "otherwise".

In Prime it would look like this:

Werner_E_4-1698966526506.png

And because the else branch is the last statement in the program, you can omit the "else" and also the last "return":#

Werner_E_5-1698966556762.png

And using "elseif" you could do it without any explicit "return" statement

Werner_E_7-1698966619457.png

 

You could even use nested if-functions instead of the programming if-statement similar to what you would do in a spreadsheet like Calc or Excel

Werner_E_8-1698966646400.png

It takes up much less space but sure is harder to read.

 

 


What's tripping me up is that the value if "x" isn't constant, it's variable so I can't use simple if/else programming. I only have the file in PDF format.

??? Not sure what you mean?
It is a function that returns one of three values depending on whether x is less than x2, greater than x1 (obviously x1>x2) or between x2 and x1.

Only if x2 < x < x1  a value dependent on x is returned, otherwise constant values phi.a resp. phi.b

 

Prime 9 sheet attached

View solution in original post

2 REPLIES 2


@mappleby811 wrote:

I'm following the attached example design, but I can't tell what function/tool in Mathcad they're using. I understand the purpose of the section and what values it should return, I'm just not sure how to make Mathcad do it. It kind of looks like a programming block, but it doesn't have the bar on the right and it isn't formatted the same inside.


Yes, you are right - its a programming block. but its made with real Mathcad, a version prior to Prime (maybe Mathcad 15 or older). Thats the reason a programming block looks differently.

There is only a single vertical line indicating a programing block, if there is only one command in an "if", the if-statement is condensed to just one line instead of spreading over two and instead of "else" the older Mathcad versions used "otherwise".

In Prime it would look like this:

Werner_E_4-1698966526506.png

And because the else branch is the last statement in the program, you can omit the "else" and also the last "return":#

Werner_E_5-1698966556762.png

And using "elseif" you could do it without any explicit "return" statement

Werner_E_7-1698966619457.png

 

You could even use nested if-functions instead of the programming if-statement similar to what you would do in a spreadsheet like Calc or Excel

Werner_E_8-1698966646400.png

It takes up much less space but sure is harder to read.

 

 


What's tripping me up is that the value if "x" isn't constant, it's variable so I can't use simple if/else programming. I only have the file in PDF format.

??? Not sure what you mean?
It is a function that returns one of three values depending on whether x is less than x2, greater than x1 (obviously x1>x2) or between x2 and x1.

Only if x2 < x < x1  a value dependent on x is returned, otherwise constant values phi.a resp. phi.b

 

Prime 9 sheet attached

mappleby811
5-Regular Member
(To:Werner_E)

You are... The MAN (or WOMAN)!

 

Thank you so much! This question is had me stumped for a while now and it just occurred to me to post here.

Top Tags