% vim: set ts=2 sw=2 et tw=80:

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc} \usepackage[margin=2cm]{geometry}
\usepackage{amstext} \usepackage{amsmath} \usepackage{array}
\newcommand{\lra}{\Leftrightarrow}

\title{Howework 5 -- Introduction to Computational Science}

\author{Claudio Maggioni}

\begin{document} \maketitle
\section*{Question 1}
Given the definition of degree of exactness being the highest polynomial degree
$n$ at which a quadrature, for every polynomial of degree $n$, produces exactly
the same polynomial, these are the proofs.

\subsection*{Midpoint rule}
All polynomials of degree 1 can be expressed as:

\[p_1(x) = a_1 \cdot x + a_0\]

Therefore their integral is:

\[\int_0^1 a_1 \cdot x + a_0 dx = \frac{a_1}{2} + a_0\]

The midpoint rule for $p_1(x)$ is

\[f\left(\frac{1}{2}\right) \cdot 1 = \frac{a_1}{2} + a_0 = \int_0^1 a_1 \cdot x
+ a_0 dx\]

Therefore the midpoint rule has a degree of exactness of at least 1.

It is easy to show that the degree of exactness is not higher than 1 by
considering the degree 2
polynomial $x^2$, which has an integral in $[0, 1]$ of $\frac{1}{3}$ but a midpoint rule
quadrature of $\frac{1}{4}$.

\subsection*{Trapezoidal rule}
The proof is similar to the one for the midpoint rule, but with this quadrature
for degree 1 polynomials:

\[\frac{f(0)}{2} + \frac{f(1)}{2} = \frac{a_0 + a_1 + a_0}{2} = \frac{a_1}{2} +
a_0\]

Which is again equal to the general integral for these polynomials.

Again $x^2$ is a degree 2 polynomial with integral $\frac{1}{3}$ but a midpoint quadrature
of $\frac{0 + 1}{2} = \frac{1}{2}$, thus bounding the degree of exactness to 1.

\subsection*{Simpson rule}
The proof is again similar, but for degree 3 polynomials which can all be
written as:

\[p_3(x) = a_3 x^3 + a_2 x^2 + a_1 x + a_0\]

The integral is:

\[\int_0^1p_3(x) dx = \frac{a_3}{4} + \frac{a_2}{3} + \frac{a_1}{2} + a_0\]

The Simpson rule gives:

\[\frac{1}{6} \cdot f(0) + \frac{4}{6}\cdot  f\left(\frac{1}{2}\right) + \frac{1}{6} \cdot f(1) =
\frac{1}{6} a_0 + \frac{4}{6} \left(\frac{a_3}{8} + \frac{a_2}{4} +
\frac{a_1}{2} + a_0\right) + \]\[\frac{1}{6} \left(a_3 + a_2 + a_1 + a_0\right) =
\frac{a_3}{4} + \frac{a_2}{3} + \frac{a_1}{2} + a_0 = \int_0^1 p_3(x)dx\]

Which tells us that the degree of exactness is at least 1.

We can bound the degree of exactness to 3 with the 4th degree polynomial $x^4$
which has integral in $[0, 1]$ of $\frac{1}{5}$ but has a quadrature of
$\frac{1}{6} \cdot 0 + \frac{2}{3} \cdot \frac{1}{16} + \frac{1}{6} \cdot 1 =
\frac{5}{24}$.
\end{document}
