Nf1 - Newton's forward difference interpolation

Nf1 - Newton's forward difference interpolation

Nf1 uses equally spaced function values to build a forward difference table, reconstruct a polynomial and estimate values between nodes. You will keep the starting point and spacing visible, recognise polynomial degree from differences, and distinguish an exact reconstruction from an approximate model.

Differences reveal a polynomial pattern

Can a short table tell you the shape of a curve? The values 1,2,5,10,171,2,5,10,17, at equally spaced inputs 0,1,2,3,40,1,2,3,4, do not increase by a constant amount. Their increases 1,3,5,71,3,5,7 do: each increase grows by 22. That second-difference pattern points to a quadratic.

You already know

A polynomial of degree nn has a non-zero coefficient of xnx^n. A table gives values at particular inputs, not automatically the rule between them. Keep the independent variable and the function value in separate columns.

Write a difference on the row where it starts. For example, the first difference on the row x=0x=0 is the value at 11 minus the value at 00.

Forward differences

For a fixed non-zero step hh,

Δf(x)=f(x+h)−f(x)\Delta f(x)=f(x+h)-f(x)

Apply the same operation again:

Δ2f(x)=Δf(x+h)−Δf(x)\Delta^2f(x)=\Delta f(x+h)-\Delta f(x)

Higher differences are obtained by repeatedly subtracting neighbouring entries in the preceding difference column.

For equally spaced values of a polynomial of degree nn, the differences of order nn are constant, and higher differences vanish. For n≥1n\ge1, that constant is non-zero. For example,

Δ(x2)=2hx+h2,Δ2(x2)=2h2\Delta(x^2)=2hx+h^2,\qquad \Delta^2(x^2)=2h^2

so differencing twice removes the changing part of a quadratic. This degree property is not separately printed in the formula booklet.

Worked example 1: a quadratic pattern

Question. Construct a difference table for 1,2,5,10,171,2,5,10,17 at inputs 0,1,2,3,40,1,2,3,4, and give the lowest possible degree of an interpolating polynomial.

Plan. Subtract each entry from the next, repeating until the changing differences disappear.

xxf(x)f(x)Δf\Delta fΔ2f\Delta^2fΔ3f\Delta^3f
0011112200
1122332200
22555522
33101077
441717
Δf(0)=2−1=1first subtractionΔ2f(0)=3−1=2difference of differencesΔ3f(0)=2−2=0constant second differences\begin{aligned} \Delta f(0)&=2-1=1 && \text{first subtraction}\\ \Delta^2f(0)&=3-1=2 && \text{difference of differences}\\ \Delta^3f(0)&=2-2=0 && \text{constant second differences} \end{aligned}

Why this step? A constant non-zero second difference identifies quadratic behaviour; it is not the first differences that must be constant.

Answer. The lowest possible polynomial degree is 22.

Check. x2+1x^2+1 gives every listed value.

Change only the polynomial profile to x3+1x^3+1, keeping the same input grid. One more difference column is needed.

Worked example 2: a cubic pattern

Question. Analyse the values 1,2,9,28,651,2,9,28,65 at inputs 0,1,2,3,40,1,2,3,4.

Plan. Continue the difference table until a non-zero constant column appears.

xxf(x)f(x)Δf\Delta fΔ2f\Delta^2fΔ3f\Delta^3fΔ4f\Delta^4f
001111666600
112277121266
229919191818
3328283737
446565
Δ2f(0)=7−1=6second differences still changeΔ3f(0)=12−6=6first third differenceΔ3f(1)=18−12=6same non-zero value\begin{aligned} \Delta^2f(0)&=7-1=6 && \text{second differences still change}\\ \Delta^3f(0)&=12-6=6 && \text{first third difference}\\ \Delta^3f(1)&=18-12=6 && \text{same non-zero value} \end{aligned}

Why this step? The second differences are not constant here; stopping one column early would misidentify the degree.

Answer. The lowest possible degree is 33.

Check. x3+1x^3+1 reproduces the five data values and has the expected cubic degree.

A spreadsheet can carry out the subtractions, but it must use the correct direction. With inputs in column A and values in B, the row-22 forward-difference formulae are:

CellFormulaMeaning
C2=B3-B2\texttt{=B3-B2}Next value minus current value
D2=C3-C2\texttt{=C3-C2}Next first difference minus current first difference
E2=D3-D2\texttt{=D3-D2}Next second difference minus current second difference

Fill down only while both required entries exist. A shorter column is expected; blank cells are not extra observations equal to zero.

Watch out

Wrong: say rounded observations are exactly quadratic because second differences are approximately equal.

