\documentclass[../schrodinger_simulation.tex]{subfiles} \begin{document} \appendix \section{The Crank-Nicholson method}\label{ap:crank_nicolson} The Crank-Nicolson (CN) approach consider both the forward difference, an explicit scheme, \begin{equation*} \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} = F_{\ivec, \jvec}^{n} \ , \end{equation*} and the backward difference, an implicit scheme, \begin{equation*} \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} = F_{\ivec, \jvec}^{n+1} \ . \end{equation*} The result is a linear combination of the explicit and implicit scheme, given by \begin{align*} \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} &= \theta F_{\ivec, \jvec}^{n+1} + (1 - \theta) F_{\ivec, \jvec}^{n} \ . \end{align*} The parameter $\theta$ is introduced for a general approach, however, for CN $\theta = 1/2$. \begin{align*} \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} &= \frac{1}{2} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \\ \end{align*} We need the first derivative in respect to both time and position, as well as the second derivative in respect to position. Taylor expanding will result in a discretized version. The Schrödinger equation contains $i$ on the left hand side, we rewrite it as \begin{align*} \frac{u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n}}{\Delta t} &= \frac{1}{2i} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \\ &= -\frac{i}{2} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \ , \end{align*} where $1/i = -i$. Using Equation \eqref{eq:schrodinger_dimensionless}, which is found in Section \ref{ssec:schrodinger}, we get \begin{align*} u_{\ivec, \jvec}^{n+1} - u_{\ivec, \jvec}^{n} & -\frac{i \Delta t}{2} \bigg[ F_{\ivec, \jvec}^{n+1} + F_{\ivec, \jvec}^{n} \bigg] \\ &= -\frac{i \Delta t}{2} \bigg[ - \frac{u_{\ivec+1, \jvec}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec-1, \jvec}^{n+1}}{2 \Delta x^{2}} \\ & \quad - \frac{u_{\ivec, \jvec+1}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec, \jvec-1}^{n+1}}{2 \Delta y^{2}} + \frac{1}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n+1} \\ & \quad - \frac{u_{\ivec+1, \jvec}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec-1, \jvec}^{n}}{2 \Delta x^{2}} \\ & \quad - \frac{u_{\ivec, \jvec+1}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec, \jvec-1}^{n}}{2 \Delta y^{2}} + \frac{1}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n} \bigg] \end{align*} We rewrite the expression and gather all terms containing the $n+1$ time step on the left hand side, and the terms containing $n$ time step on the right hand side. \begin{align*} & u_{\ivec, \jvec}^{n+1} - \frac{i \Delta t}{2 \Delta x^{2}} \big[ u_{\ivec+1, \jvec}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec-1, \jvec}^{n+1} \big] \\ & - \frac{i \Delta t}{2 \Delta y^{2}} \big[ u_{\ivec, \jvec+1}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec, \jvec-1}^{n+1} \big] + \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n+1} \\ &= u_{\ivec, \jvec}^{n} + \frac{i \Delta t}{2 \Delta x^{2}} \big[ u_{\ivec+1, \jvec}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec-1, \jvec}^{n} \big] \\ & \quad + \frac{i \Delta t}{2 \Delta y^{2}} \big[ u_{\ivec, \jvec+1}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec, \jvec-1}^{n} \big] - \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n} \end{align*} Since we use an equal step size $h$ in both $x$ and $y$ direction, we can use \begin{align*} \frac{i \Delta t}{2 \Delta h^{2}} = \frac{i \Delta t}{2 \Delta x^{2}} = \frac{i \Delta t}{2 \Delta y^{2}} \ , \end{align*} and define \begin{align*} r \equiv \frac{i \Delta t}{2 \Delta h^{2}} \end{align*} Now, the discretized Schrödinger equation can be rewritten as \begin{align*} & u_{\ivec, \jvec}^{n+1} - r \big[ u_{\ivec+1, \jvec}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec-1, \jvec}^{n+1} \big] \\ & - r \big[ u_{\ivec, \jvec+1}^{n+1} - 2u_{\ivec, \jvec}^{n+1} + u_{\ivec, \jvec-1}^{n+1} \big] + \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n+1} \\ &= u_{\ivec, \jvec}^{n} + r \big[ u_{\ivec+1, \jvec}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec-1, \jvec}^{n} \big] \\ & \quad + r \big[ u_{\ivec, \jvec+1}^{n} - 2u_{\ivec, \jvec}^{n} + u_{\ivec, \jvec-1}^{n} \big] - \frac{i \Delta t}{2} v_{\ivec, \jvec} u_{\ivec, \jvec}^{n} \ . \end{align*} \section{Matrix structure}\label{ap:matrix_structure} For a $u$ vector of length $(M-2) = 3$, the matrices $A$ and $B$ have size $(M-2)^{2} \times (M-2)^{2} = 9 \times 9$ given by \begin{align*} A = \begin{bmatrix} a_{0} & -r & 0 & -r & 0 & 0 & 0 & 0 & 0 \\ -r & a_{1} & -r & 0 & -r & 0 & 0 & 0 & 0 \\ 0 & -r & a_{2} & 0 & 0 & -r & 0 & 0 & 0 \\ -r & 0 & 0 & a_{3} & -r & 0 & -r & 0 & 0 \\ 0 & -r & 0 & -r & a_{4} & -r & 0 & -r & 0 \\ 0 & 0 & -r & 0 & -r & a_{5} & 0 & 0 & -r \\ 0 & 0 & 0 & -r & 0 & 0 & a_{6} & -r & 0 \\ 0 & 0 & 0 & 0 & -r & 0 & -r & a_{7} & -r \\ 0 & 0 & 0 & 0 & 0 & -r & 0 & -r & a_{8} \\ \end{bmatrix} \end{align*} \begin{align*} B = \begin{bmatrix} b_{0} & r & 0 & r & 0 & 0 & 0 & 0 & 0 \\ r & b_{1} & r & 0 & r & 0 & 0 & 0 & 0 \\ 0 & r & b_{2} & 0 & 0 & r & 0 & 0 & 0 \\ r & 0 & 0 & b_{3} & r & 0 & r & 0 & 0 \\ 0 & r & 0 & r & b_{4} & r & 0 & r & 0 \\ 0 & 0 & r & 0 & r & b_{5} & 0 & 0 & r \\ 0 & 0 & 0 & r & 0 & 0 & b_{6} & r & 0 \\ 0 & 0 & 0 & 0 & r & 0 & r & b_{7} & r \\ 0 & 0 & 0 & 0 & 0 & r & 0 & r & b_{8} \\ \end{bmatrix} \end{align*} \section{Figures}\label{ap:figures} We created colormap plots of the real and imaginary part of $u_{\ivec, \jvec}$, in Figure \ref{fig:colormap_real_imag}. \begin{figure*} \centering \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{images/color_map_0_real.pdf} \caption{Re$(u_{\ivec, \jvec})$ at time $t=0$.} \label{fig:colormap_0_real} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{images/color_map_1_real.pdf} \caption{Re$(u_{\ivec, \jvec})$ at time $t=0.001$.} \label{fig:colormap_1_real} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{images/color_map_2_real.pdf} \caption{Re$(u_{\ivec, \jvec})$ at time $t=0.002$.} \label{fig:colormap_2_real} \end{subfigure} \newline \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{images/color_map_0_imag.pdf} \caption{Im$(u_{\ivec, \jvec})$ at time $t=0$.} \label{fig:colormap_0_imag} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{images/color_map_1_imag.pdf} \caption{Im$(u_{\ivec, \jvec})$ at time $t=0.001$.} \label{fig:colormap_1_imag} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{images/color_map_2_imag.pdf} \caption{Im$(u_{\ivec, \jvec})$ at time $t=0.002$.} \label{fig:colormap_2_imag} \end{subfigure} \caption{The time evolution of Re($u_{\ivec, \jvec}$) and Im($u_{\ivec, \jvec}$), for time steps $t=[0, 0.001, 0.002]$.} \label{fig:colormap_real_imag} \end{figure*} % \begin{figure*} % \centering % \includegraphics[width=0.9\textwidth]{images/color_map_all.pdf} % \caption{The time evolution of the probability function $p_{\ivec, \jvec}^{n}$ (top row), % Re($u_{\ivec, \jvec}^{n}$) (middle row), and Im($u_{\ivec, \jvec}^{n}$) (bottom row). % Time step $t=0$ in the left column, $t=0.001$ in the middle column, and $t=0.002$ % in the right column.} % \label{fig:colormap_all} % \end{figure*} \end{document}