Exercise: Lagrange with population data

Building the Lagrange basis functions for the 1971–2011 census and estimating the 2005 population, compared with Newton.

Basis functions and result

Example

With the census data, form L0L_0 and L4L_4 and estimate 2005.

  1. End functions (denominators 240000):

    L0(x)=(x1981)(x1991)(x2001)(x2011)240000L4(x)=(x1971)(x1981)(x1991)(x2001)240000\begin{aligned} L_0(x)&=\frac{(x-1981)(x-1991)(x-2001)(x-2011)}{240000}\\ L_4(x)&=\frac{(x-1971)(x-1981)(x-1991)(x-2001)}{240000} \end{aligned}
  2. Polynomial as a combination of the data:

    p4(x)=i=04Li(x)f(xi)p_4(x)=\sum_{i=0}^{4}L_i(x)\,f(x_i)

Matches Newton up to rounding:

p4(2005)42.316 millonesp_4(2005)\approx 42.316\ \text{millones}