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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

If statement in a solve block??

awiest
1-Newbie

If statement in a solve block??

MathCAD newbie here so apologies in advance if this is a dumb question,

Is it possible to have a conditional statement inside a solve block? I have a problem setup that I am trying to solve for a variable. But not sure i set it up correctly.

I have a conditional statement inside the solve block, and getting error

Guidance would be appreciated

3 REPLIES 3
Fred_Kohlhepp
23-Emerald I
(To:awiest)

Convert your if statement to a function and get it out of the solve block.

Werner_E
24-Ruby V
(To:awiest)

The problem is not the conditional statement - the error is thrown because you are using an undefined variable xi.

While personally I would prefer Freds solution, here is an alternative approach. You can make xi a searched for variable, too:

As you are not interested in xi you may also finish the solve block with

As already said, I would rather recommend Freds Solution.

WE

BTW, no need to crosspost -> If statement in a solveblock

Here an approach without using xi at all, rearranging the equation and using the conditional statement directly in the equation.

or

Nonetheless, I'd still vote for Fred 😉

WE

Top Tags