Right: approximately constant differences support an approximate model. For example, changing the final value 1717 above to 17.117.1 gives second differences 2,2,2.12,2,2.1, which are close, not equal.

Use a new table with a different lower-degree contribution.

Put the spacing into the interpolation formula

For inputs 0,1,20,1,2 with values 1,2,51,2,5, the first entries of the successive difference columns are 1,1,21,1,2. Newton's formula uses those entries as coefficients of factors that vanish at earlier nodes.

The first correction contains x−x0x-x_0; the second contains both x−x0x-x_0 and x−x1x-x_1. This allows a new term to fit a new node without spoiling the nodes already fitted.

Newton's forward difference interpolating polynomial

For n+1n+1 equally spaced nodes xi=x0+ihx_i=x_0+ih, with h≠0h\ne0, set

u=x−x0hu=\frac{x-x_0}{h}

Then

Pn(x)=f(x0)+uΔf(x0)+u(u−1)2!Δ2f(x0)+u(u−1)(u−2)3!Δ3f(x0)+⋯\begin{aligned} P_n(x)&=f(x_0)+u\Delta f(x_0)\\ &\quad+\frac{u(u-1)}{2!}\Delta^2f(x_0)\\ &\quad+\frac{u(u-1)(u-2)}{3!}\Delta^3f(x_0)+\cdots \end{aligned}

Stop at order nn. The result has degree at most nn and interpolates those n+1n+1 values. It reconstructs the function exactly if that function is a polynomial of degree at most nn; otherwise it supplies an approximation.

In the formula booklet.

The booklet writes the equivalent factors using x−xix-x_i and powers of hh. The uu-form keeps the scaling together. For a quadratic, three selected nodes and the first two difference orders are enough.

Worked example 3: unit spacing

Question. Use Newton's formula to reconstruct the quadratic through (0,1),(1,2),(2,5)(0,1),(1,2),(2,5).

Plan. Use x0=0x_0=0, h=1h=1, and first entries f0=1f_0=1, Δf0=1\Delta f_0=1, Δ2f0=2\Delta^2f_0=2.

u=xstarting point 0, step 1P2(x)=1+x+x(x−1)2(2)supplied formula=x2+1expand and collect\begin{aligned} u&=x && \text{starting point }0,\ \text{step }1\\ P_2(x)&=1+x+\frac{x(x-1)}2(2) && \text{supplied formula}\\ &=x^2+1 && \text{expand and collect} \end{aligned}

Why this step? Every difference coefficient comes from the same starting row; mixing entries from different rows changes the polynomial.

Answer. P2(x)=x2+1P_2(x)=x^2+1.

Check. At x=0,1,2x=0,1,2, it gives 1,2,51,2,5.

Change only the grid spacing to h=2h=2, still sampling x2+1x^2+1 from the starting point 00.

Worked example 4: spacing two

Question. Reconstruct the quadratic through (0,1),(2,5),(4,17)(0,1),(2,5),(4,17).

Plan. Use first differences 4,124,12, second difference 88, and u=x/2u=x/2.

P2(x)=1+4u+u(u−1)2(8)new difference coefficients=1+4u2linear terms cancel=1+4(x/2)2=x2+1return to the original variable\begin{aligned} P_2(x)&=1+4u+\frac{u(u-1)}2(8) && \text{new difference coefficients}\\ &=1+4u^2 && \text{linear terms cancel}\\ &=1+4(x/2)^2=x^2+1 && \text{return to the original variable} \end{aligned}

Why this step? Increasing the step changes the differences and the scaled coordinate together. Using the new differences with u=xu=x would be inconsistent.

Answer. The same polynomial x2+1x^2+1.

Check. It passes through all three new nodes. The larger second difference 88 has not made the function more curved; the input spacing changed.

Check spacing before forming this table. Inputs 0,2,30,2,3 are not equally spaced, so the forward formula cannot use all three together. Sometimes an equally spaced subset is available; otherwise use Lagrange's method in the next lesson.

Exam tip

Write x0x_0, hh and uu first. If the independent variable is time tt, finish with a polynomial in tt, not an unexplained replacement variable.

Translate every output in the last table upwards by one, leaving the input grid fixed.

Watch out

Wrong: use u=xu=x with the spacing-two differences 4,124,12 and 88. That treats a two-unit input change as one unit. Correct: u=(x−0)/2=x/2u=(x-0)/2=x/2, so 1+4u+4u(u−1)=x2+11+4u+4u(u-1)=x^2+1.

Keep the input spacing and the difference coefficients consistent below.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account