Commit 6e01ef00 by Parameswaran Ajith

added the part of integration.

parent 63b394c8
Showing with 13 additions and 2 deletions
No preview for this file type
\subsection{Newton–Cotes formulas} \subsection{Newton–Cotes formulas}
\label{sec:int_newton_cotes}
We derived the following formulas for evaluating the following integral numerically: $I = \int_{x_1}^{x_2} f(x) \, dx.$ We derived the following formulas for evaluating the following integral numerically: $I = \int_{x_1}^{x_2} f(x) \, dx.$
\begin{eqnarray} \begin{eqnarray}
\mathit{Midpoint~rule:} & I = h \, f(\frac{x_1+x_2}{2}) + \mathcal{O}\,(h^3) \\ \mathit{Midpoint~rule:} & I = h \, f(\frac{x_1+x_2}{2}) + \mathcal{O}\,(h^3) \\
...@@ -15,10 +17,9 @@ where $h := x_2 - x_1 = x_1 - x_0$ is the width of one slice. Note that the erro ...@@ -15,10 +17,9 @@ where $h := x_2 - x_1 = x_1 - x_0$ is the width of one slice. Note that the erro
\begin{equation} \begin{equation}
I = \int_{-1}^{1} e^{-x^2} dx. I = \int_{-1}^{1} e^{-x^2} dx.
\end{equation} \end{equation}
You may use the following SciPy functions: \href{https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.trapezoid.html#scipy.integrate.trapezoid}{\texttt{scipy.integrate.trapezoid}} and \href{https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html#scipy.integrate.simpson}{\texttt{scipy.integrate.simpson}}. % and \href{https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.romb.html}{\texttt{scipy.integrate.romb}}. You may use the following SciPy functions: \href{https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.trapezoid.html#scipy.integrate.trapezoid}{\texttt{scipy.integrate.trapezoid}} and \href{https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.simpson.html#scipy.integrate.simpson}{\texttt{scipy.integrate.simpson}}.
\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. First, you can plot the error [which will be $\mathcal(O)(h^n)]$ against $h$ as a log-log plot and look at the slope. This will give you an idea of the order of convergence $n$. Then, you can actually compute $n$ using Eq.\eqref{eq:order_convg}. \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. First, you can plot the error [which will be $\mathcal(O)(h^n)]$ against $h$ as a log-log plot and look at the slope. This will give you an idea of the order of convergence $n$. Then, you can actually compute $n$ using Eq.\eqref{eq:order_convg}.
\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 \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} \begin{equation}
E = \int_{-\infty}^{\infty} \left[\left(\frac{dh_+}{dt}\right)^2 + \left(\frac{dh_\times}{dt}\right)^2 \right] \, dt. E = \int_{-\infty}^{\infty} \left[\left(\frac{dh_+}{dt}\right)^2 + \left(\frac{dh_\times}{dt}\right)^2 \right] \, dt.
...@@ -27,4 +28,14 @@ E = \int_{-\infty}^{\infty} \left[\left(\frac{dh_+}{dt}\right)^2 + \left(\frac{ ...@@ -27,4 +28,14 @@ E = \int_{-\infty}^{\infty} \left[\left(\frac{dh_+}{dt}\right)^2 + \left(\frac{
\end{enumerate} \end{enumerate}
\subsection{Romberg method, Adaptive quadrature, Gaussian quadrature}
\subsubsection*{Problems:}
\begin{enumerate}
\item Repeat problem 3 of Sec.\ref{sec:int_newton_cotes} using the adaptive Gaussian quadrature. You may use the function \href{https://docs.scipy.org/doc//scipy-1.13.0/reference/generated/scipy.integrate.quad.html#scipy.integrate.quad}{\texttt{scipy.integrate.quad}}.
\item Repeat problem 5 of Sec.\ref{sec:int_newton_cotes} using the Romberg's method. You may use the function \href{https://docs.scipy.org/doc//scipy-1.13.0/reference/generated/scipy.integrate.romb.html#scipy.integrate.romb}{\texttt{scipy.integrate.romb}}.
\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