Post Reply 
3 Point Neville's Method
12-10-2015, 08:57 PM
Post: #1
3 Point Neville's Method
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.


Code:
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;

Example 1;
lx = {16, 64, 100}
ly = {0.25, 0.125, 0.1}
x = 81

Result: 0.1058511078

Example 2:
lx = {-2, 0, 2}
ly = {11, 4, 11}
x = 3


Details and sources:
http://edspi31415.blogspot.com/2015/12/h...point.html
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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