Post Reply 
HP Prime: a student's view
08-31-2021, 07:30 PM
Post: #21
RE: HP Prime: a student's view
HPPL floats are base 10 floats, that's not comparable to Python base 2 floats.
Find all posts by this user
Quote this message in a reply
08-31-2021, 11:20 PM
Post: #22
RE: HP Prime: a student's view
Well this certainly exploded.

Tom L: I changed my code to what's below, per your suggestion, and I actually got a higher performance index, 528,000. (give or take a few hundred)
Code:
from math import *
def p_ind():
    n = 100000
    while n != 0:
        l = 10
        while l != 0:
            x = l
            x += 1
            x -= 4.567e-4
            x += 70
            x -= 69
            x *= 7
            x /= 11
            l -= 1

        x = log(x)
        x = sin(x)
        x = sqrt(x)
        x = sqrt(x)
        n -= 1

Even if I take Tom L's original code and remove the if r0 <= 0: branch, replacing the while True with while r0 != 0, I still get about the same performance as before (~170,000). I even get that same index if I replace the outer for loop with a while i != 0 loop (where i starts out as 10000 and is decremented each loop).

Thomas_Sch Wrote:imho there are few differences in the implementation.
Clearly, but where are they? I can't find anything at all, beyond differences in loops.
Find all posts by this user
Quote this message in a reply
09-01-2021, 03:40 AM (This post was last modified: 09-01-2021 11:35 AM by toml_12953.)
Post: #23
RE: HP Prime: a student's view
(08-31-2021 01:30 AM)Liam Hays Wrote:  Sure. I converted mine from the PPL version on thimet's Prime page.

When I wrote that PPL program on Thimet, I used the BASIC version as a model. Here's the C version converted:
Code:
EXPORT Thimet()
BEGIN
  LOCAL t, loops, i1, r0, x;
  t:=TICKS();
  loops:=100000;
  FOR i1:=0 TO loops-1 DO
    r0:=10;
    REPEAT
      x:=r0;
      x:=x+1;
      x:=x-4.567E-4;
      x:=x+70;
      x:=x-69;
      x:=x*7;
      x:=x/11;
      r0:=r0-1;
    UNTIL r0<=0;
    x:=LN(x);
    x:=SIN(x);
    x:=SQRT(x);
    x:=SQRT(x);
  END;
  PRINT(x);
  t:=(TICKS()-t)/1000;
  PRINT("Index: "+34/t*loops);
END;

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-01-2021, 10:43 PM
Post: #24
RE: HP Prime: a student's view
(08-30-2021 01:11 AM)Liam Hays Wrote:  This post is about my experiences so far with the Prime. It is quite long. TL;DR: nerd kid likes the Prime.

lots of good stuff (here, and later)

My first calculator was a Casio fx-9750G PLUS, a ’90s graphing calculator which is programmed in a rudimentary BASIC. Despite its shortcomings, I had a shocking amount of fun learning how to program that thing.

Hopefully the Prime can provide an environment where kids (and adults) can have some fun with mathematics and with programming.

Quote:
On the side of the apps, the Function, Advanced Graphing, and Graph 3D apps are incredible.

Thanks! Big Grin (I’m the author of those apps.) The overall design language follows that of earlier HP calcs (the 39gII, in particular, which is where the Function implementation began; the UI for the 39gII follows that of the 39gs…)

Quote:I’m not sure I’ll ever go back to low-res, monochrome plotting ever again. Functions appear instantly instead of after many seconds, zooming and panning is easy and intuitive (pinch to zoom is wonderful), and everything is just so fast.

Thanks! Big Grin Of course, the hardware (CPU, touchscreen, etc.) are a requirement for making it all work…

I’m not sure if you noticed, but you can effect purely vertical / horizontal stretches (in Function and Advanced Graphing) if you carefully position and move your fingers when pinching.

