## Saturday, November 5, 2022

### Retro Review: hp 9g

Retro Review:   hp 9g

Quick Facts:

Model:  hp 9g

Company:  Hewlett Packard

Years:  2003 (short production life)

Battery:  2 x AR76 or 2 x LR 44

Display:  10 digits, 2 digit exponent

Logic:  Algebraic - type in expressions the way you write them

Memory:  400 bytes, but can be designated as additional memory registers

Memory Registers:  26, can be extended to 59 memory registers

Slide Case

Range:  9.999999999 * 10^-99 to 9.999999999 * 10^99, real numbers only

The hp 9g is a small sized graphing calculator, similar to the Citizen SRP-325G and the Casio fx-6300g.  The 9g offers more features than the fx-6300g.

Features

*  Trig, logs, power, permutations, combinations, hyperbolic functions

*  Random numbers and integers, integer factorials, fraction, integer, sign, absolute value

*  Maximum, minimum, sum, and average up to 10 numbers

*  Base conversions (decimal, binary, octal, hexadecimal) with Boolean logic (NOT, AND, OR, XOR, NXOR, NEG)

*  20 scientific constants, all SI units

*  Conversions:  length, area, temperature, volume, mass, calories, pressure (always a good thing to have!)

*  Function graphing, more than one function can be plotted on top of each other.

*  One and Two Variable Statistics

*  Regressions:  linear, logarithmic, exponential, power, inverse, quadratic

Percent

The percent (%) just divides the argument by 100.   For example:  58% converts the number to 0.58.   That is good for multiplying or dividing but not for direct addition and subtraction.

Undo

The [ 2nd ] [ ENTER ] brings back the last thing that has been cleared or deleted.  I don't think this brings back programs that have been deleted though.

Normal Distribution - One Variable Statistics

Normal distribution is based on one-variable statistics.  The t value is based on data point a_x, which is entered in the DATA menu.  The t point is calculated with the formula:

t = (a_x - mean) / σ

Three areas can be calculated:

P(t):  lower tail cumulative distribution

Q(t):  absolute value of the cumulative distribution between 0 and t

R(t):  upper tail cumulative distribution (I think)

Process Capability - One or Two Variable Statistics

A very unique function, available to the 9G are process capability calculations.  Depending on the mode, the following can be calculated:

C_ax = capability accuracy of x values

C_ay = capability accuracy of y values

C_px = potential precision of x values

C_py = potential precision of y values

C_pkx = minimum of capability of values or capability precision of x values

C_pky = minimum of capability of values or capability precision of y values

ppm = parts per million (One variable stat mode only)

See the User Manual for formulas.

Storing a Formula

Formulas can be stored into any one of the program areas (P0- P9), using the [ SAVE ] [ PROG ] key sequence.  We can run programs from the Main mode by pressing [ PROG ] with 0 - 9.  Variables are prompted.

Example:

X^2-3X+1 [ SAVE ] [ PROG ] 9  stores x^2 + 3*x + 1 into program P9.

Evaluating the function at x = -1 and x = 8.5

[ PROG ] 9 [ = ], (formula is displayed), [ = ], [CL/ESC], -1 at the X prompt, [ = ], result:  5

[ PROG ] 9 [ = ], (formula is displayed), [ = ], [CL/ESC], 8.5 at the X prompt, [ = ], result:  47.75

At all prompts, to enter a new number, press [CL/ESC] first, very important.

Screen

The screen is split up in different sections.

There are two lines during calculations.  The top line shows what is being calculated, while the bottom line shows the results on the right hand of the screen, in a smaller font.

In program editing mode, we only get the top line as the bottom of the screen is taken by the two lines EDIT:  and *MAIN* (*DEC/HEX/OCT/BIN* for BASE-N programs).

In data input, only the top line shows the data points.

If you graph a function, the left side of the screen is the graph.  Pressing [ Trace ] will alternate between showing the x-coordinate and the y-coordinate.   Personally, I would like it better if both x and y were shown.   The small graph screen means that we really can't do much (no shading, no integration, have to arrow to approximate roots, but can draw lines and plot points).

Not perfect, but one of the best uses of a small graphics calculator screen.

Programming

The hp 9g has 400 steps that can be divided among 10 programs (P0 to P9).   Each program can either work in Main mode or Base mode.  Base mode programs are designated for base conversions and Boolean logic.

The programming language is somewhat like the C programming language.   Each instruction or line can, but doesn't have to end with a semicolon (;).    However, any command called from the INST menu inserts a semicolon.

Some program commands include:

INPUT var1[, var2, var3... ]

Input with prompt "[var] = ".

PRINT "text"/var, "text"/var, ...

Display strings and variable values

IF (condition) THEN { do if true, commands separated by a semicolon } ; ELSE { do if false, commands separated by a semicolon }

If-Then-Else structure.  The Else part is optional.

Lbl/GOTO n

Lables can take values 0-9

GOSUB PROG n;

Calls a subroutine program n.  Semicolon is required.

SLEEP(time)

Pauses execution for seconds up to 105 seconds.

SWAP(varA, varB)

Swaps the values of variables A and B

; ◢

Stops the program and shows immediate results.   Press [ = ] to continue.

var++, var--   (The ++ and -- is from the INST menu, not pressing + or - twice)

Increase or decrease the variable by 1 after the expression is evaluated.

++var, --var (The ++ and -- is from the INST menu, not pressing + or - twice)

Increase or decrease the varaible by 1 before the epression is evaluated.

FOR(start condition; continue condition; next expression) {loop commands separated by a semicolon}

For loop that works more like a WHILE loop

start condition

WHILE continue condition

loop commands

next expression

END

The FOR loop is in C language.  This is the same syntax of the FOR equation editor command of the Plus42.

On tomorrow's blog I will have sample programs for the hp 9g.

Final Thoughts... For Now

I wish the hp 9g had better manuals or manuals that were formatted like a book instead of two large sheets.   But better than nothing and the documentation is detailed.

The biggest drawbacks are the lack of screen space and small amount of programming steps.  Despite this, the hp 9g is an underrated marvel and is very unique in a line of HP calculators.

Sources

hp 9g User Manual:  https://literature.hpcalc.org/official/hp9g-ug-en.pdf

hp 9g Examples:  https://literature.hpcalc.org/official/hp9g-htg-en.pdf

"HP 9g"  Wikipedia.   Last edited May 15, 2022.   Last Accessed September 24, 2022.  https://en.wikipedia.org/wiki/HP_9g

All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

### HP 20S: Gamma Function Approximation (Stirling's Formula)

HP 20S:  Gamma Function Approximation (Stirling's Formula) Introduction The gamma function uses the approximation sequence: Let t = x + ...