# Formulas for ball rolling in a bowl?

I'm developing a program where I've a ball/sphere rolling in a bowl from the side at top, till the center at bottom, and I'm trying to get the formulas for:

• The rotation angle and the position of the sphere, depending on the starting angle measured in radians (0.000 - 6.283), the current seconds and the maximum seconds that the ball will keep rotating and considering its deccelerated.

All I knew about the needed physics is almost already forgotten, and I'm getting horrible headaches to get a properly working formula, so hope anyone can help me.

-
Are You shure that the ball is "rotating" in that bowl, or does it roll similar to the ball in a roulette? – Georg Jun 5 '11 at 17:38
then its more like rolling (mistake was because in 3d its said as tranlation/rotation/scale), thanks for the point! ;) – Dane411 Jun 5 '11 at 17:57
it depends on the shape of the bowl. I also am not sure what you mean by "starting angle measured in radians". Angle of what? The phrase "and the maximum second that the ball will keep rotating and considering its deccelerated" also needs clarification. Do you mean that you want to know when the ball will come to a stop? – Mark Eichenlaub Jun 5 '11 at 18:04
Lets move to the roulette example as Georg said, as it's more clear: It would be like the roulette wheel starting angle, realtive to last spin, so that a spin with a different starting angle and same acceleration/speed would give a different result. About the seconds, yes, I mean it will decelerate according to the seconds remaining :) – Dane411 Jun 5 '11 at 18:18
Knowing a bit more about your background will help people to pitch answers at the right level. Are you familiar / comfortable with vector calculus? In what language are you attempting to program it in? How experienced with that language are you? – qftme Jun 6 '11 at 14:27

If I understand the problem correctly there is a bowl (like a large salad bowl) and a ball rolling inside of it under the influence of gravity. Here is how to derive the equations of motion. I parametrize the position of the ball center using the quasi-coordinates $q_1$ and $q_2$ as: $$\vec{r}(q_1,q_2) = [0,0,R]-{\rm Rot}_{X}(q_{1})\cdot{\rm Rot}_{Y}(q_{2})\cdot[0,0,R]$$

where $R$ is the radius of the bowl minus the radius of the ball, equals the pitch radius of motion. My coordinate system has the bowl laying on the $x$-$y$ plane and up being the +$z$ direction. ${\rm Rot}_X()$ and ${\rm Rot}_Y()$ are the $3\times3$ rotation matrices respectively.

Differentiating I get the velocity vector of the center of gravity $$\vec{v}=\begin{bmatrix}0 & \cos q_{2}\\ \cos q_{2}\cos q_{1} & -\sin q_{2}\sin q_{1}\\ \cos q_{2}\sin q_{1} & \sin q_{2}\cos q_{1}\end{bmatrix}\begin{bmatrix}R\,\dot{q}_{1}\\ R\,\dot{q}_{2}\end{bmatrix}$$

and differentiating again, I get the acceleration of the c.o.g. $$\vec{a}=\begin{bmatrix}0 & \cos q_{2}\\ \cos q_{2}\cos q_{1} & -\sin q_{2}\sin q_{1}\\ \cos q_{2}\sin q_{1} & \sin q_{2}\cos q_{1}\end{bmatrix}\begin{bmatrix}R\,\ddot{q}_{1}\\ R\,\ddot{q}_{2}\end{bmatrix}+\begin{bmatrix}R\sin q_{2}\,\dot{q}_{2}^{2}\\ \mbox{-}R(\dot{q}_{1}^{2}+\dot{q}_{2}^{2})\cos q_{2}\sin q_{1}-2R\dot{q}_{1}\dot{q}_{2}\sin q_{2}\cos q_{1}\\ R(\dot{q}_{1}^{2}+\dot{q}_{2}^{2})\cos q_{2}\cos q_{1}-2R\dot{q}_{1}\dot{q}_{2}\sin q_{2}\sin q_{1}\end{bmatrix}$$

Now for the fun part. The forces acting on the ball are gravity $\vec{W}=[0,0,-m\,g]$ and the contact force $$\vec{N}=F\,\begin{bmatrix}\sin q_{2}\\ \cos q_{2}\sin q_{1}\\ \cos q_{2}\cos q_{1}\end{bmatrix}$$ where $F$ is the magnitude of the force (unknown), $m$ is the mass of the ball and $g$ is acceleration of gravity.

