Showing posts with label 15C. Show all posts
Showing posts with label 15C. Show all posts

Monday, January 2, 2012

Setting up Equations for Integration/Solve - HP 15C

Setting up equations for the integration and solve functions for the HP 15C. Since the release of the HP 15C Limited Edition, the processing speed has increased.

The most important thing to remember is that the equation starts with "x" on the x-register of the stack.

With integration, "x" is the variable to be integrated.

With the solve function, "x" is the variable to be solved for.

Depending on the equation, in general, you will need to duplicate "x" with [ENTER] as many times as "x" appears in the equation. Algebraic manipulation of the equation can be helpful. A technique known as Horner's Method can be used for polynomials. It also helps to handle the innermost expressions first, working outside.

I often straw a stack diagram:

ST X, ST Y, ST Z, ST T

Several things to remember:

Most two-argument functions (arithmetic, power, combination, permutation, etc):

ST T retains what was in ST T
ST Z copies the contents of ST T
ST Y the contents of ST Z moves here
ST X result of the function

Pressing ENTER, recalling from a memory register, or entering π

ST T the contents of ST Z moves here
ST Z the contents of ST Y moves here
ST Y the contents of ST X moves here
ST X the number just entered or recalled


Horner's Method

Let the polynomial p(x) = a_n * x^n + a_n-1 * x^(n-1) + ... + a1 * x + a0

Applying Horner's Method to p(x):

( ... (a_n * x + a_n-1) * x + a_n-2) * x + a_n-3) ... + a1 ) * x + a0

Functions

Integration: [ f ] [ x ] label

Solve: [ f ] [ ÷ ] label


This blog provides examples of integration, but ideas can be taken from the examples for use in solving equations.


Examples are in the format of:

b
∫ f(x) dx
a

All results shown here are rounded to 4 decimal places (FIX 4).

Example 1:

5
∫ x^2 * cos x dx
1




KEY ST X ST Y ST Z ST T
LBL 1 x - - -
ENTER x x - -
COS cos(x) x - -
x<>y x cos(x) - -
x^2 x^2 cos(x) - -
× f(x) - - -


Result: -19.4578


Example 2:

π
∫ x sin((π * x)/4) dx
0



KEY ST X ST Y ST Z ST T
LBL 2 x - - -
ENTER x x - -
π π x x -
× π*x x - -
4 4 π*x x -
÷ (π*x)/4 x - -
SIN sin(π*x/4) x - -
× f(x) - - -
RTN


Result: 4.1369


Example 3

3.5
∫ x / (x^2 + 3x - 4 ) dx =
3

3.5
∫ x / ((x + 3) *x - 4) dx
3



KEY ST X ST Y ST Z ST T
LBL 5 x - - -
ENTER x x - -
ENTER x x x -
3 3 x x x
+ x+3 x x x
× x(x+3) x x x
4 4 x(x+3) x x
- x(x+3)-4 x x x
1/x 1/... x x x
× f(x) x x x
RTN


Result: 0.0998


Example 4:

3
∫ √(x^3 - 2x + 1)/x dx
1



Let ø = √(x^3 -2x+1)


KEY ST X ST Y ST Z ST T
LBL 3 x - - -
ENTER x x - -
ENTER x x x -
3 3 x x x
y^x x^3 x x x
x<>y x x^3 x x
2 2 x x^3 x
× 2x x^3 x x
- x^3-2x x x x
1 1 x^3-2x x x
+ x^3-2x+1 x x x
√ ø x x x
x<>y x ø x x
÷ f(x) x x x
RTN


Result: 2.0912

Here are a few more examples of integrals. Try and draw the stack diagram for each step.

Example 5:

8.5
∫ x * √(x^2 - 3*x - 4) dx =
4.5

8.5
∫ x * √((x - 3) * x - 4) dx
4.5



LBL 6
ENTER
ENTER
3
-
×
4
-

×
RTN


Result: 117.2455

Example 6:
π/4
∫ x * (( sin(x-2) )/(cos x)) dx
0



