HP Forums
ANS don't work all the time! - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: ANS don't work all the time! (/thread-2090.html)



ANS don't work all the time! - Marcel - 09-06-2014 12:32 PM

Hi,
When I do in RADIAN
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.


RE: ANS don't work all the time! - Joe Horn - 09-06-2014 11:41 PM

(09-06-2014 12:32 PM)Marcel Wrote:  Hi,
When I do in RADIAN
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. Sad


RE: ANS don't work all the time! - Marcel - 09-06-2014 11:48 PM

Hi Joe,
Thank you very much for your help!
Now I will practice this behavior...
Marcel.