There’s many little details in implementation. For example, the scaling code I implemented that is used during pinch-to-zoom (in Function and Advanced Graphing) comes in two variants (when the scaling factor is less than 1): one for light mode and one for dark mode. Why? So that thin lines don’t get hidden by quick scaled rendering (lost due to aliasing). You could, for example, try plotting |Y-1|>.1 in Advanced Graphing (with default Plot Setup settings, so that there is a one-pixel-thick line not in the solution set) and then pinching inward: the one-pixel-thick line will come and go as you pinch. (You can also see this sort of things in Microsoft Word on the desktop etc., at least with fairly recent versions.)

Quote:Whereas even a simple line on the HP 48 takes ten seconds to draw, the Prime renders it as soon as the Plot button is pressed.

There’s some further improvements I’d like to make to the code to make plotting even faster… But this would mainly be noticeable with less-common more-difficult plotting tasks. (Perhaps less so with Graph 3D, where typical plots involve more computation.)

One of the things that Function and Advanced Graphing do to speed up plotting is use byte code evaluators for expression evaluation (only for simple expressions in Function; the full PPL evaluator is used for expressions beyond the BCD byte code evaluator’s abilities). Things like common subexpressions are recognized by the expression -> byte code compiler (if F1(X)=SIN(X)+SIN(X), an evaluation of F1 for a particular X value only calculates SIN(X) once).

Quote:Advanced Graphing is just as useful as Function, usually because I’m lazy and don’t want to convert general form into slope-intercept form Smile.

If you haven’t seen the graph gallery in the Advanced Graphing app, I’ve put some fun example plots in there. (Available via the physical Menu key while in a Plot view of the Advanced Graphing app.)

Quote:
But first, a thought I had a while ago. RPL is fun, it is powerful, and it is versatile. It is also obsolete. It was designed for systems far less powerful than what are available today…

In a similar vein of “…a thought I had…” — it’s not just many of the posters here, but also a good chunk of the software developers of the Prime, that grew up with simpler machines. My second home computer was a Jupiter Ace (whose default programming environment was Forth). We had fun with those simpler machines!

Quote:
I have numerous other comments and feature requests for Python, and I’ll probably put those in a separate thread so there can be actual discussion (and so this post isn’t horribly long and convoluted).

I’ve been looking through the Prime’s UI a bit over the past couple of weeks and have been thinking of possible improvements / refinements (things in the Python editor that jumped to mind immediately for me were syntax colouring, indent guides, improved help support, …)

To be clear: none of my comments here should be taken as any sort of statement regarding future releases…
Find all posts by this user
Quote this message in a reply
09-03-2021, 01:31 AM
Post: #25
RE: HP Prime: a student's view
jte Wrote:Thanks! (I’m the author of those apps.)

What? Just you, one person by themselves? That's incredible.

jte Wrote:I’m not sure if you noticed, but you can effect purely vertical / horizontal stretches (in Function and Advanced Graphing) if you carefully position and move your fingers when pinching.

I have noticed this feature, and I haven't had any use for it (yet).

jte Wrote:For example, the scaling code I implemented that is used during pinch-to-zoom (in Function and Advanced Graphing) comes in two variants (when the scaling factor is less than 1): one for light mode and one for dark mode. Why? So that thin lines don’t get hidden by quick scaled rendering (lost due to aliasing). You could, for example, try plotting |Y-1|>.1 in Advanced Graphing (with default Plot Setup settings, so that there is a one-pixel-thick line not in the solution set) and then pinching inward: the one-pixel-thick line will come and go as you pinch.
...
One of the things that Function and Advanced Graphing do to speed up plotting is use byte code evaluators for expression evaluation (only for simple expressions in Function; the full PPL evaluator is used for expressions beyond the BCD byte code evaluator’s abilities). Things like common subexpressions are recognized by the expression -> byte code compiler (if F1(X)=SIN(X)+SIN(X), an evaluation of F1 for a particular X value only calculates SIN(X) once).

It's things like these that, in my opinion, make HP calculators unique: attention to detail beyond comparison.

jte Wrote:If you haven’t seen the graph gallery in the Advanced Graphing app, I’ve put some fun example plots in there. (Available via the physical Menu key while in a Plot view of the Advanced Graphing app.)