LBL 7
ENTER
ENTER
2
-
SIN
x<>y
COS
÷
×
RTN


Result: -0.3578


I hope you find this blog helpful. Until next time, Eddie



This blog is property of Edward Shore. © 2012

3rd Order Runge-Kutta - HP 15C

This program uses a 3rd Order Runge-Kutta method to assist in solving a first order-differential equation.

Given the initial condition (x0, y0) to the differential equation:

dy/dx = f(x, y)

Find the value of y1 where h is a given step size (preferably small). The value of y1 is given by the following equations:

y1 = y0 + k1/4 + (3 * k3)/4

Where:
k1 = h * f(x0, y0)
k2 = h * f(x0 + h/3, y0 + k1/3)
k3 = h * f(x0 + (2 * h)/3, y0 + (2 * k2)/3)

Error estimated on the order of h^4

Source: Smith, Jon M. Scientific Analysis on the Pocket Calculator. John Wiley & Sons, Inc.: New York 1975 pg 174

Memory Registers Used

R0 = h
R1 = x
R2 = y
R3 = x1 (result)
R4 = y1 (result)
R5 = x0 (copied from R1)
R6 = y0 (copied from R2)
R7 = k1
R8 = k2
R9 = k3

Labels Used

Label A = Main Program
Label 0 = Program where equation is maintained

Instructions

1. Store h, x0, and y0 in memory registers R0, R1, and R2 respectively.
2. Enter or edit the equation in program mode using Label 0. Use RCL 1 for x and RCL 2 for y.
3. Run Program A. The first answer is x1. Press [R/S] for y1.
4. To find (x2, y2), store x1 in R1 and y1 in R2 and run Program A again. You can do this by pressing [STO] [ 2 ] [x<>y] [STO] [ 1 ] [ f ] [ √ ] (A) immediately following program execution.


There are 59 program steps in the main program.


Key Code
LBL A 42 21 11
RCL 1 45 1
STO 5 44 5
RCL+ 0 45 40 0
STO 3 44 3
RCL 2 45 2
STO 6 44 6
GSB 0 32 0
RCLx 0 45 20 0
STO 7 44 7
RCL 5 45 5
RCL 0 45 0
3 3
÷ 10
+ 40
STO 1 44 1
RCL 6 45 6
RCL 7 45 7
3 3
÷ 10
+ 40
STO 2 44 2
GSB 0 32 0
RCLx 0 45 44 0
STO 8 44 8
RCL 5 45 5
RCL 0 45 0
2 2
x 20
3 3
÷ 10
+ 40
STO 1 44 1
RCL 6 45 6
RCL 8 45 8
2 2
x 20
3 3
÷ 10
+ 40
STO 2 44 2
GSB 0 32 0
RCLx 0 45 20 0
STO 9 44 9
RCL 3 45 3
R/S 31
RCL 6 45 6
RCL 7 45 7
4 4
÷ 10
+ 40
RCL 9 45 9
3 3
x 20
4 4
÷ 10
+ 40
STO 4 44 4
RTN 43 32



Example 1

dy/dx = x^2 + sin(x * y)

Initial Conditions: (1, 1), let h = 0.01

Program for equation:

 
LBL 0
RAD
RCL 1
x^2
RCL 1
RCLx 2
SIN
+
RTN

Results:

x y
1.0000 1.0000
1.0100 1.0186
1.0200 1.0375
1.0300 1.0568


Example 2

dy/dx = x^3 * y - y

Initial Condition: (1,1); Step size h = 0.01

Program for the equation:
 
LBL 0
RCL 1
3
y^x
RCLx 2
RCL- 2
RTN

Results:

x y
1.0000 1.0000
1.0100 1.0002
1.0200 1.0006
1.0300 1.0014




This blog is property of Edward Shore. © 2012

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

HP 71B Basic and Casio fx-CG 100: Weighted Random Sample

HP 71B Basic and Casio fx-CG 100: Weighted Random Sample Introduction In calculators, it is fairly easy to generate a rand...