# Discrete Integration with an Angular Spring

Trying to simulate an angular spring similar to the one in this image:

I need a way of calculating the change in angle, $\Delta\theta$ between discrete time steps of length $\Delta t$ seconds due to the torque $\tau$ from the spring and damping. I have the following equations:

$\tau = I\alpha \implies \alpha=\frac{\tau}{I}$ (where $\alpha$ is the angular acceleration)

$\tau=(k_s(\theta_t-\theta_0)-k_d(\omega_t-\omega_0))*\hat{h}$

Where $k_s$ and $k_d$ are the spring and damping constants, $\theta_t$ is the angle at the current time step, and $\omega_t$ is angular velocity and the current time step, and $\hat{h}$ is the axis to rotate around.

Using implicit Euler integration (first update the angular velocity, then update the angle):

$\Delta\omega=\Delta t*\alpha$

$\omega_{t+1}=\omega_t+\Delta\omega$

$\Delta\theta=\Delta t*\omega$

$\theta_{t+1}=\theta_t+\Delta\theta$

The problem that I'm running into is the torque $\tau$ is a vector, and $\alpha$, $\omega$, and $\theta$ are scalars. So I think the equation $\alpha=\frac{\tau}{I}$ is missing something.

So how do I apply the torque $\tau$ to calculate the angular acceleration $\alpha$?

All four quantities $\tau$, $\theta$, $\omega$, and $\alpha$ are generally vectors. Their direction is perpendicular to the plane in which they act. The moment of inertia is a tensor. So the actual dynamic equation is $$\vec{\tau} = {\bf I}\, \vec{\alpha}$$ where boldface denotes a tensor.
However, for problems in which all the action is in the same plane, all of the vectors point in the same direction. In that case we have a simple relationships among the components $$\tau_z = I_{zz}\, \omega_z.$$
In such cases this is usually written for typographic simplicity $$\tau = I\,\omega$$
Note that is is a good argument against writing $|\vec{A}| = A$ as many (most?) textbooks do. Writing $|\vec{A}|$ is admittedly more cumbersome, but it removes the ambiguity that can exist when ordinary letters are used both for scalars and for the magnitudes of vectors, and possibly the only non-zero component of a vector.