Higher Order Delay Line Interpolation
Lagrange Interpolation
Maxima Code for Lagrange InterpolationSearch Physical Audio Signal Processing
Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?
The maxima program is free and open-source, like Octave:K.2
(%i1) lagrange(N, n) :=
product(if equal(k,n) then 1 else (D-k)/(n-k), k, 0, N);
D - k
(%o1) lagrange(N, n) := product(if equal(k, n) then 1 else -----, k, 0, N)
n - k
Usage example:
(%i2) lagrange(1,0);
(%o2) 1 - D
(%i3) lagrange(1,1);
(%o3) D
(%i4) lagrange(4,0);
(1 - D) (D - 4) (D - 3) (D - 2)
(%o4) - -------------------------------
24
(%i5) ratsimp(lagrange(4,0));
4 3 2
D - 10 D + 35 D - 50 D + 24
(%o5) ------------------------------
24
(%i6) expand(lagrange(4,0));
4 3 2
D 5 D 35 D 25 D
(%o6) -- - ---- + ----- - ---- + 1
24 12 24 12
(%i7) expand(lagrange(4,0)), numer;
4 3 2
(%o7) 0.041666666666667 D - 0.41666666666667 D + 1.458333333333333 D
- 2.083333333333333 D + 1.0
