\documentclass[12pt]{article}
\usepackage{fullpage,amsmath,amsfonts}

\newcommand{\x}{\boldsymbol{x}}
\renewcommand{\v}{\boldsymbol{v}}
\newcommand{\w}{\boldsymbol{w}}
\renewcommand{\a}{\boldsymbol{a}}
\renewcommand{\b}{\boldsymbol{b}}
\renewcommand{\c}{\boldsymbol{c}}
\newcommand{\e}{\mathrm{e}}
\renewcommand{\d}{\mathrm{d}}
\renewcommand{\i}{\mathrm{i}}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\newcommand{\Range}{\operatorname{Range}}
\newcommand{\Ker}{\operatorname{Ker}}
\newcommand{\Span}{\operatorname{Span}}
\renewcommand{\dim}{\operatorname{dim}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}


\begin{document}

\title{Numerical Methods I}
\author{Lab Session 7}
\date{November 6, 2003}
\maketitle

\begin{enumerate}

\item Write an \textsf{Octave} function to integrate a function $f$ on
the interval $[a,b]$ by using the composite trapezoidal rule with $N$
equispaced partitions.

Recall that on partition $i$, the trapezoidal rule reads
\[
   \int_{x_{i-1}}^{x_i} f(x) \, \d x
   \approx
   h \, \frac{f(x_{i-1}) + f(x_i)}2 \,,
\]
where $h=(b-a)/N$.

\item Test, by generating a doubly logarithmic error plot, whether the
trapezoidal rule is really of order $2$ for each of the functions
\begin{gather*}
  f(x) = \e^x \,, \\
  g(x) = \sin 2 \pi x \,, \\
  h(x) = x^{1/3} 
\end{gather*}
on the interval $[0,1]$.

\end{enumerate}
\end{document}
