Post Reply 
CAS: overriding HOME variables, bug or feature? (for me, a feature!)
07-09-2021, 10:43 PM (This post was last modified: 07-09-2021 11:09 PM by ramon_ea1gth.)
Post: #1
CAS: overriding HOME variables, bug or feature? (for me, a feature!)
I was preparing a different post when I found this, that for me, it’s a cool feature.

While in CAS, enter, for example, this expression with single quotation marks (to avoid evaluation):
‘Z:=Z0·exp(i·β·z)’

Look at the symbols used: Z and Z0 are HOME vars, with predefined values, the first one typed as real and the second one, as complex. But for me, as engineer, the meaning is they are impedances (complex values), while z is a distance. So I would like to use these names when working in CAS to perform symbolic manipulations.

Now select by touching the quoted expression and press the soft-key simplify. The same effect is obtained by entering:
simplify(‘Z:=Z0·exp(i·β·z)’)

Now it happens! Z is converted into a CAS variable, overriding the HOME variable Z typed as real (great! I can save my own expression with the name I like!).

Next interesting step: now I want to assign a value to Z0, different from the HOME variable (and even a different type). So go and enter:
simplify(‘Z0:=50’)

So here you are! Now Z0 has a value of 50, different from the contents of the HOME variable Z (go to the HOME environment and check it). These new variables, Z and Z0 are displayed as CAS variables when pressing the VAR key.

So now, if you enter Z, the calculator retrieves the contents of Z, i.e., Z0·exp(i·β·z), but evaluated. Then, if you change the value of Z0, the retrieved value of Z will also change, as the internal expression Z0·exp(i·β·z) is evaluated.

The matter is that I wanted to be able to override HOME variables so I could use standard symbols that sometimes match the HOME variable names, as proposed in this post:
https://www.hpmuseum.org/forum/thread-16057.html

So I like this behaviour. Thus, in case the developers decide to change this behaviour, please, consider including an option in the CAS settings to disengage HOME variables from the CAS environment, as this find shows it is possible and it would be very useful to manipulate symbolic expressions that include any kind of symbols (even those used as names of HOME vars).

Enjoy the find!

(Edited: minor change to have a non-zero value of Z0 before retrieving Z).

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
CAS: overriding HOME variables, bug or feature? (for me, a feature!) - ramon_ea1gth - 07-09-2021 10:43 PM



User(s) browsing this thread: 1 Guest(s)