<commit_before>\documentclass[aps,reprint]{revtex4-1}
% Engine-specific settings
% Detect pdftex/xetex/luatex, and load appropriate font packages.
% This is inspired by the approach in the iftex package.
% pdftex:
\ifx\pdfmatch\undefined
\else
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
\fi
% xetex:
\ifx\XeTeXinterchartoks\undefined
\else
    \usepackage{fontspec}
    \defaultfontfeatures{Ligatures=TeX}
\fi
% luatex:
\ifx\directlua\undefined
\else
    \usepackage{fontspec}
\fi
% End engine-specific settings
\usepackage[english]{babel}
\usepackage{csquotes}
% \usepackage[backend=biber, sortcites]{biblatex}
\usepackage{url}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames,svgnames, table]{xcolor}
\usepackage[font={scriptsize}]{caption}
\usepackage{amsmath} \usepackage{amsthm} \usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{enumerate}
\usepackage{tikz} \usepackage{float}
\usepackage[procnames]{listings}
\usepackage{pstool} \usepackage{pgfplots}
\usepackage{wrapfig} \usepackage{graphicx} \usepackage{epstopdf}
\usepackage{afterpage}
\usepackage{physics}
\usepackage{multirow}
\usepackage{gensymb}
\usepackage{algorithm}
\usepackage{microtype}
\usepackage[noend]{algpseudocode}
\usepackage{xcolor,colortbl}
\usepackage{microtype}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
% \usepackage{pythontex}
% \usepackage{authblk}
\usepackage{nth}
\usepackage{siunitx}
% \usepackage[toc,page]{appendix}
\floatstyle{plaintop}
\restylefloat{table}

% SET LISTING STUFF (FRED)
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{dred}{rgb}{0.545,0,0}
\definecolor{dblue}{rgb}{0,0,0.545}
\definecolor{lgrey}{rgb}{0.9,0.9,0.9}
\definecolor{gray}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\lstdefinelanguage{cpp}{
      backgroundcolor=\color{lgrey},
      basicstyle=\footnotesize \ttfamily \color{black} \bfseries,
      breakatwhitespace=false,
      breaklines=true,
      captionpos=b,
      commentstyle=\color{dkgreen},
      deletekeywords={...},
      escapeinside={\%*}{*)},
      frame=off,
      language=C++,
      keywordstyle=\color{purple},
      morekeywords={BRIEFDescriptorConfig,string,TiXmlNode,DetectorDescriptorConfigContainer,istringstream,cerr,exit},
      identifierstyle=\color{black},
      stringstyle=\color{blue},
      % numbers=left,
      % numbersep=5pt,
      numberstyle=\tiny\color{black},
      rulecolor=\color{black},
      showspaces=false,
      showstringspaces=false,
      showtabs=false,
      stepnumber=1,
      tabsize=5,
      title=\lstname,
    }

