Thursday, October 6, 2011

RPL Programming Tutorial - Part 4 - HP 49g+/50g: For-Next

What's it all FOR?

OK, corny titles aside, welcome to Part 4 of the RPL Tutorial for the HP 49g+ and 50g calculators. Part 4 will introduce another fundamental structure in mathematical programming: the FOR-NEXT structure.

The FOR-NEXT structure allows the programmer to designate a set of commands to be repeated a set number of times. The structure can use a counter, known as a dummy variable. The counter can also be part of a calculation.

In general, the FOR-NEXT structure looks something like this:

FOR counter-variable = start-number TO end-number
Instructions go here
NEXT (or END)

Duplicating Pascal's Triangle


1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1


This is the first six rows of the famous Pascal's Triangle. Pascal's Triangle is used for many purposes. One use of the triangle is to determine the coefficients of the binomial expansion of (x + y)^n, where n is an integer. The top row of Pascal's Triangle is designated as "Row 0".

Any entry in Pascal's Triangle can be found using the Combination function:

COMB(r, n) = r! / (n! * (r - n)!)

Where:
r = the row number
n = the entry number

This program will return all of the entries of a given row.

The Program PASCAL

Comments will be italicized, starting with an asterisk. This program starts with the desired row number R on Level 1 of the Stack.

[RS] [ + ] (<< >>)
[RS] [ 0 ] (&rarr) [ALPHA] [ √ ] (R)

* Store the desired row number in local variable R
[RS] [ + ] (<< >>)
[LS] [ + ] ( { } )

* Puts an empty list on the stack, all the entries will go in this list
[ &rarr ] [SPC]
0 [SPC] [ALPHA] [ √ ] (R)

* Start-number = 0, End-number = R
[LS] [EVAL] (PRG)
[F3] (BRCH)
[LS] [F4] (FOR)

* Inserts the FOR-NEXT structure
[ALPHA] [STO] (K)
* Let K be the counter-variable (or dummy variable)
[SPC] [ALPHA] [ √ ] (R) [SPC] [ALPHA] [STO] (K)
[LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F1] (COMB)

* Calculates COMB(R, K)
[ + ]
* Adds result to the list
[ENTER]
* Terminates program entry

