Skip to main content
1-Visitor
June 6, 2017
Solved

Question about using if condition for a parameter evaluation

  • June 6, 2017
  • 1 reply
  • 1950 views

Hi All, I have a question regarding using the if condition inside the "add line" block, would anyone help me about this?

My target is to assign a value to the parameter "c_calculated". If logic=1, I want to use an equation to calculate the variable "c_calculated". If logic=0, I want to assign a number "c_initial" to the variable "c_calculated" . However, it seems like Mathcad does not allow me to do it in the way showing below. Would anyone tell me what is wrong with this?


Thank you!

if condition.JPG

Best answer by LucMeekes

Mathcad complains that the results have different shapes.

in the 'if' line the result is an expression, a symbolic one.

In the 'otherwise'line the result is (most probably) a simple constant.

Mathcad 15 cannot deal with that.

Observing that you're dealing with symbolics, I've revisited your original problem with as result:

And with LOGIC=0 that becomes:

Maybe this approach works for you in Mathcad 15.

Success!
Luc

1 reply

23-Emerald IV
June 6, 2017

There are several ways to do what you want:

Success!
Luc

yhuang-31-VisitorAuthor
1-Visitor
June 6, 2017

Hi LucMeeks,

Thank you so much for your help! Would you advise me why I failed to get the result? This is an error message that shows up in my worksheet. Thank you!

if condition2.JPG

LucMeekes23-Emerald IVAnswer
23-Emerald IV
June 6, 2017

Mathcad complains that the results have different shapes.

in the 'if' line the result is an expression, a symbolic one.

In the 'otherwise'line the result is (most probably) a simple constant.

Mathcad 15 cannot deal with that.

Observing that you're dealing with symbolics, I've revisited your original problem with as result:

And with LOGIC=0 that becomes:

Maybe this approach works for you in Mathcad 15.

Success!
Luc