To verify that $\vec{N}$ is a reaction force check with $\vec{N}\cdot\vec{v}=0$, thus providing zero power to the system.

The equations of motion (ignoring the rotational components and friction) are $$\vec{W}+\vec{N} = m\;\vec{a}$$ The solution of which yields $F$, $\ddot{q}_2$ and $\ddot{q}_2$ as

$$\ddot{q}_{1}=2\dot{q}_{1}\dot{q}_{2}\tan q_{2}-\frac{g}{R}\,\frac{\sin q_{1}}{\cos q_{2}}$$ $$\ddot{q}_{2}=\mbox{-}\dot{q}_{1}^{2}\sin q_{2}\cos q_{1}-\frac{g}{R}\,\sin q_{2}\cos q_{1}$$ $$F=m\, g\,\cos q_{2}\cos q_{1}+R\, m\,\left(\dot{q}_{1}^{2}\cos^{2}q_{2}+\dot{q}_{2}^{2}\right)$$

Whats left to be done, is put it through a numerical integrator scheme like Runge-Kutta [1] [2] and watch the variables $q_1$ and $q_2$ evolve over time.

To add friction, add a component of force in the direction opposite of $\vec{v}$ with magnitude $\mu\,F$ where $\mu$ is the coefficient of friction (like 0.02-0.10 for rolling).

-
As you can see even a Basic problem (as stated in title) is quite involved to solve. – ja72 Jun 8 '11 at 4:34
Thank you! I wish I could know just the half of it, I understand it but don't know to be able to reproduce it again. Your answers despite being so impresive, isn't what I'm looking for, since its calculus consumes high CPU time (cos/sin/square/...), usually for complex calculus it's done by an approach which may not be a real formula based on physics or math laws, but which works as it should. :) – Dane411 Jun 10 '11 at 3:16

There are several ways you could do this. Below I will outline a couple of possible approaches, but it may be that a simpler / more elegant solution exists. Here are my 2cents nonetheless.

Firstly, it would be a lot easier if you first consider the motion of a zero-radius ball and worry about making it bigger and appearing as if it's 'rolling' later on. Here's how I think you could approach the motion of a zero-radius ball, in the bowl.

You would need to program time-evolution equations of motion for each of the three dimensions individually. You could do this in your choice of coordinate system. For the geometry of the apperatus you are trying to model, I think cylindrical coordinates $(r,\theta,z)$ would be easier than cartesian coordinates $(x,y,z)$. In which case, you would need just a circular motion equation (relating $r$ and $\theta$ with time,) with the addition of a resistive term to simulate the energy loss and therefore reduction of the 'orbital' radius. The fall in $z$ could then be determined from the (varying) $r$-value with respect to the geometry of your bowl. I.e. A smaller radial position corresponds to a position nearer the centre of the bowl and therefore a lower height.

In cartesian coordinates you would probably need a damped harmonic oscillator equation for each of the $x$- and $y$-coordinates. The change in $z$ could then be determined in the some way as above.

Alternatively, as opposed to having an educated guess at the equations of motion as described above, you could derive them 'from scratch' by considering the potential and kinetic energy exchange (again for each coordinate individually.) If you did this in a vector formalism (using the coordinate system of your choice) you would just have to solve the equations for the velocity $\vec{v}(t)$, then integrate to find the position $\vec{x}(t)$. Again though, you would also need an additional term to account for the loss of energy due to friction. (Otherwise the ball's speed will not decay and therefore neither will its 'orbit'.)

Once you've got your dynamics set up for the motion of a zero-radius ball (a point I guess,) you can then program a modification to adjust how the ball is displayed so that it looks like an object of the desired size. One option would be (for a ball of radius r) to display the point as moving around a constant distance r higher than the surface of the bowl, then program a few lines to depict the ball as an object extended by the distance r around the point. How complex this gets depends on how realistic you want it to appear.

Edit: In your question you refer to "rotation angle" and "position" - if I understand you correctly, you mean the initial position and velocity of the ball. These values would be put in by the programmer or program user as initial conditions, after which the dynamics equations would evolve the system.

-
thanks for the quick reply! I'm currently working on it and looks like your answer is leading me to the solution, may post some doubts later :] – Dane411 Jun 8 '11 at 19:06
@Dane: Your welcome. Glad I could help :-) – qftme Jun 9 '11 at 14:01
@Dane: See also this question physics.stackexchange.com/questions/11227/… – qftme Jun 18 '11 at 15:01