# HP F2226A - 48GII Graphic Calculator User Manual Page 631

Graphing calculator.

Here is the translation of the algorithm to a program in User RPL language.
(See Chapter 21 for additional information on programming):
«
x y p
«
x SIZE
n
«
x VANDERMONDE
IF 'p<n-1' THEN
n
p 2 +
FOR j
j COL− DROP
-1 STEP
ELSE
IF 'p>n-1' THEN
n 1 +
p 1 +
FOR j
x j ^
OBJ
ARRY
j COL+
NEXT
END
END
y OBJ
ARRY
MTREG
NUM
"
"
"
Save it into a variable called POLY (POLYnomial fitting).
Open program
Enter lists x and y, and p (levels 3,2,1)
Open subprogram 1
Determine size of x list
Open subprogram 2
Place x in stack, obtain V
This IF implements step 3 in algorithm
Place n in stack
Calculate p+1
Start loop j = n-1, n-2, ..., p+1, step = -1
Remove column and drop it from stack
Close FOR-STEP loop
Calculate n+1
Calculate p+1
Start a loop with j = n, n+1, ..., p+1.
j
Calculate x
, as a list
Convert list to array
Close FOR-NEXT loop
Ends second IF clause.
Ends first IF clause. Its result is X
Convert list y to an array
X and y used by program MTREG
Convert to decimal format
Close sub-program 2
Close sub-program 1
Close main program
n
Page 18-60