# Quadratic interpolator help

## Troubleshooting

The interpolator is implemented in JavaScript running in your browser and so it will not work unless you have JavaScript enabled, as most people do.

The x input values must be unique and the y values must be unique; the same number cannot appear twice in the x column or twice in the y column.

Exactly one box must be empty before clicking the Calculate button.

## Interpolation derivation

The quadratic polynomial P(x) fitting three points (x_{0}, y_{0}),
(x_{1}, y_{1}), and (x_{2}, y_{2}) is given by

This is the "Lagrange form" of the interpolator. It's easy to verify
that P(x_{i}) = y_{i}.
If four x values and three y values are given, the equation above is used
to predict the missing y value.

## Inverse interpolation

If four y values and three x values are given, the interpolator reverses
the role of x and y in the formula above. That is, it treats the y's as
inputs and the x's as output. It fits a quadratic polynomial P(y) so
that P(y_{i}) = x_{i} and uses that polynomial to predict the missing x
value.

Note what inverse interpolation does **not** do. When
solving for a missing x, it does **not** fit a quadratic
polynomial P(x) and then solve for x. Such a
process would likely be unstable. If you do want to solve for an x value
this way, you are doing root-finding, not interpolation. In that case, you
can use the formula above in combination with the quadratic formula.

This means that code in this page does not necessarily perform "round trips." That is if you solve for a missing y value, then erase the corresponding x and solve for it, you might not get back the x you started with.

Back to the quadratic interpolator.