[ ' ] [ALPHA] [ALPHA] [SYMB] (P) [F1] (A) [SIN] (S) [F3] (C) [F1] (A) [NXT] (L) [ENTER] [STO>]

The completed program:
<< &rarr R << { } 0 R FOR K R K COMB + NEXT >> >>

Instructions:
1. Enter the desired row number on Level 1 of the Stack.
2. Run PASCAL
3. If the list exceeds the width of the screen, you can press either [HIST] [F2] (VIEW) or [ &uarr ] [F2] (VIEW) to get the list in View Mode. Use the arrow keys ( [ &rarr ] and [ &larr ] ) to scroll the list's contents.

Test:
3rd Row: {1 3 3 1}

6th Row: {1 6 15 20 15 6 1}

12th Row: {1 12 66 220 495 792 924 792 495 220 66 12 1}

This is just one example of using the FOR-NEXT structure. In Part 5, coming soon, we get the calculator to ask for a number. See you then!

Eddie


This tutorial is property of Edward Shore. Mass reproduction or distribution requires express permission of the author.

RPL Programming Tutorial - Part 3 - HP 49g+/50g: If-Then-Else

If Only...

Welcome to Part 3 of the RPL Programming Tutorial with the HP 49g+ and HP 50g calculator. To recap, Part 1 discussed the basics of RPL programming and Part 2 introduced the concept of local variables.

In Part 3 we will dive into the IF-THEN and IF-THEN-ELSE structures. These structures test data against a condition, and then instructs the machine to execute designated program code based on the results.

In general, an IF-THEN-ELSE-END structure looks like this:

IF condition listed here (i.e. x = 5, y > 10, z ≤ 0, a ≠ b, etc.)
THEN commands to be done if the condition is true
ELSE commands to be done if the condition is false
END

How to find the IF menu

You can input the IF, THEN, ELSE, and END program commands separately. However, the HP 50g (and 49g+) gives the user another choice. With a keystroke sequence, you can enter the entire sequence as a template.

To insert the templates:

Start by pressing [LS] [EVAL] (PRG) [F3] (BRCH) .

To insert an IF-THEN-END structure, press [LS] [F1] (IF).

To insert an IF-THEN-ELSE-END structure, press [RS] [F1] (IF).

The next two programs will show an example of each of the two structures.

The Online Shipping Deal

A famous online store is running a promotion: Order at least $100.00 from our store, and we'll pay the $5.95 shipping fee! This program calculates the total amount of the order, with shipping if any. Assume the store charges 7.5% sales tax on all orders including shipping.

Notes:
1. The local variable A will be used to designate the amount of goods purchased.
2. Since A + y% = A + x * y /100 = A * (1 + y /100), we will multiply the amount plus shipping by 1.075. (Let y = 7.5%)
3. The $5.95 shipping charge applies only when the order amount is less than $100.00. Set up the test this way: If A < 100, add 5.95 to A, otherwise do nothing. Because we are only executing further instructions only when the condition is true, no ELSE command is necessary.

The Program ONSALE

Comments will be italicized, starting with an asterisk. This program assumes that the purchase amount is on Level 1 of the stack.

[RS] [ + ] (<< >>)
* Start of the program
[RS] [ 0 ] (&rarr)
[ALPHA] [F1] (A)

* Assign the amount to the local variable A
[RS] [ + ] (<< >>)
* Start the main program
[ALPHA] [F1] (A)
* Call A to the stack
[LS] [EVAL] (PRG)
[F3] (BRCH)
[LS] [F1] (IF)

* Insert the IF-THEN-END structure
[ALPHA] [F1] (A)
[SPC] 100 [RS] [ X ] (<)

* Insert the test condition A < 100
[ &darr ] (down arrow)
5.95 [ + ]

* Add shipping charge if A < 100
[ &darr ] 1.075 [ x ] [RS] [ENTER] (&rarr NUM) [ENTER]
* Finish the program

[ ' ] [ALPHA] [ALPHA] [ ' ] (O) [EVAL] (N) [SIN] (S) [F1] (A) [NXT] (L) [F5] (E) [ENTER] [STO>]

The completed program ONSALE:
<< &rarr A << A IF A 100 < THEN 5.95 + END 1.075 * &rarr NUM >> >>

Instructions:
1. Enter the amount on Level 1 of the stack.
2. Run ONSALE.

Test Data:

Input = 50, Result = 60.14625 (A $50.00 order results in a total bill of $60.15.)

Input = 99.99, Result = 113.8855 (A $99.99 order results in a total bill of $113.89)

Input = 100, Result = 107.5 (A $100.00 order results in a total bill of $107.50. Surprised? Remember all orders $100.00 or more result in the shipping charged being waived.)

Input = 149.99, Result = 161.23925 ($149.99 order yields a bill of $161.24)

f(x) = (sin x)/x

This program calculates the function f(x) = (sin x)/x for all real numbers. If we attempt to calculate f(0) directly, we would get a "division by zero" error. However, the calculus limit as f(x) approaches 0 is 1. Let's create a test condition that detects for an input of 0. If the input is anything else, f(x) computes normally.

Note: The test of equality requires two equal signs, ==. This can be typed directly from the keyboard via alpha or by the TEST submenu of the PROGRAM menu. This program uses TEST submenu method (4 keystrokes opposed to 6 keystrokes).

The Program SINX

The program takes X from Level 1 of the stack and stores it as the local variable X.

[RS] [ + ] (<< >>)
[RS] [ 0 ] (&rarr)
[ X ]

* Stores the contents of Level 1 in the local variable X
[RS] [ + ] (<< >>)
[LS] [EVAL] (PRG)
[F3] (BRCH)
[RS] [F1] (IF)

* Inserts the IF-THEN-ELSE-END structure
[ X ] [SPC] 0
[LS] [EVAL] (PRG) [F4] (TEST) [F1] (==)

* Inserts the double equals sign, ==, for the equality test. Test X = 0?
[ &darr ] [SPC] 1
* Enters the commands should X = 0 (THEN)
[ &darr ] [SPC]
[ X ] [SIN] [ X ] [ ÷ ]
[RS] [ENTER] (&rarr NUM)

* Enters the commands should X ≠ 0 (ELSE)
[ENTER]
* Terminates program entry

[ ' ] [ALPHA] [ALPHA] [SIN] (S) [TOOL] (I) [EVAL] (N) [ X ] (X) [ENTER] [STO>]

The complete program:
<< &rarr X << IF X 0 == THEN 1 ELSE X SIN X / &rarr NUM END >> >>

Source: HP 48SX Scientific Expandable Calculator: Owner's Manual Volume II. Hewlett Packard, 3rd Edition, 1990

Instructions for SINX:
1. Enter X on the stack.
2. Run SINX.

Test Data - Assume the calculator is in Radians mode:

Input = -1, Result = 0.841470984808

Input = 0, Result = 1 (If you get this, then the IF-THEN-ELSE-END structure worked)

Input = 1, Result = 0.841470984808

Coming up, we'll take a look at the FOR-NEXT structure. See you next time in Part 4!

Eddie


This tutorial is property of Edward Shore. Mass reproduction or distribution requires express permission of the author.

RPL Programming Tutorial - Part 2 - HP 49g+/50g: Local Variables

Welcome!

Welcome to Part 2 of the RPL Programming Tutorial for the HP 49g+ and 50g calculators. To recap, Part 1 talked about how to create, save, run, and (if need be) delete a program.

In Part 2, introduces the concept of the local variable. Simply put, a local variable is a variable that is used in a program and is then purged (deleted) at the end of the program. Local variables are not stored outside of the program, which saves memory.

A general structure of declaring local variables goes like this:

<< commands needed to set up the local variables, if any &rarr Local Variables
<< main program >> >>

=================================================================
Hint: There are times that you want to store information outside of a program. To do so, just store the data in a variable enclosed in single quotes followed by a STO command. These variables are called global variables.
=================================================================

Fibonacci Sequence

The well known Fibonacci Sequence is:
1, 1, 2, 3, 5, 8, 13, 21, 34,...

After the first two numbers, each succeed number is the sum of the last two numbers.

F_n = F_(n-1) + F_(n-2) where F_1 = 1 and F_2=1.

You can quickly find the mth term of the Fibonacci Sequence by using this closed formula:

f(n) = (ø^(n + 2) - (1 - ø)^(n + 2)) ÷ √5

Where:
ø = (1 + √5) ÷ 2, the Golden Ratio
n = m - 2

There are two local variables used in this program:
N = M - 2, the user supplies where M is the desired mth term
H = ø

The Program FIBN

Comments will be italicized, starting with an asterisk *. This program starts with M on Level 1 of the stack.

[RS] [ + ] (<< >>)
* Start of the program
2 [ - ]
* Subtract 2 from M to get N
1 [SPC] 5 [ √ ] [ + ]
2 [ ÷ ]

* Set up the Golden Ratio Constant, to be stored in H
[RS] [ 0 ] (&rarr)
* Prepare to name the local variables
[ALPHA] [EVAL] (N) [SPC]
[ALPHA] [MODE] (H)
[RS] [ + ] (<< >>)

* Start the main program
[ALPHA] [MODE] (H) [SPC]
* Leave spaces in between H and N
[ALPHA] [EVAL] (N) [SPC]
2 [ + ] [y^x]

* H^(N + 2); [y^x] is shown as ^
1 [SPC] [ALPHA] [MODE] (H) [ - ]
[ALPHA] [EVAL] (N) [SPC] 2
[ + ] [y^x]

* (1 - H)^(N + 2)
[ - ]
* H^(N + 2) - (1 - H)^(N + 2)
5 [ √ ] [ ÷ ]
* ( H^(N + 2) - (1 - H)^(N + 2) ) ÷ √5
[EVAL]
* To simplify the answer
[ENTER]
* To terminate program entry

[ ' ] [ALPHA] [ALPHA]
[F6] (F) [TOOL] (I) [F2] (B) [EVAL] (N)
[ENTER] [STO>]


Here is the completed program:

<< 2 - 1 5 √ + 2 / → N H
<< H N 2 + ^ 1 H - N 2 + ^ - 5 √ / EVAL >> >>


How to run FIBN:
1. Enter M on the Stack
2. Run FIBN

Results:
FIBN(1) = 1
FIBN(2) = 1
FIBN(3) = 2
FIBN(4) = 3
FIBN(5) = 5
etc...

That wraps up Part 2. In Part 3, the IF-THEN-END and IF-THEN-ELSE-END program structures are introduced. Until then, Cheers! Eddie

Source Used: Math Formulas and Tables from Mobile Reference. SoundTells, LLC 2003-2010

This tutorial is created and is the property of Edward Shore. No mass reproduction without express permission of the author.


Edit: 10/20/11: correct an error in the formula in the text. The program is correct.

RPL Programming Tutorial - Part 1 - HP 49g+/50g: Your First Program


RPL Tutorial - Part 1

Introduction

This is a first in a series of RPL programming tutorial with the Hewlett Packard HP 50g Graphics Calculator. RPL stands for the Reverse Polish Lisp programming language. RPL is similar to RPN, since RPL is a combination of RPN (Reverse Polish Notation), Lisp, and Forth.

This series of tutorials cover basic RPL programming. There is a wide variety of mathematical programs, applications, and analysis that can be done with the HP 50g calculator. My goal of this series is to introduce readers to RPL programming so that they get a working knowledge of RPL programming.

The Hewlett Packard graphing series, starting with the HP 28C in the late 1980s, through the HP 48S series, the HP 48G series, the HP 49G at the turn of the century, and the 49g+ all operate on RPL. If you have a 50g or a 49g+, you can follow the programs in this tutorial keystroke by keystroke. Most of the programs shown in this series can be programmed on the 48S, 48G, and the 28 series - but please check your manual: these are older calculators that require different keystrokes.

For example, the programming commands are accessed on the 48S and 48G just by pressing the [PRG] key on the top row. However, on the 49g+ and 50g, you will need to press [LS] [EVAL] to access the program commands.

The author owns a 48SX, 48G, 49g+, and a 50g.

Getting Started

Shift and Soft Keys

For the HP 50g:

[LS] represents the Left Shift key. It is the third key up from the ON button on the left hand side of the keyboard. The key's color is white.

[RS] represents the Right Shfit key. if is the second key up from the ON button on the left hand side of the keyboard. The key's color is orange.

[ALPHA] is the Alpha Key, which allows the user to type alpha and other characters. This is important in naming programs and variables. For the programs in the tutorials, I will use one letter names for variables (i.e. A, B, C, etc..)

Pressing [ALPHA] twice will lock the keyboard into Alpha-Lock mode. This allows you to type more than one letter in succession. Press [ALPHA] again to leave Alpha-Lock mode.

The [ALPHA] key, which is yellow in color, is the fourth key from the ON button on the left hand side of the keyboard.

Finally, the top row of the keyboard consists of six soft keys, labeled F1 to F6. The functions of the soft keys change depending on which menu is currently active.

HP 49g+ Shfit Key Colors:
[ALPHA] - yellow
[LS] - green
[RS] - red

HP 50g Shift Key Colors:
[ALPHA] - yellow
[LS] - white
[RS] - orange

Setting the 50g to RPN Mode

All the programs shown in this tutorial series will be operated in RPN (Reverse Polish Notation) mode. To set the 50g in RPN mode:

1. Press the [MODE] key.
2, Press [F2] (CHOOSE) and select RPN.

Your calculator is set. (49g+ users follow the same instructions)

Setting Soft Menus

Personally I like using soft menus. The HP 49g+ and 50g gives a user a choice to operate using soft menus or scrolling menus. All of the keystrokes in the programs in this tutorial assume that you are using soft keys. To set the calculator for soft keys:

1. Press the [MODE] key
2. Press [F1] (FLAGS) to bring up the calcualtor's flags. Flags are binary operators that dictates the various modes of the calculator. Note: There are user flags that you can set for programming purposes.
3. Scroll up until you see "117" on the left side. If there is a check mark next the 117, the calculator will read "117: Soft MENU". Otherwise, the calculator will read "117: CHOOSE boxes". Press [F3] until 117 is checked. Then press [F6] (OK) twice.

We want the calculator to read "√ 117 Soft MENU". 49g+ users will follow the same instructions.
Programming Basics

Brackets

Programs are enclosed with "pointy" brackets. ( << >> ) All the programming instructions are included with a set of brackets. We can enclose programming instructions in many sets of brackets.

How to Name Programs

You can name a program almost any name you want. Program names are enclosed in single quotes. ( ' ' ) Named programs are shown in the Variables menu. You can simply access the Variables menu by press the [VAR] key. Variables most recently stored are listed first.

Note that:

1. Variable names can be used to name not only programs, but real numbers, complex numbers, constants, graphic databases, matrices, vectors, lists, and even quotes.

2. The Variables menu will only show the first five characters. When a menu is showing (this works with almost any soft menu), you can press [RS] [down arrow] to have the calculator list the full name of each of the commands shown in the current soft menu.
(Edited 4/12/2013: Thank you to Félix Hernández for correcting me on this step - much appreciated!) 

3. Variables must start with a letter and can be of any length. No spaces are allowed in variable names.

Acceptable: 'PROG1', 'MYPROG', 'CHANGE%'
Not Acceptable: '123', 'COOL PROGRAM'

How to Name a Program:

1. Press [ ' ].
2. Press [ALPHA] [ALPHA] and type the name. The alphabetic characters are the yellow letters on the keys. Lower case letters can be accessed by first pressing [LS] before the letter. You can access other characters as well by first pressing [RS] before the appropriate key. When done press [ENTER].
3. Press [STO>].

How to delete a Program:

1. Press [ ' ]
2. Press [VAR] and find the program (or variable) you want to delete. Press the appropriate soft key to recall the name.
3. Press [TOOL] then [F5] (PURGE). The program (variable) is deleted.

Your First Program

Finally! Now we get to the good stuff - programming! Programming is one of my favorite features of graphing calculators.

The first program we are going to do is a simple one: find the area of a circle of a given radius. This program takes the radius from Level 1 of the stack and returns a numeric approximation of the area.

Commands Used

&rarr NUM: Convert the contents of Level 1 to an approximate answer.

The Program ACIR

For each program, I will list a series of keystrokes. Following the keystrokes, any notes will be italicized .

Ready?

[RS] [ + ] (<< >>)
* Start the program
[LS] [ √ ] (x^2)
* Square function - labeled as SQ
[LS] [SPC] (π)
* Inserts π
[ x ]
[RS] [ENTER] (->NUM)
* Convert answer to an approximation
[ENTER]
* Terminate program

[ ' ] [ALPHA] [ALPHA]
[F1] (A) [F3] (C) [TOOL] (I) [ √ ] (R) [ENTER] [STO>]


Store the program in variable ACIR

The Program:

<< SQ π * ->NUM >>

Running ACIR

1. Type the radius.
2. Press [VAR] - find ACIR and press the appropriate soft key. Press [NXT] if necessary.

An alternative way:

1. Type the radius.
2. Press [ ' ] [ALPHA] [ALPHA] type ACIR and press [ENTER].
3. Press [EVAL] to run the program.

Results:

Radius = 6; Result = 113.09734
Radius = 4.08; Result = 52.29621

Hint: You can look at program (to edit, view, etc), by pressing [ ' ], typing the name, and pressing [LS] [STO>] (RCL) .

Be sure to check this blog for future tutorials on RPL Programming. Up next, local variables. See you next time! - Eddie

This tutorial is property of Edward Shore. Mass reproduction or distribution requires express permission by the author.

Friday, September 30, 2011

Common Keyboard Commands for Hewlett Packard RPL Calculators (HP 48S/48G/50g)


(updated 10/1/2011)

This is a quick reference to common mathematical functions for the Hewlett Packard RPL calculators. In general, HP RPL calculators are classified into three families:

This table will focus on the HP 48S, 48G, and 50g - three of four models I actually own (I have a 49g+ which should be the same key mapping as the 50g. The 49G has a different mapping - and I do not own a 49G.)

Note: [LS] = left shift key (3rd key up from the ON button on the left side)
[RS] = right shift key (2nd key up from the ON button on the right side)

About Soft Keys

On the top row, there are six soft keys. The functions of these six keys change depending on what menu is currently active. The top row of the HP 49G, 49g+, and 50g are labeled as:

[F1] [F2] [F3] [F4] [F5] [F6]

On the HP 48S and 48G, these keys are not labeled - but I will still use the F# convention. So [F1] means first soft key from the left, [F2] means second soft key from the left, and so on.

Note: For the 50g, it is assumed that Soft Menus are turned on. (Flag -117 is set)

List of Functions

x^2
HP 48S/48G: [LS] [ √x ]
HP 50g: [LS] [ √X ]

x√y
HP 48S/48G: [RS] [√x]
HP 50g [RS] [√X]

10^x
HP 48S/48G: [LS] [y^x]
HP 50g: [LS] [EEX]

LOG
HP 48S/48G: [RS] [y^x]
HP 50g: [RS] [EEX]

e^x
HP 48S/48G: [LS] [1/x]
HP 50g: [LS] [Y^X]

LN
HP 48S/48G: [RS] [1/x]
HP 50g: [RS] [Y^X]

ABS
HP 48S: [MTH] [ F1 ] (PARTS) [ F1 ] (ABS)
HP 48G: [MTH] [F5] (REAL) [NXT] [F1] (ABS)
HP 50g: [LS] [ ÷ ]

ARG
HP 48S: [MTH] [ F1 ] (PARTS) [ F4 ] (ARG)
HP 48G: [MTH] [NXT] [F3] (CMPL) [F6] (ARG)
HP 50g: [RS] [ ÷ ]

ASIN
HP 48S/48G: [LS] [SIN]
HP 50g: [LS] [SIN]

ACOS
HP 48S/48G: [LS] [COS]
HP 50g: [LS] [COS]

ATAN
HP 48S/48G: [LS] [TAN]
HP 50g: [LS] [TAN]

->NUM
HP 48S: [RS] [EVAL]
HP 48G: [LS] [EVAL]
HP 50g: [RS] [ENTER]

->Q (Exact Answer)
HP 48S: [LS] [EVAL]
HP 48G: [LS] [ 9 ] (SYMBOLIC) [NXT] [F3]
HP 50g: [LS] [ 6 ] (CONVERT) [F4] (REWRI) [NXT] [F5] (->Q)

x!
HP 48S: [MTH] [F2] (PROB) [F3] (!)
HP 48G: [MTH] [NXT] [F1] (PROB) [F3] (!)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F3] (!)

COMB (Combination)
HP 48S: [MTH] [F2] (PROB) [F1] (COMB)
HP 48G: [MTH] [NXT] [F1] (PROB) [F1] (COMB)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F1] (COMB)

PERM (Permutation)
HP 48S: [MTH] [F2] (PROB) [F2] (PERM)
HP 48G: [MTH] [NXT] [F1] (PROB) [F2] (PERM)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F2] (PERM)

RAND (Random #)
HP 48S: [MTH] [F2] (PROB) [F4] (RAND)
HP 48G: [MTH] [NXT] [F1] (PROB) [F4] (RAND)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F4] (RAND)

% (Returns level 2 * level 1% on level 1)
HP 48S: [MTH] [F1] (PARTS) [NXT] [F4] (%)
HP 48G: [MTH] [F5] (REAL) [F1] (%)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [F1] (%)

%CHG (Percent Change from level 2 to level 1)
HP 48S: [MTH] [F1] (PARTS) [NXT] [F5] (%CH)
HP 48G: [MTH] [F5] (REAL) [F2] (%CH)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [F2] (%CH)

IP (Integer Part)
HP 48S: [MTH] [F1] (PARTS) [NXT] [NXT] [F3] (IP)
HP 48G: [MTH] [F5] (REAL) [NXT] [F5] (IP)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [NXT] [F5] (IP)

FP (Fraction Part)
HP 48S: [MTH] [F1] (PARTS) [NXT] [NXT] [F4] (FP)
HP 48G: [MTH] [F5] (REAL) [NXT] [F6] (FP)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [NXT] [F6] (FP)

To access the hyperbolic functions (SINH, COSH, etc..)
HP 48S: [MTH] [F3] (HYP)
HP 48G: [MTH] [F4] (HYP)
HP 50g: [LS] [SYMB] (MTH) [F4] (HYP)

Matrix Functions:

INV (Inverse)
HP 48S/48G: [1/x]
HP 50g: [1/X]

DET (Determinant)
HP 48S: [MTH] [F4] (MATR) [F5] (DET)
HP 48G: [MTH] [F2] (MATR) [F2] (NORM) [NXT] [F2] (DET)
HP 50g: [LS] [ 5 ] (MATRICES) [F2] (OPER) [F6] (DET)

M^T (Transpose)
HP 48S: [MTH] [F4] (MATR) [F3] (TRN)
HP 48G: [MTH] [F2] (MATR) [F1] (MAKE) [F3] (TRN)
HP 50g: [LS] [ 5 ] (MATRICES) [F2] (OPER) [NXT] [NXT] [F5] (TRN)

EGVL (Eigenvalues)
(not on the HP 48S)
HP 48G: [MTH] [F2] (MATR) [NXT] [F3] (EGVL)
HP 50g: [LS] [ 5 ] (MATRICES) [NXT] [F1] (EIGEN) [F3] (EGVL)

RREF
(not on the HP 48S)
HP 48G: [MTH] [F2] (MATR) [F3] (FACTR) [F1] (RREF)
HP 50g: [LS] [ 5 ] (MATRICES) [F5] (LIN S) [F4] (RREF)

Stack Functions:

Clear the Entire Stack
HP 48S: [RS] [backspace]
HP 48G: [LS] [DEL]
HP 50g: [RS] [Backspace]

Swap contents of levels 1 and 2
HP 48S: [LS] [right arrow] (SWAP)
HP 48G: [LS] [right arrow] (SWAP)
HP 50g: [LS] [right arrow] (unmarked)

Roll the entire stack down 1 level
(Move everything down one level and level 1 goes to stack n)
HP 48S: [PRG] [F1] (STK) [F6] (DEPTH) [F4] (ROLLD)
HP 48G: [LS] [up arrow] (STACK) [F6] (DEPTH) [F4] (ROLLD)
HP 50g: [LS] [EVAL] (PRG) [F1] [NXT] [F6] (DEPTH) [F2] (ROLLD)

Angle Conversions:

Degrees to Radians
HP 48S: [LS] [SPC] (π) [ x ] 180 [ ÷ ]
HP 48G: [MTH] [F5] (REAL) [NXT] [NXT] [F5] (D->R)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL] [NXT] [NXT] [F5] (D->R)

Radians to Degrees
HP 48S: 180 [ x ] [LS] [SPC] (π) [ ÷ ]
HP 48G: [MTH] [F5] (REAL) [NXT] [NXT] [F6] (R->D)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL] [NXT] [NXT] [F5] (R->D)

RPL Basics


RPL Basics
(updated 10/1/2011)





I dedicate this blog to Peter Murphy - thank you for the request!


This is a basic tutorial of reverse polish lisp (RPL). It is a combination of RPN (reverse polish notation), Lips, and Forth languages.


RPL removes the need to enter parenthesis during long calculations and allows for immediate feedback during calculations; you will not need to enter a long operation before getting feedback - thus eliminating errors. A lot of times, the number of keystrokes required to make a calculation is reduced using RPL compared to algebraic systems. RPL works like RPN, but there several differences.


All of the following calculators, manufactured by Hewlett Packard, operate on RPL: HP-28C, HP-48S, HP-48SX, HP-48G, HP-48G+, HP-48GX, HP-49G, HP 49g, HP 50g. Currently, only HP 50g is sold new. The rest can be found used (sometimes new) on other online vendors. There are also several emulators of RPL calculators (HP48+ for example) that can be used for the iPhone/iPod Touch/iPad and devices operating on Android.


There are two types of RPL: User and System. User RPL is for basic, everyday use. You can create programs with User RPL right on the calculator's keyboard. System RPL allows users to create faster and more efficient programs. However, System RPL programming is more difficult than User RPL - most of the time programs have to complied and then downloaded to the calculator. For our purposes of the tutorial, we will use User RPL ("Just use the keyboard"). You can find additional information on RPL on the HP Museum of Calculators' RPL Page.

The Stack

Typically, an RPL calculator uses a stack with an infinite amount of "levels" (or registers). Each level is stacked on top of another. The size of the stack is dynamic depending on the contents each level has. In my experience, I end up using 1 to 3 levels, but I can use as many levels as I want so long as I have memory. For example a four-level stack diagram looks like this:

4:
-------------------------------
3:
-------------------------------
2:
-------------------------------
1:
-------------------------------

The 28C displays 3 levels, the HP 48S and 48G series display 4 levels, and the HP 49G series, including the 49g+ and 50g can display any number depending on the screen's font setting. Typically, FONT 8 shows 7 levels.

What is required of the user to execute a desired operation depends on the number of arguments (for our purpose, numbers) the function requires. Most calculator functions require one or two arguments.


One-argument functions operate on whatever is in level 1, sometimes referred to as X register. For one-argument functions, simply execute the desired operation. One-argument functions include all the trigonometric functions (sine, cosine, tangent), logarithms, exponential (e^), reciprocal, square root, and factorial (x!). The change sign operation fits under the category of one-number operations because it simply multiplies the number by -1. The change sign operation is labeled [ +/- ].


Two-argument functions operate on the contents of levels 2 and 1. Level 2 is like the Y register and level 1 the X register. Common two-argument functions include the arithmetic operators (+, -, x, ÷), powers (y^x), combination and permutations, percent and percent change (Δ%). To use a two-argument function, enter the first number (y), then press ENTER. ENTER terminates the entry and gets the calculator ready to receive another number. Next, enter the second number (x). A second ENTER is not required because executing the operation terminates the second entry. In summary, to operate a two-argument function:


1. Enter the first (y) argument,

2. Press ENTER to terminate the first entry.

3. Enter the second (x) argument,

4. Execute the desired function.


When you link more than one operation, it is known as a chain calculation. A simple example is adding a list four numbers. Another example is adding two groups of numbers and then multiplying the two sums together.


In chain calculations, whatever in the display becomes the first argument of the operation. All that is needed is to enter the second argument (number), and then the required function. For chain calculations:


1. Enter the next required argument

2. Execute the desired function, no ENTER is required


The scope of this blog is just to give a very basic tutorial of RPL. It is a "do by example" tutorial. Keystrokes are shown in blue. All calculations on this blog are rounded to 4 decimal places.

This blog will demonstrate keystrokes on the 48S (works also on the 48SX), 48G (works also on the 48G+ and 48GX), and the 50g (works also on the 49g+).

==========================================================

To set the calculator to 4 decimal places:

HP 48S:

4 [ENTER] [LS] [CST] (MODES) [2nd soft key from left] (FIX)

HP 48G (via the Mode Selection Screen):

[LS] [MODES], choose Fix 4 on the menu

HP 50g (via the Mode Selection Screen):

[MODE], choose Fix 4 on the menu.

=========================================================

Examples: Calculating with RPL

Format of the display will be shown as follows:
[...]
[2: contents]
[1: contents]

Shift Keys

Left Shift [LS]: This key has an arrow going up and turning left. It is the third key up from the ON button on the left side. It is orange on the 48S, purple on the 48G, periwinkle on the 49G, green on the 49g+, and white on the 50g.

Right Shift [RS]: This key has an arrow going up and turning right. It is the second key up from the ON button on the right side. It is blue on the 48S, green on the 49G, light red on the 49G, red on the 49g+, and orange on the 50g.

The 28C has 1 shift key - in red.

Soft Keys: There are six soft keys on the top row of the keyboard. Their functions change depending on the current active menu. On the 48S and 48G series, these keys are not labeled. On the 49G, 49g+, and 50g, they are labeled F1 through F6, left to right. The soft keys are labeled as:

[F1] [F2] [F3] [F4] [F5] [F6]

In this tutorial I will put the label on the soft keys. [F1] mean the leftmost soft key, [F2] is the second leftmost key, and so on. Got it?

In this tutorial I will put the label of any shifted function or any function accessed by a soft key parenthesis after the key. For example, for the square function:

[LS] [ √ ] (x^2)

Press the left shift key, then the square root key. The square function is just labeled as the left-shifted function of that key.

Note: For the 50g, it is assumed that Soft Menus are turned on. (Flag -117 is set)

#1: 5 + 8

Keystrokes:

HP 48S/48G/50g: [ 5 ] [ENTER]

Display: [1: 5.0000]

HP 48S/48G/50g: [ 8 ] [ + ]

Display: [1: 13.0000]

Result: 13

#2: Chain Addition: 1000 + 1500+ 1750

Keystrokes:

HP 48S/48G/50g: 1000 [ENTER]

Display: [1: 1000.0000]

HP 48S/48G/50g: 1500 [ + ]

Display: [1: 2500.0000]

HP 48S/48G/50g: 1750 [ + ]

Display: [1: 4250.0000]

Result: 4,250

#3: To Clear the Stack

HP 48S: [LS] [backspace key]
HP 48G: [LS] [DEL]
HP 50g: [LS] [backspace key]

#4: 10 - 6

As in any calculation involving subtraction or division, the order of the arguments is important.

Keystrokes:

HP 48S/48G/50g: 10 [ENTER]

Display: [1: 10.0000]

HP 48S/48G/50g: 6 [ - ]

Display: [1: 4.0000]

Result: 4

#5: 6 x 2.95 + 2 x 1.28

Sometimes it is useful to leave previous results on the stack while working on parts of the problem. The order of operations tells us to do multiplication first, then addition.

HP 48S/48G/50g: 6 [ENTER] 2.95 [ x ]

Display:
[1: 17.7000]

Leave 17.7 on the stack for future use.

HP 48S/48G/50g: 2 [ENTER]

Display:
[2: 17.7000]
[1: 2.0000]

HP 48S/48G/50g: 1.28 [ x ]

Display:
[2: 17.7000]
[1: 2.5600]

Now complete the calculation.

HP 48S/48G/50g: [ + ]

Display:
[1: 20.2600]

Result: 20.26

# 6: 200 ÷ (3^2.5 - 1)

Keystrokes:

We'll start by entering 200 and leaving it on the stack for future use.

HP 48S/48G/50g: 200 [ENTER] 3 [ENTER]

Display:
[2: 200.0000]
[1: 3.0000]

HP 48S/48G/50g: 2.5 [y^x]

Display:
[2: 200.0000]
[1: 15.5885]

HP 48S/48G/50g: 1 [ - ]

Display:
[2: 200.0000]
[1: 14.5885]

We are ready for the division.

HP 48S/48G/50g: [ ÷ ]

Display:
[1: 13.7095]

Result: 13.7095

#7: 2 x (5 ^ 2.5 ÷ 2.5 ^ 5)

Take care of the fraction first, multiply it all by 2 in the end.

HP 48S/48G/50g: 2 [ENTER] 5 [ENTER]

Display:
[2: 2.0000]
[1: 5.0000]

HP 48S/48G/50g: 2.5 [y^x]

Display:
[2: 2.0000]
[1: 55.9017]

HP 48S/48G/50g: 2.5 [ENTER] 5 [y^x]

Display:
[3: 2.0000]
[2: 55.9017]
[1: 97.6563]

HP 48S/48G/50g: [ ÷ ]

Display:
[2: 2.0000]
[1: 0.5724]

Finish it off.

HP 48S/48G/50g: [ x ]

Display:
[1: 1.1449]

Result: 1.1449

# 8: 1/2 + 3/7 - √(25/64)

√ is the symbol for square root

Keystrokes (or one possible set of keystrokes):

HP 48S/48G/50g: 2 [1/x]

Display:
[1: 0.5000]

HP 48S/48G/50g: 3 [ENTER] 7 [ ÷ ]

Display:
[2: 0.5000]
[1: 0.4286]

HP 48S/48G/50g: [ + ] 25 [ENTER] 64 [ ÷ ]

Display:
[2: 0.9286]
[1: 0.3906]

HP 48S/48G/50g: [ √ ]

Display:
[2: 0.9286]
[1: 0.6250]

HP 48S/48G/50g: [ - ]

Display:
[1: 0.3036]

Result: 0.3036

#9: Find a decimal approximation, to four decimal places, of e^-3.

Keystrokes:

HP 48S: [ 3 ] [+/-] [LS] [1/x] (e^x)
HP 48G: [ 3 ] [+/-] [LS] [1/x] (e^x)
HP 50g: [ 3] [+/-] [LS] [y^x] (e^x) [RS] [ENTER] (->NUM)

Result: 0.0498


# 10: √(3^2 + 4^2)

Keystrokes:

HP 48S/48G/50g:
3 [LS] [ √ ] (x^2) 4 [LS] [ √ ] (x^2)

Display:
[2: 9.0000]
[1: 16.0000]

HP 48S/48G/50g:
[ + ] [√ ]

Display:
[1: 5.0000]

Result: 5

# 11: Find the percent change between 19.99 (old) and 34.99 (new)

%CHG = Δ% = [new - old] ÷ old x 100%

Keystrokes:

HP 48S:
19.99 [ENTER] 34.99 [MTH] [F1] (PARTS) [NXT] [F5] (%CH)

HP 48G:
19.99 [ENTER] 34.99 [MTH] [F5] (REAL) [F2] (%CH)

HP 50g:
19.99 [ENTER] 34.99 [LS] [SYMB] (MTH) [F5] (REAL) [F2] (%CH)

Result: 75.0375% change

Register Operations

Two common register operations are Swap and Roll Down.

Swap: This operation swaps the contents on the X and Y registers. The key is typically labeled [x<>y]. The swap function is useful when arguments need to be switched before performing subtraction, division, and taking powers.

# 12: 2 - (-5 x 3)

In order to demonstrate the Swap function, let's enter the multiplication first.

Keystrokes:

HP 48S/48G/50g:
5 [+/-] [ENTER] 3 [ x ]

Display:
[1: -15.000]

HP 48S/48G/50g:
2 [ENTER]

Display:
[2: -15.0000]
[1: 2.0000]

We need 2 on the top because we need to calculate 2 - (-5 x 3), not (-5 x 3) - 2. This is where the Swap operation comes in.

HP 48S/48G/50g:
[LS] [right arrow] (SWAP - not marked on the 50g+)

Display:
[2: 2.0000]
[1: -15.0000]

Now with the arguments in the proper order, we can execute the subtraction.

HP 48S/48G/50g:
[ - ]

Display:
[1: 17.0000]

Result: 17

# 13: Calculate 200 ÷ 40, but enter 40 first, then 200.

Here we can use the Swap operation to correct the order of dividend and divisor.

HP 48S/48G/50g:
40 [ENTER] 200

Display:
[1: 40.0000]
[ 200]

We need to swap the arguments.

HP 48S/48G/50g:
[ENTER] [LS] [left arrow]

Display:
[2: 200.0000]
[1: 40.0000]

Now we got it!

HP 48S/48G/50g:
[ ÷ ]

Display:
[1: 5.0000]

Result: 5

Roll Down: This operation pushes down the contents of the register one level. You choose how many of the levels "roll" down.


# 14 Roll down a three level stack.

A simple example: Say we have entered 4, 1, and 9 on to the stack and the stack is like this:

3: 4
2: 1
1: 9

((Clear Stack) 4 [ENTER] 1 [ENTER] 9 [ENTER])

I want to rotate the entire stack. The keystrokes for this is:

HP 48S:
[PRG] [F1] (STK) [F6] (DEPTH) [F4] (ROLLD)

HP 48G:
[LS] [up arrow] [F6] (DEPTH) [F4] (ROLLD)

HP 50g:
[LS] [EVAL] (PRG) [F1] (STACK) [NXT] [F6] (DEPTH) [F2] (ROLLD)

The stack looks like this:

3: 9
2: 4
1: 1


The Constant Pi (π)

The Pi key (or keystroke sequence) puts π on level 1 and lifts everything else one level.

# 15: Find the area of a circle with a radius of 2.35 inches.

Area = π *radius^2

Keystrokes:

HP 48S/48G/50g:
[LS] [SPC] (π) 2.35 [LS] [ √ ] (x^2) [ x ]

Display:
[1: 'π*5.5225']

HP 48S: [RS] [EVAL] (->NUM)
HP 48G: [LS] [EVAL] (->NUM)
HP 50g: [RS] [ENTER] (->NUM)

Display:
[1: 17.3494]

Result: 17.3494 square inches

Additional Examples

# 16: How many 5-card hands can be dealt out of a standard deck of 52 playing cards?

Combination = COMB = n! ÷ (k! x (n - k)!)

It is found in the Math-Probability Menu, labeled COMB

Keystrokes:

HP 48S:
52 [ENTER] 5 [MTH] [F2] (PROB) [F1] (COMB)

HP 48G:
52 [ENTER] 5 [MTH] [NXT] [F1] (PROB) [F1] (COMB)

HP 50g:
52 [ENTER] 5 [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F1] (COMB)

Result: 2,598,960 possible hands

# 17: You have purchased a calculator for $99.99 and present a coupon for 15% for the purchase price. Assume sales tax is 8.75%. What is the final amount due?

The percent function returns level 2 * level 1 ÷ 100 on level 1.

Keystrokes:

HP 48S:
99.99 [ENTER] [ENTER] 15 [MTH] [F1] (PARTS) [NXT] [F4] (%) [ - ] [ENTER] 8.75 [F4] (%) [ + ]

HP 48G:
99.99 [ENTER] [ENTER] 15 [MTH] [ F5 ] (REAL) [F1] (%) [- ] [ENTER] 8.75 [F1] (%) [ + ]

HP 50g:
99.99 [ENTER] [ENTER] 15 [LS] [SYMB] (MTH) [F5] (REAL) [F1] (%) [ -] [RS] [ENTER] (->NUM) [ENTER] 8.75 [F1] (%) [ + ]

Result: 92.4283 (The final bill is $92.43)

# 18: How to set the Angle Mode

HP 48S:
[LS] [CST] (MODES) [NXT] [NXT]
Select [F1] for Degrees, [F2] for Radians, [F3] for Gradients


HP 48G (via menu):
[RS] [CST] (MODES) [down arrow]
Use [F2] to choose the angle, press [F6] (OK) to accept the settings


HP 50g (via menu):
[MODE] [down arrow] [down arrow]
Use [F2] to choose the angle, press [F6] (OK) to accept the settings



# 19: While the calculator is in Radians mode, find sin^-1 (.5). Then convert the result to degrees.

See # 18 on how to set the calculator to Radians mode. Your calculator is in Radians mode if the display has a RAD indicator on the upper left corner of the screen.

HP 48S/48G/50g: .5 [LS] [SIN] (ASIN)

Display:
[1: 0.5236]

HP 48S: 180 [ x ] [LS] [SPC] (π) [ ÷ ] [RS] [EVAL]
HP 48G: [MTH] [F5] (REAL) [NXT] [NXT] [F6] (R->D)
HP 50g: [LS] [SYMB] (MTH) [F5] [NXT] [NXT] [F6] (R->D)

Display:
[1: 30.0000]

So sin^-1 (.5) ≈ .5236 radians = 30º

Note:
R->D is the Radians to Degrees function
D->R is the Degrees to Radians function

I hope you find this tutorial on RPL helpful.


Eddie

Wednesday, September 21, 2011

RPN Basics

RPN Basics
(updated 9/25/2011)

This is a basic tutorial of reverse polish notation (RPN).  RPN is an operating system that some calculators use, primarily those manufactured by Hewlett Packard.  RPN removes the need to enter parenthesis during long calculations and allows for immediate feedback during calculations; you will not need to enter a long operation before getting feedback - thus eliminating errors.  A lot of times, the number of keystrokes required to make a calculation is reduced using RPN compared to algebraic systems.

Typically, a RPN calculator uses a stack with four registers, named X, Y, Z, and T.  Each register is stacked on top of another.  A four-register stack diagram looks like this:

T
---
Z
---
Y
---
X [DISPLAY]                                                                                                                                         

Most displays will only show the contents of the X register. 

What is required of the user to execute a desired operation depends on the number of arguments (for our purpose, numbers) the function requires.  Most scientific calculator functions require one or two arguments.

One-argument functions operate on whatever is in the display, or the X register.  For one-argument functions, simply execute the desired operation.  One-argument functions include all the trigonometric functions (sine, cosine, tangent), logarithms, exponential (e^), reciprocal, square root, and factorial (x!).  The change sign operation fits under the category of one-number operations because it simply multiplies the number by -1.  The change sign operation is often labeled either CHS (HP 12C, HP 15C) or +/- (HP 35S).

Two-argument functions operate on the contents on the Y and X registers.  Common two-argument functions include the arithmetic operators (+, -, x, ÷), powers (y^x), combination and permutations, percent and percent change (Δ%).  To use a two-argument function, enter the first number (y), then press ENTER.  ENTER terminates the entry and gets the calculator ready to receive another number.  Next, enter the second number (x).  A second ENTER is not required because executing the operation terminates the second entry.  In summary, to operate a two-argument function:

1.  Enter the first (y) argument,
2.  Press ENTER to terminate the first entry.
3.  Enter the second (x) argument,
4.  Execute the desired function.

When you link more than one operation, it is known as a chain calculation.  A simple example is adding a list four numbers.   Another example is adding two groups of numbers and then multiplying the two sums together.

In chain calculations, whatever in the display becomes the first argument of the operation.  All that is needed is to enter the second argument (number), and then the required function.  For chain calculations:

1.  Enter the next required argument
2.  Execute the desired function, no ENTER is required

A more detailed explanation of the stack can be found in manuals of the HP 12C, 15C, and 35S calculators.     HP Website

The scope of this blog is just to give a very basic tutorial of RPN.  A lot of examples are provided to illustrate how to use the functions on an RPN calculator. 

Calculators with RPN

Hewlett Packard:
Scientific: 15C (including Limited Edition), 35S, 48 Series, 32Sii, 41C, 50g+, and many others
Financial: 12C (all editions), 30b

iPod Apps:
GO-Sci 25, GO-Sci 21, just to name a couple.

You can look for RPN calculators online, many are available for the iPod, iPad, and Android operating mobile devices.

This tutorial is going to be a "do by example" tutorial.  Keystrokes are shown in blue.  All calculations on this blog are rounded to 4 decimal places.

* Note: This works for most models.  In these examples, you may need to press a shift key to access an operation depending on the calculator.  Since this tutorial covers a variety of calculators, the shift keys are omitted.  Please check your manual.

Examples:  Calculating with RPN


#1:  5 + 8

Keystrokes:
5 [ENTER]       Display: 5.0000

8 [ + ]                Display: 13.0000


Result: 13


#2: 10 - 6
As in any calculation involving subtraction, the order is important.

Keystrokes:  
10 [ENTER]      Display: 10.0000

6 [ - ]                  Display: 4.0000


Result: 4

# 3:  6 x 2.95 + 2 x 1.28


Keystrokes:
6 [ENTER]       Display: 6.0000

2.95 [ x ]            Display: 17.7000

2 [ENTER]       Display:  2.0000

1.28 [ x ]            Display: 2.5600

[ + ]                    Display: 20.2600


Result: 20.26


# 4:  200 ÷ (3^2.5 - 1)

Keystrokes:
200 [ENTER]       Display:  200.0000

3 [ENTER]           Display: 3.0000

2.5 [y^x]               Display: 15.5885

1 [ - ]                     Display: 14.5885


[ ÷ ]                       Display: 13.7095

Result: 13.7095

# 5:  1/2 + 3/7 - √(25/64)


√ is the symbol for square root

Keystrokes (or one possible set of keystrokes):
2 [1/x]                   Display: 0.5000
3 [ENTER]           Display: 3.0000

7 [ ÷ ]                    Display: 0.4286

[ + ]                       Display: 0.9286
25 [ENTER]         Display: 25.0000

64 [ ÷ ]                  Display: 0.3906
[ √ ]                       Display: 0.6250

[ - ]                        Display: 0.3036

Result: 0.3036

# 6:  e^-3


Keystrokes:
3 [CHS] (or [+/-])      Display: -3
[e^x]                          Display: 0.0498


Result: 0.0498

# 7:  √(3^2 + 4^2)

Keystrokes:

If a square operation [x^2] is available:
3 [x^2]                    Display: 9.0000

4 [x^2]                    Display: 16.0000

[ + ]                         Display: 25.0000

[ √ ]                         Display: 5.0000

If a [x^2] is not available:
3 [ENTER] 2 [y^x]      Display: 9.0000

4 [ENTER] 2 [y^x]      Display: 16.0000

[ + ]                               Display: 25.0000

[ √ ]                               Display: 5.0000

Result: 5

# 8: Find the percent change between 19.99 (old) and 34.99 (new)

%CHG = Δ% =  [new - old] ÷ old x 100%

Keystrokes:

If a percent change function [Δ%] is available:
19.99 [ENTER]             Display: 19.9900

34.99 [Δ%]                    Display: 75.0375

If  [Δ%] is not available:
34.99 [ENTER] 19.99 [-]    Display: 15.0000

19.99 [÷]                              Display: 0.7504
100 [x]                                 Display: 75.0375


Result: The percent change is an increase of 75.0375%

Register Operations

Two common register operations are Swap and Roll Down.

Swap: This operation swaps the contents on the X and Y registers.  The key is typically labeled [x<>y].  The swap function is useful when arguments need to be switched before performing subtraction, division, and taking powers. 

#9:  2 - (-5 x 3)

Keystrokes:
5 [CHS] (or [+/-])       Display: -5
[ENTER] 3 [ x ]         Display: -15.0000
                                Display:  2       
[x<>y]                        Display: -15.0000
[ - ]                             Display: 17.0000

Result: 17

Roll Down:  This operation pushes down the contents of the register one level.

In a four stack scheme:
Whatever was in the T register goes to the Z register
Whatever was in the Z register goes to the Y register
Whatever was in the Y register goes to the X register
Whatever was in the X register goes to the T register

The key often labeled R with a down arrow next to it.  [R↓]

The Constant Pi (π)

The Pi key (or keystroke sequence) puts π on the X register (display) and lifts everything else one level.  On a four-register stack, whatever was held in the T register is lost.

#10: Find the area of a circle with a radius of 2.35 inches.

Area = π *radius^2

Keystrokes:
[π]                             Display: 3.1416

2.35 [x^2] [x]           Display: 17.3494


Result: 17.3494 square inches

Alternatively:  [ π ] 2.35 [ENTER] 2 [y^x] [ x ]

Additional Examples:

#11:  How many 5-card hands can be dealt out of a standard deck of 52 playing cards?

Combination = n! ÷ (k! x (n - k)!)

This function has several labels: Cy,x (HP 15C), COMB (HP 42S, HP 50g+), or nCr (most calculators)
The factorial function has several labels, typically x! or n!.

Keystrokes:

If a combination function is available:
52 [ENTER] 5 [nCr]

If a combination function is not available:
5 [x!]                                  Display: 120.0000

52 [ENTER]                      Display: 52.0000

5 [ - ]                                  Display: 47.0000

[x!]                                     Display: 2.5862     59   (2.5682 x 10^59)

[ x ] [1/x]                            Display: 3.2222    -62   (3.2222 x 10^-62)

52 [x!]                                Display: 8.0658      67  (8.0658 x 10^67)

[ x ]                                    Display: 2,598,960.000

Result: 2,598,960 possible 5-card hands

#12:  Find the sine of 30°

Keystrokes:
If necessary, set the calculator to degrees mode
30 [SIN]

Result: 0.5000

#13:  You have purchased a calculator for $99.99 and present a coupon for 15% for the purchase price.  Assume sales tax is 8.75%.  What is the final amount due?

In RPN calculators, the percent function [ % ] returns Y * X%.  The contents of the Y stack remain unchanged.

Keystrokes:
99.99 [ENTER] 15 [ % ]      Display: 14.9985   (99.99 x 15%)
[ - ]                                         Display: 84.9915
8.75 [ % ]                              Display: 7.4368     (84.9915 x 8.75%)
[ + ]                                        Display: 92.4283

Result: 92.4283 (The final bill is $92.43)

#14:  You deposit $1,000 in a bank account earning 3.5% interest for 5 years.  How much money will you have after 5 years?

FV = PV x (1 + i%)^n

Where FV is the future value, PV is the present value, i is the periodic interest rate, and n is the number of periods.  We are looking for FV with PV = 1,000, i = 3.5, and n = 5.

Keystrokes:
1000 [ENTER] 1 [ENTER] 3.5 [ % ]       Display: 0.0350

[ + ]                                                             Display: 1.0350

5 [ y^x ]                                                      Display: 1.1877

[ x ]                                                             Display: 1,187.6863

Result: 1,187.6863  ($1,187.68)


#15: On a right triangle, find the angle x in degrees:


                    /|
                  /  |
                /    |
        15  /      |
            /        |
          /x        |
         --------
               10

(my attempt at a right triangle, hopefully you get the picture)

x = arccos (10/15) = cos^-1 (10/15)

Keystrokes:

Set the calculator in Degrees mode if necessary.
10 [ENTER] 15 [ ÷ ]               Display: 0.6667
[COS^-1]                                Display: 48.1897

Result: The angle is 48.1897°


I hope you find this tutorial on RPN helpful.

Eddie

Many thanks to Xavier A. and Dieter on the MoHPC (The Museum of HP Calculators) Forum. 







Pictures of the HP 15C Limited Edition and the HP 12C 30th Year Anniversary Edition

Hello, everyone. In September 2011, Hewlett Packard released special editions of two of the most popular calculator models: the HP 15C Limited Edition and the HP 12C 30th Year Anniversary Special Edition.


HP 15C Limited Edition

The HP 15C Limited Edition is a reissue of the HP 15C that was in the market during the 1980s.  The calculator had a horizontal interface.  With the calculator operating in RPN (Reverse Polish Notation), users and fans of the HP 15C praised the calculator for ease of use and it's landscape shape.  Features include: complex numbers, matrices, and keystroke programming up to 448 steps.  



 The 15C Limited Edition box. 






The 15C Limited Edition Scientific Calculator.  
The 15C came with a written manual, which is probably a copy of the original 15C manual, a carrying case, and something really nice: a 15C emulator.  I have yet to try the emulator but it is on the list of things to do.  I am real excited to get the 15C Limited Edition.  The new 15C is 100 times faster than the original model released in the 1980s. The Limited Edition is the first time in over 20 years that 15C calculators were produced.  I understand that there are originally 10,000 calculators produced - hopefully more will be in the future.  So if you want one, get shopping immediately!  

HP 12C 30th Year Anniversary Edition

The HP 12C 30th Year Anniversary Edition is a celebration of Hewlett Packard's HP 12C calculator.  Unlike the HP 15C, the HP 12C has been continually been in the market, ever since September 1, 1981!  The HP 12C is a RPN Financial Calculator which features: time value of money, interest conversion, bond calculations, days between date calculations, cash flows, and keystroke programming.  Most HP 12Cs have a memory of 99 steps, which includes the 30th Year Anniversary Edition.  Hewlett Packard sells a Platinum Edition of the 12C which has a programming memory of 400 steps.  



The box contains a getting started guide and a carrying pouch. 

Enjoy the pictures, but these calculators are going fast.  I have two 15C LEs and one 12C 30th Year Anniversary Edition.  

Eddie

Monday, September 19, 2011

New Finds

Last week I bought two Hewlett Packard HP 15C limited Edition calculators. The limited edition is a reissue of the HP 15C calculator, a favorite of many scientists and mathematicians. I also bought a 30th Year edition of the HP 12C calculator, Hewlett Packard's best selling calculator for 30 years. I plan to post pictures soon, but if you want to buy one, check out www.HP.com, www.buy.com, Bach Company, or Samson Cables.

There is a lot of talk on the 15C on the Hewlett Packard Museum of Calculators forum ( http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi ). It is a forum for fans of math and Hewlett Packard calculators.


At the Azusa Swap Meet yesterday, I managed to pick up a TI-82 calculator. The TI-82 is basically the bridge between the TI-81 and the TI-83+/TI-84+ series. It is nice to fill holes in the collection.

Got to go, take care,
Eddie

Tuesday, September 13, 2011

Sharp EL-W516X Review

Hi everyone. Today I am giving a short review of the Sharp EL-W516X solar calculator. I bought this calculator at Target for $17.99.

The main features of the EL-W516X include: WriteView mode, statistical operations, matrix operations, base calculations, complex operations, and a drill mode. The drill mode tests your mathematical ability on arithmetic problems. While this mode has been panned, I find the drill mode enjoyable, and I challenge myself to see how fast I can correctly answer a set of questions.

Generally, this calculator is a remake of the Sharp EL-W516 calculator. A picture of both models are shown below, with the newer EL-W516X on the left, and the older EL-W516 on the right.

The set of operations of the EL-W516X is the same as the EL-W516. The normal mode allows you enter calculations in a linear format or a textbook format (WriteView ™). The textbook format reurns exact answers (fractions, fractions of π, square roots) whenever possible. Decimal equivalents can be accessed by pressing the CHANGE key (sometimes twice).

Some of them include:

Catalog. This calculator contains a catalog of all the functions available by pressing MATH, 0. The catalog is available in every mode.

Calculus. Functions include single variable numerical integration, single numberical derivatives, and the sum function (Σ). I am happy to report that on the several tests calculations I made with the EL-W516X, the calculator boasts a faster processor than its predecessor.

Statistics. Regressions include linear, quadratic, power, exponential, logarithmic, inverse, and general exponential (y = a * b^x). Normal distribution calculations are include in this mode. (finding the area but not inverse)

Base Operations.. The calculator offers five bases: decimal (standard), binary, octal, hexadecimal, and pental (base 5). To enter a base mode, all you Ned to do is to perform a conversion. To access the A-F in hexadecimal mode, you just need to press the corresponding key (no ALPHA key required). The logic operations (and, not, or, etc) are found in the catalog.

Equation Solving. In addition to the ability to solve any equation in one variable (X), the calculator has solvers for 2 x 2 and 3 x 3 linear systems, and the quadratic and cubic equation. The general solver is in form f(X) = 0, you supply the f(X).

Complex Mode. . This mode in my opinion, falls a little short. This mode can not use WriteView and it's operations are limited to polar/rectangular conversions, square (x^2), cube (x^3), and the arithmetic operations. I would have liked for it to do at least exponential and logarithms, as well as exponential powers beyond 3.

Definable Functions.. You can store up to four operations in memories D1 - D4 for later use. Not very useful because what you can store is limited.

Definable Formulas. You can store up to four formulas (including integrals, sums, and derivatives) in memories F1 - F4 for later use. I find this ability useful, you can store formulas for calculation or even for reference. The ALGB function (MATH, 1 in Normal Mode) can be used to substitute values for variables.

Other. The calculator offers basic matrix, lists, and table operations.


OVERALL

I like the sharp, crisp display of the EL-W516X. The calculator also has a faster processor - which means faster calculations (it pays truly pays off when doing numerical calculus). Function wise, this calculator has a lot to offer and us good pick up for anyone who wants an inexpensive calculator with a lot of function. 4 out 5 stars.

Wednesday, September 7, 2011

Ready for school?

Sorry I have not blogged in while. For the students: are you in school or about to go back? What math classes are you taking?

Sunday, June 26, 2011

Texas Instruments TI-nspire CX Short Review

In early June, the TI-nspire CX calculator finally hit the stores.  I bought mine at a local Office Depot in West Covina for about $160.  The CX is the third installment of the TI-nspire series.  The CX, I feel, is what TI should have released the first time.


The CX boasts a color screen.  You are able to edit certain text (in the Notes Application), graphs, and cells in 15 colors.  The color screen has a better contrast to their black and white nspire counterparts.  The best part is that I can read the screen anywhere at any angle instead of having to tilt my calculator to certain degrees.  


The CX has a much better keyboard than the Touchpad.  I won't go into how much dislike users have for the original Clickpad here, but the alphabetic keys on the bottom of the Touchpad were atrocious.  The keys were hard to press, put a lot of pressure on the finger, and the keys put a strain on my hands after typing on it for several minutes.  Thankfully, TI corrected this problem and on the CX the alphabetic keys on the bottom of the unit have a more tactile feel to them.  The keys are easy to press.


Although, what is up with the trigonometric functions not being on the keyboard?  Same for π and θ.


The CX also has 100 MB of memory - which is a lot for a calculator.  It may not be the biggest, because an HP 50g calculator can have up to 4 GB(?) on it with the use of an SD card, but that is a ton of memory for a calculator noneoftheless.


The CX package comes with the Student Software.  The Software can be used to emulate the nspire CX and also act as the link between the calculator and the computer.


Overall, I enjoy using the nspire CX and can not wait to get my hands on the CAS version.




TI nspire webpage

Saturday, June 4, 2011

My Favorite Number



Even though I am a fan of numbers in general, my favorite number is π. π is the famous irrational constant used in measuring the area and circumference in circles, plays an important role in trigonometry, and the Gamma of 1/2 is the square root of π. Every March 14 is designated π Day, celebrated around the world, particularly in mathematical circles, schools, and universities. It also happens to be the birthday of Albert Einstein, Billy Crystal, Les Brown, Quincy Jones, and yours truly (Eddie - the writer on this blog).


Going by memory, the first 15 digits of π is 3.14159 26535 89793.

So, what is your favorite number?

Tuesday, May 24, 2011

Polynomial Derivative and Integral for HP 35S

This program calculates the coefficients of the derivative and the integral of a polynomial. The maximum degree of the polynomial can be is seven.

The variables of the polynomial are:

H x^7 + G x^6 + F x^5 + E x^4 + D x^3 + C x^2 + B x + A

Instructions:

1. Load the Polynomial. Press XEQ P001, enter the degree of the polynomial and load the coefficients from the highest degree to the constant.

2. Operation. To find the derivative, press XEQ P033. For an indefinite integral, press XEQ P083.

Program



' Start of program
' Messages in quotes can be typed by pressing the EQN key. Each letter is typed as so: RCL letter .
' To set/clear flag 10 press Gold Shift FLAGS. 1 for Set, 2 for Clear. "Type" 10 by pressing the decimal point followed by the zero.

P001 LBL P
P002 SF 10
P003 "DEGREE"
P004 PSE
P005 CF 10
P006 INPUT N
P007 1
P008 +
P009 STO M
P010 SF 10
P011 "X^"
P012 PSE
P013 RCL M
P014 1
P015 -
P016 PSE
P017 1
P018 +
P019 +/-
P020 STO I
P021 "COEF"
P022 PSE
P023 CF 10
P024 RCL(I)
P025 STOP

' STOP is entered by pressing R/S

P026 STO(I)
P027 DSE M
P028 GTO P010
P029 SF 10
P030 "DONE"
P031 CF 10
P032 RTN



' Derivative Routine

P033 1
P034 RCL+ N
P035 STO M

' Calculate the coefficients

P036 RCL M
P037 +/-
P038 STO I
P039 +/-
P040 -1
P041 RCL+ M
P042 STOx(I)
P043 DSE M
P044 GTO P036

' Shift the coefficients to the appropriate slots

P045 2
P046 1
P047 RCL+ N
P048 1000
P049 ÷
P050 +
P051 STO M

P052 RCL M
P053 IP
P054 +/-
P055 STO I
P056 RCL(I)
P057 1
P058 STO+ I
P059 R↓
P060 STO(I)
P061 ISG M
P062 GTO P052

P063 RCL N
P064 +/-
P065 1
P066 -
P067 STO I
P068 0
P069 STO(I)

' Display Routine

P070 RCL N
P071 STO M

P072 RCL M
P073 +/-
P074 STO I
P075 VIEW(I)
P076 DSE M
P077 GTO P072

P078 SF 10
P079 "DONE"
P080 PSE
P081 CF 10
P082 RTN



' Integral Routine

' Calculate the coefficients

P083 1
P084 RCL +N
P085 STO M

P086 RCL M
P087 +/-
P088 STO I
P089 +/-
P090 1/x
P091 STOx(I)
P092 DSE M
P093 GTO P086

' Shift the coefficients into the proper place
' The constant term is assigned 0 (technically, it is an arbitrary constant)

P094 1
P095 RCL+ N
P096 STO M

P097 RCL M
P098 +/-
P099 STO I
P100 1
P101 -
P102 RCL(I)
P103 x<>y
P104 STO I
P105 x<>y
P106 STO(I)
P107 DSE M
P108 GTO P097

P109 0
P110 STO A

' Display Routine

P111 RCL N
P112 2
P113 +
P114 STO M

P115 RCL M
P116 +/-
P117 STO I
P118 VIEW(I)
P119 DSE M
P120 GTO P115

P121 SF 10
P122 "DONE"
P123 PSE
P124 CF 10
P125 RTN

' End of Program

Memory: LN=433



Example

Find the derivative and integral of f(x) = x^3 - 2x^2 + 1

Derivative:
1. XEQ P001
2. Enter 3 at DEGREE prompt, then press R/S
3. "X^3" : 1, R/S
4. "X^2" : -2, R/S
5. "X^1" : 0, R/S
6. "X^0" : 1, R/S
7. XEQ P033. Press R/S after each coefficient.

Then f'(x) = 3x^2 - 4x

For the integral:
1. XEQ P001
2. Enter 3 at DEGREE prompt, then press R/S
3. "X^3" : 1, R/S
4. "X^2" : -2, R/S
5. "X^1" : 0, R/S
6. "X^0" : 1, R/S
7. Press XEQ P083.

Then the integral is .25x^4 - .6666666667x^3 + x

Recall that the variables of the polynomial are:

H x^7 + G x^6 + F x^5 + E x^4 + D x^3 + C x^2 + B x + A


Trigonometry Reduction Formula and Solving Simple Arcsine and Arccosine Equations

Trigonometry Reduction Formula and Solving Simple Arcsine and Arccosine Equations Some Background and Periodic Reduction Formulas ...