Docsity

Physics 113 Recitation: Modeling Earth-Sun System & Two-Body Interaction, Assignments of Physics

Toggle sidebar
bg1
PHYSICS 113 – Recitation Assignment 3
Name
Recitation Assignment # 3 – The Two-Body Problem
October 10, 2007
Today’s recitation will involve the general form of gravity, and, in particular, you will show using
a computer that two bodies will orbit one another in an elliptical orbit. Moreover, you will use
numerics to determine the optimal speed for a particle traveling in a circular orbit. Note, for
simplicity, when I use the symbol ⊙, it means “of the sun”, and when I use ⊕, it means, “of the
earth.”
You may complete this in class. However, if you are unable to do so, it is expected that you
complete this for recitation next time. Remember to email both programs to Travis when you are
done, and be sure to put your name in as a comment in both.
It is also strongly recommended that you test your code after each step in the process.
If you have any questions, please ask.
New Concepts:
Physical
•Central gravity
•Two body interaction
Computational
•Nested Loops
•Lists of objects
Part I
In the first part of the assignment, we will model the earth-sun system. Since the sun is much more
massive than the earth, we will be able to make the assumption that the sun is stationary.
1. Log into a workstation, pull up firefox, make yourself comfortable, etc.
2. In your “contemporary1” directory (or whatever you’ve chosen to call it), create a new pro-
gram using emacs called “prog3a.py”.
3. As with all of your python programs which use graphics, you will want:
from visual import *
at the top.
pf3
pf4

Partial preview of the text

Download Physics 113 Recitation: Modeling Earth-Sun System & Two-Body Interaction and more Assignments Physics in PDF only on Docsity!

PHYSICS 113 – Recitation Assignment 3

Name

Recitation Assignment # 3 – The Two-Body Problem

October 10, 2007

Today’s recitation will involve the general form of gravity, and, in particular, you will show using a computer that two bodies will orbit one another in an elliptical orbit. Moreover, you will use numerics to determine the optimal speed for a particle traveling in a circular orbit. Note, for simplicity, when I use the symbol ⊙, it means “of the sun”, and when I use ⊕, it means, “of the earth.”

You may complete this in class. However, if you are unable to do so, it is expected that you complete this for recitation next time. Remember to email both programs to Travis when you are done, and be sure to put your name in as a comment in both.

It is also strongly recommended that you test your code after each step in the process.

If you have any questions, please ask.

New Concepts:

Physical

  • Central gravity
  • Two body interaction

Computational

  • Nested Loops
  • Lists of objects

Part I

In the first part of the assignment, we will model the earth-sun system. Since the sun is much more massive than the earth, we will be able to make the assumption that the sun is stationary.

  1. Log into a workstation, pull up firefox, make yourself comfortable, etc.
  2. In your “contemporary1” directory (or whatever you’ve chosen to call it), create a new pro- gram using emacs called “prog3a.py”.
  3. As with all of your python programs which use graphics, you will want:

from visual import *

at the top.

  1. Create two spheres. Make one yellow, and at the origin, and the other blue, and at a position
    1. 5 × 101 1m from the central body, and along the x-axis. Also add the following lines to your code:

scene.range=2e scene.autoscale=

The first line makes the viewscreen large enough to see a bit beyond the “orbit” of the earth, and the second command tells the code not to automatically resize the picture if the earth flies out of the field of view. Start by making the radii the true values from our solar system (look this up using google or in your textbook). Too small? Maybe you need to make them bigger.

  1. Here’s where we start to add physics. The sun has a mass of 2 × 1030 kg, and the earth has a mass of 6 × 1024 kg. Set both of these. For example, the mass of the sun can be set by writing: sun.m=2e and similarly for the earth. Give the earth an initial velocity of 35 km/s=35000m/s in the y-direction. However, in general, you should be keeping track of the momentum not the velocity, so you should compute the corresponding momentum as follows This can be done by entering: earth.p=vector(0,35000*earth.m,0)
  2. Remember the relation we discussed in class (in the non-relativistic limit):

∆~r = ~p/m∆t

Well, at each timestep, you have to evolve the position of the earth, according to this formula. Put in the following additions to your code:

yr=3.15e dt=0.02*yr t=

while (t < 2yr) : rate (10) earth.pos=earth.pos+dtearth.p/earth.m t=t+dt

The first three commands tell the code how many seconds there are in a year. The second tells it what the value of ∆t is. The third tells it to “start the clock” at t=0.

  1. As we saw, the earth just flies in a straight line, when, in fact, we know that it moves around the sun. What makes it move? Gravity! The acceleration due to gravity can be expressed as:

F^ ~⊕ = − GM⊙M⊕ r^3 sun−earth

(~r⊕ − ~r⊙)

where G = 6. 67 × 10 −^11 N m 2 kg^2 is the gravitational constant. You should define the force on the earth as:

  1. Instead of writing explicitly, “star[0].p=star[0].p ...” and then the same for star[1], perhaps it would be better to do a loop. Whereever you are doing a calculation on both stars, you’ll want the following:

for mystar in (star): mystar.pos=mystar.pos+mystar.p/star.m*dt

for example, along with any other calculations which need to be done on all stars. Note also that this loop should be “nested” (doubly indented) if it is under the time loop.

  1. Make sure a yellow trail follows star “0” and a blue trail follows star “1”.