I'm trying to compute the turning number of a closed plane curve, which should be a really straight forward computation. But my result is not a whole number, i.e. the total curvature is not a multiple of $2\pi$, which is impossible so I'm making a mistake somewhere. I know from plotting the curve that the turning number should be $-2$. I've been looking for hours but cannot seem to find it. Maybe someone can spot the mistake... Here is my work:
Let $\beta(t) = ((1+2\cos(t))\sin(t), (1+2\cos(t))\cos(t))$ be a regular closed plane curve. To compute the turning number $n_{\beta}$ I want to use the following:
$$n_{\beta} = \frac{1}{2\pi}\int_{0}^{L}K_{\beta}(t)dt\, ,$$
where $L$ is the period of $\beta$ and $K_{\beta}(t)$ is the curvature. I can compute the curvature like this:
$$K_{\beta} = \frac{1}{||\dot{\beta}(t)||^3}\cdot\det({\dot{\beta}(t), \ddot{\beta}(t)})$$
Computations:
$$\dot{\beta}(t) = (\cos t + 2\cos 2t, -\sin t -2\sin 2t)$$ $$\ddot{\beta}(t) = (-\sin t - 4 \sin 2t, -\cos t - 4 \cos 2t)$$ $$||\dot{\beta}(t))|| = (4\cos t + 5)^{1/2}$$ $$\det({\dot{\beta}(t),\ddot{\beta}(t)}) = -6 \cos t - 9$$
This is giving me the curvature
$$K_{\beta}(t) = \frac{-6 \cos t -9}{(4 \cos t + 5)^{3/2}}$$
At this point I integrated the curvature with the help of Wolframalpha, which did it numerically but I'm pretty sure it's $-2\pi-1$, when from the picture it should be $-4\pi$. Oddly enough, if I integrate the curvature without the power of $\frac{3}{2}$ in the denominator i actually get the correct result. Can anyone help me spot my mistake? Thanks a lot!
Edit: Here's a link to see the graph: https://www.desmos.com/calculator/vcxbpj2ios

I found my mistake! Posting it as an answer, so future viewers can see what is happening. The issue was not the computation, but misuse of a formula. The thing is that the formula I wanted to use for the turning number, i.e.
$$n_{\beta} = \frac{1}{2\pi} \int_{0}^{L} K_{\beta}(t)dt$$
may only be used for curves that are parametrized by arclength. Since curvature is invariant under reparametrization I just assumed that it would work the same way. But the reparametrization-invariance actually gives us
$$K_{\beta \circ \varphi}(t) = K_{\beta}(\varphi(t)),$$
where $\beta \circ \varphi$ is a reparametrization of $\beta$ by arclength. So what I ignored was the $\varphi(t)$ as the argument of the curvature. If we account for this, by a change of variable we get
$$n_{\beta} = \frac{1}{2\pi} \int_{0}^{L} K_{\beta}(\varphi(t))\, dt = \frac{1}{2\pi} \int_{0}^{L} K_{\beta}(t)\cdot|\varphi'(t)|\,dt = \frac{1}{2\pi} \int_{0}^{L} K_{\beta}(t)\cdot||\dot{\beta}(t)||\,dt,$$
where for the last equality we used the fact that the reparametrization is given by $\varphi(s) = \int_{s_0}^{s} ||\dot{\beta}(\tau)||\,d\tau$, so $\varphi'(s) = ||\dot{\beta}(s)||$ by the fundamental theorem of calculus. Therefore, in my exercise one must integrate the function
$$K_{\beta}(t)\cdot||\dot{\beta}(t)|| = \frac{-6\cos t-9}{4\cos t + 5}$$
which evaluates to $-4\pi$, giving the turning number of -2, which is exactly what it should be.