HP 50g Graphing Calculator User Manual
Page 628

Page 18-61
«
Open program
x y p
Enter lists x and y, and p (levels 3,2,1)
«
Open subprogram 1
x SIZE n
Determine size of x list
«
Open subprogram 2
x VANDERMONDE
Place x in stack, obtain V
n
IF ‘p<n-1’ THEN
This IF implements step 3 in algorithm
n
Place n in stack
p 2 +
Calculate p+1
FOR j
Start loop j = n-1, n-2, …, p+1, step = -1
j COL
− DROP
Remove column and drop it from stack
-1 STEP
Close FOR-STEP loop
ELSE
IF ‘p>n-1’ THEN
n 1 +
Calculate n+1
p 1 +
Calculate p+1
FOR j
Start a loop with j = n, n+1, …, p+1.
x j ^
Calculate x
j
, as a list
OBJ
ARRY
Convert list to array
j COL+
Add column to matrix
NEXT
Close FOR-NEXT loop
END
Ends second IF clause.
END
Ends first IF clause. Its result is X
y OBJ
ARRY
Convert list y to an array
MTREG
X and y used by program MTREG
NUM
Convert to decimal format
»
Close sub-program 2
»
Close sub-program 1
»
Close main program
Save it into a variable called POLY (POLYnomial fitting).
As an example, use the following data to obtain a polynomial fitting with p =
2, 3, 4, 5, 6.