## Stirling Interpolation

Back to Programming

### Description

This formula is used for (2n + 1) odd equispaced arguments and the value is to be tabulated near the middle point of those arguments. This interpolation is obtained by considering the arithmetic mean of Gauss’s forward and backward interpolation for odd (2n+1) arguments.

DERIVATION

The formula of Stirling’s interpolation is:

GRAPHICAL REPRESENTATION

### Algorithm

INPUT:

The values of x and f(x)

OUTPUT:

The f(x) after calculating the value of specified x

PROCESS:

``````Step 1: [Taking the values of x and f(x)]
Read n [number of given terms]
for i = 0 to n - 1 repeat
[End of for loop]
Read x1 [value for which f(x) is to be calculated]

Step 2: [Stirling interpolation]
Set h ← x - x
Set s ← n / 2
Set a ← x[s]
Set u ← (x1 - a) / h
for i = 0 to  n – 2 repeat
Set del[i] ←  y[i + 1] - y[i]
[End of ‘for’ loop]
for i = 1 to n – 2 repeat
for j = 0 to n - i –2 repeat
Set del[j][i] ← del[j + 1][i - 1] - del[j][i - 1]
[End of ‘for’ loop]
[End of ‘for’ loop]
Set y1 ← y[s]
for i = 1 to n – 1 repeat
if i mod 2 ≠ 0) then
if k ≠ 2 then
Set t1 ← t1×(u^k-(k - 1)^2)
else
Set t1 ← t1 × (u^2 - (k - 1)^2)
[End of ‘if’]
Set k ← k + 1
Set d ← d × i
Set s ← (n - i) / 2
Set y1 ← y1 + ((t1 / (2 × d)) × (del[s][i - 1] + del[s - 1][i - 1]))
else
Set t2 ← t2 × (u^2- (l - 1)^2)
Set l ← l + 1
Set d ← d × i
Set s ← (n - i) / 2
Set y1 ← y1 + ((t2 / (d)) × (del[s][i - 1]))
[End of ‘if’]
[End of ‘for’ loop]
Print y1
[End of stirling interpolation]
``````

### Code

1. This formula decreases more rapidly than other formulas.

2. It gives better accuracy than the other formulas

3. This formula uses the function values of both sides of the function f(x)