Skip to main content
1-Visitor
September 3, 2015
Question

If statement in a solve block??

  • September 3, 2015
  • 2 replies
  • 2110 views

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

2 replies

23-Emerald I
September 3, 2015

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

25-Diamond I
September 3, 2015

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

25-Diamond I
September 3, 2015

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