Learn linear interpolation from scratch
1. What is interpolation for?
Imagine a table with a measurement at 10 °C and 20 °C, but you need an estimate at 14 °C. You did not actually measure 14 °C. Linear interpolation estimates the missing value by assuming a straight-line change between nearby observations.
2. Learn to read two reference points
Each (X,Y) pair contains related numbers. If X is temperature and Y is a measurement, (10,200) means the measurement is 200 at 10 °C. Find the row below and above your target X. Here they are (10,200) and (20,260). Other rows are not used for this one segment.
3. How far along the segment are you?
Calculate the fraction of the X interval reached by the target. From 10 to 20, a target of 14 is 4 units along a 10-unit interval: 40% of the way.
4. Apply the same fraction to the Y change
Y changes by 60 between the known points. Because you travelled 40% of the X interval, add 40% of 60 to the starting Y of 200. This gives 224.
5. What if you have many points?
With three, five or more rows, the calculator sorts the points by X. To estimate Y at X=25, it uses the two points surrounding 25, for example X=20 and X=30. This creates a piecewise-linear function: each segment can have a different slope, so the line may change direction.
6. Reverse mode: given Y, find X
You can also start from a known Y. The calculator checks every segment for matching X values. A line that rises and then falls can have two answers. If a flat segment is at the requested Y, every X in that interval is a solution.
7. Interpolation versus extrapolation
Interpolation estimates between known observations. Extrapolation extends a straight line beyond them. The calculator extrapolates Y outside the X range using the nearest end segment. In reverse mode it avoids extrapolating multi-point tables, where the answer can be ambiguous.
8. When is this method not a good fit?
If data are noisy, have abrupt jumps or clearly follow a curved pattern, straight segments may not represent the underlying process. Interpolation is not regression: interpolation passes through the input points, while regression fits an approximate trend to variable observations.
Use 2 to 25 points, with no duplicate X coordinates. Points are sorted by X and joined by a straight segment between each pair of neighbours. This does not measure uncertainty or perform regression. It may be unsuitable for jumps, discontinuities or noisy experimental data. Calculations use floating-point arithmetic; rounding is applied for display only.
The formula follows from the straight line through two points, applied independently on each interval. NumPy and SciPy document piecewise-linear interpolation as distinct from smooth interpolating curves and statistical regression.
NumPy — 1-D linear interpolation · SciPy — Interpolation tutorial