.. Created by Adam Cunnningham on Fri Jun 3 2016. .. |M1| replace:: M\ :sub:`1` .. |M2| replace:: M\ :sub:`2` .. |R1| replace:: R\ :sub:`1` .. |R2| replace:: R\ :sub:`2` .. |x1| replace:: x\ :sub:`1` .. |x2| replace:: x\ :sub:`2` .. |y1| replace:: y\ :sub:`1` .. |y2| replace:: y\ :sub:`2` **Tatooine** ============ Report Description ------------------ The report consists of the following exercises. **Exercise 1. Solve the Equations of Motion** Develop a program using Heun's method to simulate the dynamics of the Kelper-453b system, incorporating two stars. **Exercise 2. Plot Trajectories** Generate trajectories for the planet under a range of conditions to see what kind of orbits exist. By "a range of conditions", we mean that the initial positions and velocities of the planet should be changed to observe the effect on the orbit. **Exercise 3. Find Closest Stable Orbit** Find an orbit as close as possible to the pair of stars that still seems stable. This can be done by moving the initial position of the planet closer to the suns, and seeing what happens. **Exercise 4. Animate the Trajectory** Visualize the trajectory generated by adding animation to the simulation code. **Exercise 5. Explore Unequal Masses (Optional)** Explore some trajectories with unequal masses and see the effect on stability. The article on the website states that The larger star, Kepler-453A, is similar to our own Sun, containing 94% as much mass, while the smaller star, Kepler-453B, contains 20% as much mass ... These masses might be an interesting place to start, scaled so that they sum to 1. Hints and Suggestions for the Report ------------------------------------ - Write a ``calculate_orbit`` function to calculate the state of the planet for a given number of time steps. - Write a ``plot_orbit`` function which calls ``calculate_orbit`` to calculate the orbit, then plots the result. - Call ``plot_orbit`` with different arguments to generate different trajectories. Incorporating Two Suns into the Simulation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The first simulation developed in class included a single sun located at the origin. It was assumed that the mass of the sun (M) was so much greater than that of the planet that the sun could be considered as stationary. With two suns, this is no longer the case, and the changing positions of the suns needs to be taken into account. We could compute the motion of the two suns by solving the differential equations that are Newton's Laws. However, this is an unnecessary complication. Instead, we'll treat the motion of the suns as a "solved" problem. The solution is that they both move in a circular orbit about their collective center of mass. - Assume that the two suns are of mass |M1| and |M2|, with |M1| + |M2| = 1. For simplicity, let |M1| = |M2| = 0.5. - Let the suns be one unit apart, with positions (|x1|, |y1|) and (|x2|, |y2|). Again for simplicity, let the center of mass be located at the origin. The distance of the first sun from the origin is |R1| and the distance of the second sun from the origin is |R2|. - Assuming an angular velocity of 1, then the positions of the suns are given by: - If |M1| = |M2| = 0.5, then |R1| = |R2| = 0.5. So, this gives us a way to compute exactly the positions of the suns at time t. Incorporating Two Suns into the Animation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The main difference here is that the suns are now moving, rather than stationary. - The suns are now drawn objects that get updated during the animation. - These drawn objects need to be created at the same time as *point* and *line*. - They need to be initialized inside ``init``. - The data in these objects needs to be updated inside ``animate``. - To be redrawn, they need to be returned from both ``init`` and ``animate``. The Effect of Two Suns on the Planet ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The main difference will be in the ``dP_dt`` function. This needs to be changed to take into account the positions and masses of the two suns. Forces simply add, so: - Modify the ``dP_dt`` function to include *two* forces, once towards each sun. - Replace the x and y terms used to calculate ax and ay by x - |x1|, y - |y1| for the first sun and x - |x2|, y - |y2| for the second sun.