This week's sets of classical pen and paper and computational exercises are tailored to the topic of two-body problems and central forces. It follows what was discussed during the lectures during week 12 (March 20-24) and week 12 (March 27-31).
The relevant reading background is
The equations of motion in the center-of-mass frame in two dimensions with \( x=r\cos{(\phi)} \) and \( y=r\sin{(\phi)} \) and \( r\in [0,\infty) \), \( \phi\in [0,2\pi] \) and \( r=\sqrt{x^2+y^2} \) are given by
$$ \mu \ddot{r}=-\frac{dV(r)}{dr}+\mu r\dot{\phi}^2, $$and
$$ \dot{\phi}=\frac{L}{\mu r^2}. $$Here \( V(r) \) is any central force which depends only on the relative coordinate.
See the lecture notes on central forces for a discussion of this problem. It is given as an example in the lecture notes (slides from March 20-24) and the lecture text at https://mhjensen.github.io/Physics321/doc/LectureNotes/_build/html/chapter6.html#effective-or-centrifugal-potential.
Consider a particle of mass \( m \) in a \( 2 \)-dimensional harmonic oscillator with potential
$$ V(r)=\frac{1}{2}kr^2=\frac{1}{2}k(x^2+y^2). $$We assume the orbit has a final non-zero angular momentum \( L \). The effective potential looks like that of a harmonic oscillator for large \( r \), but for small \( r \), the centrifugal potential repels the particle from the origin. The combination of the two potentials has a minimum for at some radius \( r_{\rm min} \).
with
$$ \delta=\arctan(\gamma/\beta), $$Using the code we developed in homework 5 or the first midterm (part b), we can solve the above harmonic oscillator problem in two dimensions using our code from this homework. We need however to change the acceleration from the gravitational force to the one given by the harmonic oscillator potential.
The code is given here for the Velocity-Verlet algorithm, with obvious elements to fill in.
# Common imports
import numpy as np
import pandas as pd
from math import *
import matplotlib.pyplot as plt
import os
# Where to save the figures and data files
PROJECT_ROOT_DIR = "Results"
FIGURE_ID = "Results/FigureFiles"
DATA_ID = "DataFiles/"
if not os.path.exists(PROJECT_ROOT_DIR):
os.mkdir(PROJECT_ROOT_DIR)
if not os.path.exists(FIGURE_ID):
os.makedirs(FIGURE_ID)
if not os.path.exists(DATA_ID):
os.makedirs(DATA_ID)
def image_path(fig_id):
return os.path.join(FIGURE_ID, fig_id)
def data_path(dat_id):
return os.path.join(DATA_ID, dat_id)
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
DeltaT = 0.01
#set up arrays
tfinal = 10.0
n = ceil(tfinal/DeltaT)
# set up arrays for t, a, v, and x
t = np.zeros(n)
v = np.zeros((n,2))
r = np.zeros((n,2))
# Initial conditions as compact 2-dimensional arrays
r0 = np.array([1.0,0.5]) # You need to change these to fit rmin
v0 = np.array([0.0,0.0]) # You need to change these to fit rmin
r[0] = r0
v[0] = v0
k = 1.0 # spring constant
m = 1.0 # mass, you can change these
omega02 = k/m
# Start integrating using the Velocity-Verlet method
for i in range(n-1):
# Set up forces, define acceleration first
a = -r[i]*omega02 # you may need to change this
# update velocity, time and position using the Velocity-Verlet method
r[i+1] = r[i] + DeltaT*v[i]+0.5*(DeltaT**2)*a
# new accelerationfor the Verlet method
anew = -r[i+1]*omega02
v[i+1] = v[i] + 0.5*DeltaT*(a+anew)
t[i+1] = t[i] + DeltaT
# Plot position as function of time
fig, ax = plt.subplots()
ax.set_xlabel('t[s]')
ax.set_ylabel('x[m] and y[m]')
ax.plot(t,r[:,0])
ax.plot(t,r[:,1])
fig.tight_layout()
save_fig("2DimHOVV")
plt.show()
Instead of solving the equations in the cartesian frame we will now rewrite the above code in terms of the radial degrees of freedom only. Our differential equation is now
$$ \mu \ddot{r}=-\frac{dV(r)}{dr}+\mu r\dot{\phi}^2, $$and
$$ \dot{\phi}=\frac{L}{\mu r^2}. $$Consider an ellipse defined by the sum of the distances from the two foci being \( 2D \), which expressed in a Cartesian coordinates with the middle of the ellipse being at the origin becomes
$$ \sqrt{(x-a)^2+y^2}+\sqrt{(x+a)^2+y^2}=2D. $$Here the two foci are at \( (a,0) \) and \( (-a,0) \). Show that this form is can be written as
$$ \frac{x^2}{D^2}+\frac{y^2}{D^2-a^2}=1. $$This bonus exercise gives you an additional score of 20pt.
Make a class called Solvers which contains the following:
oAt least three class level variables
The class may also contain any other methods or class level variables that you think are needed.
Make then a function (outside of the class Solver) that solves the Earth-Sun problem using the Solvers class (Exercise 6 from Homework 5).
The following gives you an opportunity to earn five extra credit points on each of the remaining homeworks and ten extra credit points on the midterms and finals. This assignment also covers an aspect of the scientific process that is not taught in most undergraduate programs: scientific writing. Writing scientific reports is how scientist communicate their results to the rest of the field. Knowing how to assemble a well written scientific report will greatly benefit you in you upper level classes, in graduate school, and in the work place.
The full information on extra credits is found at https://github.com/mhjensen/Physics321/blob/master/doc/Homeworks/ExtraCredits/. There you will also find examples on how to write a scientific article. Below you can also find a description on how to gain extra credits by attending scientific talks.
This assignment allows you to gain extra credit points by practicing your scientific writing. For each of the remaining homeworks you can submit the specified section of a scientific report (written about the numerical aspect of the homework) for five extra credit points on the assignment. For the two midterms and the final, submitting a full scientific report covering the numerical analysis problem will be worth ten extra points. For credit the grader must be able to tell that you put effort into the assignment (i.e. well written, well formatted, etc.). If you are unfamiliar with writing scientific reports, see the information here
The following table explains what aspect of a scientific report is due with which homework. You can submit the assignment in any format you like, in the same document as your homework, or in a different one. Remember to cite any external references you use and include a reference list. There are no length requirements, but make sure what you turn in is complete and through. If you have any questions, please contact us.
HW/Project | Due Date | Extra Credit Assignment |
---|---|---|
HW 3 | 2-8 | Abstract |
HW 4 | 2-15 | Introduction |
HW 5 | 2-22 | Methods |
HW 6 | 3-1 | Results and Discussion |
Midterm 1 | 3-12 | Full Written Report |
HW 7 | 3-22 | Abstract |
HW 8 | 3-29 | Introduction |
HW 9 | 4-5 | Results and Discussion |
Midterm 2 | 4-16 | Full Written Report |
HW 10 | 4-26 | Abstract |
Final | 4-30 | Full Written Report |
You can also gain extra credits if you attend scientific talks. This is described here.
This opportunity will allow you to earn up to 5 extra credit points on a Homework per week. These points can push you above 100% or help make up for missed exercises. In order to earn all points you must:
Approved talks: Talks given by researchers through the following clubs:
All the material on extra credits is at https://github.com/mhjensen/Physics321/blob/master/doc/Homeworks/ExtraCredits/.