Interpolation Calculator

Calculate linear, bilinear, and Lagrange polynomial interpolation values online with interactive coordinate plots and step-by-step LaTeX formulas.

Quick Examples
Solve For
Known Point 1 (x₁, y₁)
Known Point 2 (x₂, y₂)
Interpolation
Interpolated y
140
Ratio Factor (t)
0.4
Slope (m)
10
Y-Intercept (b)
0
Line Equation
y = 10x + 0

Interactive Coordinate Plot

正在加载中...

Step-by-Step Formula Derivation
Step-by-Step Formula Derivation
y=y1+(x−x1)⋅y2−y1x2−x1y=100+(14−10)⋅200−10020−10y=140\begin{aligned} y &= y_1 + (x - x_1) \cdot \frac{y_2 - y_1}{x_2 - x_1} \\[0.6em] y &= 100 + (14 - 10) \cdot \frac{200 - 100}{20 - 10} \\[0.6em] y &= 140 \end{aligned}
0.0/ 5
0 ratings
Rate this tool
Click stars to rate

Comments

U

Why Interpolation Matters When Tables Have Gaps

Engineers, physicists, students, and data analysts constantly work with discrete reference tables—steam property tables, thermodynamic enthalpy charts, tax or engineering lookup matrices, and sampled sensor logs. In practice, the exact input value you need almost never sits neatly on a printed row. Guessing by eye introduces avoidable rounding error, while manually rearranging slope equations on scratch paper is slow and error-prone when you have dozens of points to check.

Whether you need a quick linear interpolation between two adjacent rows, an inverse lookup to find xx from a target yy, a 2D bilinear interpolation across a rectangular grid, or a smooth Lagrange polynomial passing through multiple sampled points, this online interpolation calculator computes exact values instantaneously alongside an interactive coordinate plot and step-by-step derivations.

Core Mathematical Formulas and Variable Dictionary

In numerical analysis, linear interpolation approximates an unknown function value by connecting two known data points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) with a straight line segment.

1. One-Dimensional Linear Interpolation and Inverse Solving

When x1≠x2x_1 \neq x_2 and you want to solve for yy at a given target xx, the standard slope-intercept formulation is:

y=y1+(x−x1)⋅y2−y1x2−x1y = y_1 + (x - x_1) \cdot \frac{y_2 - y_1}{x_2 - x_1}

Equivalently, in computer graphics and numerical computing, this is expressed as a weighted average (often called lerp) using the dimensionless ratio t=x−x1x2−x1t = \frac{x - x_1}{x_2 - x_1}:

y=(1−t)y1+ty2y = (1 - t) y_1 + t y_2

If you already know the target yy and need to solve backward for xx (provided y1≠y2y_1 \neq y_2), simply invert the slope ratio:

x=x1+(y−y1)⋅x2−x1y2−y1x = x_1 + (y - y_1) \cdot \frac{x_2 - x_1}{y_2 - y_1}

When 0≤t≤10 \le t \le 1, the target lies strictly between the two endpoints (interpolation). When t<0t < 0 or t>1t > 1, the same linear equation extends beyond the known interval (extrapolation).

2. Two-Dimensional Bilinear Interpolation

When a quantity depends on two independent variables (x,y)(x, y) sampled on a rectangular grid with four known corner values Q11=f(x1,y1)Q_{11} = f(x_1, y_1), Q21=f(x2,y1)Q_{21} = f(x_2, y_1), Q12=f(x1,y2)Q_{12} = f(x_1, y_2), and Q22=f(x2,y2)Q_{22} = f(x_2, y_2), bilinear interpolation performs two linear interpolations along the xx-axis followed by one linear interpolation along the yy-axis:

f(x,y1)=x2−xx2−x1Q11+x−x1x2−x1Q21f(x, y_1) = \frac{x_2 - x}{x_2 - x_1} Q_{11} + \frac{x - x_1}{x_2 - x_1} Q_{21} f(x,y2)=x2−xx2−x1Q12+x−x1x2−x1Q22f(x, y_2) = \frac{x_2 - x}{x_2 - x_1} Q_{12} + \frac{x - x_1}{x_2 - x_1} Q_{22} f(x,y)=y2−yy2−y1f(x,y1)+y−y1y2−y1f(x,y2)f(x, y) = \frac{y_2 - y}{y_2 - y_1} f(x, y_1) + \frac{y - y_1}{y_2 - y_1} f(x, y_2)

3. Multi-Point Lagrange Polynomial Interpolation

For datasets that curve noticeably across three or more points (x0,y0),(x1,y1),…,(xn,yn)(x_0, y_0), (x_1, y_1), \dots, (x_n, y_n) with distinct xjx_j coordinates, the Lagrange polynomial constructs the unique polynomial of degree at most nn passing exactly through every known point:

L(x)=∑j=0nyjℓj(x),ℓj(x)=∏0≤k≤n, k≠jx−xkxj−xkL(x) = \sum_{j=0}^{n} y_j \ell_j(x), \quad \ell_j(x) = \prod_{0 \le k \le n,\, k \neq j} \frac{x - x_k}{x_j - x_k}

Choosing the Right Interpolation Method

Selecting the right method prevents unnecessary complexity while keeping approximation error within acceptable engineering tolerances.

Interpolation MethodMinimum Known PointsBest-Fit Real-World ScenariosKey Assumptions & Limitations
Linear (1D)2 pointsSteam/gas property tables, sensor calibration, animation lerp, quick financial estimatesAssumes constant slope between points; truncation error grows if the underlying curve bends sharply
Bilinear (2D)4 grid cornersElevation grids, CFD lookup tables, image resampling, engine fuel/ignition mapsRequires orthogonal grid bounds (x1≠x2x_1 \neq x_2 and y1≠y2y_1 \neq y_2); surface is linear along grid lines
Lagrange (Multi-Point)2+ points (typically 3–6)Curved calibration data, physics lab measurements, polynomial curve verificationAll xix_i values must be distinct; high-degree polynomials (n>8n > 8) can oscillate near boundaries

Worked Engineering Walkthrough: Saturated Steam Table Lookup

Suppose you are analyzing a steam turbine and consult a standard saturated steam table that lists specific enthalpy at 100∘C100^\circ\text{C} and 150∘C150^\circ\text{C}, but your process operates at 120∘C120^\circ\text{C}.

  1. Identify the bracketing rows: x1=100x_1 = 100, y1=2676.1 kJ/kgy_1 = 2676.1\text{ kJ/kg} and x2=150x_2 = 150, y2=2772.6 kJ/kgy_2 = 2772.6\text{ kJ/kg}.
  2. Compute the dimensionless factor tt:
t=120−100150−100=2050=0.4t = \frac{120 - 100}{150 - 100} = \frac{20}{50} = 0.4
  1. Compute the interpolated enthalpy yy:
y=2676.1+0.4⋅(2772.6−2676.1)=2676.1+0.4⋅96.5=2714.7 kJ/kgy = 2676.1 + 0.4 \cdot (2772.6 - 2676.1) = 2676.1 + 0.4 \cdot 96.5 = 2714.7\text{ kJ/kg}

Because 0≤0.4≤10 \le 0.4 \le 1, the calculator tags the result as Interpolation rather than Extrapolation, plots both endpoints alongside (120,2714.7)(120, 2714.7) on the interactive coordinate grid, and outputs the full linear equation y=1.93x+2483.1y = 1.93x + 2483.1.

Frequently Asked Questions (FAQ)