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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Question about using if condition for a parameter evaluation

yhuang-3
1-Newbie

Question about using if condition for a parameter evaluation

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

ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:yhuang-3)

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

View solution in original post

3 REPLIES 3
LucMeekes
23-Emerald III
(To:yhuang-3)

There are several ways to do what you want:

Success!
Luc

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

LucMeekes
23-Emerald III
(To:yhuang-3)

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

Announcements

Top Tags