Post Reply 
nextprime function now working as expected with Ans
07-26-2022, 02:10 AM
Post: #1
nextprime function now working as expected with Ans
I have just recently acquired an HP prime. I tried the nextprime(2) and it worked as expected giving the answer 3. I then tried nextprime(Ans), expecting to get 5. It returned 2. It seems nexrprime and Ans are not communicating for sme reason.

Or is there something I am doing wrong?
Find all posts by this user
Quote this message in a reply
07-26-2022, 04:12 AM
Post: #2
RE: nextprime function now working as expected with Ans
(07-26-2022 02:10 AM)lbundle Wrote:  I have just recently acquired an HP prime. I tried the nextprime(2) and it worked as expected giving the answer 3. I then tried nextprime(Ans), expecting to get 5. It returned 2. It seems nexrprime and Ans are not communicating for sme reason.

Or is there something I am doing wrong?

On the version of prime I am using on my phone
Software Version: 2.1.14346 (2019 11 21)
Hardware Version: Emu

nextprime(Ans) always returns 1.15951471769ᴇ15.
regardless of what Ans is preset to!
nextprime(Eval(Ans)) gives the expected result 5 when Ans is set to 3
Find all posts by this user
Quote this message in a reply
07-26-2022, 04:19 AM
Post: #3
RE: nextprime function now working as expected with Ans
The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS. Since nextprime() is a CAS function, nextprime(Ans) always uses CAS's Ans, not Home's Ans. Does this mean that the HP Prime has multiple personality disorder? Yes, and it's scary because CAS's personality sneaks across into Home without warning, as you discovered.

Solution to this problem is simple: nextprime() and nextprime(Ans) work as desired in CAS view.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
07-26-2022, 04:22 AM
Post: #4
RE: nextprime function now working as expected with Ans
(07-26-2022 04:12 AM)Stevetuc Wrote:  nextprime(Ans) always returns 1.15951471769ᴇ15.
regardless of what Ans is preset to!
nextprime(Eval(Ans)) gives the expected result 5 when Ans is set to 3

The former (above) is using the Ans from CAS. Go into CAS, set its Ans to something, then go back to Home and set its Ans to something else. nextprime(Ans) will use the Ans from CAS, not the Ans from Home, even though you're in Home view.

The latter (above) is forcing Prime to use Home's Ans.

Crazy Prime. Sad

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
07-26-2022, 01:06 PM
Post: #5
RE: nextprime function now working as expected with Ans
(07-26-2022 04:19 AM)Joe Horn Wrote:  The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS.

We can get CAS Ans from Home side, with id(Ans)

Is there a way to get value of Home Ans, from CAS side?
(without switching to Home side to grab it, then switch back)
Find all posts by this user
Quote this message in a reply
07-26-2022, 04:48 PM
Post: #6
RE: nextprime function now working as expected with Ans
(07-26-2022 04:19 AM)Joe Horn Wrote:  The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS. Since nextprime() is a CAS function, nextprime(Ans) always uses CAS's Ans, not Home's Ans. Does this mean that the HP Prime has multiple personality disorder? Yes, and it's scary because CAS's personality sneaks across into Home without warning, as you discovered.

Solution to this problem is simple: nextprime() and nextprime(Ans) work as desired in CAS view.

Is this supposed to be a feature or a bug? If it's a feature I cannot possibly see a use for it.
Find all posts by this user
Quote this message in a reply
07-26-2022, 06:10 PM (This post was last modified: 07-27-2022 01:10 PM by toml_12953.)
Post: #7
RE: nextprime function now working as expected with Ans
(07-26-2022 04:19 AM)Joe Horn Wrote:  The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS. Since nextprime() is a CAS function, nextprime(Ans) always uses CAS's Ans, not Home's Ans. Does this mean that the HP Prime has multiple personality disorder? Yes, and it's scary because CAS's personality sneaks across into Home without warning, as you discovered.

This is why I always recommended that either

1) CAS and home be totally separate modes with no interaction. Those of us who have no need of CAS could ignore it.

or

2) CAS and home be totally integrated so that there was no division at all. You'd always be in a mode that could solve problems both numerically and exactly. Use a decimal point for approximation, or none for exact.

3.0 ÷ 4 = .75
3 ÷ 4 = ¾

TI's calculators have no problem doing this and neither do Casio's so I know it's not impossible.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
07-27-2022, 11:54 AM
Post: #8
RE: nextprime function now working as expected with Ans
The 50g too.

I suspect the main reason was to use an existing, well-respected CAS pkg, rather than spend limited resources on developing a competing one, but that does then lead to the Home/CAS split.

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
Find all posts by this user
Quote this message in a reply
07-27-2022, 12:44 PM
Post: #9
RE: nextprime function now working as expected with Ans
The reason for the Home/CAS split is to comply with requirements for standardized testing. HP's market is education, not technical professionals. Much as I like the speed, larger memory and better display, I still use the 50g much more than the Prime.
Find all posts by this user
Quote this message in a reply
Post Reply 




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