\documentclass[../main.tex]{subfiles}
\graphicspath{{\subfix{../images/}}}

\begin{document}
\section{Methods}
% problem 1
When we study the Penning traps effect on a particle with a charge $q$, we need to consider the forces acting on the particle. The sum of all forces acting on the particle, is given by the Lorentz force \eqref{eq:lorentz_force}.
\begin{equation}\label{eq:lorentz_force}
    \mathbf{F} = q \mathbf{E} + q \mathbf{v} \times \mathbf{B},
\end{equation}
We can use Newton's second law \eqref{eq:newton_second} to determine this sum by 
\begin{align*}
    \ddot{\mathbf{r}} &= \frac{1}{m} \sum_{i} \mathbf{F}_{i} \\
    &= \frac{1}{m} (q \mathbf{E} + q \mathbf{v} \times \mathbf{B}) \\
    &= \frac{q}{m} \big(\frac{V_{0}}{d^{2}} (x, y, -2z) + (B_{0}\dot{y}, -B_{0}\dot{x}, 0) \big),
\end{align*}
where the complete derivation can be found in \ref{sec:appendix_b}. We can now write the particle's position as
\begin{align}
    \label{eq:motion_x}
    \ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x &= 0, \\
    \label{eq:motion_y}
    \ddot{y} + \omega_{0} \dot{x} - \frac{1}{2} \omega_{z}^{2} y &= 0, \\
    \label{eq:motion_z}
    \ddot{z} + \omega_{z}^{2} z &= 0,
\end{align}
% define w_0 og w_z i appendix?
In addition, we can find the general solution for eq. \eqref{eq:motion_z}, when we consider the characteristic equation of a second order differential equation \cite{lindstrom:2016:ch10:5}. 
\begin{align*}
    r^{2} + \omega_{z}^{2} &= 0 \\
    r &= \pm \sqrt{- \omega_{z}^{2}} = \mp i \omega_{z},
\end{align*}
two complex roots which gives us solutions in the form of
\begin{equation}\label{eq:all_diff_sol}
    z = c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t},
\end{equation}
For a complex number $z = a + ib$, we can define $e^{z} \equiv e^{a} (\cos{b} + i \sin{b})$ \cite{lindstrom:2016:ch3}. We can rewrite \eqref{eq:all_diff_sol} as
\begin{align*}
    c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t} &= c_{1} (\cos{\omega_{z} t} + i \sin{\omega_{z} t}) + c_{2} (\cos{\omega_{z} t} - i \sin{\omega_{z} t} \\
    &= E \cos{\omega_{z} t} + i F \sin{\omega_{z} t}
\end{align*}
%
Since \eqref{eq:motion_x} and \eqref{eq:motion_y} are coupled, we want to rewrite it as a single differential equation. We can obtain this by introducing $f(t) = x(t) + iy(t)$,
\begin{align*}
    (\ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x) + i (\ddot{y} + \omega_{0} \dot{x} - \frac{1}{2} \omega_{z}^{2} y) &= 0 \\
    \ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x + i\ddot{y} + i\omega_{0} \dot{x} - i \frac{1}{2} \omega_{z}^{2} y &= 0 \\
    \ddot{x} + i\ddot{y} + i\omega_{0} \dot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x - i \frac{1}{2} \omega_{z}^{2} y &= 0 \\ 
    \ddot{x} + i\ddot{y} + i\omega_{0} (\dot{x} + i \dot{y}) - \frac{1}{2} \omega_{z}^{2} x - i \frac{1}{2} \omega_{z}^{2} y &= 0 \text{where $i \omega_{0} \dot{x} + (-1) \omega_{0} \dot{y} = i \omega_{0} \dot{x} + i^{2} \omega_{0} \dot{y}$} \\
    \ddot{f} + i \omega_{0} \dot{f} - \frac{1}{2} \omega_{z}^{2} f &= 0
\end{align*}

 





Physical properties given by newtons second law \eqref{eq:newton_second}
\begin{equation}\label{eq:general_solution}
    f(t) = A_{+}e^{-i(\omega_{+} t + \phi_{+})} + A_{-}e^{-i(\omega_{-} t + \phi_{-})}
\end{equation}
The particle moves and its position can be determined using newton. where the electric field

\subsection*{Algorithm}


\subsection*{Tools}
We used matplotlib

\end{document}