% USEFUL LINKS:
% -------------
%
% - UiO LaTeX guides:          https://www.mn.uio.no/ifi/tjenester/it/hjelp/latex/
% - Mathematics:               https://en.wikibooks.org/wiki/LaTeX/Mathematics
% - Physics:                   https://ctan.uib.no/macros/latex/contrib/physics/physics.pdf
% - Basics of Tikz:            https://en.wikibooks.org/wiki/LaTeX/PGF/Tikz
% - All the colors!            https://en.wikibooks.org/wiki/LaTeX/Colors
% - How to make tables:        https://en.wikibooks.org/wiki/LaTeX/Tables
% - Code listing styles:       https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings
% - \includegraphics           https://en.wikibooks.org/wiki/LaTeX/Importing_Graphics
% - Learn more about figures:  https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
% - Automagic bibliography:    https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management  (this one is kinda difficult the first time)
%
%                              (This document is of class "revtex4-1", the REVTeX Guide explains how the class works)
%   REVTeX Guide:              http://www.physics.csbsju.edu/370/papers/Journal_Style_Manuals/auguide4-1.pdf
%
%
% COMPILING THE .pdf FILE IN THE LINUX TERMINAL
% ---------------------------------------------
%
% [terminal]$ pdflatex report_example.tex
%
% Run the command twice, always.
%
% When using references, footnotes, etc. you should run the following chain of commands:
%
% [terminal]$ pdflatex report_example.tex
% [terminal]$ bibtex report_example
% [terminal]$ pdflatex report_example.tex
% [terminal]$ pdflatex report_example.tex
%
% This series of commands can of course be gathered into a single-line command:
% [terminal]$ pdflatex report_example.tex && bibtex report_example.aux && pdflatex report_example.tex && pdflatex report_example.tex
%
% ----------------------------------------------------



% \documentclass[english,notitlepage,reprint,nofootinbib]{revtex4-2}  % defines the basic parameters of the document
\documentclass[english,notitlepage,reprint,nofootinbib]{revtex4-2}  % defines the basic parameters of the document
% If you want a single-column, remove "reprint"
\usepackage{silence}
\WarningFilter{revtex4-2}{Repair the float}

% Allows special characters (including æøå)
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

% Note that you may need to download some of these packages manually, it depends on your setup.
% It may be usefult to download TeXMaker, because it includes a large library of the most common packages.

\usepackage{amssymb}  % mathematical symbols (physics imports amsmath)
\usepackage{amsmath}
\usepackage{graphicx}         % include graphics such as plots
\usepackage{xcolor}           % set colors
\usepackage{hyperref}         % automagic cross-referencing
\usepackage{listings}         % display code
\usepackage{subfigure}        % imports a lot of cool and useful figure commands
\usepackage{float}
%\usepackage[section]{placeins}
\usepackage{algorithm}
\usepackage{booktabs}
\usepackage[noend]{algpseudocode}
\usepackage{subfigure}
\usepackage{tikz}
\usepackage[noabbrev,nameinlink]{cleveref}
\usepackage[separate-uncertainty=true]{siunitx}
% Define amu = Dalton
\DeclareSIUnit\amu{u}

\usepackage{todonotes}
\usetikzlibrary{quantikz}
% defines the color of hyperref objects
% Blending two colors:  blue!80!black  =  80% blue and 20% black
\hypersetup{ % this is just my personal choice, feel free to change things
    colorlinks,
    linkcolor={red!50!black},
    citecolor={blue!50!black},
    urlcolor={blue!80!black}}


% ===========================================

