BL2.ru

Interpolation - Newton polynomial (online calculator)

Newton interpolation polynomial for equally spaced nodes: enter x₀ and x₁ (step h is computed) and function values. The forward or backward formula is chosen automatically; the polynomial and graph are shown.

Calculate

What it is

The Newton interpolation polynomial service helps you interpolate or extrapolate the value of a function at an arbitrary point using a table of known values, automatically choosing the forward or backward Newton interpolation formula.

If the interpolation nodes are equally spaced and ordered by value, so that xi+1 − xi = h = const, i.e. xi = x0 + i·h, i = 0, 1, …, n, the interpolation polynomial can be written in Newton form. Exactly one polynomial of degree at most n passes through n + 1 points — the same one the Lagrange polynomial gives, but Newton's form is more convenient for tables with a constant step.

Finite differences

The formulas use finite differences: Δyi = yi+1 − yi (first), Δ2yi = Δyi+1 − Δyi (second), and so on. For y = x3 at the nodes 1, 2, 3, 4:

xyΔyΔ2yΔ3y
117126
281918
32737
464

The third differences are constant — the sign of a cubic polynomial.

Newton formulas

First (forward) Newton interpolation formula, q = (x − x0) / h:

Pn(x) = y0 + qΔy0 + q(q−1)/2!·Δ2y0 + … + q(q−1)…(q−n+1)/n!·Δny0

Second (backward) Newton interpolation formula, q = (x − xn) / h:

Pn(x) = yn + qΔyn−1 + q(q+1)/2!·Δ2yn−2 + … + q(q+1)…(q+n−1)/n!·Δny0

Newton interpolation polynomials are convenient when the interpolation point is near the beginning (forward Newton formula) or the end (backward Newton formula) of the table: the first, most significant terms then come from the nearest nodes and the rounding error is smaller.

Example

  • Forward formula, x = 1.5: h = 1, q = (1.5 − 1)/1 = 0.5. P = 1 + 0.5·7 + 0.5·(−0.5)/2·12 + 0.5·(−0.5)·(−1.5)/6·6 = 1 + 3.5 − 1.5 + 0.375 = 3.375 = 1.53.
  • Backward formula, x = 3.5: q = (3.5 − 4)/1 = −0.5. P = 64 + (−0.5)·37 + (−0.5)·0.5/2·18 + (−0.5)·0.5·1.5/6·6 = 64 − 18.5 − 2.25 − 0.375 = 42.875 = 3.53.

Since the function is a cubic and there are four nodes, the result is exact.

Good to know

  • The step h must be constant and non-zero; for an uneven grid use the Lagrange polynomial or divided differences.
  • Adding a new node does not require recomputing the whole polynomial — one more term is appended. This is the main practical advantage of Newton's form.
  • With many nodes a high-degree polynomial can oscillate strongly between them (Runge's phenomenon); in practice 3–6 nearest nodes are used.
  • Outside the table (extrapolation) accuracy drops quickly.
  • You can also use the services Linear interpolation and extrapolation, Bilinear interpolation and Lagrange polynomial.

Where it is used

  • Function tables and handbooks — values between rows of tables with a constant step (logarithms, trigonometry, material properties by temperature).
  • Numerical methods — numerical differentiation and integration (Simpson's and Adams formulas) are built on Newton's formulas.
  • Measurement processing — instrument readings taken at equal time intervals: the value at an intermediate moment.
  • Astronomy and navigation — interpolating ephemerides (positions of planets and satellites) tabulated at equal intervals.
  • Economics — filling gaps in time series with a constant step (months, quarters).
  • Studying — checking numerical-methods homework.

How to use

  • Enter x0 and x1 — they define the step h; the remaining nodes x2, x3, … are filled automatically.
  • Enter f(xi) at each node. The "+" and "−" buttons add and remove points.
  • Put the point you need into xN and press "Calculate" (or enable auto-calculation with the box in the button).
  • The calculator shows h, q, the result f(xN) and which formula — forward or backward — was used.

FAQ

When is Newton’s formula used?
For nodes with a constant step h. For arbitrary nodes use the Lagrange polynomial.
Forward vs backward formula?
The forward formula works from x₀ (start of the table), the backward one from the last node. The calculator picks the one closer to xN.
What is q?
q = (xN − x₀)/h — the position of the point in table steps.
Is the result the same as Lagrange?
Yes, the interpolating polynomial through given nodes is unique; only the form differs.