ANS don't work all the time!
09-06-2014, 12:32 PM
Post: #1
 Marcel Member Posts: 156 Joined: Mar 2014
ANS don't work all the time!
Hi,
polar_coordinates([7 8]) ENTER
I get
[10.63.. 0.85...] This is OK and now if I do
rectangular_coordinates(Ans) ENTER
I get
[0 0]
So ANS do not return the last response...
Marcel.
09-06-2014, 11:41 PM (This post was last modified: 09-06-2014 11:48 PM by Joe Horn.)
Post: #2
 Joe Horn Senior Member Posts: 1,655 Joined: Dec 2013
RE: ANS don't work all the time!
(09-06-2014 12:32 PM)Marcel Wrote:  Hi,
polar_coordinates([7 8]) ENTER
I get
[10.63.. 0.85...] This is OK and now if I do
rectangular_coordinates(Ans) ENTER
I get
[0 0]
So ANS do not return the last response...
Marcel.

This issue keeps coming up. It's not a bug, but it's VERY unexpected behavior (and IMHO a very annoying misfeature). The problem is that Home has its own Ans, which is different from the Ans in CAS. So there are two different system variables, both with their own contents, and both called Ans! In Home, it's hard to know which one is being used. Dreadful.

Getting to your example: Since polar_coordinates() and rectangular_coordinates() are CAS functions, they always use the Ans from CAS, not the one from Home, even if you are using those functions in Home.

Extreme example:
(1) CAS
(2) 4+5 Enter --> 9 (now CAS's Ans is 9)
(3) Home
(4) 6+7 Enter --> 13 (now Home's Ans is 13, but CAS's Ans is still 9)
(5) sqrt(Ans) --> 3 (spell out sqrt with lowercase letters)

This looks like a bug (the square root of 13 is 3???) but it's not, because sqrt is a CAS function, so it used the CAS Ans, not the Home Ans, even though you typed it in Home.

Easy solution to this misfeature: If you want to use CAS functions, use CAS, not Home. Otherwise, don't use Ans in Home, because it's ambiguous there.

Bottom line:
In CAS, only the CAS Ans is used.
In Home, CAS functions use CAS's Ans; everything else uses Home's Ans.

EDIT: Another big difference between the two Ans's:

CAS's Ans is always the result at the bottom of the history, regardless of what put it there. Therefore deleting the bottom history level changes CAS's Ans.

Home's Ans is always the most recent result, no matter where it is on the history stack (if it's even there at all). Deleting history levels does NOT change Home's Ans.

Of course, none of this is documented anywhere because that would take away all the fun of discovering it for ourselves.

<0|ɸ|0>
-Joe-
09-06-2014, 11:48 PM (This post was last modified: 09-06-2014 11:56 PM by Marcel.)
Post: #3
 Marcel Member Posts: 156 Joined: Mar 2014
RE: ANS don't work all the time!
Hi Joe,
Thank you very much for your help!
Now I will practice this behavior...
Marcel.
 « Next Oldest | Next Newest »

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