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

Do you know...

ValeryOchkov
24-Ruby III

Do you know...

...that x and y in Mathcad Prime are local variables.

See please one curious thing

:

solve-xmcd.pngsolve-mcdx.png

3 REPLIES 3

No, x and y are not local variables, but variables inside a Prime solve block (apparently) are local.

In Mathcad you defined x and y before the Given. In Prime you defined x and y only inside the solve block. In both cases you did NOT assign the result of the find to x and/or y. So in both cases, after the solve block, have the values they had before the solve block.

In Mathcad that means x and y are the 2-element vectors as defined. In Prime x and y are undefined, and the plot is an autoplot, using x from -10 to +10 (as default).

Had you assigned (at least) x, before the solve block to be the same 2-element vector, the plots in Prime and Mathcad would be the same (straight lines).

 

Luc


variables inside a Prime solve block (apparently) are local.

Correct! You may also notice that you can't simply drag an expression from outside the solve block into the block (you can do, but the expression will land underneath the solve block and not inside. You must use copy and paste.

I don't like Primes solve blocks (they look ugly and cannot be evaluated symbolically) but IMHO making the guess variables local to the solve block, yet giving the user the choice to use global guesses, is a good feature anyway.

Announcements