[Math] Symbolic polynomial interpolation

polynomialssymbolic computation

I'm trying to create polynomials from some symbolic points to discretize derivations. This means I'm having data like
$(a, \phi(a)),\ (b, \phi(b) ) $and $(c, \phi(c))$ and want to fit a second order polynomial through these points.

I tried Matlabs polyfit but it can't handle syms. I also had a look at Maxima, but couldn't find any function there neither.

I'd be really happy if someone could point out how to do this in a CAS.

Best Answer

Mathematica can find an interpolating polynomial symbolically. For example,

InterpolatingPolynomial[{{a, w}, {b, x}, {c, y}, {d, z}}, t]

yields this answer:

$$(t-a) \left((t-b) \left(\frac{(t-c) \left(\frac{\frac{z-y}{d-c}-\frac{y-x}{c-b}}{d-b}-\frac{\frac{y-x}{c-b}-\frac{x-w}{b-a}}{c-a}\right)}{d-a}+\frac{\frac{y-x}{c-b}-\frac{x-w}{b-a}}{c-a}\right)+\frac{x-w}{b-a}\right)+w.$$