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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Creo relation in Mathcad.

AndyHermanson
14-Alexandrite

Creo relation in Mathcad.

I am wondering how i can write a Creo Relation in Mathcad 15.

In Creo the relation looks like this:


IF MOD_WIDE == 4


LEFT_BAY_MOD_WIDE = 2

ELSE


LEFT_BAY_MOD_WIDE = 3

ENDIF

So when the variable MOD_WIDE is defined as 4, then the other variable LEFT_BAY_MOD_WIDE is set equal to 2, otherwise it is 3.

Any suggestions?

ACCEPTED SOLUTION

Accepted Solutions

OK, Mathcad has a lot of equal signs with different meaning - you see three of them in both of my posts.

1) ":=" This is the assignment sign. You get it by simply typing ":" or you can use it from the evaluation toolbar

2) "=" The (bold) boolean equal sign; you use it to compare values; you get it by typing Ctrl&+ or take it from the Boolean toolbar

3) "=" the evaluation equal sign used to numerically evaluate the LHS; get it by typing the normal "=". There is a preference setting which results that when you type on the LHS a variable which is not defined and then the normal = you get a :=

I attach the worksheet for your convenience

View solution in original post

9 REPLIES 9

Creo_If.png

Better so - for Mathcad 15, Prime and Express:

Left.png

Any special reason for that preference other than that we would have to replace "otherwise" for "else" (or "elseif") in Prime?

Personally I prefer the programmed variant as I feel its a more clearly representation, especially when it comes to nested branches. But I think its a matter of peronal taste.

If shortness matters one could use in this case the following, but I wouldn't recommend it:

Creo_if2.png

BTW it works, because in MC FALSE=0 and TRUE=1.

AndyHermanson
14-Alexandrite
(To:Werner_E)

I am not getting either of these to work quite right. I think its the BOLD = sign. is not appearing that way on mine. Any suggestions? what might i be doing wrong.

The first one i got close but it wont assign the mod_wide := value into the next part.

OK, Mathcad has a lot of equal signs with different meaning - you see three of them in both of my posts.

1) ":=" This is the assignment sign. You get it by simply typing ":" or you can use it from the evaluation toolbar

2) "=" The (bold) boolean equal sign; you use it to compare values; you get it by typing Ctrl&+ or take it from the Boolean toolbar

3) "=" the evaluation equal sign used to numerically evaluate the LHS; get it by typing the normal "=". There is a preference setting which results that when you type on the LHS a variable which is not defined and then the normal = you get a :=

I attach the worksheet for your convenience

AndyHermanson
14-Alexandrite
(To:Werner_E)

Thank you so much. The "=" is actually shown as an arrow (Evaluate Symbolically) in the evaluation toolbar. Also i had forgotten to hit spacebar to grab the whole part to evaluate.

The symbolic evaluation (right arrow) is yet another of Mathcads equal signs but its not used in my examples. It has nothing to do with the boolean (bold) equal sign.

AndyHermanson
14-Alexandrite
(To:Werner_E)

Really both say they use "ctrl +"? i r confused.

The shortcut for symbolic evaluation is Ctrl+.

In my german localized version the tool tip says that I get the fat boolean equal sign with Ctrl+=, but hats wrong, it's Ctrl++ on a german keyboard.

Anyway, just try and you will see immediatly if you get the right sign.

Announcements

Top Tags