Update formatting and add chktexrc

This commit is contained in:
Ceres 2025-11-16 18:17:51 +00:00
parent 972cddcd0e
commit e8722346d4
Signed by: ceres-sees-all
GPG key ID: 9814758436430045
3 changed files with 74 additions and 77 deletions

4
Exercise 1/.chktexrc Normal file
View file

@ -0,0 +1,4 @@
CmdLine
{
--nowarn 3 --nowarn 36
}

Binary file not shown.

View file

@ -30,27 +30,22 @@
\renewcommand{\familydefault}{\sfdefault} \renewcommand{\familydefault}{\sfdefault}
\captionsetup[figure]{labelfont=bf,textfont=normalfont} \captionsetup[figure]{labelfont=bf,textfont=normalfont}
\captionsetup[subfigure]{labelfont=bf,textfont=normalfont} %\captionsetup[subfigure]{labelfont=bf,textfont=normalfont}
%%%% comment out the below for the other title option %%%% comment out the below for the other title option
\makeatletter \makeatletter
\def\@maketitle{ \def\@maketitle{
\raggedright \raggedright\newpage
\newpage
\noindent \noindent
\vspace{0cm} \vspace{0cm}
\let \footnote \thanks \let\footnote\thanks{\hskip -0.4em \huge \textbf{{\@title}} \par}
{\hskip -0.4em \huge \textbf{{\@title}} \par}
\vskip 1.5em \vskip 1.5em
{\large {\large
\lineskip.5em \lineskip.5em
\begin{tabular}[t]{l} \begin{tabular}[t]{l}
\raggedright \raggedright\@author\end{tabular}\par}
\@author
\end{tabular}\par}
\vskip 1em \vskip 1em
\@date \@date\par
\par
\vskip 1.5em \vskip 1.5em
} }
\makeatother \makeatother
@ -62,7 +57,7 @@
\author[1]{Paddy Milner} \author[1]{Paddy Milner}
\affil[1]{Department of Physics, University of Bristol} \affil[1]{Department of Physics, University of Bristol}
\renewcommand\Affilfont{\itshape\small} \renewcommand\Affilfont{\itshape\small}% chktex 6
\date{01.03.2025} \date{01.03.2025}
\maketitle \maketitle
@ -74,29 +69,35 @@ The aim of this exercise was to use computational methods to model the gravitati
\section{Introduction} \section{Introduction}
In this exercise we will create a computational model to first simulate the orbit of the moon around the earth, and then the orbit of a lunar probe around the moon as well. Using these simulations, we will first use realistic starting conditions to verify that the simulations behave as expected, i.e. they behave how these objects do in real life. We will then alter these starting conditions and observe how these alterations affect the simulations result. In this exercise we will create a computational model to first simulate the orbit of the moon around the earth, and then the orbit of a lunar probe around the moon as well. Using these simulations, we will first use realistic starting conditions to verify that the simulations behave as expected, i.e.\ they behave how these objects do in real life. We will then alter these starting conditions and observe how these alterations affect the simulations result.
\section{Theory and Methods} \label{sec:Theory} \section{Theory and Methods}
Our models will simply use Newton's equation for gravitational attraction, Our models will simply use Newton's equation for gravitational attraction,
$$F=\frac{GMm}{r^2}$$ \[F=\frac{GMm}{r^2}\]
Combined with Newton's second law of motion, Combined with Newton's second law of motion,
$$F=ma$$ \[F=ma\]
to find the acceleration of the objects. For the moon's orbit around the earth, we find that to find the acceleration of the objects. For the moon's orbit around the earth, we find that
$$M_m\ddot{r}_m=-\frac{M_eM_mG}{|r_m|^2}\hat{r}_m=-\frac{M_eM_mG}{|r_m|^3}r_m$$ \[M_m\ddot{r}_m=-\frac{M_{e}M_{m}G}{|r_m|^2}\hat{r}_m=-\frac{M_{e}M_{m}G}{|r_m|^3}r_m\]
where $M_e$ is the mass of the earth, $M_m$ is the mass of the moon, $G$ is the gravitational constant, and $r_m=(x_m,y_m)$, the coordinates of the moon relative to the fixed origin at the centre of the earth. We will assume that the mass of the moon is negligible compared to that of the earth, and therefore the motion of the earth can be ignored, hence the fixed origin at its centre. From this, we can obtain the following differential equations: where $M_e$ is the mass of the earth, $M_m$ is the mass of the moon, $G$ is the gravitational constant, and $r_m=(x_m,y_m)$, the coordinates of the moon relative to the fixed origin at the centre of the earth. We will assume that the mass of the moon is negligible compared to that of the earth, and therefore the motion of the earth can be ignored, hence the fixed origin at its centre. From this, we can obtain the following differential equations:
\begin{align} \begin{align}
\frac{\mathrm{d}v_{m,x}}{\mathrm{d}t}=-\frac{M_eGx_m}{(x_m^2+y_m^2)^{3/2}};\ \ \ \ \ \frac{\mathrm{d}x_m}{\mathrm{d}t}=v_{m,x} \frac{\mathrm{d}v_{m,x}}{\mathrm{d}t}=-\frac{M_{e}Gx_m}{(x_m^2+y_m^2)^{3/2}};\ \ \ \ \ \frac{\mathrm{d}x_m}{\mathrm{d}t}=v_{m,x}
\nonumber \\ \nonumber \\
\frac{\mathrm{d}v_{m,y}}{\mathrm{d}t}=-\frac{M_eGy_m}{(x_m^2+y_m^2)^{3/2}};\ \ \ \ \ \frac{\mathrm{d}y_m}{\mathrm{d}t}=v_{m,y} \frac{\mathrm{d}v_{m,y}}{\mathrm{d}t}=-\frac{M_{e}Gy_m}{(x_m^2+y_m^2)^{3/2}};\ \ \ \ \ \frac{\mathrm{d}y_m}{\mathrm{d}t}=v_{m,y}
\label{eq:Moon} \label{eq:Moon}
\end{align} \end{align}
This can then be extended to model the probe orbiting the moon as well. It feels attraction from both the moon and the earth, so needs terms for both: This can then be extended to model the probe orbiting the moon as well. It feels attraction from both the moon and the earth, so needs terms for both:
\begin{align} \begin{align}
\frac{\mathrm{d}v_{p,x}}{\mathrm{d}t}=-\frac{M_eGx_p}{(x_p^2+y_p^2)^{3/2}}-\frac{M_eGx_{pm}}{(x_{pm}^2+y_{pm}^2)^{3/2}};\ \ \ \ \ \frac{\mathrm{d}x_p}{\mathrm{d}t}=v_{p,x} \frac{\mathrm{d}v_{p,x}}{\mathrm{d}t}&=-\frac{M_{e}Gx_p}{(x_p^2+y_p^2)^{3/2}}-\frac{M_{e}Gx_{pm}}{(x_{pm}^2+y_{pm}^2)^{3/2}};
\nonumber \\ \nonumber \\
\frac{\mathrm{d}v_{p,y}}{\mathrm{d}t}=-\frac{M_eGy_p}{(x_p^2+y_p^2)^{3/2}}-\frac{M_eGy_{pm}}{(x_{pm}^2+y_{pm}^2)^{3/2}};\ \ \ \ \ \frac{\mathrm{d}y_p}{\mathrm{d}t}=v_{p,y} \nonumber \\
\label{eq:Probe} \frac{\mathrm{d}x_p}{\mathrm{d}t}&=v_{p,x}
\nonumber \\
\nonumber \\
\frac{\mathrm{d}v_{p,y}}{\mathrm{d}t}&=-\frac{M_{e}Gy_p}{(x_p^2+y_p^2)^{3/2}}-\frac{M_{e}Gy_{pm}}{(x_{pm}^2+y_{pm}^2)^{3/2}};
\nonumber \\
\nonumber \\
\frac{\mathrm{d}y_p}{\mathrm{d}t}&=v_{p,y}\label{eq:Probe}
\end{align} \end{align}
where $r_p$ is the position of the probe relative to the earth, and $r_{pm}=r_p-r_m$ is the position of the probe relative to the moon. These will then be solved in python using the scipy.integrate.solve\_ivp () method, after being supplied with initial condition for velocity and position. where $r_p$ is the position of the probe relative to the earth, and $r_{pm}=r_p-r_m$ is the position of the probe relative to the moon. These will then be solved in python using the scipy.integrate.solve\_ivp () method, after being supplied with initial condition for velocity and position.
@ -106,59 +107,55 @@ where $r_p$ is the position of the probe relative to the earth, and $r_{pm}=r_p-
\includegraphics[width=1\linewidth]{Images/1.png} \includegraphics[width=1\linewidth]{Images/1.png}
The function for part 1 takes 2 inputs, velocityFactor and orbits. These are scalar multipliers for the initial velocity and max time respectively, which can be altered as desired. The function for part 1 takes 2 inputs, velocityFactor and orbits. These are scalar multipliers for the initial velocity and max time respectively, which can be altered as desired.
The function for the derivatives is then defined, taking an input of time, the initial state, the masses of each object and the gravitaional constant. State is provided as a tuple with 4 objects, and each value in it is then assigned to xm, ym, vx and vy. The equations for the derivative of each of these values, relating to the equations outlined in equation \ref{eq:Moon} are then defined, and are returned in the same order they were initially given. The function for the derivatives is then defined, taking an input of time, the initial state, the masses of each object and the gravitaional constant. State is provided as a tuple with 4 objects, and each value in it is then assigned to xm, ym, vx and vy. The equations for the derivative of each of these values, relating to the equations outlined in equation~\ref{eq:Moon} are then defined, and are returned in the same order they were initially given.
\includegraphics[width=1\linewidth]{Images/2.png} \includegraphics[width=0.95\linewidth]{Images/2.png}
The initial starting conditions of the system are then defined. $M_e$, $M_m$, $G$ and $r$ are all known and fixed quantities. The standard value for $v$, the initial velocity of the moon, is set by balancing centripetal force with gravitational force to produce a stable, circular orbit, however it can be changed by altering velocityFactor in order to produce an elliptical orbit. t\_max is set to the sidereal period of the moon multiplied by the number of orbits desired. The position and velocity are then split up into $x$ and $y$ values, and the simplest case is taken, with the moon starting on the $x$ axis and moving directly upwards, allowing us to set $y_m$ and $v_{x,m}$ to 0, and $x_m$ and $v_{y.m}$ to $r$ and $v$ respectively. The initial starting conditions of the system are then defined. $M_e$, $M_m$, $G$ and $r$ are all known and fixed quantities. The standard value for $v$, the initial velocity of the moon, is set by balancing centripetal force with gravitational force to produce a stable, circular orbit, however it can be changed by altering velocityFactor in order to produce an elliptical orbit.\ t\_max is set to the sidereal period of the moon multiplied by the number of orbits desired. The position and velocity are then split up into $x$ and $y$ values, and the simplest case is taken, with the moon starting on the $x$ axis and moving directly upwards, allowing us to set $y_m$ and $v_{x,m}$ to 0, and $x_m$ and $v_{y.m}$ to $r$ and $v$ respectively.
\includegraphics[width=1\linewidth]{Images/3.png} \includegraphics[width=0.95\linewidth]{Images/3.png}
The solve\_ivp() function is then called to solve the differential equations. The initial conditions are provided as a tuple, in the order defined in the differential equations function. The time range is also provided as a tuple, and the other arguments needed for the differential equations function are provided using args=. Matplotlib is then used to create a plot of the position of the moon at each time defined in t. x and y axes are then added for clarity. The solve\_ivp() function is then called to solve the differential equations. The initial conditions are provided as a tuple, in the order defined in the differential equations function. The time range is also provided as a tuple, and the other arguments needed for the differential equations function are provided using args=. Matplotlib is then used to create a plot of the position of the moon at each time defined in t.\ x and y axes are then added for clarity.
\subsection{Lunar Probe} \subsection{Lunar Probe}
\begin{center} \begin{center}
\includegraphics[width=0.85\linewidth]{Images/4.png} \includegraphics[width=0.85\linewidth]{Images/4.png}
\end{center} \end{center}
The initial configuration for section 2 is very similar to that of section 1. The function for the section also takes velocityFactor and orbits as inputs, which perform the same function as in section 1. The differential equations function has a similar form to the one in section 1, taking time, state and some constants as input. The differential equations that govern the movement of the moon and their associated state values are the same, but we now have the additional equations seen in equation \ref{eq:Probe}, and the variables required for them. Each differential equation is then returned in the same order they were provided, as in the first part. The initial configuration for section 2 is very similar to that of section 1. The function for the section also takes velocityFactor and orbits as inputs, which perform the same function as in section 1. The differential equations function has a similar form to the one in section 1, taking time, state and some constants as input. The differential equations that govern the movement of the moon and their associated state values are the same, but we now have the additional equations seen in equation~\ref{eq:Probe}, and the variables required for them. Each differential equation is then returned in the same order they were provided, as in the first part.
\includegraphics[width=1\linewidth]{Images/5.png} \includegraphics[width=0.95\linewidth]{Images/5.png}
We then set the initial conditions for both the moon and probe. The values for the moon are all the same as in section 1. The initial conditions for the probe are found by selecting an appropriate distance for the probe from the moons center, then again balancing centripetal and gravitational forces to find its velocity around the moon. However, as the coordinate system is relative to the earth and not the moon, both the initial position and velocity of the probe relative to the moon must be added to the position and velocity of the moon relative to the earth, in order to get the state of the probe relative to the earth. The tolerances for this part were set lower, as the motion of the probe is more precise than that of the moon, so this was required to achieve a good degree of accuracy. We then set the initial conditions for both the moon and probe. The values for the moon are all the same as in section 1. The initial conditions for the probe are found by selecting an appropriate distance for the probe from the moons center, then again balancing centripetal and gravitational forces to find its velocity around the moon. However, as the coordinate system is relative to the earth and not the moon, both the initial position and velocity of the probe relative to the moon must be added to the position and velocity of the moon relative to the earth, in order to get the state of the probe relative to the earth. The tolerances for this part were set lower, as the motion of the probe is more precise than that of the moon, so this was required to achieve a good degree of accuracy.
\includegraphics[width=1\linewidth]{Images/6.png} \includegraphics[width=0.95\linewidth]{Images/6.png}
The results are then calculated using solve\_ivp (). Again this is very similar to the procedure in part 1, only with more variables for the initial state. Matplotlib is again used to plot the position of both the moon and the probe in the same fashion as part 1. The results are then calculated using solve\_ivp (). Again this is very similar to the procedure in part 1, only with more variables for the initial state. Matplotlib is again used to plot the position of both the moon and the probe in the same fashion as part 1.
\section{Results and Discussion} \section{Results and Discussion}
\subsection{Orbit of the Moon} \subsection{Orbit of the Moon}
When given standard starting conditions, the simulation provided a stable and circular orbit, as expected, shown in figure \ref{fig:MoonCircular}. When given standard starting conditions, the simulation provided a stable and circular orbit, as expected, shown in figure~\ref{fig:MoonCircular}.
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/7.png} \includegraphics[width=1\linewidth]{Images/7.png}
\caption{Circular orbit as a result of standard initial conditions} \caption{Circular orbit as a result of standard initial conditions}\label{fig:MoonCircular}
\label{fig:MoonCircular}
\end{figure} \end{figure}
The simulation kept its shape for a large number of orbits, showing its stability. When the initial velocity was altered but the radius of the orbit was held, we observed a range of effects. For small alterations, approximately in the range of 0.1<velocityFactor<1.41, stable elliptical orbits were produced, as shown in figures \ref{fig:MoonSmallElliptical} and \ref{fig:MoonBigElliptical}. The simulation kept its shape for a large number of orbits, showing its stability. When the initial velocity was altered but the radius of the orbit was held, we observed a range of effects. For small alterations, approximately in the range of 0.1<velocityFactor<1.41, stable elliptical orbits were produced, as shown in figures~\ref{fig:MoonSmallElliptical} and~\ref{fig:MoonBigElliptical}.
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/8.png} \includegraphics[width=1\linewidth]{Images/8.png}
\caption{Elliptical orbit with a velocity of 0.4*v} \caption{Elliptical orbit with a velocity of 0.4*v}\label{fig:MoonSmallElliptical}
\label{fig:MoonSmallElliptical}
\end{figure} \end{figure}
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/9.png} \includegraphics[width=1\linewidth]{Images/9.png}
\caption{Elliptical orbit with a velocity of 1.3*v} \caption{Elliptical orbit with a velocity of 1.3*v}\label{fig:MoonBigElliptical}
\label{fig:MoonBigElliptical}
\end{figure} \end{figure}
For velocities less than 0.1*v, the simulation began to fail, producing what was effectively noise. At velocities greater than 1.41*v, the moon appears to escape the orbit of the earth, as shown in figure \ref{fig:MoonEscape}. These trajectories continued with increasing t\_max, to the point where simulation took a very long time, suggesting that they are not simply very large orbits. For velocities less than 0.1*v, the simulation began to fail, producing what was effectively noise. At velocities greater than 1.41*v, the moon appears to escape the orbit of the earth, as shown in figure~\ref{fig:MoonEscape}. These trajectories continued with increasing t\_max, to the point where simulation took a very long time, suggesting that they are not simply very large orbits.
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/10.png} \includegraphics[width=1\linewidth]{Images/10.png}
\caption{Moon escaping the earths orbit} \caption{Moon escaping the earths orbit}\label{fig:MoonEscape}
\label{fig:MoonEscape}
\end{figure} \end{figure}
This can be compared with what we would expect using the escape velocity equation, which is given by This can be compared with what we would expect using the escape velocity equation, which is given by
\begin{equation} \begin{equation}
@ -170,32 +167,28 @@ As we find the velocity for a circular orbit by balancing centripetal and gravit
v=\sqrt{\frac{GM}{R}} v=\sqrt{\frac{GM}{R}}
\label{eq:Velocity} \label{eq:Velocity}
\end{equation} \end{equation}
We can see that the difference between equation \ref{eq:Escape} and equation \ref{eq:Velocity} is simply a factor of $\sqrt 2$, or 1.414, so our model holds well with what we would expect. We can see that the difference between equation~\ref{eq:Escape} and equation~\ref{eq:Velocity} is simply a factor of $\sqrt 2$, or 1.414, so our model holds well with what we would expect.
\subsection{Lunar Probe} \subsection{Lunar Probe}
For standard starting values for section 2, we again see the moon in a stable circular orbit around the earth, and the probe forms a stable orbit around the moon as well, as shown in figure \ref{fig:ProbeCircular} For standard starting values for section 2, we again see the moon in a stable circular orbit around the earth, and the probe forms a stable orbit around the moon as well, as shown in figure~\ref{fig:ProbeCircular}
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/11.png} \includegraphics[width=1\linewidth]{Images/11.png}
\caption{Circular orbit of moon and probe} \caption{Circular orbit of moon and probe}\label{fig:ProbeCircular}
\label{fig:ProbeCircular}
\end{figure} \end{figure}
When altering the initial velocity of the moon, for small changes we again see stable elliptical orbits. With increases above 1.41*v, causing the moon to escape the earth, the probe continues to orbit the moon in a stable manner, as shown in figure \ref{fig:ProbeBigEscape} When altering the initial velocity of the moon, for small changes we again see stable elliptical orbits. With increases above 1.41*v, causing the moon to escape the earth, the probe continues to orbit the moon in a stable manner, as shown in figure~\ref{fig:ProbeBigEscape}
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/12.png} \includegraphics[width=1\linewidth]{Images/12.png}
\caption{Moon and probe escaping the earth} \caption{Moon and probe escaping the earth}\label{fig:ProbeBigEscape}
\label{fig:ProbeBigEscape}
\end{figure} \end{figure}
When we decrease the starting velocity of the moon, it continues in a stable orbit, however when reaching the periapsis of the moons orbit, the probe is accelerated enough to escape the orbit of both the moon and the earth, as shown in figure\ref{fig:ProbeSmallEscape} When we decrease the starting velocity of the moon, it continues in a stable orbit, however when reaching the periapsis of the moons orbit, the probe is accelerated enough to escape the orbit of both the moon and the earth, as shown in figure\ref{fig:ProbeSmallEscape}
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/13.png} \includegraphics[width=1\linewidth]{Images/13.png}
\caption{Probe escaping the moon} \caption{Probe escaping the moon}\label{fig:ProbeSmallEscape}
\label{fig:ProbeSmallEscape}
\end{figure} \end{figure}
The point at which the probe escapes the moon can be increased by changing the direction of the probes orbit around the moon, simply by setting vpy0 = vm-vpm, rather than vm+vpm. Now, when the probe escapes the orbit of the moon, it is still gravitationally bound to the earth and enters an erratic orbit around it, shown in figure \ref{fig:ProbeEarth} The point at which the probe escapes the moon can be increased by changing the direction of the probes orbit around the moon, simply by setting vpy0 = vm-vpm, rather than vm+vpm. Now, when the probe escapes the orbit of the moon, it is still gravitationally bound to the earth and enters an erratic orbit around it, shown in figure~\ref{fig:ProbeEarth}
\begin{figure} \begin{figure}
\includegraphics[width=1\linewidth]{Images/14.png} \includegraphics[width=1\linewidth]{Images/14.png}
\caption{Probe escaping the moon and entering an orbit around the earth} \caption{Probe escaping the moon and entering an orbit around the earth}\label{fig:ProbeEarth}
\label{fig:ProbeEarth}
\end{figure} \end{figure}
\section{Conclusion} \section{Conclusion}