(9g) Sample programs
|
09-24-2022, 11:27 PM
(This post was last modified: 09-24-2022 11:29 PM by Eddie W. Shore.)
Post: #1
|
|||
|
|||
(9g) Sample programs
Programs for the HP with a unique language, the hp 9g:
hp 9g Program: Integer Division This program gives the quotient and remainder of N ÷ D. The program here assumes you enter positive integers, and some code can be entered for checking inputs. Code: INPUT N Examples: N = 4379, D = 8; Result: 547 R3 N = 5884, D = 29; Result: 202 R26 Note: The PRINT command converts variable values to strings automatically, without the need for a string or STR$ command. hp 9g Program: Arithmetic-Geometric Mean This program determines the AGM given two numbers A and G. Code: INPUT A Examples: A = 1.3, G = 1.5, Result: ANS ≈ 1.39821143 A = 20, G = 45, Result: ANS ≈ 31.23749374 Notes: 10^ is from [ 2nd ] (10^x) the antilog function. The label command must have the colon character after the label number, or a syntax error occurs. If you run a program from the Main mode by the [ PROG ] key, you will be transferred to Program mode when the program finishes. hp 9G Program: The Maximum Value of A through X Y = maximum value Z = counter variable Code: PRINT "MAX(A:X)"; ◢ Example: Clear all variable in the MAIN mode by CL-VAR Set up variables: A = 12, D = 24, E = 37, G = 40, S = 19, T = 16, U = 7 Result: MAX= 40 Notes: ++ is from the Instruction menu, it is a smaller-jointed double plus. When the program encounters a run/stop instruction (◢), the last message is displayed. Continue execution by pressing the equals key [ = ]. hp 9g Program: Plotting y = A * sin(B * x + C) + D The programming mode does not offer a lot of support when it comes to graphs. For instance, the last message prints over the graph. Furthermore, the angle mode (preferably Radians) and clearing the screen must be done in the Main mode before running the program. Neither the angle mode or variable/screen clearing can be programmed. Code: PRINT "SINE" Although it wasn't used in the programs above, the FOR command is more like the C format, reminding me of the equation editor for the Plus42 app. FOR(start condition; continue condition; next expression) {loop commands separated by a semicolon} |
|||
09-25-2022, 03:41 PM
Post: #2
|
|||
|
|||
RE: (9g) Sample programs
Wow, I completely missed that the 9g was programmable! Interesting.
I may have to go dig mine out of the dust and see what it can do. Thanks Eddie! |
|||
09-25-2022, 04:16 PM
Post: #3
|
|||
|
|||
RE: (9g) Sample programs
Not me, I completely didn't bother checking if it was programmable, as it's keyboard and overall construction are so poor, it became one of the 'must have, just because it's an HP' machines and never took a serious look. But Eddie's post does intrigue me, and if I can find mine in less than 5 minutes, I'll give a whirl.
Thanks Eddie! --Bob Prosperi |
|||
09-29-2022, 09:34 PM
(This post was last modified: 09-29-2022 09:37 PM by bbergman.)
Post: #4
|
|||
|
|||
RE: (9g) Sample programs
Okay, I dug out my 9g, spent a day trying to find batteries that still worked, and booted it up.
AND...promptly reminded myself of why it was in the storage box. Damn, this thing has a terrible keyboard (double bounces, missed pressed, mushy icky feel, etc), and the display isn't nearly as good as I remember. Then there is the lack of an understandable programming model. Also, sadly found out that the display has some vertical pixels missing in the middle of the screen. Figures. Ugh. Well, it was nice to think about it, at least. I "think" it's going back in the storage box now. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)