Orbital motion

This exercise explores the motion of a particle in a spherical Coulomb potential. The equations of motion are similar to those for a planet orbiting the sun: the radial acceleration varies inversely with the square of the distance. Or, we could be simulating a classical hydrogen atom. ORIGIN 1  This specifies that the vector components are numbered 1, 2 and 3 and not 0, 1, and 2. Pick starting X and V vectors and a starting time. X 0 1 0          V 0.75 0 0          t 0  We start at y = 1 on the y axis where x and z are zero. The starting velocity is in the x direction so that we will orbit in the x,y plane. We will stack the X and V values and put them into our 6-vector z Z stack X V  ()  x y z Vx Vy Vz Z 0 1 0 0.75 0 0                  The next two submatrix definitions let us recover X and V from the stack Z for plotting: X Z () submatrix Z 1  3  1  1  ()  V Z () submatrix Z 4  6  1  1  ()  We do this because it is easier to remember X and V than to remember the components of Z. We must have a 6-vector Z because the Runge-Kutta routine must have everything it needs in one variable. The force will vary as 1/r 2. The square of the radius is simply the dot product of X with itself. The force in the x direction is the radial force multiplied by x/r. The radial acceleration will be C/r 2 with C selected as: C 1   The x acceleration, for example, is a x C r 2 x r   which is the same as C Z 1 