\newcommand{\expect}[1]{\left\langle#1\right\rangle}

\begin{document}

\title{Solving the Two-dimensional Schrödinger Equation Numerically}  % self-explanatory
\author{Lars Bogner} % self-explanatory
\date{\today}                             % self-explanatory
\affiliation{{\url{https://github.uio.no/larsbog/FYS4150}}}                            % ignore this, but keep it.

%This is how we create an abstract section.
\begin{abstract}
We present a numerical framework for solving the two-dimensional, time-dependent Schrödinger equation. Our method uses the unconditionally stable, second-order accurate in both space and time Crank-Nicolson finite difference scheme. We implement the discretized system efficiently in C++ using the Armadillo linear algebra library to handle sparse matrix operations. Our framework is highly configurable and allows us to simulate various potentials, with a specific focus on modeling single- and multiple-slit experiments. Our results demonstrate excellent numerical accuracy, maintaining probability conservation to within an order of \num{e-15}. The simulations successfully reproduce key quantum mechanical phenomena, including wave packet diffraction and the characteristic interference patterns from double and triple slits. Additionally, we demonstrate the approach's flexibility by computing the probability distribution of particle detection on a virtual screen. This work establishes a robust, extensible foundation for computational exploration of two-dimensional time-dependent quantum dynamics.
\end{abstract}

\maketitle
\tableofcontents


% ===========================================
\section{Introduction}
\input{chapters/introduction.tex}


% ===========================================
\section{Methods}\label{sec:methods}
\input{chapters/methods.tex}

% ===========================================
\section{Results and discussion}\label{sec:results_and_discussion}
%
\input{chapters/results.tex}


% ===========================================
\section{Conclusion}\label{sec:conclusion}
\input{chapters/conclusion.tex}


% ===========================================
\appendix
\section{Evolution of wave function in presence of a double slit} \label{app:evolv}
The simulation uses a grid spacing \(h = \num{0.005}\) and a time step of \(\Delta t = \num{2.5e-5}\,\mathrm{s}\). The double slit has a thickness of \(\num{0.02}\), an aperture of \(\num{0.05}\), a separation of \(\num{0.05}\), and  a barrier potential \(V_\mathrm{wall} = \num{1.0e10}\). The wave packet is initially broader in the \(y\)-direction to enhance the visibility of interference effects. Each figure displays three subplots: the probability density in 2D, and the real and imaginary parts of the wave function \(u\), illustrating the full complex evolution of the quantum state.
The time evolution of the wave function in the double-slit setup is illustrated in \cref{fig:t_0_evolution,fig:t_1_evolution,fig:t_2_evolution}. Initially, as shown in \cref{fig:t_0_evolution}, the wave packet is localized before the barrier, with its probability distribution concentrated around the initial position and negligible interference structure. By the intermediate time in \cref{fig:t_1_evolution}, the wave packet has reached the slits, and partial transmission has produced oscillations in the real and imaginary components, while faint interference fringes start forming in the probability distribution. Finally, after the wave has passed the slits, \cref{fig:t_2_evolution} shows well-developed interference fringes in $|u|^2$, and alternating positive and negative regions in the real and imaginary parts, reflecting the coherent superposition of the two transmitted components.
\begin{figure}[ht]
    \centering
    \includegraphics[width=\columnwidth]{include/wavefunction_t_0.000s.pdf}
    \caption{Initial state of the double-slit simulation at $t = \num{0.000}\,\mathrm{s}$. The three panels show (from top to bottom) the probability distribution $|u|^2$, the real part of the wave function $\mathrm{Re}(u)$, and the imaginary part $\mathrm{Im}(u)$. The wave packet is initially centered at $\left(x_c, y_c\right) = \left(\num{0.25}, \num{0.5}\right)$ with widths $\sigma_x = \num{0.05}$ and $\sigma_y = \num{0.20}$, moving primarily in the $x$-direction with momentum $p_x = \num{200.0}$.}
    \label{fig:t_0_evolution}
\end{figure}

\begin{figure}[ht]
    \centering
    \includegraphics[width=\columnwidth]{include/wavefunction_t_0.001s.pdf}
    \caption{Evolution of the wave function at $t = \num{0.001}\,\mathrm{s}$. The wave packet approaches the double slit located at $x = \num{0.5}$. The interference pattern begins to emerge in the probability distribution $|u|^2$, while the real and imaginary parts of the wave function start to show oscillatory structure due to partial transmission through the slits.}
    \label{fig:t_1_evolution}
\end{figure}

\begin{figure}[ht]
    \centering
    \includegraphics[width=\columnwidth]{include/wavefunction_t_0.002s.pdf}
    \caption{Wave function after passing the slits at $t = \num{0.002}\,\mathrm{s}$. Clear interference fringes are visible in the probability distribution $|u|^2$, indicating coherent superposition of the transmitted wave packets. The real and imaginary components exhibit alternating regions of positive and negative amplitude, reflecting the phase differences between the paths through the two slits.}
    \label{fig:t_2_evolution}
\end{figure}

\onecolumngrid
% \bibliographystyle{apalike}
\bibliographystyle{unsrt}
\bibliography{include/project5}


\end{document}