HP Prime CAS integration (1000 Views)
Reply
Frequent Advisor
davetheguru
Posts: 81
Registered: ‎11-20-2013
Message 1 of 7 (1,000 Views)

HP Prime CAS integration

As promised in a previous message, here starts some observations on the HP Prime Graphing Calculator.

 

Take the integration problem of 2 * integral of sqrt(R^2-X^2) with respect to X from -R to R (not in calculator syntax but hopefully in readable form since I can't type in math symbols here), which derives to the area of a circle, on the HP-50g this reduces (EVALs) to pi*R^2 as expected.

 

However, on the Prime (using 'r' for 'R', and 'x' for 'X'), I get the following error message: "Unable to sort r>(-r)". After Esc to get back to the main screen, the result is 2*r^2*ASIN (r/abs(r)). Note that CAS settings have Simplify=Maximum. Now I can see for r>0, this will reduce to the proper formula for the area of a circle. But why didn't the Prime figure that
out? The HP-50g appeared smarter (?). Or is there a way to put the r>0 constraint somewhere and have the Prime get the same result? Are there ways to put a list of constraints with expressions to help reduce expressions in CAS?

 

Take a double integration, this time to find the formula for the volume of a sphere, equal to 2 * integral of [integral of sqrt(R^2-X^2-y^2) with respect to Y from -sqrt(R^2-X^2) to +sqrt(R^2 -X^2] with respect to X from -R to R. (whew! an equation editor on this medium would be nice). On the HP-50g, this evaluates to 4*R^3*pi/3 (which is correct).

 

On the Prime (variables in lower case), I get several pages of error messages (that come faster than I can note)
terminating with the same error as above repeated several times. In the CAS screen the only result is the message "Error: Max order (64) exceeded or non unidirectional series".

 

Bug(s) or is there something more I have to do?

 

Trusted Contributor
Joseph Horn
Posts: 98
Registered: ‎09-25-2006
Message 2 of 7 (978 Views)

Re: HP Prime CAS integration


davetheguru wrote:

Take the integration problem of 2 * integral of sqrt(R^2-X^2) with respect to X from -R to R ... on the HP-50g this reduces (EVALs) to pi*R^2 as expected.

However, on the Prime (using 'r' for 'R', and 'x' for 'X'), I get the following error message: "Unable to sort r>(-r)". After Esc to get back to the main screen, the result is 2*r^2*ASIN (r/abs(r)). Note that CAS settings have Simplify=Maximum. Now I can see for r>0, this will reduce to the proper formula for the area of a circle. But why didn't the Prime figure that
out? The HP-50g appeared smarter (?). Or is there a way to put the r>0 constraint somewhere and have the Prime get the same result? Are there ways to put a list of constraints with expressions to help reduce expressions in CAS? 


The HP 50g assumes that R>0.  Prime does not, and gives the correct result for any 'r'.  In this regard, Prime is "smarter" than the 50g.

 

If you want to tell Prime to assume that r>0, then in CAS type:

 

assume(r>0)

 

Then you'll get the result you want.

 

Alternative: Instead of -r and r as the limits, use -abs(r) and abs(r).  Same result, without restricting r itself.

 

Hope that helps!

 

-Joe-

-Joe-
Frequent Advisor
davetheguru
Posts: 81
Registered: ‎11-20-2013
Message 3 of 7 (927 Views)

Re: HP Prime CAS integration

Thanks Joe for the tip!  I would agree with you on the 'smarter' point.  The Prime is also a lot faster.  The answers are almost instantaneous (compared to several seconds on the '50g).

 

When I try the tip with the double integral problem (volume of sphere), I still get no where.  Still get several screens of error messages and stops in about 15 seconds.  Esc'ing back to CAS screen the result is [0 0.000000] for me.

 

I was wondering how long assume() affects are persistent.  For jus the next operation?  CAS session?  life of calculator? ...

Trusted Contributor
Joseph Horn
Posts: 98
Registered: ‎09-25-2006
Message 4 of 7 (920 Views)

Re: HP Prime CAS integration

[ Edited ]

davetheguru wrote:

I was wondering how long assume() affects are persistent.  For jus the next operation?  CAS session?  life of calculator? ...


Eternity. Or until you undo it, whichever comes first. There are several ways of undoing an assume( ).  Here are a few.

 

Every use of the assume( ) command overwrites all previous assumptions on that variable.  For example, if you say assume(r>0) and then assume(r,integer), the result is only that r is assumed to be an integer; the assumption that it is positive is deleted.

 

You can always check which assumptions exist for any varaible by using the about( ) command.

 

If you want to have several assumtions on one variable, use the additionally( ) command.  For example, to assume that r is a positive integer, one way is assume(r,integer) and then additionally(r>0).

 

You can remove all assumptions by specifying just the variable. For example, assume(r) removes all assumptions about r. Although not documented, additionally(r) seems to have the same result as about(r), because it adds no new assumptions and then returns the existing ones.

 

Setting a variable equal to a number deletes all assumptions on that variable (obviously).

 

Of course, purge(r) not only removes all assumptions about r but also removes it from the CAS variable list entirely.

 

-Joe-

-Joe-
Advisor
StefanD
Posts: 12
Registered: ‎12-05-2013
Message 5 of 7 (900 Views)

Re: HP Prime CAS integration

I think another way to make a assumptions which is only valid for one calculation is to use the with operator ("|"), for which a template can be found in the math templates (Button with C). 

(Please correct me if I'm wrong.)

 

Stefan

 

Tip: you could enter formulas here in the forum by using http://texify.com/ and including the image ("Insert/edit image -> from another site")

Frequent Advisor
davetheguru
Posts: 81
Registered: ‎11-20-2013
Message 6 of 7 (877 Views)

Re: HP Prime CAS integration

Thanks Joe for the great info.

 

And Stefan, yes the '|' worked.  I first did a purge(r) [thanks again Joe] to remove calculator's previous knowledge about r.

Then I copied the integral to the first box of the '|' operator and typed in r>0 in the second (the subscripted box).

 

I got the same result as when I did assume(r>0).

 

Cool.  Also with the problems still in the history, it was really easy to test this out.  A good feature of the Prime.

Occasional Visitor
Hammersmith
Posts: 1
Registered: ‎01-11-2014
Message 7 of 7 (761 Views)

Re: HP Prime CAS integration

Hi, DaveTheGuru.

I don't think you're missing anything.  I have used HP calculators since the beginning and I've been quite dissapointed with the Prime, especially when compared to the 50g.  Here are some thoughts that I sincerely wish were more positive but the Prime is singularly unimpressive:

 

1.  A touch screen should be marketed as, "How to muck up your calculator and scratch the screen."  The Prime screen is more delicate and less reliable than the 50g's simpler "no hands necessary" screen and soft keys.

2.  S. Jobs was right in this case: Color is a distraction and unnecessary, especially when considering battery drain penalty.

3.  A replacement battery is impossible to find and there is no adequate health indicator available for it.

4.  Now, a charger must be added to my away bag, whereas I can get batteries for my 50g at the 7-11 on Pluto, if need be.

5.  While the Prime is faster than the 50g, it lacks the programming depth of the 50g.  There is a lack of programming flexibility in the Prime as compared to the 50g.  Is the Prime's speed accelerated by it's simpler language?

6.  Pascal/BASIC sucks out loud as a language here, in the real world, especially when compared to the 50g's native language.  Associates of mine who are much better programmers than I will ever be see PPL as a disabled-for-the-sake-of-simplicity (or popularity) language.  It seems obvious that the Prime was dumbed down in the design phase, otherwise it would have used C as a base language.  (C Compiler too large?  Aw, shucks!  Start over and figure it out... never happened.)

7.  !! -> The Prime is lacking a SD port!!   Using a computer as a storage medium instead of a SD card means that my high-security data and sensitive programs can now be hacked both while the Prime is plugged in to a computer and when the exported data is at rest, stored on the computer.  And it may be possible to hack a Prime directly.  (I frequently work with TS and above data on my 50g, and (i) it can't be remote-hacked, (ii) the radiation signature is very low, so it doesn't broadcast significantly to any receptors, and (iii) I can store my sensitive information on SD cards instead of an optional hackable computer system.)  While this doesn't apply to many users, especially students, the associates I work with worldwide use 50g which is approved for TS environments.  The Prime is not, which means that developmental scientists in many fields working with sensitive data won't touch them with a 10-meter cattle prod.

8.  Quite a few of the applications don't work as they are described, or fail in eval.  Your examples are excellent, but are the tip of the iceberg.

9.  Many of the programs in the User's Guide don't work as shown.  I have re-written some of them successfully during coffee breaks, usually with a completely different design approach that yields the same results.

10.  With hackable and pre-hacked computers abundant now, think of what a One-Time Pad Cipher program on a 50g can accomplish for hack-proof communications... Yes, I've written a highly successful modular OTPC program on the 50g.  Don't try this on a hackable Prime!

11.  There is no available language reference covering all the commands on the Prime at this time.  There is a commands list available (not from HP), but it has no functionality descriptions.  As is well-known, there is a sufficient one for the 50g.  How can HP release the Prime without a comprehensive language reference?  Was it released a year too early?

 

And the list is much longer than this, but I don't have that kind of time.  The Prime is viewed by most scientists and professionals with whom I have contact in many fields as a toy for students, and not practical for serious work.  In fact, one associate even postulated that it was developed by a group of students with very little experience!  However, there is entertainment value - it is somewhat amusing to watch it stumble and fail over and over again while attempting basic routines.

 

If HP is thinking that the Prime is a replacement for the 50g, they're digging in the wrong place.  The buried treasure lies in developing the 50g to it's next logical step, not going down the wrong path to a predictable dead end.  Flashiness without substance is never important or impressive.

 

A new version of anything should, in theory, be an improvement over what exists.  As far as looking forward to improvements to the 50g, well, as the Zen master said, "We'll see."

 

Advice?  Go out and purchase several 50g's and store them in original packaging.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.