By Xah Lee. Date: . Last updated: .

In ~1991, i bought the HP-28s calculator for ~\$250. It was introduced in 1988 and is the first calculator that is capable of symbolic computation. For example, you can use it to solve quadratic equation symbolically. (that is, give symbolic solution for `a*x^2 + b*x + c == 0`.) And, it is also one of the first graphing calculator. This is a RPN calculator, and is also a programable calculator. (The first graphing calculator is Casio fx-7000G, 1985.)

## My First Computer Program: the 8-Queens Puzzle

It is actually the HP-28s that i did my first programing. I never took any programing course, but am a avid learner of math and computer stuff. I read the manuals from cover to cover. [see Emacs Idolization: Have You Read the Emacs Manual From Cover to Cover?]

My first program is a program to solve the 8 queens puzzle: position 8 queens on chess board so that none can check the other. It was a puzzle posted to CompuServe's math forum (CompuServe is a pre-internet online server in early 1990s). At the time, i'm also a crazy fan of recreational math. I took it upon myself to solve this by programing my super calculator to automatically generate the solution.

The 8-queens puzzle is typically solved by a backtracking algorithm. This is what i did, even though at the time i know nothing about computer science or programing. [see my Computing Experience (Impression Of Lisp from Mathematica)] Also, a couple years later i realized, that there is a bug in my program. That is, my program misses 8 solutions (or was it 4?).

Here's my code for the 8-queens puzzle:

## Music Chord Program

Around 1991, i'm taking music classes. One of the things in music theory and training, is to understand the various chords, and being able to identify by ear. The HP-28s is capable of playing simple beeps of various frequencies. Thus, i actually wrote a relatively large program that plays musical chords and scales.

What follows below is a introduction from the documentation i wrote:

These programs can spell and play any triad or seventh chords. You type-in a chord and have the calculator to play it by pressing PLAY1, PLAY2, PLAY3 or spelled out by pressing SPELL. By pressing CHORD, HP-28 will generate a triad or 7th chord randomly. For example, you key in “A M ” and press PLAY1, HP-28 will play a A major triad.

(Enharmonic chords with roots on E♯, B♯, F♭, C♭ are not generated by CHORD but can be arguments of SPELL or PLAY. Enharmonic chords using double sharp or double flat as roots are not generated nor recognized. These programs can be used on HP-28s (and probably would work in HP-48s, HP-48sx, HP-48G, and HP-48GX models).

Chords to be PLAYed or SPELLed must be typed in as a string format: “Note” + “AccidentalSign” + “Quality”. For example, A sharp major 7th is entered as “A#M7”. A major triad is entered as “A M ”.

Here is a table showing all the chords starting with roots of A, A♭, and A♯. Chords starting with other keys are similarly entered.

```"M" = Major
"m" = minor
"+" = augumented
"h" = half-diminished.
"∞" = dimished
Spaces in the string can be left out.```

This system of programs also allows you to key in the duration of each note to be played, in increment of 1/100th seconds. You can also change the ratio between adjacent notes to get 24 note per octave micro turning or other strange effects. To do so, simply change the value stored in DUR or R. For more information, see the variable diagrams in Section 3 of this book. This system will be expanded in later version. The following functions are good candidates for expansion: play chord progressions, play scales, identify chords, invert/retrograde/augument/diminition of melodies, metronome, tuning machine. Readers are welcome to send in their .expansion programs.