macro quadinterp x y xp yp #x and y are columns of three (x,y) observations #macro finds a, b, and c values that exactly fit the three points where #y = a + bx + cx^2 #xp is an input and yp is determined by quadratic interpolation #Copyright (c) Paul G. Mathews, 8 Oct 01, All rights reserved mcolumn x y mconstant a b c xp yp let c=(y(3)-y(1)-(x(1)-x(3))/(x(1)-x(2))*(y(2)-y(1))) let c=c/(x(3)*x(3)-x(1)*x(3)+x(1)*x(2)-x(2)*x(3)) let b=(y(2)-y(1)+c*(x(1)*x(1)-x(2)*x(2)))/(x(2)-x(1)) let a=y(1)-b*x(1)-c*x(1)*x(1) print a b c let yp=a+b*xp+c*xp*xp print xp yp endmacro