Shared2018-04-11-132058.texOpen in CoCalc
Final project doc
\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

%% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{siunitx}
\usepackage{float}
\usepackage{subcaption}

\title{Simulating Charged Particles in Magnetic Fields}
\author{Crystal Burgos, Ryan Culhane, Sara Idris}

\begin{document}
\maketitle

\section{Abstract}
This experiment set out to create a Python program that could model the motion of multiple particles in an arbitrary magnetic field. The code we created utilizes the initial position, velocity, mass, and charge and inputs those values into an algorithm that uses Euler's method to approximate the position of the particle for a set step size and number of iterations. The program we created plots the motion of the particle due to both the magnetic field and the electric forces between each particle. For certain magnetic fields, the program can only run less than 1000 iterations for a time step of 0.005 because of the computational resolution of Numpy. To resolve this, we decreased our time step to 0.0005 for 100,000 iterations.
\section{Introduction}

\subsection{Magnetic Fields}

\subsection{Euler's Method}
% use a table and do a step by step process
Euler's method is a useful mathematical process that allows us to approximate the graph of functions using only the first derivative and the initial condition of the function. If the first derivative is known, then you can approximate the graph of the function by assuming the slope is constant for a small step t. So at the initial value of the function ($x_0$,$y_0$), the function will have a slope f'($x_0$,$y_0$), and the new y position will be the product of the slope and t. At x=$x_0$+t the slope can also be approximated as f'($x_0$+t,$y_0$+tf'($x_0$,$y_0$)) and the process can be repeated after each additional time step. Although Euler's method can only be used as an approximation, as the time step decreases, the approximation becomes more accurate. This algorithm is very useful because it allows us to approximate the value of a function at a set of points using only the initial conditions and the equation of the slope of the graph.

\section{Implementation}
% add block code and separate the paragraphs by block
To be able to plot the motion of the particle we first organized our program into sections. To organize the particles in the field and our initial conditions, we created a class for our particles where we stored the initial positions in the x, y, and z directions as arrays, the velocities in the x, y, and z directions as arrays, the mass as a float, and the charge of the particle as a float. After defining the initial conditions, we created a function that defined the magnetic field in all three directions and then saved each component of the field, in order, in an array. We also defined a function that used the initial positions of each particle to calculate the total electric force on each particle and saves the electric force in an ordered array with each component of the force. Then, we defined a function that calculated the force on the particle using the magnetic field function and a new ordered velocity array containing the last element of each x velocity, y velocity, and z velocity. Next, we created a function that determined the acceleration of the particle from the sum of the electric and magnetic forces and the mass of the particle and it was saved as an array. Then we defined a new function that performed one step in Euler's method by using kinematic equations to find the new x, y, and z positions using the acceleration for the corresponding direction and time step. The new positions were then appended to the position arrays defined in each particle. The same method was used to find the new velocities in the x,y, and z direction and update the velocity arrays. Afterwards, we created a for loop that would perform the one step Euler function a specific number of times. Last, we plotted the x, y, and z position of each particle on a 3D plot.

\section{Results}
% use two different viewpoints and present them side by side
% maybe also plot the electric field and magnetic field for each corresponding motion plot
% do 3-4 cases with 3 plots for each case
% provide a case that shows we know it works; show a particle moving in a field perpendicular to its velocity
\begin{table}[H]
\begin{center}
\caption{Measured Temperatures of Objects}
\label{tab:table1}
\begin{tabular}{c|c|c|c|c|c} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between
\textbf{Object} & \textbf{Calibration*} & \textbf{Ibr**} & \textbf{Igr***} & \textbf{Ibg****} & \textbf{Literature Temperature}\\
\hline
Metal & Metal & 1373.15 & 1373.15 & 1373.15 & 1373.15\\
Sun & Metal & 4548.5 & 5769.8 & 3860.6 & 5778\\
Sun & Sun & 5778.1 & 5778.1 & 5778.2 & 5778\\
Albireo (Bright) & Sun & 3657.2 & 4223.0 & 3306.4 & 4270\\
Albireo (Dim) & Sun & 7943.5 & 12773 & 6199.0 & 13200\\
Albireo (Bright) & Albireo & 4346.5 & 4251.2 & 4472.6 & 4270\\
Mizar (Bright) & Sun & 14030 & 13752 & 14619 & 9000\\
Mizar (Dim) & Sun & 10126 & 9979.5 & 10420 & 8221\\
Mizar (Bright) & Mizar & 10420 & 10588 & 10454 & 9000\\
Aldebaran & Sun & 3449.3 & 3396.8 & 3494.7 & 3910\\
Betelgeuse & Sun & 3135.9 & 3228.6 & 3066.4 & 3590\\
Sirius & Sun & 14955 & 13817 & 16431 & 9940\\
\end{tabular}
\end{center}
\end{table}

\begin{table}[H]
\begin{center}
\caption{Calibration Settings}
\label{tab:table2}
\begin{tabular}{c|c|c|c|c|c|c} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between
\textbf{Calibration} & \textbf{R Factor 1} & \textbf{R Factor 2} & \textbf{R Factor 3} & \textbf{B Factor 1} & \textbf{B Factor 2} & \textbf{B Factor 3}\\
\hline
Metal & 1.0970 & 1 & 1 & 1.1852 & 1 & 1 \\
Sun & 1.0970 & 1.0007 & 1 & 1.1852 & 0.7464 & 1 \\
Albireo* & 1.0970 & 1.0007 & 1.0061 & 1.1852 & 0.7464 & 0.7599 \\
Mizar* & 1.0970 & 1.0007 & 0.9449 & 1.1852 & 0.7464 & 1.0851 \\
\end{tabular}
\end{center}
\end{table}

* Both the Albireo and Mizar calibrations were calibrated to the dimmer of the two stars in each of the binary systems, using the literature temperatures reported in Table 1.

\begin{figure}[H]
\begin{center}
Figure 1: Photograph of the Glowing Metal
%%\includegraphics[width=0.8\textwidth]{samplepic.png}
\caption{Zoomed in view of the photograph used to determine the temperature of the metal. Only a small rectangular area that did not contain pixels that appeared black from the center of this photograph were analyzed in the MatLab code. The area selected for this particular photograph was (x,y)=(1366,872) to (x,y)=(1450,946).}
\end{center}
\end{figure}

\begin{figure}[H]
\begin{center}
Figure 2: Source of Intensity Values
%%\includegraphics[width=0.8\textwidth]{IMG_1512.JPG}
\caption{The above photo demonstrates a digital camera's intensity input, with each large outlined square representing one pixel. Each pixel has one red filter, one blue filter, and two green filters (which are averaged). These filters provide the intensity measurements of R,G, and B values respectively. We have shown this on 5 of 25 pixels above to avoid redundancy. We average all the values of these three inputs and then use those values to create our intensity ratios. See the formula beside the diagram.}
\end{center}
\end{figure}

\begin{figure}[H]
\begin{center}
Figure 3: Ratio of Intensities vs. Temperatures
%%\includegraphics[width=0.8\textwidth]{Physics264Lab7Plot.JPG}
\caption{A sample of the theoretical ratio and temperature relations for the piece of metal. The ratios were created using the data in the graphs from Figure 2. The red curve is the ratio of blue to red intensities, the blue curve is blue to green intensities, and the green curve is green to red intensities with the calculated ratios the correspondingly colored constant functions.}
\end{center}
\end{figure}

\section{Conclusion}

\end{document}