I am writing a python script which calculates the final velocity of a ball after colliding with the wall of the container. The entire system is in 2D. The collisions are elastic, and the balls are all circles with radius = 1 and mass = 1. The container is basically a large ball of radius 10, and obviously all the balls are contained within this container.

I already have a formula which calculates the final velocity of the ball after it collides with another ball, but I can't figure out or find an angle-free formula for the collision of a ball against the container wall.

The formula I am using for the ball-to-ball collisions comes from Wikipedia: from https://en.wikipedia.org/wiki/Elastic_collision

v'_1 is the final velocity of the ball and v_1 is the initial velocity. Given that the masses of ball 1 and 2 are the same, the maths term in the front cancels out.

I don't think these formula work for a collision between the ball and the container wall, as the balls are inside of the container. So essentially, I am asking if there is an angle-free (vector) equation that describes this situation.

Currently, my script for working out the velocity follows this logic, but I do not think it works beyond the ball's first collision with the wall? enter image description here

Thanks, Sid


1 Answer 1


The general (vector) formula you are looking for can be simply derived from the condition of elastic collision against a (locally) flat wall characterized by a normal unit vector ${\bf \hat n}$: $$ \begin{align} {\bf v'}_{\parallel}&={\bf v}_{\parallel}\\ {\bf v'}_{\perp}&=-{\bf v}_{\perp}, \end{align} $$ where the subscript $_{\parallel}$ indicates the component of a vector parallel to the wall and $_{\perp}$ indicates the component perpendicular to the wall. In practice, $$ \begin{align} {\bf v}_{\perp}&=({\bf \hat n}\cdot{\bf v})~{\bf \hat n}\\ {\bf v}_{\parallel}&={\bf v}-{\bf v}_{\perp}. \end{align} $$ With these formulas, it is possible to deal with any kind of wall, not necessarily flat, provided the equation of the surface is available, and one can evaluate the components of the normal vector.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.