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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Local assignment within an equation

mnet
3-Visitor

Local assignment within an equation

How is the following possible in Mathcad?

Untitled picture.png

 I can not even type (S2 = S1) within the equation.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:mnet)

There's no problem. Just use Mathcad and a little magic...

 

To get the assignment type the following (exactly):

(s.2{s.1)

Now you have to set the display of the 'local definition' operator from a left-pointing arrow, to an equals sign. Use the menu: Tools > Worksheet options

then choose the 'display' tab and you should find that operator listed there.

Note that it is bad practice to do this, because it conceals what is actually happening. At first glance it would seem that a boolean comparison ( does s.2 equal s.1 ?) is made, which should/would result in either True (=1) or False (=0).

 

Success!

Luc

 

View solution in original post

4 REPLIES 4
LucMeekes
23-Emerald III
(To:mnet)

There's no problem. Just use Mathcad and a little magic...

 

To get the assignment type the following (exactly):

(s.2{s.1)

Now you have to set the display of the 'local definition' operator from a left-pointing arrow, to an equals sign. Use the menu: Tools > Worksheet options

then choose the 'display' tab and you should find that operator listed there.

Note that it is bad practice to do this, because it conceals what is actually happening. At first glance it would seem that a boolean comparison ( does s.2 equal s.1 ?) is made, which should/would result in either True (=1) or False (=0).

 

Success!

Luc

 

I can only second what Luc said. Its something you should avoid in any case.

Valery (Ochkov, one of the authors of the WaterStemPro) loves to confuse people with that kind of baubleries and gadgetry.

There is no benefit in doing so other than disturb and deceive people with.

Furthermore I see no need for any inline assignment here anyway. Just type s.1 and if s.2 is used later, then type s.2:=s1 in a separate region in the worksheet. Thats much clearer and less failure prone.

 

LucMeekes
23-Emerald III
(To:Werner_E)

"Furthermore I see no need for any inline assignment here anyway. Just type s.1 and if s.2 is used later, then type s.2:=s1 in a separate region in the worksheet."

I fully agree with the first sentence, not with the second.

Note that it really is a local assignment. Following the equation that contains the local assignment, s.2 has the same value as it had before the equation. That is different from assigning s.2:s.1 in a seperate assignment!

 

Luc

Yes, you are probably right (I am too lazy to type in the address  a second time to have another look at the sheet).

The local assignment in any case won't change the variable on sheet level and if s2 is already assigned a value before and  is used later again, a separate assignment would be wrong, indeed.

Anyway, it remains an unnecessary and nonsensical hide-and-seek game.

Top Tags