HP (Hewlett-Packard) 32SII Calculator User Manual


 
Simple Programming 12–25
File name 32sii-Manual-E-0424
Printed Date : 2003/4/24 Size : 17.7 x 25.2 cm
Polynomial Expressions and Horner's Method
Some expressions, such as polynomials, use the same variable several times
for their solution. For example, the expression
Ax
4
+ Bx
3
+ Cx
2
+ Dx + E
uses the variable x four different times. A program to calculate such an
expression using RPN operations could repeatedly recall a stored copy of x
from a variable. A shorter RPN programming method, however, would be to
use a stack which has been filled with the constant (see "Filling the Stack with
a Constant" in chapter 2).
Rorer's Method is a useful means of rearranging polynomial expressions to
cut calculation steps and calculation time. It is especially expedient with
SOLVE and
FN, two relatively complex operations that use subroutines.
This method involves rewriting a polynomial expression in a nested fashion to
eliminate exponents greater than 1:
Ax
4
+ 13x
3
+ Cx
2
+D x + 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
Example:
Write a program using RPN operations for 5x
4
+ 2x
3
as (((5x + 2)x)x)x, then
evaluate it for x = 7.
Keys: Display: Description:
z
d
z
U

!
z
P



z
X

"!
%

!
Fills the stack with x.