We interpolate points by polynomial

$latex

P_{N-1}(x)=\sum_{j=0}^{N-1}{a_jx^j}

$

Its coefficients are found as a solution of system of linear equations:

$latex

\left\{ P_{N-1}(x_k) = f_k\right\},\quad k=-\frac{N-1}{2},\dots,\frac{N-1}{2}

$

Code example:

def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2)