03-B Binary Star System

Consider a hypothetical binary star system consisting of two stars with masses, radii, and initial positions and velocities given by

Star Mass Radius Initial Position Initial Velocity
1 \(m_1 = 6 \times 10^{30}\) kg \(R_1 = 2 \times 10^{10}\) m \(\vec{r}_1 = \langle 0, -8, 0 \rangle \times 10^{10} \) m \(\vec{v}_1 = \langle 1.1, 0, 0 \rangle \times 10^4\) m/s
2 \(m_2 = 2 \times 10^{30}\) kg \(R_2 = 1 \times 10^{10}\) m \(\vec{r}_2= \langle 0, 12, 0 \rangle \times 10^{10} \) m ?? unknown ??

First, find (analytically, i.e. on paper) the following quantities that you will need to complete the program:

  • the position of the center of mass of the system, and
  • the initial velocity of star 2 under the condition that the center of mass of the system is at rest.

The code below is starter code that will model the above situation.  To complete this code you will need to:

  1. Define values for the initial velocities of each star star1.v and star2.v.
  2. Define values for the initial momenta of each star star1.p and star2.p.
  3. Inside the loop:
    • Compute the position (r) of star 2 relative to star 1.
    • Compute the force (F) on star 2 by star 1. This will depend on the masses of the stars star1.m and star2.m and their separation vector r.
    • Use the force F to update the momentum of each star.
    • Use the new momenta values to update the position of each star.
    • Redraw the “CM” label (cm.pos) for the center of mass based on the new star positions star1.pos and star2.pos. The center-of-mass should not move if you’ve done things correctly.
# Binary Star System

# set showAxes to True to display labeled coordinate axes  
showAxes = True

# Define Constants
G = 6.7e-11                 # Newton's gravitational constant

r1 = vector(0,-8e10,0)      # Initial Position of Star 1 (m)
r2 = vector(0,12e10,0)      # Initial Position of Star 2 (m)

# Define sphere objects for each star
star1 = sphere(pos=r1, radius=2e10, color=color.red, make_trail=True, trail_type="points", interval=10, retain=50)
star2 = sphere(pos=r2, radius=1e10, color=color.yellow, make_trail=True, interval=10, retain=50)

# Define the masses of the stars
star1.m = 6e30                   # Mass of Star 1 (kg)
star2.m = 2e30                   # Mass of Star 2 (kg)

####################################################################
#                                                                  #
# Define initial velocities (.v) and momenta (.p) of each star.    #
#                                                                  #
####################################################################


####################################################################
#                                                                  #
# Add command to draw the CM label in the correct location (.pos). #
#    Without this command, the center of mass will be shown        #
#    incorrectly at the origin of the coordinate system.           #
#                                                                  #
####################################################################
cm = label(text="CM", box=0, color=color.green)

# Display a set of coordinate axes
if showAxes:
    L = 25e10                       # adjust length of axes as needed     

    r = L*0.005                     # thickness of axes 
    o = 0.3                         # opacity of axes 
    axiscolor=color.white           # color of axes 

    xaxis=cylinder(pos= vector(0,0,0),axis=vector(L,0,0),radius=r,opacity=o,color=axiscolor)
    xarrow=cone(pos= xaxis.axis,axis=vector(5*r,0,0),radius=2*r,opacity=o,color=axiscolor)

    yaxis=cylinder(pos=vector(0,0,0),axis=vector(0,L,0),radius=r,opacity=o,color=axiscolor)
    yarrow=cone(pos= yaxis.axis,axis=vector(0,5*r,0),radius=2*r,opacity=o,color=axiscolor)

    zaxis=cylinder(pos=vector(0,0,0),axis=vector(0,0,L),radius=r,opacity=o,color=axiscolor)
    zarrow=cone(pos= zaxis.axis,axis=vector(0,0,5*r),radius=2*r,opacity=o,color=axiscolor)

    label(pos=vector(xarrow.pos.x+xarrow.axis.x+3*r,0,0),text='x',box=0,opacity=0,color=axiscolor)
    label(pos=vector(0,yarrow.pos.y+yarrow.axis.y+3*r,0),text='y',box=0,opacity=0,color=axiscolor)
    label(pos=vector(0,0,zarrow.pos.z+zarrow.axis.z+3*r),text='z',box=0,opacity=0,color=axiscolor)

dt = 4e4                    # Time Step (seconds)

while True:
    rate(200)
    
    # Find the position of star2 relative to star 1, call it r
    
    
    # Compute the Force on star 2 by star 1, call it F
    
    
    # Apply the Momentum Principle to update the momenta of both star 1 and star 2
    
    
    
    # Update each Star's position 
    
    
    
    # Update the Center of Mass label position