Been around back to 1805. BC (Before Computers) they hand did the calculations for hundreds of points and published books for ships. Now its built into you Android.
I'll have to give it a go but I don't remember what a cosine is
Let the central angle Θ between any two points on a sphere be:
Θ = d r {\displaystyle \Theta ={\frac {d}{r}}} {\displaystyle \Theta ={\frac {d}{r}}}
where:
d is the distance between the two points (along a great circle of the sphere; see spherical distance),
r is the radius of the sphere.
The haversine formula hav of Θ is given by:
hav ( Θ ) = hav ( φ 2 − φ 1 ) + cos ( φ 1 ) cos ( φ 2 ) hav ( λ 2 − λ 1 ) {\displaystyle \operatorname {hav} \left(\Theta \right)=\operatorname {hav} (\varphi _{2}-\varphi _{1})+\cos(\varphi _{1})\cos(\varphi _{2})\operatorname {hav} (\lambda _{2}-\lambda _{1})} {\displaystyle \operatorname {hav} \left(\Theta \right)=\operatorname {hav} (\varphi _{2}-\varphi _{1})+\cos(\varphi _{1})\cos(\varphi _{2})\operatorname {hav} (\lambda _{2}-\lambda _{1})}
where
φ1, φ2: latitude of point 1 and latitude of point 2,
λ1, λ2: longitude of point 1 and longitude of point 2.
Finally, the haversine function (half a versine) of an angle θ (applied above to the differences in latitude and longitude) is:
hav ( θ ) = sin 2 ( θ 2 ) = 1 − cos ( θ ) 2 {\displaystyle \operatorname {hav} (\theta )=\sin ^{2}\left({\frac {\theta }{2}}\right)={\frac {1-\cos(\theta )}{2}}} \operatorname {hav} (\theta )=\sin ^{2}\left({\frac {\theta }{2}}\right)={\frac {1-\cos(\theta )}{2}}
To solve for the distance d, apply the inverse haversine hav-1 to the central angle Θ or use the arcsine (inverse sine) function:
d = r hav − 1 ( h ) = 2 r arcsin ( h ) {\displaystyle d=r\operatorname {hav} ^{-1}(h)=2r\arcsin \left({\sqrt {h}}\right)} d=r\operatorname {hav} ^{-1}(h)=2r\arcsin \left({\sqrt {h}}\right)
where h=hav(Θ), or more explicitly:
d = 2 r arcsin ( hav ( φ 2 − φ 1 ) + cos ( φ 1 ) cos ( φ 2 ) hav ( λ 2 − λ 1 ) ) {\displaystyle d=2r\arcsin \left({\sqrt {\operatorname {hav} (\varphi _{2}-\varphi _{1})+\cos(\varphi _{1})\cos(\varphi _{2})\operatorname {hav} (\lambda _{2}-\lambda _{1})}}\right)} {\displaystyle d=2r\arcsin \left({\sqrt {\operatorname {hav} (\varphi _{2}-\varphi _{1})+\cos(\varphi _{1})\cos(\varphi _{2})\operatorname {hav} (\lambda _{2}-\lambda _{1})}}\right)}
= 2 r arcsin ( sin 2 ( φ 2 − φ 1 2 ) + cos ( φ 1 ) cos ( φ 2 ) sin 2 ( λ 2 − λ 1 2 ) ) {\displaystyle =2r\arcsin \left({\sqrt {\sin ^{2}\left({\frac {\varphi _{2}-\varphi _{1}}{2}}\right)+\cos(\varphi _{1})\cos(\varphi _{2})\sin ^{2}\left({\frac {\lambda _{2}-\lambda _{1}}{2}}\right)}}\right)} {\displaystyle =2r\arcsin \left({\sqrt {\sin ^{2}\left({\frac {\varphi _{2}-\varphi _{1}}{2}}\right)+\cos(\varphi _{1})\cos(\varphi _{2})\sin ^{2}\left({\frac {\lambda _{2}-\lambda _{1}}{2}}\right)}}\right)}
When using these formulae, one must ensure that h does not exceed 1 due to a floating point error (d is only real for h from 0 to 1). h only approaches 1 for antipodal points (on opposite sides of the sphere)—in this region, relatively large numerical errors tend to arise in the formula when finite precision is used. Because d is then large (approaching πR, half the circumference) a small error is often not a major concern in this unusual case (although there are other great-circle distance formulas that avoid this problem). (The formula above is sometimes written in terms of the arctangent function, but this suffers from similar numerical problems near h = 1.)
As described below, a similar formula can be written using cosines (sometimes called the spherical law of cosines, not to be confused with the law of cosines for plane geometry) instead of haversines, but if the two points are close together (e.g. a kilometer apart, on the Earth) you might end up with cos(d/R) = 0.99999999, leading to an inaccurate answer. Since the haversine formula uses sines, it avoids that problem.
I don't think I have much chance here.
WOW