Periodic
boundaries are only slightly more
difficult to implement. We require that the value of the function be calculated
as if the ends were tied together. The wave at one endpoint is
calculated as if it had the other endpoint as its nearest neighbor.
This boundary condition is coded by using two ``extra" grid points that
have x coordinates just outside the
medium. These extra grid points are updated
to the values at the opposite boundary after every time step
but they are not displayed on the screen.