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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

7-Bedrock

Return Variable

Hello everyone,

Lets say I have:

x=2 and y=5

I want to create a new variable that is going to be equal to the variable with the highest value, per say...

z=max(x,y)

and in return get 'y' not 5

but if I change the 'x' and 'y' values I want it to return whichever variable has the highest value.

PS Im new at this, maybe I am missing a simple rule of programming, not sure...

4 REPLIES 4
23-Emerald III
(To:IRarch)

The short answer is: What you want is not possible with mathcad.

The longer answer is:

You can write a formula that will tell you which one is the larger of the two input values, but the result is not a 'variable' in the sense that (I think) you mean: The symbolic answer to a numerical comparison.

Hmm. I tried to demonstrate it was not possible, and found that it IS possible in Mathcad 11:

But I have my doubts on the usefullness of this, and on whether it works in Mathcad 15 or Prime.

Succes!

Luc

19-Tanzanite
(To:LucMeekes)

It doesn't work in Mathcad 15, so I very much doubt it works in Prime.

24-Ruby II
(To:LucMeekes)

Here is the result obtained in the MC15 M045 and MP 3.1 versions.

7-Bedrock