# How to make a formula that will interpolate a curved line graph?

In this curved line graph, I need to be able to make a formula that can tell me the interpolated value at any point on the curved path given one Data input.

So for example if I wanted to know what value the line was at exactly half way between Point 2 and Point 3, I can eyeball it and tell it would be somewhere around 3.0 for a value, and to get it more exact I could use a ruler and some math. But that is the long way of finding 1 point on the curve at a time. Is there a generic formula that can take any arbitrary curved path with a set of points (a curved path that has no real pattern except that it's a collection of splines with known points to interpolate between) and turn it into a mathematical formula that you could input a Data 1 and it spits out the Data 2 value of the curve where the Data points meet, or vice versa?

For example,
Input Data 1 to math formula = Point 2.5
Data 2 = [Computed by math formula] 3.0

or

Input Data 2 to math formula = 3.0
Data 1 = [Computed by math formula] Point 2.5

Just need the method to develop the math formula!

-

If you just have four data points (or some smallish number, anyway), then the easiest approach is probably something called "Lagrange interpolation".

The wikipedia page has a bunch of formulas that might be hard to understand, but the examples should be pretty clear:

For four given data points, you will get a cubic (degree three) equation of the form $y = ax^3 + bx^2 + cx + d$, which you can then use to get intermediate values anywhere.

-