double ratint(double* xa, double* ya, int n, double x, double* dy);
For a function f whose values at the points [xa, xa + n) are [ya, ya + n), this routine approximates f with a rational funtion and returns the interpolated value at the point x. On return, dy contains an error estimate.
Parameters:
xa | X values of the function. |
---|---|
ya | Y values of the function. |
n | Number of values. |
x | Value to interpolate function at. |
dy | Error estimate. |
Returns:
R(x), where R a rational function defined on the points (xa, ya), (xa + 1, ya + 1), ... (xa + n - 1, ya + n - 1).
Usage:
double x[] = {1, 2, 3, 4}
double y[] = {-1, 1, 2, -2}
double dy;
double yy = ratint(x, y, 4, 2.5, &dy);
Header:
#include "interpol.h"