Commit 86bad589 by Parameswaran Ajith

added ODE problems.

parent 6e01ef00
Showing with 37 additions and 37 deletions
No preview for this file type
......@@ -79,10 +79,10 @@
\section{Numerical integration}
\label{sec:integr}
\input{integration.tex}
%
% \section{Ordinary differential equations: Initial value problems}
% \input{ode.tex}
%
\section{Ordinary differential equations: Initial value problems}
\input{ode.tex}
% \section{Root finding}
% \input{root.tex}
%
......
......@@ -59,36 +59,36 @@ For the problems in this section, you may use Scipy's high-level interface to va
\item Compute the lapse function $e^{2\Phi(r)}$ by solving Eq.(\ref{eq:tov3}) starting from $r = r_\star$ to $r = 0$. On top of that, plot the lapse function for a Schwarzschild black hole (see Eq.\ref{eq:lapse_schwarz}) from $r = r_s$ to $r = 2 r_\star$, where $r_s \equiv 2 G m_\star/c^2$ is the Schwarzschild radius of the star. This exterior solution should match the interior solution at $r = r_\star$.
\end{enumerate}
\subsection{Non-linear ordinary differential equations showing chaotic behavior: Lorenz equations}
The Lorenz equations were originally developed as a simplified mathematical model for atmospheric convection by Edward Lorenz. This was the first set of equations where deterministic chaos was observed. These coupled ordinary differential equations are
\begin{eqnarray}
\frac{dx(t)}{dt} & = & \sigma [y(t)-x(t)], \nonumber \\
\frac{dy(t)}{dt} & = & x(t) [\rho - z(t)] - y(t), \nonumber \\
\frac{dz(t)}{dt} & = & x(t)y(t) - \beta z(t),
\end{eqnarray}
where $\rho, \sigma$ and $\beta$ are parameters of the system.
\subsubsection{Problems:}
\begin{enumerate}
\item Solve the Lorenz system for $\rho = 28, \sigma = 10$ and $\beta = 8/3$ with the following initial conditions $x(t = 0) = y(t = 0) = z(t=0) = 1$. Plot $x(t)$, $y(t)$ and $z(t)$ for $t = 0 ... 100$. Is the solution deterministic or stochastic?
\item Repeat the calculation with same parameters except for a tiny change in the initial condition for $x$: i.e., $x(t = 0) = 1 + 10^{-9}$. Plot $x(t = 0) = y(t = 0) = z(t=0) = 1$ on top of the earlier estimate. Explain the result.
\item Make a 3D plot of $x, y, z$. You should see the famous butterfly shaped structure now!
\item Optional exercise: Make an animation of the above~\footnote{You can either use the matplotlib \href{http://matplotlib.org/api/animation_api.html}{animation} package or convert a number of PNG files to a gif animation using \href{http://www.imagemagick.org/Usage/anim_basics/}{ImageMagick}.}.
\end{enumerate}
\subsection{Stochastic ordinary differential equations: Langevin equation}
The random motion of a particle in a fluid due to collisions with the molecules of the fluid, called the Brownian motion, is described by the Langevin equation:
\begin{equation}
m \frac{d^2 \bx}{dt^2} = - \lambda \frac{d \bx}{dt} + \boldeta(t),
\end{equation}
where $m$ is the mass of the particle, $\bx$ its position vector, $\lambda$ a damping coefficient, and $\boldeta(t)$ (called the \emph{noise term}) describes the stochastic forces (e.g., random collissions of molecules) affecting the particle.
\subsubsection{Problems:}
\begin{enumerate}
\item Using the Euler-Maruyama method, compute the $1-d$ Brownian motion trajectories generated by the Langevin equation
${d x}/{dt} = \eta(t)$,
where $\eta(t)$ is Gaussian noise with zero mean and unit variance. Plot $x(t)$ for $ t \in [0, 100]$ assuming $x(t=0) = 0$. Is the solution deterministic or stochastic?
\item Generalize the code so that it can deal with arbitrary number of particles. Plot $x(t)$ for 1000 particles on a single plot. Compute the average displacement $\bar{x}(t)$ of the particles (from $x(t=0)$) as a function of $t$ and plot it against $t$. What is the relation between $\bar{x}(t)$ and $t$?
\item Using the \href{http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.hist}{\texttt{hist}} function, plot the probability distribution $P(x)$ of $x(t)$ at $t = 10, 50, 100$.
\end{enumerate}
% \subsection{Non-linear ordinary differential equations showing chaotic behavior: Lorenz equations}
% The Lorenz equations were originally developed as a simplified mathematical model for atmospheric convection by Edward Lorenz. This was the first set of equations where deterministic chaos was observed. These coupled ordinary differential equations are
% \begin{eqnarray}
% \frac{dx(t)}{dt} & = & \sigma [y(t)-x(t)], \nonumber \\
% \frac{dy(t)}{dt} & = & x(t) [\rho - z(t)] - y(t), \nonumber \\
% \frac{dz(t)}{dt} & = & x(t)y(t) - \beta z(t),
% \end{eqnarray}
% where $\rho, \sigma$ and $\beta$ are parameters of the system.
% \subsubsection{Problems:}
% \begin{enumerate}
% \item Solve the Lorenz system for $\rho = 28, \sigma = 10$ and $\beta = 8/3$ with the following initial conditions $x(t = 0) = y(t = 0) = z(t=0) = 1$. Plot $x(t)$, $y(t)$ and $z(t)$ for $t = 0 ... 100$. Is the solution deterministic or stochastic?
% \item Repeat the calculation with same parameters except for a tiny change in the initial condition for $x$: i.e., $x(t = 0) = 1 + 10^{-9}$. Plot $x(t = 0) = y(t = 0) = z(t=0) = 1$ on top of the earlier estimate. Explain the result.
% \item Make a 3D plot of $x, y, z$. You should see the famous butterfly shaped structure now!
% \item Optional exercise: Make an animation of the above~\footnote{You can either use the matplotlib \href{http://matplotlib.org/api/animation_api.html}{animation} package or convert a number of PNG files to a gif animation using \href{http://www.imagemagick.org/Usage/anim_basics/}{ImageMagick}.}.
% \end{enumerate}
%
% \subsection{Stochastic ordinary differential equations: Langevin equation}
%
% The random motion of a particle in a fluid due to collisions with the molecules of the fluid, called the Brownian motion, is described by the Langevin equation:
% \begin{equation}
% m \frac{d^2 \bx}{dt^2} = - \lambda \frac{d \bx}{dt} + \boldeta(t),
% \end{equation}
% where $m$ is the mass of the particle, $\bx$ its position vector, $\lambda$ a damping coefficient, and $\boldeta(t)$ (called the \emph{noise term}) describes the stochastic forces (e.g., random collissions of molecules) affecting the particle.
%
% \subsubsection{Problems:}
% \begin{enumerate}
% \item Using the Euler-Maruyama method, compute the $1-d$ Brownian motion trajectories generated by the Langevin equation
% ${d x}/{dt} = \eta(t)$,
% where $\eta(t)$ is Gaussian noise with zero mean and unit variance. Plot $x(t)$ for $ t \in [0, 100]$ assuming $x(t=0) = 0$. Is the solution deterministic or stochastic?
% \item Generalize the code so that it can deal with arbitrary number of particles. Plot $x(t)$ for 1000 particles on a single plot. Compute the average displacement $\bar{x}(t)$ of the particles (from $x(t=0)$) as a function of $t$ and plot it against $t$. What is the relation between $\bar{x}(t)$ and $t$?
% \item Using the \href{http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.hist}{\texttt{hist}} function, plot the probability distribution $P(x)$ of $x(t)$ at $t = 10, 50, 100$.
% \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