I love the plot gallery---do you think you could add Tupper's self-referential formula? Smile My only complaint with the gallery is that you have to save Advanced Graphing as a new app to be able to access the equations.

jte Wrote:I’ve been looking through the Prime’s UI a bit over the past couple of weeks and have been thinking of possible improvements / refinements (things in the Python editor that jumped to mind immediately for me were syntax colouring, indent guides, improved help support, …)

Nice. I personally think the help for most Python functions and some newer PPL functions is kind of poorly written (missing punctuation, typos). It's not really an issue, though, as it doesn't obscure the function parameters or anything.
Find all posts by this user
Quote this message in a reply
09-03-2021, 04:06 AM
Post: #26
RE: HP Prime: a student's view
Quote:I love the plot gallery---do you think you could add Tupper's self-referential formula? Smile My only complaint with the gallery is that you have to save Advanced Graphing as a new app to be able to access the equations.

I am mildly curious if that smiley was because you know who "jte" is, or if you were unaware... in which case this whole situation gets a bit more hilarious. Smile

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
09-03-2021, 09:30 PM
Post: #27
RE: HP Prime: a student's view
OMG!!

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-04-2021, 01:30 AM
Post: #28
RE: HP Prime: a student's view
Tim Wessman Wrote:I am mildly curious if that smiley was because you know who "jte" is, or if you were unaware... in which case this whole situation gets a bit more hilarious.

The smile was because of the rather unusual window requirements to plot that formula (a 543-digit y-axis window value, for example). As such, I wasn't really serious about adding it to the Plot Gallery.

Who is "jte"? What am I missing here? If the name is someone's initials, it doesn't ring any bells in my limited knowledge of HP's calculator teams.
Find all posts by this user
Quote this message in a reply
09-04-2021, 03:18 AM
Post: #29
RE: HP Prime: a student's view
(09-04-2021 01:30 AM)Liam Hays Wrote:  
Tim Wessman Wrote:I am mildly curious if that smiley was because you know who "jte" is, or if you were unaware... in which case this whole situation gets a bit more hilarious.

The smile was because of the rather unusual window requirements to plot that formula (a 543-digit y-axis window value, for example). As such, I wasn't really serious about adding it to the Plot Gallery.

Who is "jte"? What am I missing here? If the name is someone's initials, it doesn't ring any bells in my limited knowledge of HP's calculator teams.

You might want to look at the link that you posted, under the History section. The JT in jte's forum name is significantSmile
Find all posts by this user
Quote this message in a reply
09-04-2021, 05:45 AM
Post: #30
RE: HP Prime: a student's view
(09-04-2021 01:30 AM)Liam Hays Wrote:  Who is "jte"? What am I missing here? If the name is someone's initials, it doesn't ring any bells in my limited knowledge of HP's calculator teams.

Lol. Very nice then. Smile

Quote:I love the plot gallery---do you think you could add Tupper's self-referential formula?

"The formula was defined by Jeff Tupper and appears as an example in Tupper's 2001 SIGGRAPH paper on reliable two-dimensional computer graphing algorithms.[1] This paper discusses methods related to the GrafEq formula-graphing program developed by Tupper.[2]"

Smile

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
09-04-2021, 07:29 AM
Post: #31
RE: HP Prime: a student's view
By chance, I am reading again the book The Hitchhiker's Guide to the Galaxy, where a starship is powered by the "infinite improbability drive" and crazy improbable things happen. After reading these posts, I wonder if this technology is embedded in the Prime (not yet documented) and it's been used Smile

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
09-04-2021, 08:44 AM
Post: #32
RE: HP Prime: a student's view
My left arm's drifting away into the sunset. How am I going to operate the buttons on my HP Prime now?

— Ian Abbott
Find all posts by this user
Quote this message in a reply
09-04-2021, 04:49 PM
Post: #33
RE: HP Prime: a student's view
(09-04-2021 05:45 AM)Tim Wessman Wrote:  
(09-04-2021 01:30 AM)Liam Hays Wrote:  Who is "jte"? What am I missing here? If the name is someone's initials, it doesn't ring any bells in my limited knowledge of HP's calculator teams.

