Skip to main content
8-Gravel
February 26, 2018
Solved

Variable not defined. Mathcad 3.0

  • February 26, 2018
  • 1 reply
  • 4513 views

Variable not defined.PNG

 

Somebody Knows why I can not give r11 to the function A?

Best answer by Werner_E

The reason is, as Fred already said, the (unneccessary) use of the symbolics.

The symbolics always traces back to the root of the definition of a variable and uses this for its calculations.

In your example the root is the "root" command (pun intended) and unfortunately "root" is only for numeric evaluation and can't be evaluated symbolically. So when the symbolics tries to go back to the definition of r11 it also tries to evaluate the root command, fails and that way r11 remains undefined for the symbolics.

What Valery found is not a bug but just a way to break that tracing back of the symbolics. Its called numeric inline evaluation. When you write r11:=root(f,g,x)=0.974 this is treated as a simple value assignment. The symbolics does not see the root command anymore and takes the numeric value at the end as value of r11.

You can achieve the very same effect if you use the (on first sight meaningless) assignment r11:=r11=...

BTW, are you aware that there is a second way to use the root command? You can use it without having to define a guess value first but simply provide limits for the looked for value -> r11:=root(f,g,x,0,2)=0.974

Interestingly the symbolics behaves a bit different (but still not as expected) if the values are calculated that way.

Bild.PNG

 

1 reply

24-Ruby IV
February 26, 2018

r11.png

hegel8-GravelAuthor
8-Gravel
February 26, 2018

OK. But Im interested to know what happened with my programm.  I would like to know why he/she (the programm) doesn´t like it.

Omar

 

 

 

 

 

 

 

 

 

 

23-Emerald I
February 26, 2018

@hegel wrote:

OK. But Im interested to know what happened with my programm.  I would like to know why he/she (the programm) doesn´t like it.

Omar

 


Mathcad symbolics are very challenging to use.  You're using symbolics to do what you should be doing numerically.