nextprime function now working as expected with Ans
07-26-2022, 02:10 AM
Post: #1
 lbundle Junior Member Posts: 2 Joined: Jul 2022
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?
07-26-2022, 04:12 AM
Post: #2
 Stevetuc Senior Member Posts: 312 Joined: Jan 2014
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
07-26-2022, 04:19 AM
Post: #3
 Joe Horn Senior Member Posts: 2,000 Joined: Dec 2013
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-
07-26-2022, 04:22 AM
Post: #4
 Joe Horn Senior Member Posts: 2,000 Joined: Dec 2013
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.

<0|ɸ|0>
-Joe-
07-26-2022, 01:06 PM
Post: #5
 Albert Chan Senior Member Posts: 2,550 Joined: Jul 2018
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)
07-26-2022, 04:48 PM
Post: #6
 lbundle Junior Member Posts: 2 Joined: Jul 2022
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.
07-26-2022, 06:10 PM (This post was last modified: 07-27-2022 01:10 PM by toml_12953.)
Post: #7
 toml_12953 Senior Member Posts: 2,091 Joined: Dec 2013
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?
07-27-2022, 11:54 AM
Post: #8
 cdmackay Senior Member Posts: 724 Joined: Sep 2018
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
Casio, Rockwell 18R
07-27-2022, 12:44 PM
Post: #9
 John Keith Senior Member Posts: 1,026 Joined: Dec 2013
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.
 « Next Oldest | Next Newest »

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