HP Prime and Casio Prizm: 3 Point Neville's Method
Introduction
Neville’s Method is an interpolation method to find an
approximation of f(x) at point x. The
function may or may not be known. The
method uses Lagrange interpolation polynomials.
For this blog entry, we will work with 3 known points to
interpolate a fourth point. We certainly
can use a higher order interpolation if desired or needed. In general for the 3 known points (x0, y0), (x1,
y1), and (x2, y2):
P(0,0)
|
|
|
|
P(0,1)
|
|
P(1,1)
|
|
P(0,2)
|
|
P(1,2)
|
|
P(2,2)
|
|
|
Think of this like a collapsing bracket, collect two
neighboring points until a column is completed.
Repeat the process until P(0,n) is reached. In this case of 3 points, the approximate
answer is y ≈ P(0,2).
Formulae:
P(0,0) = (x0, y0)
P(1,1) = (x1, y1)
P(2,2) = (x2, y2)
P(0,1) = ((x1 – x)*y0) + (x – x0)*y1) / (x1 – x0)
P(1,2) = ((x2 – x)*y1) + (x – x1)*y2) / (x2 – x1)
P(0,2) = ((x2 – x)*P(0,1) + (x – x0)*P(1,2)) / (x2 – x0)
Y = P(0,2)
The NEVILLE3 program works with the 3-point interpolation
where lists presents the points {x0, x1, x2} and {y0, y1, y2}. If you use a TI-84 Plus, the Casio Prizm
version can be adopted (with appropriate changes).
HP Prime Program:
NEVILLE3
Input: lx and ly and
list of three elements, {x0, x1, x2} and {y0, y1, y2}, respectively, and x is
the target point.
EXPORT NEVILLE3(lx,ly,x)
BEGIN
// Neville 3-Point Approx.
// EWS 2015-12-07
LOCAL la,a,y,k,n;
la:={0}; // for consistency
FOR k FROM 1 TO 3 DO
IF k==3 THEN
a:=((lx(3)-x)*la(2)+(x-lx(1))*
la(3))/(lx(3)-lx(1));
ELSE
a:=((lx(k+1)-x)*ly(k)+(x-lx(k))*
ly(k+1))/(lx(k+1)-lx(k));
END;
la:=CONCAT(la,{a});
END;
y:=la(4); RETURN y;
END;
Casio Prizm Program NEVILLE3
Input: List 1 and
List 2 and list of three elements, {x0, x1, x2} and {y0, y1, y2}, respectively,
and x is the target point.
“3 PT NEVILLE”
“LIST X”? → List 1
“LIST Y”? → List 2
“X?” → X
{0} → List 3
For 1 → K To 3
If K = 3
Then
(( List 1[3] – X ) * List 3[2] + ( X – List 1[1]) * List
3[3] )
÷ (List 1[3] – List 1[1]) → A
Else
(( List 1[K+1] – X ) * List 2[K] + (X – List 1[K]) * List
2[K+1] )
÷ (List 1[K+1] – List 1[K] ) → A
IfEnd
Augment(List 3,{A}) → List 3
Next
List 3[4] → Y
Y
Examples:
Example 1;
List X/List 1 = {16, 64, 100}
List Y/List 2 = {0.25, 0.125, 0.1}
X = 81
Result: 0.1058511078
Example 2:
List X/List 1 = {-2, 0, 2}
List Y/List 2 = {11, 4, 11}
X = 3
Result: 19.75
Sources:
Mitchell, Kevin. “Neville’s
Method” Simon Fraser University. MACM
316 – Fall 2010. http://people.math.sfu.ca/~kevmitch/teaching/316-10.09/neville.pdf Retrieved December 4, 2015
Wikiversity. “Topic: Numerical analysis/Neville’s algorithm
examples” https://en.wikiversity.org/wiki/Topic:Numerical_analysis/Neville%27s_algorithm_examples Retrieved December 4, 2015
This blog is property of Edward Shore. 2015