In the movie version of the book “Charlotte’s Web” there is a song “Zuckermans Famous Pig” which features the lyrics

Fine swine wish he was mine

What if he’s not so big

Seeing this cartoon while in graduate school^{(1) }and while taking a numerical methods course led to the parody song*Fine Spline, coefficients are primeWhat if it grows too big?*

## Interpolation: When to use it

There are three general categories when interpolation is used

**Sampled real-world data does not cover the full range (regression case)**

If the interpolation covers points inside of the data set this is generally a “safe” scenario e.g., the interpolated data will be smooth within the range. If the interpolation goes outside of the data set then the values predicted by the interpolation should be checked against real-world expectations. In general, 10~15% beyond the sampled range (for smooth data) is reasonable to interpolate.**To reduce calculation cost (speed or memory)**

Some calculations are memory or FLOPs intensive; interpolations (especially polynomial interpolation) can show a significant reduction in the total number of operations.^{(2)}**Handle discontinuities (piecewise interpolation)**

For equations with discontinuities, an interpolation can be used to provide a non-infinite transition between the operating realms.

## Interpolation: When not to use it

The “when not to use” is the mirror image of the “when to use.”

**Mister toad’s wild ride:**^{(3)}(Sampled and Discontinuities):

In some instances, the curvature of the equations is so severe that interpolations cannot accurately capture the data**Flip**^{(4)}side: The real thing is cheaper:

Depending on the equation, and your target processor, the real calculation may be less intensive. In general when I hit a polynomial of order 6 or greater I start to question the value; (Taylor series after 3 terms).**Integer data: Gear 1.3**

The class interpolation failure is when integer data is interpolated to floating-point values. My first exposure to this was when I interpolated a non-CVT vehicle into the 1.3^{rd}gear.^{(5)}

Follow these tips and you will know if you can “Pig out or Pig In” with your interpolation.

## Footnotes

- Back at this time, campus television had a limited number of channels. I would estimate that about 50% of my classmates, like me, had it on in the background the day before.
- When performing polynomial interpolation save your powers, e.g.

x2 = x*x;

x3 = x2 * x;

x4 = x2 * x2; - Continuing with the children’s story theme
- I hope these puns don’t get you off on the wrong foot with my Flip-FLOPS.
- Interestingly enough it was seeing that (a good decade before CVT’s were common) that I understood the impact that a CVT could have on fuel economy. If you are interested in fuel economy take a look at this series I’m writing.