Rational interpolation without poles: ratinterp

### 6.27.34 Rational interpolation without poles: ratinterp

The ratinterp command computes a family of pole-free rational functions which interpolate given data. Rational interpolation usually gives better results than the classic polynomial interpolation, which may oscillate highly in some cases.

- ratinterp takes up to three arguments:
  - Matrix data with 2 columns with rows corresponding to points (xk,yk), k=0,1,…,n, or the sequence of lists data_x=[x0,x1,…,xn] and data_y=[y0,y1,…,yn], where a=x0<x1<⋯<xn=b,
  - an identifier var, which may also be a number, symbolic expression or list of numbers a (optional, by default x),
  - an integer d such that 0≤ d≤ n (optional, by default min{3,⌊ n/2⌋}).
- ratinterp(data⟨,var,d⟩) or ratinterp(data_x,data_y⟨,var,d⟩) returns a rational interpolation r(a) of the given points using the method of Floater and Hormann (2006). If a is a list of numbers a1,a2,…,am, then the list [r(a1)…,r(am)] is returned. There are at most n+1 distinct interpolants which can be specified by varying the parameter d.

Examples.

- Input:
  ratinterp([1,3,5,8],[2,-1,3,4],x,1)
  Output:

  −19 x3+288 x2−1133 x+1200
  6 x2−48 x+210

- Input:
  ratinterp([1,3,5,8],[2,-1,3,4],x,2)
  Output:

  − |
  29 x3
  168
  | + |
  17 x2
  7
  | − |
  1507 x
  168
  | + |
  61
  7