Post Reply 
Programming Question on HP15CE
06-20-2024, 06:10 PM
Post: #1
Programming Question on HP15CE
Hi,
So it's seriously been years since I used my 41CX and even then, I wasn't a programming guru. I recently picked up the 15CE and wanted to go thru the manual and learn the programming, etc..

The first example is to program a simple equation for time to fall from a certain height. The formula is: t = square root of 2H/g. When they make the program, it's straight forward and when they execute the program they just input the h and then execute the program and the correct answer is displayed. My question is, how did the program know that the value of H was inside the square root, for the life of me, I can't figure that out.. For those interested, the reference I'm reffering to can be found on pages 14 and 15 of the 15CE Collector Edition's user manual.

Thanks!
Find all posts by this user
Quote this message in a reply
06-20-2024, 11:44 PM
Post: #2
RE: Programming Question on HP15CE
I had to remember RPN when I got mine too!. I think its just the order of the keystrokes and the efficient and concise way that RPN works. h is entered, 2 is entered and multiplied by the previous value which was h, 9.8 is entered for g, and divided into the previous result which was 2h, then the square root of all that is taken.

The global supply of brackets was not reduced. And isn't that a beautifully written manual?
Find all posts by this user
Quote this message in a reply
06-21-2024, 07:30 AM
Post: #3
RE: Programming Question on HP15CE
The answer is called "Reverse Polish Notation".
So execution step-by-step gives :
[Image: gravity.jpg]

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
06-21-2024, 07:51 AM
Post: #4
RE: Programming Question on HP15CE
RPN allowing you to interpret order of operations yourself!
Find all posts by this user
Quote this message in a reply
06-21-2024, 08:56 AM
Post: #5
RE: Programming Question on HP15CE
You could use the Python to RPN - source code converter with the following program:
Code:
def time(H):
  return SQRT(2*H/9.8)

This is the converted program for the HP-42S:
Code:
01 LBL "time"
02 STO "H"
03 RDN
04 2
05 RCL "H"
06 *
07 9.8
08 /
09 SQRT
10 RTN
11 LBL 50
12 "-Utility Funcs-"
13 RTN

In this case we don't really need to use the register H as the value is already on the stack.
And then no utility functions are used. Thus we can skip them too.
The text-label "time" is not supported by the HP-15C and has to be replaced for instance by label A.

So we end up with:
Code:
01▸LBL A
02 2
03 ×
04 9.8
05 ÷
06 SQRT
07 RTN
This is close to Pierre's program.
Find all posts by this user
Quote this message in a reply
06-21-2024, 12:04 PM
Post: #6
RE: Programming Question on HP15CE
(06-21-2024 08:56 AM)Thomas Klemm Wrote:  Pierre's program

This is not my program but, in response to tones688, the one he was referring. (on pages 14 and 15 of the 15CE Collector Edition's user manual)

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
06-21-2024, 12:46 PM
Post: #7
RE: Programming Question on HP15CE
Hello!

If in doubt, aks ChatGPT: „Please write a program for the hp-15c to calculate the time it takes for an object to fall a given height on earth

The first result used a storage register for the input value, so I asked again: „Can you please rewrite that program without using a memory register

Ang got almost the same listing as has been shown above several times already, albeit with one unnecessary ENTER:

Code:
001 - f LBL A      ; Label A
002 - ENTER        ; Duplicate the height h on the stack
003 - 2
004 - ×            ; Multiply h by 2
005 - 9.81
006 - ÷            ; Divide by g (9.81)
007 - √x           ; Take the square root
008 - g RTN        ; Return

The code comes with a very detailed explanation of the equations and detailed instructions on how to use it.

Regards
Max
Find all posts by this user
Quote this message in a reply
Post Reply 




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