Lol. Very nice then. Smile

Quote:I love the plot gallery---do you think you could add Tupper's self-referential formula?

"The formula was defined by Jeff Tupper and appears as an example in Tupper's 2001 SIGGRAPH paper on reliable two-dimensional computer graphing algorithms.[1] This paper discusses methods related to the GrafEq formula-graphing program developed by Tupper.[2]"

Smile

I see.

That actually explains a lot, now that I look at it. The Wikipedia article references and discusses GrafEq, which explains the "©2017 PedagoguerySoftwareInc www.peda.com" banner that Advanced Graphing's Plot view displays after a warmstart. I had been wondering about this for a while.

ramon_ea1gth Wrote:By chance, I am reading again the book The Hitchhiker's Guide to the Galaxy, where a starship is powered by the "infinite improbability drive" and crazy improbable things happen. After reading these posts, I wonder if this technology is embedded in the Prime (not yet documented) and it's been used

What the Hitchhiker's Guide doesn't tell you is that Slartibartfast was actually contracted by HP to design Norway, and hiring the mice for construction was just part of the deal. Smile
Find all posts by this user
Quote this message in a reply
09-05-2021, 06:16 AM
Post: #34
RE: HP Prime: a student's view
(09-03-2021 01:31 AM)Liam Hays Wrote:  
jte Wrote:Thanks! (I’m the author of those apps.)

What? Just you, one person by themselves? That’s incredible.

Thanks. The software development team is smaller than one might imagine. All of the developers that have been involved over the life of the project have each committed a fair chunk of code to the project (the others are no slouches!). At times, the development team has been larger: there’s been many valuable contributions from software developers that aren’t part of the current crew. (And, of course, the project as a whole depends on many who aren’t writing code.)

Liam Hays Wrote:I love the plot gallery—do you think you could add Tupper’s self-referential formula? Smile

Yes, Tim has asked about that too. Big Grin The precision of the arithmetic currently used by the Advanced Graphing app is insufficient for these sorts of formulas. Adding an app targeted towards integer grid plotting might be one way we could get another fun graph gallery added to the Prime. (A general integer grid plotting app along with improved PPL - Plot view interaction could make implementing games on rectangular grids an easier exercise for those so inclined.)

Liam Hays Wrote:My only complaint with the gallery is that you have to save Advanced Graphing as a new app to be able to access the equations.

Hmmmm… yes… something to think about!

(I’ve just typed in & deleted a bunch of thoughts: possibilities, options, trade-offs… I guess I was right, at first: something to think about! Big Grin)
Find all posts by this user
Quote this message in a reply
09-05-2021, 09:30 AM
Post: #35
RE: HP Prime: a student's view
(09-03-2021 01:31 AM)Liam Hays Wrote:  
jte Wrote:I’m not sure if you noticed, but you can effect purely vertical / horizontal stretches (in Function and Advanced Graphing) if you carefully position and move your fingers when pinching.

I have noticed this feature, and I haven't had any use for it (yet).

A couple of weeks ago I showed this feature to a few of my AP Calculus students who are new Prime users. I thought they were going to pee themselves with excitement. Big Grin

Often, calculus problems involve functions defined over some fixed domain, so the ability to interactively zoom just vertically is exceedingly useful.
Find all posts by this user
Quote this message in a reply
09-05-2021, 03:44 PM
Post: #36
RE: HP Prime: a student's view
(09-03-2021 04:06 AM)Tim Wessman Wrote:  
Quote:I love the plot gallery—do you think you could add Tupper’s self-referential formula? Smile My only complaint with the gallery is that you have to save Advanced Graphing as a new app to be able to access the equations.

I am mildly curious if that smiley was because you know who “jte” is, or if you were unaware… in which case this whole situation gets a bit more hilarious. Smile

Any day we manage to amuse Tim, we’ve played our parts well! Cool
Find all posts by this user
Quote this message in a reply
Post Reply 




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