Strange behaviour of ANS ?
12-22-2015, 06:23 AM
Post: #1
 Dirk. Junior Member Posts: 41 Joined: Mar 2015
Strange behaviour of ANS ?
Hello,
took me a while to see what happens -> Maybe not easy to reproduce.

For me it seems CAS.l2norm(Ans) is not always catching the last/shown value of Ans.

Example:
[1 2] ENTER
-> [1 2]

Ans
-> [1 2]

CAS.l2norm[Ans]
-> Sometimes output seems to be a result from an older vector or even complete garbage, for example 0 or a complex number...

Do I missunderstand something?

I made some screenshot, but I don't know how to insert it into the post. It shows the following situation:

[3 6] ENTER -> [3 6]
Ans ENTER -> [3 6]
CAS.l2norm(Ans) -> 3*sqrt(5)

[1 2] ENTER -> [1 2]
Ans ENTER -> [1 2]
CAS.l2norm(Ans) -> 3*sqrt(5)

Before Clear (Shift ESC) I even manged to get some complex number as a result of CAS.l2norm(Ans)
12-22-2015, 06:58 AM
Post: #2
 Joe Horn Senior Member Posts: 1,985 Joined: Dec 2013
RE: Strange behaviour of ANS ?
You might be running into the strange fact that there are two different Ans variables: a Home Ans, and a CAS Ans. They can have different values. Home's Ans is changed by every operation in Home (including calls to CAS functions from Home), but CAS's Ans is only changed by operations performed within CAS view.

Try performing these operations in the specified view in the order shown:

