Solution of the equations of motion for a particle in a box