Commit c7963cb2 by Parameswaran Ajith

added integration

parent 3d8ea3ae
Showing with 32 additions and 0 deletions
No preview for this file type
...@@ -77,6 +77,9 @@ ...@@ -77,6 +77,9 @@
\section{Numerical differentiation} \section{Numerical differentiation}
\input{diff.tex} \input{diff.tex}
\section{Numerical integration}
\input{integration.tex}
%\section{Lab 2} %\section{Lab 2}
%\input{rest.tex} %\input{rest.tex}
......
\subsection{Numerical integration}
We derived the following formulas for evaluating the following integral numerically: $I = \int_{x_1}^{x_2} f(x) \, dx.$
\begin{eqnarray}
\mathit{Midpoint~rule:} & I = h \, f(\frac{x_1+x_2}{2}) + \mathcal{O}\,(h^3) \\
\mathit{Trapezoidal~rule:} & I = \frac{h}{2} \,\left[ f(x_1) + f(x_2) \right] + \mathcal{O}\,(h^3) \\
\mathit{Simpson's~1/3~rule:} & I = \frac{h}{3} \,\left[ f(x_0) + f(x_2) + 4 f(x_1) \right] + \mathcal{O}\,(h^5),
\end{eqnarray}
where $h := x_2 - x_1 = x_1 - x_0$ is the width of one slice. Note that the error estimates given above are the local errors. The global error is proportional to the local error $/~h$.
\subsubsection*{Problems:}
\begin{enumerate}
\item Show that Trapezoidal rule provides an estimate of the integral with local error $ \mathcal{O}\,(h^3)$.
\item Show that Simpson's 1/3 rule provides an estimate of the integral with local error $ \mathcal{O}\,(h^5)$.
\item Compute the following integral numerically using the two explicit methods given above, as well as using Romberg's method:
\begin{equation}
I = \int_{-1}^{1} e^{-x^2} dx.
\end{equation}
You may use the following SciPy functions: \href{http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.integrate.cumtrapz.html#scipy.integrate.cumtrapz}{\texttt{scipy.integrate.cumtrapz}}, \href{http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.integrate.simps.html#scipy.integrate.simps}{\texttt{scipy.integrate.simps}} and \href{https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.romb.html}{\texttt{scipy.integrate.romb}}.
\item Repeat the calculation using three different values of $h$. Plot the error $\Delta I$ against $h$. Show that the numerical estimates converge to the exact value according to the expected order of convergence.
\item Using the Trapezoidal and Simpson's methods, compute the energy loss due to GW emission from binary black holes using the numerical-relativity data discussed in Sec.~\ref{sec:BBH_nr_data_fd}. The radiated energy can be computed from the GW polarizations as
\begin{equation}
E = \int_{-\infty}^{\infty} \left[\left(\frac{dh_+}{dt}\right)^2 + \left(\frac{dh_\times}{dt}\right)^2 \right] \, dt.
\end{equation}
\item Repeat the calculation with three different values of $h$ (sampling rate $dt$ of the data). Compute the order of convergence [see, e.g., Eq.\eqref{eq:order_convg}].
\end{enumerate}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment