Post Reply 
Prime User Function Catalog, Pressing "Run"
08-23-2022, 04:24 PM
Post: #1
Prime User Function Catalog, Pressing "Run"
User's don't only create programs.

Sometimes, we create math functions. It is useful to give descriptive names to such functions. For example, see the attached user function. Put it into your HP Prime.

Now, list your available user "Programs" in the catalog. Scroll down to that descriptively named user function. It is the one named "Lambert_Omega_Householder."

Press "Run."

As Henry Gibson said, "Very interesting, but stupid."

Instead of transferring the name of the function to the command line, the present machine's firmware flashes an exclamation point at the user, and ignores what the user obviously needs done.

Why? Well, because the user tried to "run" a "function" instead of a program. If run this way, a function can have no input.

It really looks as if every single time a user intends to get the name of a function from the catalog, and place it into the command line, the user is forced to type the function name over again, manually. Using a simulator this is easy. Use the PC's keyboard, but what if the person is using an actual physical calculator?

It feels like an infinite number of twiddly shifts and alpha button presses.

Every time.

This can make people hate the physical calculator's actual buttons.

If a user highlights the name of a user function in the program list, and hits "Run" the machine should transfer a copy of the long descriptive function name into the command line, and supply a set of open and close parenthesis.

Every time.

Lots of people know more than I know about how to get around this type of "feature."

I hope.

Otherwise, we should ask HP to update the firmware. Please add this astonishingly simple behavior in the user interface. It would conflict with nothing else.

Bill Triplett
20220823

PS: In case you only have a physical calculator, and have not yet set up a simulator or the connectivity kit, I will also post code for the example program here:

Code:

#CAS
//Lambert_Omega_Householder
//Principal branch of the Lambert W function using the Householder method.
//Rev.1.46 (Nov. 28, 2020) (c) Takayuki HOSODA (aka Lyuka)
//Acknowledgments: Thanks to Albert Chan for his informative suggestions.
Lambert_Omega_Householder(x):=
BEGIN
  LOCAL y, p, s, t, u, v;
  LOCAL q, r;
  HComplex := 1; // Enable complex result from a real input.
  r := sqrt(MAXREAL) / 1e4; // Limit x range
  IF abs(RE(x)) > r OR abs(IM(x)) > r THEN return "LW0H: x out of range"; END;
  r := 1.0 / e;
  s := x + r;
  IF s == 0 THEN return -1; END;
  q := e - sqrt(2.0) - 1.0;
  y := 1.0 * ln(r + sqrt(2.0 * r * s) + q * s); // approximation near x=-1/e
  r := MAXREAL;
  REPEAT
    q := r;
    p := y;
    s := exp(y);
    t := s + x;
    u := y * s;
    v := u - x;
    v := (6.0 * ((y + 1.0) * u * x + t * (t + u)) + v * (3.0 * (u + x) + y * v));
    IF (0 == v) THEN break; END;
    t := 3.0 * (u - x) * ((u + x) * (y + 2.0) + 2.0 * s);
    y := y - t * inv(v); // Householder's method of order 4
    r := abs(y - p); // correction radius;
  UNTIL 0 == r OR q <= r; // convergence check
  return p;
END;
#END

This code does some heavy lifting. In optics, we sometimes need to use this function when nothing else will do. The author is amazing. His code handles imaginary inputs and outputs quite nicely.


Attached File(s)
.hpprgm  Lambert_Omega_Householder.hpprgm (Size: 3.34 KB / Downloads: 3)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Prime User Function Catalog, Pressing "Run" - Bill Triplett - 08-23-2022 04:24 PM



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