Skip to main content
1-Visitor
Sep 3, 2015 1:45 PM UTC
Question

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

23-Emerald I
Sep 3, 2015 3:28 PM UTC

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

Translate
Werner_E
25-Diamond I
Sep 3, 2015 4:29 PM UTC

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

Translate
Werner_E
25-Diamond I
Sep 3, 2015 4:40 PM UTC

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

Translate