Please write down the code you sued to calculate velocity v.
You applet did not support v=0. But my previous applet does.