Wednesday, November 16, 2011

HP 15C Programming Tutorial - Part 7: Solve and Integration

Solving Equations with the HP 15C

The HP 15C has a powerful solve feature that finds the real roots of the equation f(x)=0 given an interval.

Caution: When using the solve feature on an original HP 15C calculator - you will want to allow additional time since the calculator can be slow in the solve process.

Procedure:
1. Program an equation and label it.
2. In Run mode, enter the lower limit of the interval and press [ENTER].
3. Enter the upper limit of the interval, and press [ f ] [ ÷ ] (SOLVE) Label. Label can be 0-9, .0-.9, or A-E.

We will use two examples to illustrate the power of the SOLVE function.

Example 1

Find the root for the equation f(x) = x ln x - 3. We claim that the root is somewhere in the interval [1, 6].

First enter the equation. For this equation, use Label 0. Assume that x is in the display.


Key Codes Key
001 42 21 0 LBL 0
002 36 ENTER * duplicates x
003 43 12 LN * X: ln(x), Y: x
004 20 × * x ln (x)
005 3 3
006 30 - * x ln (x) - 3
007 43 32 RTN


1. Press [ g ] [R/S] (P/R) to go to Run Mode.
2. Press [ 1 ] [ENTER] [ 6 ] [ f ] [ ÷ ] (SOLVE) [ 0 ].

Result: x ≈ 2.8574.

Example 2

Find the two roots to the equation g(x) = x^2 + 4x - 3. Using Horner's Method, we can rewrite the equation as g(x) = (x + 4)x - 3.

We will use Label 1 for g(x).


Key Codes Key
001 42 21 1 LBL 1
002 36 ENTER * duplicates x
003 4 4
004 40 +
005 20 × * (x + 4)x
006 3 3
007 30 - * (x + 4)x - 3
008 43 32 RTN


Let's try to see if we can find a positive root. How about an interval of [0, 3]?

0 [ENTER] 3 [ f ] [ ÷ ] (SOLVE) 1

Result: x ≈ 0.6458.

Are there any roots bigger than 0.6458? Try an interval of [3, 100].

3 [ENTER] 100 [ f ] [ ÷ ] (SOLVE) 1

Result: x ≈ 0.6458 (no different)

How about any roots below 0? Try an interval [-100, 0].

100 [CHS] [ENTER] 0 [ f ] [ ÷ ] (SOLVE) 1

Result: x ≈ -4.6458

So our two roots are x ≈ {-4.6458, 0.6458}.

Integral

The HP 15C also has a built in integral function ( ∫ ). This is useful for finding definite integrals for functions, even when the function is not defined at the end points.

Caution: Just like the Solve function - allow extra time with the Integral function when using the original HP 15C calculators. In addition, using the Integral function requires 23 memory registers to operate. It may be a good idea to clear the program memory prior to entering functions for integration.

Procedure:
1. Enter a function in a program. The program must have a label.
2. Enter the lower limit of integration and press [ENTER].
3. Enter the upper limit of integration and press [ f ] [ × ] ( ∫ ).

We will use two examples to illustrate the Integration feature.

Example 1

Calculate ∫ ( e ^ (-x^2), x, 0, 2). Use Label 2.


Key Code Keys
001 42 21 2 LBL 2
002 43 11 x^2
003 16 CHS
004 12 e^x * e^(-x^2)
005 43 32 RTN


Press [ g ] [R/S] (P/R) to switch to Run Mode. Then press [ 0 ] [ENTER] [ 2 ] [ f ] [ × ] ( ∫ ) [ 2 ].

Result: Integral ≈ 0.8821

Example 2

Calculate ∫ ( |sin x|, x, 0, 2π). Use Label 3.


Key Code Keys
001 42 21 3 LBL 3
002 43 8 RAD * use Radians mode
003 23 SIN
004 43 16 ABS * |sin x|
005 43 32 RTN


In Run mode:

0 [ENTER] [ g ] [EEX] ( π ) 2 [ × ] [ f ] [ × ] ( ∫ ) 3

Result: Integral = 4

This concludes Part 7 of the tutorial. In the next part we will use the knowledge of programming functions and equations to calculate derivatives and sums.



This tutorial is property of Edward Shore. © 2011