Polynomial Expressions and Horner's Method

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

Ax4 + Bx3 + Cx2 + 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:

Ax4 + 13x3 + Cx2+D x + E

(Ax3 + Bx2 + Cx + D ) x + E

((Ax2 + Bx + C ) x + D )x + E

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

Example:

Write a program using RPN operations for 5x4 + 2x3 as (((5x + 2)x)x)x, then evaluate it for x = 7.

Keys: Display:Description:

zdz

UŒŒ  !

P

  

X

 "! % Fills the stack with x.

š

 !

Simple Programming 12–25

File name 32sii-Manual-E-0424

 

Printed Date : 2003/4/24

Size : 17.7 x 25.2 cm