Week 9 Self check questions and solutions
Week 9 Self check questions and solutions#
Question 1:
Let \(f\) be a function defined on the interval \([a,b]\). Let \(x_k\in [a,b]\), \(k=0,\dots,n\) with \(x_i \neq x_j\) for all \(i\neq j\). Write down the Lagrange interpolation polynomial \(p\) of degree \(n\) that interpolates \(f\) in the points \(x_k\).
Solution
We define
Then
Question 2:
State the general form of Newton-Cotes quadrature rules.
Solution
For a general Newton-Cotes formula consider the interpolation points \(x_j=a+jh\), \(j=0,\dots,n\) with \(h=(b-a)/n\). Let \(p_n\) be the corresponding Lagrange polynomial
for interpolating \(f\) at these points. Then the Newton-Cotes formula takes the form
Question 3:
Explain the Runge phenomenon and state how it can be prevented.
Solution
Let \(p_n(x)\) be the Lagrange interpolation polynomial of a continuous function \(f\) in the interval \([-1,1]\). The Runge phenomenon states that as \(n\rightarrow\infty\) the error \(\max_{x\in[-1,1]}|f(x)-p_n(x)|\) may diverge to infinity for certain functions. The problem can be solved by using Chebychev points in \([-1,1]\) instead of equispaced points.
Question 4:
Explain why Newton-Cotes rules of increasing order will in general not converge to the exact integral of a function.
Solution
Since Newton-Cotes quadrature is based on interpolation in equispaced points the Runge phenomenon applies as well, preventing convergence as the order is increased.
Question 5:
A quadrature formula on the interval \([-1,1]\) uses the quadrature points\ \(x_0=-\alpha\), \(x_1=\alpha\), where \(0<\alpha\leq 1\).
The formula is required to be exact whenever \(f\) is a polynomial of degree \(1\). Show that \(w_0=w_1=1\), independent of the value of \(\alpha\). Show also that there is one particular value of \(\alpha\), such that the formula is exact also for all polynomials of degree \(2\). Find this \(\alpha\), and show that, for this value, the formula is also exact for all polynomials of degree \(3\).
Solution:
In order to integrate constant functions exactly we require
To integrate the linear function \(x\) exactly we require
Hence, \(w_0=w_1\) and since \(w_0+w_1=2\) we have \(w_0=w_1=1\) independently of \(\alpha\). For quadratic functions we need
and therefore \(\alpha=\frac{1}{\sqrt{3}}\). For \(x^3\) we have
Hence, also cubic functions are integrated exactly by this quadrature rule.
Question 6: Consider the integral \(I(f):=\int_a^bf(x)dx\). Assume that we want to approximate \(I(f)\) by a Newton-Cotes quadrature rule of the form \(I_2(f):=\omega_0f(a)+\omega_1f((a+b)/2)+\omega_2f(b)\). Derive the corresponding weights \(\omega_0\), \(\omega_1\), and \(\omega_2\).
Solution:
Let \(x_0 = a\), \(x_1 = \frac{a+b}{2}\), \(x_2 = b\). We have
We now use the symmetry of Newton-Cotes rules to derive that \(\omega_2 = \omega_0 = \frac{b-a}{6}\). Since the sum of all weights must be \((b-a)\) we obtain \(\omega_1 = \frac{4(b-a)}{6}\).