% Custom commands
\newcommand{\unit}[1]{\:\mathrm{#1}}
\newcommand{\noref}[1]{\hyperref[#1]{\ref*{#1}}}
\newcommand{\nonref}[1]{\hyperref[]{\ref*{#1}}}
\newcommand\blankpage{%
  \null
  \thispagestyle{empty}%
  \addtocounter{page}{-1}%
  \newpage}

% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{7} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{7}  % for normal

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\columnwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}


% Biber for references
% \bibliographystyle{aipauth4-1}

\begin{document}
\sisetup{detect-all}
\title{Numerical approaches to solving Schrödinger's equation for
two electrons in an external oscillator potential with C++ and Julia}
\author{<NAME>}
\author{<NAME>}
\author{<NAME>}
\affiliation{University of Oslo, Oslo, Norway \\ Source code available at: \url{https://github.com/Caronthir/FYS3150/tree/master/Project2}}
\date{\today}

\begin{abstract}
Numerical solutions to the problem with two electrons in a harmonic oscillator
potential are investigated. Results are presented both with and without
the Couloumb interaction, and compared for limits of the oscillator strength.
The problem is written as an eigenvalue problem, which is solved with the
famous Jacobi rotation algorithm, through separate implementations in C++ and Julia.
The execution speed of the Jacobi method was compared to the built-in eigenvalue solvers
in armadillo and julia.

The results show that for strong oscillator potentials the Coulomb interaction is negligible,
while for weaker potential wells the repulsion has a large impact on the solution. From
comparing runtimes it is evident that the built-in eigenvalue solvers are far superior
to the Jacobi method. The Jacobi implementation in Julia was faster by around a factor
4 compared to the C++ implementation. The reason for this is unknown.
\end{abstract}
\maketitle
\tableofcontents
\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother

\newpage

\section{Introduction}
\label{sec:introduction}
Eigenvalue problems occur frequently in mathematics and science. Many problems
are on or can be re-written to the form
\begin{align*}
  A \mathbf{x} = \lambda \mathbf{x}
\end{align*}
For matrices where $n \geq 5$ there is
no general analytical procedure to obtain the roots of the characteristic polynomial, by the
Abel-Ruffini theorem. In most situations the eigenvalue problems have much
larger matrices, on the order \(n\sim 10\), and numerical algorithms are needed to solve the problems. In
this paper, the direct Jacobi rotation and built-in methods in Julia and the C++
library armadillo are used to solve eigenvalue problems. This project was implemented
in two programming languages for several reasons. First of all, it is very relevant to
learn several programming languages, and for future projects it is interesting
to compare execution speeds for the same algorithm.

The methods are used to solve Schrödinger's equation for two electrons in a
three-dimensional harmonic oscillator potential, which can be reformulated into
an eigenvalue problem through scaling and mathematical manipulations. The
energy eigenvalues and associated eigenstates are then obtained by Jacobi's method,
and compared to known analytic solutions.

The study of electrons confined in a potential is a highly active research field,
because of the possible nano-medical applications, and in the development of semi-conductors
and quantum computers.
\section{Theory}
\label{sec:theory}
\subsection{Jacobi's rotation algorithm}
The general idea of Jacobi's algorithm is rather straightforward. Finding the
eigenvalues of any matrix is hard, but finding the eigenvalues of a diagonal
matrix is trivial. A matrix \(A\) is converted to an approximately a diagonal
matrix through a series of orthogonal matrix transformations on the form:
\begin{align*}
  T = S^T A S
\end{align*}
where $S$ is a rotation matrix. This amounts to rotating the rotating the matrix
around hyperplanes in such a way that the off-diagonal elements are reduced to
fall beneath some threshhold.
Since eigenvalues are preserved under similarity
transformations, the eigenvalues of \(A\) can be read off the diagonal of a
sufficiently diagonalized matrix. For a more detailed description, see \cite{mortenjensen}.

There are several ways to iterate through the matrix to eliminate the offdiagonal
elements, for instance a full systematic iteration over all matrix elements. In this paper,<commit_msg>Small change<commit_after>\documentclass[aps,reprint]{revtex4-1}
% Engine-specific settings
% Detect pdftex/xetex/luatex, and load appropriate font packages.
% This is inspired by the approach in the iftex package.
% pdftex:
\ifx\pdfmatch\undefined
\else
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
\fi
% xetex:
\ifx\XeTeXinterchartoks\undefined
\else
    \usepackage{fontspec}
    \defaultfontfeatures{Ligatures=TeX}
\fi
% luatex:
\ifx\directlua\undefined
\else
    \usepackage{fontspec}
\fi
% End engine-specific settings
\usepackage[english]{babel}
\usepackage{csquotes}
% \usepackage[backend=biber, sortcites]{biblatex}
\usepackage{url}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames,svgnames, table]{xcolor}
\usepackage[font={scriptsize}]{caption}
\usepackage{amsmath} \usepackage{amsthm} \usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{enumerate}
\usepackage{tikz} \usepackage{float}
\usepackage[procnames]{listings}
\usepackage{pstool} \usepackage{pgfplots}
\usepackage{wrapfig} \usepackage{graphicx} \usepackage{epstopdf}
\usepackage{afterpage}
\usepackage{physics}
\usepackage{multirow}
\usepackage{gensymb}
\usepackage{algorithm}
\usepackage{microtype}
\usepackage[noend]{algpseudocode}
\usepackage{xcolor,colortbl}
\usepackage{microtype}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
% \usepackage{pythontex}
% \usepackage{authblk}
\usepackage{nth}
\usepackage{siunitx}
% \usepackage[toc,page]{appendix}
\floatstyle{plaintop}
\restylefloat{table}

% SET LISTING STUFF (FRED)
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{dred}{rgb}{0.545,0,0}
\definecolor{dblue}{rgb}{0,0,0.545}
\definecolor{lgrey}{rgb}{0.9,0.9,0.9}
\definecolor{gray}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\lstdefinelanguage{cpp}{
      backgroundcolor=\color{lgrey},
      basicstyle=\footnotesize \ttfamily \color{black} \bfseries,
      breakatwhitespace=false,
      breaklines=true,
      captionpos=b,
      commentstyle=\color{dkgreen},
      deletekeywords={...},
      escapeinside={\%*}{*)},
      frame=off,
      language=C++,
      keywordstyle=\color{purple},
      morekeywords={BRIEFDescriptorConfig,string,TiXmlNode,DetectorDescriptorConfigContainer,istringstream,cerr,exit},
      identifierstyle=\color{black},
      stringstyle=\color{blue},
      % numbers=left,
      % numbersep=5pt,
      numberstyle=\tiny\color{black},
      rulecolor=\color{black},
      showspaces=false,
      showstringspaces=false,
      showtabs=false,
      stepnumber=1,
      tabsize=5,
      title=\lstname,
    }

% Custom commands
\newcommand{\unit}[1]{\:\mathrm{#1}}
\newcommand{\noref}[1]{\hyperref[#1]{\ref*{#1}}}
\newcommand{\nonref}[1]{\hyperref[]{\ref*{#1}}}
\newcommand\blankpage{%
  \null
  \thispagestyle{empty}%
  \addtocounter{page}{-1}%
  \newpage}

% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{7} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{7}  % for normal

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\columnwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}


% Biber for references
% \bibliographystyle{aipauth4-1}

\begin{document}
\sisetup{detect-all}
\title{Numerical approaches to solving Schrödinger's equation for
two electrons in an external oscillator potential with C++ and Julia}
\author{<NAME>}
\author{<NAME>}
\author{<NAME>}
\affiliation{University of Oslo, Oslo, Norway \\ Source code available at: \url{https://github.com/Caronthir/FYS3150/tree/master/Project2}}
\date{\today}

\begin{abstract}
Numerical solutions to the problem with two electrons in a harmonic oscillator
potential are investigated. Results are presented both with and without
the Couloumb interaction, and compared for limits of the oscillator strength.
The problem is written as an eigenvalue problem, which is solved with the
famous Jacobi rotation algorithm and through separate implementations in C++ and Julia.
The execution speed of the Jacobi method was compared to the built-in eigenvalue solvers
in armadillo and julia.

The results show that for strong oscillator potentials the Coulomb interaction is negligible,
while for weaker potential wells the repulsion has a large impact on the solution. From
comparing runtimes it is evident that the built-in eigenvalue solvers are far superior
to the Jacobi method. The Jacobi implementation in Julia was faster by around a factor
4 compared to the C++ implementation. The reason for this is unknown.
\end{abstract}
\maketitle
\tableofcontents
\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother

\newpage

\section{Introduction}
\label{sec:introduction}
Eigenvalue problems occur frequently in mathematics and science. Many problems
are on or can be re-written to the form
\begin{align*}
  A \mathbf{x} = \lambda \mathbf{x}
\end{align*}
For matrices where $n \geq 5$ there is
no general analytical procedure to obtain the roots of the characteristic polynomial, by the
Abel-Ruffini theorem. In most situations the eigenvalue problems have much
larger matrices, on the order \(n\sim 10\), and numerical algorithms are needed to solve the problems. In
this paper, the direct Jacobi rotation and built-in methods in Julia and the C++
library armadillo are used to solve eigenvalue problems. This project was implemented
in two programming languages for several reasons. First of all, it is very relevant to
learn several programming languages, and for future projects it is interesting
to compare execution speeds for the same algorithm.

The methods are used to solve Schrödinger's equation for two electrons in a
three-dimensional harmonic oscillator potential, which can be reformulated into
an eigenvalue problem through scaling and mathematical manipulations. The
energy eigenvalues and associated eigenstates are then obtained by Jacobi's method.

The study of electrons confined in a potential is a highly active research field,
because of the possible nano-medical applications, and in the development of semi-conductors
and quantum computers.
\section{Theory}
\label{sec:theory}
\subsection{Jacobi's rotation algorithm}
The general idea of Jacobi's algorithm is rather straightforward. Finding the
eigenvalues of any matrix is hard, but finding the eigenvalues of a diagonal
matrix is trivial. A matrix \(A\) is converted to an approximately a diagonal
matrix through a series of orthogonal matrix transformations on the form:
\begin{align*}
  T = S^T A S
\end{align*}
where $S$ is a rotation matrix. This amounts to rotating the rotating the matrix
around hyperplanes in such a way that the off-diagonal elements are reduced to
fall beneath some threshhold.
Since eigenvalues are preserved under similarity
transformations, the eigenvalues of \(A\) can be read off the diagonal of a
sufficiently diagonalized matrix. For a more detailed description, see \cite{mortenjensen}.

There are several ways to iterate through the matrix to eliminate the offdiagonal
elements, for instance a full systematic iteration over all matrix elements. In this paper,
{'fraction_non_alphanumeric': 0.10255354200988467, 'fraction_numerical': 0.009335529928610654, 'mean_word_length': 5.353685128652421, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5598887', 'n_tokens_mistral': 4521, 'n_tokens_neox': 4163, 'n_words': 1393}