PRE-ACTIVITY: Make sure you have gone through the code for Adventure #1 from Day 3 as we will build off this code.

In Adventure #1 you will be disrupting your fake planetary system with another body in 3D. First, we will work on getting a stable system, and then we will try to mess it up with another body in 3D.

Start with the "START HERE" code in the "Code" section down below. This code is the same as the code from Adventure #1, Day 3, however the zeroing of the z-axis positions and velocities is taken out so that you can add a velocity and position in the 3rd dimension. From what we learned yesterday about the stability of orbits, one thing we might want to try is to start off our orbits such that the velocity vectors are perpendicular to our position vectors. The steps are as follows:

  • We know that a vector perpendicular to (x,y) has components (-y,x). So, first we reconstruct our velocity vectors so that have components (-r_y, r_x) for each position vector (r_x, r_y).
  • Then we renormalize each velocity vector such that it has the same magnitude as the original velocity vectors.
  • Play with each initial velocity by changing vx/vy slightly until you have a (fairly) stable orbit.
  • Then add in another body with a position and velocity that includes a z component. Make sure you don't renormalize this as well when you do the above 3 steps for the original stable-ish system!
  • START HERE: Code for plotting orbits in 3D

    Code to calculate and plot 3D orbits. Modify to make initial velocities tangential for the possibility of more stable orbits.

    Super Planet Crash!

    Can you make a stable system?

    Bonus: Orbits Game

    Can you please your alien overlords by building them awesome planetary systems?