Post Reply 
(42S) Newton Polynomial Interpolation
05-11-2022, 09:32 PM (This post was last modified: 05-11-2022 09:42 PM by Thomas Klemm.)
Post: #2
(67) Newton Polynomial Interpolation
Program

This program for the HP-67 works similar to the one for the HP-42S:
Code:
001: 31 25 11     ; LBL A
002: 34 15        ; RCL E
003: 02           ; 2
004: 71           ; *
005: 33 14        ; STO D
006: 35 53        ; Rv
007: 34 15        ; RCL E
008: 01           ; 1
009: 61           ; +
010: 33 15        ; STO E
011: 34 14        ; RCL D
012: 61           ; +
013: 35 33        ; ST I
014: 35 53        ; Rv     
015: 31 25 00     ; LBL 0
016: 33 24        ; STO (i)
017: 34 14        ; RCL D
018: 31 81        ; x>0
019: 22 01        ; GTO 1
020: 31 33        ; Rv
021: 35 84        ; DSZ
022: 35 54        ; SPACE 
023: 33 24        ; STO (i)
024: 35 22        ; RTN
025: 31 25 01     ; LBL 1
026: 35 53        ; Rv
027: 31 33        ; DSZ
028: 31 33        ; DSZ
029: 31 33        ; DSZ
030: 34 24        ; RCL (i)
031: 51           ; -
032: 34 14        ; RCL D
033: 02           ; 2
034: 51           ; -
035: 33 14        ; STO D
036: 35 24        ; x<>I
037: 34 24        ; RCL (i)
038: 35 52        ; x<>y
039: 35 33        ; ST I
040: 44           ; CLx
041: 61           ; +
042: 35 54        ; R^
043: 35 52        ; x<>y
044: 51           ; -
045: 81           ; /
046: 31 34        ; ISZ
047: 31 34        ; ISZ
048: 22 00        ; GTO 0
049: 31 25 12     ; LBL B
050: 00           ; 0
051: 34 15        ; RCL E
052: 02           ; 2
053: 71           ; *
054: 01           ; 1
055: 51           ; -
056: 35 33        ; ST I
057: 35 53        ; Rv
058: 22 03        ; GTO 3
059: 31 25 02     ; LBL 2
060: 35 52        ; x<>y
061: 34 24        ; RCL (i)
062: 51           ; -
063: 71           ; *
064: 31 34        ; ISZ
065: 31 25 03     ; LBL 3
066: 34 24        ; RCL (i)
067: 61           ; +
068: 31 33        ; DSZ
069: 31 33        ; DSZ
070: 31 33        ; DSZ
071: 22 02        ; GTO 2
072: 35 52        ; x<>y
073: 34 00        ; RCL 0
074: 51           ; -
075: 71           ; *
076: 34 01        ; RCL 1
077: 61           ; +
078: 35 22        ; RTN
Instead of P+ and f(x) use the labels A and B.

Registers

This is the situation with 3 points:

R0: \(x_0\)
R1: \([y_0]\)
R2: \(x_1\)
R3: \([y_0, y_1]\)
R4: \(x_2\)
R5: \([y_0, y_1, y_2]\)
R6: \([y_1, y_2]\)
R7: \([y_2]\)

D: ? … used
E: 3 … number of points
I: k … index

When the next point is entered, some of the values at the end are overwritten:

R0: \(x_0\)
R1: \([y_0]\)
R2: \(x_1\)
R3: \([y_0, y_1]\)
R4: \(x_2\)
R5: \([y_0, y_1, y_2]\)
R6: \(x_3\)
R7: \([y_0, y_1, y_2, y_3]\)
R8: \([y_1, y_2, y_3]\)
R9: \([y_2, y_3]\)
R10: \([y_3]\)

D: ? … used
E: 4 … number of points
I: k … index


For \( n \) points \( 3 n - 1 \) registers are used.
Thus we can enter at most \( 8 \) points.

Initialisation

Before you enter points, make sure the counter is reset:

0
STO E


Examples

The examples from the previous post work the same way.
Only the index of the registers is shifted by 2:
Code:
00: -5
01: 12
02: 1
03: 0.1666666667
04: 2
05: -0.3095238096
06: -2
07: 11
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(67) Newton Polynomial Interpolation - Thomas Klemm - 05-11-2022 09:32 PM



User(s) browsing this thread: 1 Guest(s)