Let's make nice things

If a tree falls in the forest...

If science is done and no one knows about it...

We have to communicate our work as scientists. When it comes times to write a paper that shares your glorious scientific achievements with the world, there are some conventions that your audience expects. If you deviate significantly from those, you run the risk of not having your voice heard (or not getting the job, or paper accepted, etc).

So, in physics, the default method for document preparation involves using the typesetting framework Latex. (often written as $\LaTeX$ and pronounced LAY-tek.) It differs from Word and Google Docs in that you are really writing a small computer program that gets interpreted by a Latex compiler, which then produces the final output.

Nearly everything you would see on the (arXiv) is prepared using Latex. (The arXiv is a place where physicists and astronomers share their work)

An easy way to get started is by using Overleaf (https://www.overleaf.com/) , a free online, browser based Latex compiler.

We looked at the simple document I made that has a few of the important parts of a lab report: words/math/figures/references.

Here is the raw latex code that I used. (It will work if you copy and paste the code below into a new overleaf project, expect you need to supply your own figure)



\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{hyperref}


\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = blue, %Colour for external hyperlinks
  linkcolor    = blue, %Colour of internal links
  citecolor   = red %Colour of citations
}
\geometry{letterpaper, margin=1in}

\usepackage{listings}
\usepackage{xcolor}

\definecolor{codegray}{rgb}{0.9,0.9,0.9}

\lstdefinestyle{labreportstyle}{
    backgroundcolor=\color{codegray},   
    basicstyle=\ttfamily\footnotesize,    
}

\lstset{style=labreportstyle}


\usepackage{wrapfig}

\title{Exp 0: On Falling Bodies \\ PHYS 37100}
\author{Dr. James Hedberg }
\date{August 29, 2022}

\begin{document}
\maketitle

\begin{abstract}
What happens when objects fall? In this experiment we investigate the physics of point masses under the influence of a uniform gravitational field. 
\end{abstract}

\section{Introduction}

The force of gravity between two objects, $m_1$ and $m_2$ is given by:

\begin{equation}
    F_G = G\frac{m_1 m_2}{R^2}
\end{equation}
where $G$ is the Universal Gravitational Constant, $m_1$ and $m_2$ are the two masses, and $R$ is the distance between the two masses. In the case of a point-like mass near the surface of the Earth, this equation becomes:

\begin{equation}
    F_G = G\frac{m_E m}{R_E^2}
\end{equation}
where $m_E$ is the mass of the Earth ($5.972 \times 10^{24} \; \textrm{kg}$), $m$ is the point mass and $R_E$ is the (average) radius of the Earth ($6.371 \times 10^{6} \; \textrm{m}$)

In the absence of drag forces, we can assume this is the only force acting on the mass as it falls, thus with Newton's 2\textsuperscript{nd} Law, we can write:

\begin{equation}
    \Sigma F = G\frac{m_E m}{R_E^2} = m a
\end{equation}
where $a$ is the acceleration of the mass.

Solving for $a$ using the values quoted above leads to:

\begin{equation}
    a = G\frac{m_E}{R_E} = 9.8 \; \rm{m/s^2}
\end{equation}

Thus, we can say that any mass in this situation should accelerate towards the Earth at a rate of $g=9.8$ m/s\textsuperscript{2}. 

\section{The Physics}



We can calculate the velocity at a time $t$ by using:
\begin{equation}
    v(t) = g t 
\end{equation}
Integrating this result to obtain the position:

\begin{equation}
    y = g \int_0^t t \; dt = \frac{1}{2}gt^2
\end{equation}

\begin{figure}[h!]
    \centering
    \includegraphics[width=.4\textwidth]{figures/example-plot-2.png}
    \caption{A plot of a ball falling with constant acceleration}
    \label{fig:freefall}
\end{figure}



As we see in figure \ref{fig:freefall}, the velocity is a linear line while the position is a parabolic curve, as expected\cite{newton1}.

\section{Code/Data}

The code that was used to generate some example data. (note the listings package in the preamble)

\begin{lstlisting}[language=Python]
import numpy as np

time = np.linspace(0, 10, 10)
a = 9.8
speed = a*time
position = 0.5*a*np.square(time)

\end{lstlisting}

Not included here is the plot commands, because they are boring and not very relavent. But the entire script is available at this \href{https://colab.research.google.com/drive/19QiMkQWF-p32LOEemegebi-eb-Ub1x9l?usp=sharing}{Colab Notebook.}

We can present some of our data in a table form if that's helpful too.

\begin{center}
\begin{tabular}{||c | c c c||} 
 \hline
 Time [s] & Speed [m/s] & Position [m] & \\ [0.5ex] 
 \hline
 0 & 0 & 0 & \\ 
 \hline
 1 & 9.8 & 4.9 & \\
 \hline
 2 & 19.6 & 19.6 & \\
 \hline
 3 & 29.4 & 44.1 & \\
 \hline
\end{tabular}
\end{center}

We don't need to reproduce our entire data set here, but the rest can be found at our online repository. 

\section{Other things}

\begin{wrapfigure}{r}{0.2\textwidth}
    \centering
    \includegraphics[width=0.2\textwidth]{figures/Traian_vuia_flying_machine.jpg}
    \caption{An early experimenter. This figure is in the Public Domain.}
\end{wrapfigure}

You can include links like this one here. (note the \texttt{hyperref} package in the preamble)

The 371 Course Page: \href{https://hedberg.ccnysites.cuny.edu/PHYS371/}{Course Page}.

Or make smaller, wrapped figures using the \texttt{wrapfig} package. In general images can be a little tricky to get just right. You can adjust the size by playing with the width control.

For a more thorough guide, see this \href{https://www.overleaf.com/learn/latex/Inserting_Images}{help page}.

%Sometimes you'll just have to do silly things like 
%this to get the spacing right.
\bigskip
\bigskip
\bigskip
\bigskip
\bigskip
\bigskip


\begin{thebibliography}{9}

\bibitem{newton1}
Newton, Isaac \emph{Principia - The mathematical principles of natural philosophy.}, 1687.

\end{thebibliography}

\end{document}




The above code will create the following document when compiled.

You can look at the project here: OverLeaf Link

And, it's of course readily downloadable as a pdf file: Lab Report Example PDF