User mode, Polynomial expressions and horner's method – HP 15c User Manual

Page 79

Advertising
background image

Section 6: Programming Basics

79

For example, ´b´A becomes ´bA, ´m´%
becomes ´m%, and O´# becomes O#.
The removal of the ´ is not ambiguous because the ´-shifted function
is the only logical one in these cases. The keycodes for such instructions do
not include the extraneous ´ even if you do key it in.

User Mode

User mode is a convenience to save keystrokes when addressing (calling
up) programs for execution. Pressing ´U will exchange the primary
functions and ´-shifted functions of the A through E keys only. In
User mode (USER annunciator displayed):

´ shift
Primary

A

B

C

D

E

¤ ' @ y

| shift

x

2

LN

LOG



Press | U again to deactivate User mode.

Polynomial Expressions and Horner's Method

Some expressions, such as polynomials, use the same variable several times
for their solution. For example, the expression

f(x) = Ax

4

+ Bx

3

+ Cx

2

+ Dx + E

uses the variable x four different times. A program to solve such an
equation could repeatedly recall a stored copy of x from a storage register.
A shorter programming method, however, would be to use a stack which
has been filled with the constant (refer to Loading the Stack with a
Constant, page 41).

Horner's Method is a useful means of rearranging polynomial expressions to
cut calculation steps and calculation time. It is especially expedient in
_ and f, two rather long-running functions that use subroutines.

This method involves rewriting a polynomial expression in a nested fashion
to eliminate exponents greater than 1:

Ax

4

+ Bx

3

+ Cx

2

+

Dx + E

(Ax

3

+ Bx

2

+ Cx + D)x + E

((Ax

2

+ Bx + C)x + D)x + E

(((Ax + B)x + C)x + D)x + E

Advertising