for the position and velocity
of an individual particle,
where the index
indicates the values for time
and
for
the time
after one more time step has been taken:
. The acceleration induced on a particle by the
gravitational forces of all other particles is indicated by
.
So, all we have to do now is to code it up. By the way, let's rename
the file. Rather than a generic name nbody.C, let's call it
forward_euler1.C.