How to solve equation of arctangent within tangent?

157 Views Asked by At

Context

I found the $y = 1-\tan^2(2x-1)$ formula based on observations of equirectangular projections of a grid sphere. In order to transform spherical coordinates as $(lat,lon)$ to a quadrant of an equirectangular projection $(x,y)$, I need to solve the problem below.

Problem

I have these equations for $x$ and $y$ with a given $lat$ and $lon$. Both $lat$ and $lon$ are normalized from $0$ to $1$. The first step is to remove $y$ and solve for $x$:

Eq. 1: $$ y = 1 - lat - lat\tan^2(\arctan(\sqrt{\frac{1}{lat}-1}) (2x-1) ) $$ Eq. 2: $$ y = 1 - lon - lon\tan^2(\arctan(\sqrt{\frac{1}{lon}-1}) (2x-2) ) $$

Removing $y$ from the equation (but I'm not sure if I'm going in the right direction with this):

Eq. 3: $$ lat + lat\tan^2(\arctan(\sqrt{\frac{1}{lat}-1}) (2x-1) ) $$ $$ = lon + lon\tan^2(\arctan(\sqrt{\frac{1}{lon}-1}) (2x-2) ) $$

EDIT: With the help of a friend, I've been able to further reduce it to:

Eq. 4: $$ \frac {\cos(\arctan(\sqrt{\frac{1}{lon}-1}) (2x-2))} {\cos(\arctan(\sqrt{\frac{1}{lat}-1}) (2x-1))} = \sqrt{\frac{lon}{lat}} $$

using this rule: $1+tan^2 = 1/cos^2$.

And then I'm still stuck... Any help is greatly appreciated!

Mind that the only interesting solution for $x$ is in the range $0 \le x \le 1$.

I've read something about Law of Tangents, but I'm not sure if I can apply it here, and if so, how?


Example

For example, for a $lat$ of $\frac{40}{90}$ and a $lon$ of $\frac{120}{180}$, the intersection that I'm looking for is $x = 0.8756$ and $y=0.3175$. The graph including the intersection that can be found is shown here:

Intersection between the lat and lon functions


Note: I come from StackOverflow - not much of a mathematician - therefore I'm not sure if I got the tags and formatting right.