CAS: 1+2 --> 3
CAS: Ans --> 3
Home: 4+5 --> 9
Home: Ans --> 9
Home: CAS(Ans) --> 3 (CAS's Ans is still 3)
Home: Ans --> 3 (the call to CAS from within Home changed Home's Ans)

Is this related to what you are seeing?

<0|ɸ|0>
-Joe-
12-22-2015, 07:33 AM
Post: #3
 Dirk. Junior Member Posts: 41 Joined: Mar 2015
RE: Strange behaviour of ANS ?
Thank you Joe,
this sems to be it. Very confusing!

But I did not manage to pass the home-answer to CAS.l2norm in home environment. Is it possible?

Dirk.
12-22-2015, 04:25 PM (This post was last modified: 12-22-2015 04:26 PM by Joe Horn.)
Post: #4
 Joe Horn Senior Member Posts: 1,985 Joined: Dec 2013
RE: Strange behaviour of ANS ?
(12-22-2015 07:33 AM)Dirk. Wrote:  Thank you Joe,
this sems to be it. Very confusing!

But I did not manage to pass the home-answer to CAS.l2norm in home environment. Is it possible?

No. All CAS functions use CAS's Ans, even when called from Home view. If you need to send Home's Ans into a CAS function, you must first store it into a variable and then call the CAS function on that variable.

Strong suggestion: When in Home view, EITHER avoid using CAS functions OR avoid using Ans (take your pick). If you need both, go into CAS view and stay there.

<0|ɸ|0>
-Joe-
12-23-2015, 04:09 AM
Post: #5
 Dirk. Junior Member Posts: 41 Joined: Mar 2015
RE: Strange behaviour of ANS ?
Dear Joe,
thank you very much. Is there a strong argument for this behavior or does it make sense to ask HP to change the Ans-variable to stick to the context (home/CAS) currently active?

Dirk.
12-23-2015, 05:30 AM
Post: #6
 Joe Horn Senior Member Posts: 1,985 Joined: Dec 2013
RE: Strange behaviour of ANS ?
(12-23-2015 04:09 AM)Dirk. Wrote:  Dear Joe,
thank you very much. Is there a strong argument for this behavior or does it make sense to ask HP to change the Ans-variable to stick to the context (home/CAS) currently active?

There must be good reasons, but I don't understand any of them. Wouldn't the simplest solution be to have just ONE Ans variable, shared by Home and CAS? Like all the other system variables! Well, except for epsilon and Digits, which are strictly CAS settings and are not recognized in Home.

<0|ɸ|0>
-Joe-
01-13-2016, 11:56 AM
Post: #7
 Dirk. Junior Member Posts: 41 Joined: Mar 2015
RE: Strange behaviour of ANS ?
Since the people from HP are "here" again -> happy new year!!!
I would like to bring this topic to their attention.
Perhaps is is possible to go from strange behaviour to expected behaviour?

Dirk.
01-13-2016, 01:49 PM (This post was last modified: 01-13-2016 01:50 PM by primer.)
Post: #8
 primer Member Posts: 135 Joined: Sep 2015
RE: Strange behaviour of ANS ?
(12-23-2015 05:30 AM)Joe Horn Wrote:  Wouldn't the simplest solution be to have just ONE Ans variable, shared by Home and CAS?

maybe not so simple.
user starts in CAS mode,
then type (x+1) [enter]
now go to Home,
what would you like to expect here ?

Let's try to give a simple answer to that question....

primer
01-13-2016, 02:11 PM
Post: #9
 Dirk. Junior Member Posts: 41 Joined: Mar 2015
RE: Strange behaviour of ANS ?
Hello,
when working in HOME mode, but using a CAS-cammonad, I would expect ANS to carry the result of the previous calculation done in HOME. Or the result of the last calculation done independently of the environment. But not a result form yesterday.

Dirk.
01-13-2016, 02:36 PM (This post was last modified: 01-13-2016 02:36 PM by DrD.)
Post: #10
 DrD Senior Member Posts: 1,133 Joined: Feb 2014
RE: Strange behaviour of ANS ?
(12-22-2015 06:58 AM)Joe Horn Wrote:  You might be running into the strange fact that there are two different Ans variables: a Home Ans, and a CAS Ans. They can have different values. Home's Ans is changed by every operation in Home (including calls to CAS functions from Home), but CAS's Ans is only changed by operations performed within CAS view.

Joe's description makes sense to me, however, another approach could be to change the answer variable name: use HAns for Home view related answers, and CAns for CAS view related answers, to remove ambiguity.

-Dale-
01-13-2016, 03:52 PM (This post was last modified: 01-13-2016 03:53 PM by primer.)
Post: #11
 primer Member Posts: 135 Joined: Sep 2015
RE: Strange behaviour of ANS ?
(01-13-2016 02:11 PM)Dirk. Wrote:  When working in HOME mode, but using a CAS-command, I would expect ANS to carry the result of the previous calculation done in HOME.
Yes, that would makes sense, but it's more complex to users.
At least as it is now, it's clear : it's two separate environments. it does not depends on last result type.

For me it's like I had two calculators, with the ability to copy things between them.
This is how I see these two modes.

primer
01-15-2016, 07:56 AM
Post: #12
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: Strange behaviour of ANS ?
Hello,

Cas and Home are kind of like 2 calculators in one. CAS is a separate program, self sufficient and with its own ways of doing things, which are adapted to its purpose (symbolic calculations).
In the same way, Home is also self sufficient , with its own way of doing things...

However, we recognize that sometimes, a user will need to work cross domain, which is why Home and CAS were made to "communicate". But this communication is, like all communications, imperfect, with imperfections being caused by various reasons ranging from incompatibility of purpose, incompatibly of implementation, incompatibility due to prior/unchangeable decision, all the way down to we have not had time to actually make that work.

Ans is problematic because some CAS objects are NOT representable in Home and vice-versa. This makes changing the Ans an incompatibility of implementation, which are relatively hard to fix.
Note that you should always be able to specify which Ans to use by doing CAS.Ans and num.Ans

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
01-15-2016, 12:35 PM
Post: #13
 Dirk. Junior Member Posts: 41 Joined: Mar 2015
RE: Strange behaviour of ANS ?
Hello Cyrille,
thank you very much. I did not understand everything you said, but I think the main point of confusion got lost, since this should be easy to fix.

In home mode I use the ANS key to pass an argument to the next function, which is unfortunately a CAS-function. So the calculator should by no means use the ANS of the last calculation done in CAS.

Transferring Objects (e.g. a matrix) between home and CAS by hand is no choice.
It is inconvenient and you have to change the E to e (or vice versa?) which is annoying.
01-15-2016, 12:44 PM
Post: #14
 DrD Senior Member Posts: 1,133 Joined: Feb 2014
RE: Strange behaviour of ANS ?
(01-15-2016 07:56 AM)cyrille de brébisson Wrote:  Note that you should always be able to specify which Ans to use by doing CAS.Ans and num.Ans

Cyrille

Thanks for this great tip, Cyrille!

-Dale-
 « Next Oldest | Next Newest »

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