How to find arc length of Fermat's spiral

I have a question about finding the arc length of Fermat's spiral. I used the polar integration formula for the logarithmic spiral and Archimedean spiral and it works. however, I do not know how to solve the integral for Fermat's spiral which has the equation $r^2=a^2(\theta)$. I heard it has something to do with an elliptic integral but I am not sure how to use it. I am trying to find the "$a$" value given the number of rotations and length of the spiral.


A full derivation follows. All elliptic integrals/functions follow Mathematica/mpmath conventions.

Arbitrarily set $a=1$, since we can trivially reintroduce it at the end. Our starting integral is $$\int_0^x\sqrt{\frac1{4t}+t}\,dt$$ which gives the spiral length from $\theta=0$ to $\theta=x$. We can easily rewrite this as $$\frac14\int_0^x\frac{1+4t^2}{\sqrt{t(t^2+1/4)}}\,dt$$ Now, using 239.08 in Byrd and Friedman's Handbook of Elliptic Integrals, this is equivalent to$\newcommand{cn}{\operatorname{cn}}\newcommand{sn}{\operatorname{sn}}\newcommand{dn}{\operatorname{dn}}$ $$\frac1{2\sqrt2}\int_0^{u_1}R\left(\frac12\cdot\frac{1-\cn u}{1+\cn u}\right)\,du$$ where $R(x)=1+4x^2$ and $u_1=F(\varphi,m)=F\left(\cos^{-1}\frac{1-2x}{1+2x},\frac12\right)\equiv F^*(x)$. ($E^*(x)$ is defined the same as $F^*(x)$, but with $E$ replacing $F$.)

Expanding $R$ we get $$\frac1{2\sqrt2}\int_0^{u_1}\left(1+\left(\frac{1-\cn u}{1+\cn u}\right)^2\right)\,du$$ and a partial fraction decomposition transforms this into $$\frac1{\sqrt2}\int_0^{u_1}\left(1-\frac2{1+\cn u}+\frac2{(1+\cn u)^2}\right)\,du$$ Applying B&F 341.52/53/54 to each partial fraction and performing some lucky cancellations gives a result without integrals: $$\frac1{3\sqrt2}\left(u_1+\frac{2\sn u_1\dn u_1}{(1+\cn u_1)^2}\right)$$ But we know that $\cn u_1=\cos\varphi=\frac{1/2-x}{1/2+x}$. Thus, using the identities $\sn^2u+\cn^2u=m\sn^2u+\dn^2u=1$, and bearing in mind $m=\frac12$, we derive $$\sn u_1=2\sqrt2\sqrt{\frac x{4x^2+4x+1}}\qquad\dn u_1=\sqrt{\frac{4x^2+1}{4x^2+4x+1}}$$ and finally simplify the integral to $$\frac1{3\sqrt2}\left(u_1+\sqrt{2x(4x^2+1)}\right)$$ Thus, for the general Fermat spiral $r=a\sqrt\theta$, the length over $\theta\in[0,x]$ is $$\color{red}{L(a,x)=\frac a{3\sqrt2}\left(F^*(x)+\sqrt{2x(4x^2+1)}\right)}$$

from mpmath import *

def L(x):
    F = ellipf(acos((0.5-x) / (0.5+x)), 0.5)
    return (F + sqrt(2*x*(4*x**2+1))) / sqrt(18)

plot(L, [0, 20])

I am trying to find the $a$ value in $r=a\sqrt\theta$ such that when the arc reaches $r=10$, the arc will be $27.47$ units long.

Numerical root-finding (of the function $L(a,(10/a)^2)-27.47$) gives $a=5.323405\dots$


A similar derivation allows us to find the arc length of the lituus $r=\frac k{\sqrt\theta}$. Over $\theta\in[a,b]$ where $a,b>0$, the length is $k\sqrt2(P(b)-P(a))$ where $$P(x)=F^*(x)-2E^*(x)+\frac{2x-1}{2x+1}\sqrt{2x+\frac1{2x}}$$ This form is necessary becuase the lituus length is unbounded both ways.