Is there an analytical solution to this nonlinear ODE? Is there an analytical solution to the nonlinear ODE
$$\frac{dx}{d\theta} = -\sqrt{\frac{x^2}{4\cos^2\theta} - \cos^2\theta}$$
over $\theta \in [0, \pi/2]$ with initial condition $x(0) = 2$?
Using the substitution $y = \sin\theta$, I was able to transform this into
$$\frac{dx}{dy} = -\sqrt{\frac{x^2-4(1-y^2)^2}{4(1-y^2)^2}},$$
but couldn't get much further.
Context: On a typical globe, one can only see half of the earth at a time. Waldo Tobler's slides on "Unusual Map Projections" mention the following amusing solution to this problem: simply wrap the earth around the globe twice (see image).
In trying to find an aesthetically pleasing conformal version of this construction by changing the shape of the globe, I found myself needing to solve the above ODE to determine its cross section; specifically, mapping latitude $\theta$ to distance from the polar axis, $x(\theta)$.
It can be solved numerically, of course, and that's what I did. I'm just curious about whether an analytical solution exists. The numerical solution looks a lot like $x(\theta) = 2\sqrt{\cos\theta}$, but isn't exactly the same.
In case you're curious, here is a render of the final result of my hacking on all this.
 A: One can apply the following procedure showing that this equation is indeed amenable to an exact analytical treatment. The first thing to note is that it can be rewritten in the following form
$$\left(\frac{dx}{d\theta}\right)^2-\frac{x^2}{4\cos^2\theta}+\cos^2\theta=0.$$
Now, let us consider the Hamiltonian system
$$H=p^2-\frac{x^2}{4\cos^2\theta}+\cos^2\theta.$$
It is easy to note that, for $p(0)=0$ and $x(0)=2$, one has $H(\theta=0)=0$. So, a solution of the Hamilton equations (here dot means derivation with respect to $\theta$)
$$\dot x=\frac{\partial H}{\partial p}=2p$$
$$\dot p=-\frac{\partial H}{\partial x}=\frac{x}{2\cos^2\theta}$$
gives also a solution to the equation we started from. From Hamilton equations we get
$$\ddot x=\frac{x}{\cos^2\theta}$$
with the initial conditions $\dot x(0)=0$ and $x(0)=2$. This second order equation has an explicit analytical solution, through hypergeometric functions $\left._2F_1\right.$ and $\cos t$, that can be easily obtained using Mathematica or your other preferred symbolic manipulation software.
