Wolfram Research

Function Repository Resource:

GeneralRationalInterpolation

Source Notebook

Find a rational interpolation of a function defined parametrically

Contributed by: Wolfram Research

ResourceFunction["GeneralRationalInterpolation"][{fx,fy},{t,m,n},x,{t1,,tm+n+1}]]

gives the rational polynomial function of x, with numerator order m and denominator order n, that interpolates the curve with x and y coordinates fx and fy generated as a function of t, at the interpolation points t1,t2, ….

ResourceFunction["GeneralRationalInterpolation"][{fx,fy},{t,m,n},x,{t,t0,t1}]

gives the rational interpolant with the interpolation points chosen automatically from the interval t0 to t1.

Details and Options

ResourceFunction["GeneralRationalInterpolation"] takes the same options as ResourceFunction[“RationalInterpolation”].

Examples

Basic Examples

An approximation to the function whose graph is the upper half-circle:

In[1]:=
ResourceFunction[
 "GeneralRationalInterpolation"][{Cos[t], Sin[t]}, {t, 2, 4}, x, Table[(i \[Pi])/6, {i, 0, 6}]]
Out[1]=

The error is quite large near the endpoints:

In[2]:=
Plot[% - Sqrt[1 - x^2], {x, -1, 1}, PlotRange -> All]
Out[2]=

When automatically chosen, the interpolation points result in a smaller maximum error:

In[3]:=
ResourceFunction[
 "GeneralRationalInterpolation"][{Cos[t], Sin[t]}, {t, 2, 4}, x, {t, 0, \[Pi]}]
Out[3]=
In[4]:=
Plot[% - Sqrt[1 - x^2], {x, -1, 1}]
Out[4]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

See Also

License Information