Professional Documents
Culture Documents
Ioannis Chalidis
23rd November 2014
Haversine Function.
and the inverse haversine function is: hav 1 (z) = 2 sin1 ( z) or:
hav 1 (z) = 2 arcsin z
Haversine Formula
The haversine formula is an equation important in navigation, giving greatcircle distances between two points on a sphere from their longitudes and
latitudes. The distance between two points: A(a1 , b1 ), B(a2 , b2 ), in a sphere
(earth) with radius r is given by the formula:
d
= hav (a2 a1 ) + cos (a1 ) cos (a2 ) hav (b2 b1 )
hav
r
It is important to note that latitudes:a1 , a2 and longitudes: b1 , b2 are in radian. One can then solve for d either by simply applying the inverse haversine
(if available) or by using the arcsin (inverse sine) function:
d = r hav 1 (hav (a2 a1 ) + cos (a1 ) cos (a2 ) hav (b2 b1 ))
and finally1 :
s
d = 2r arcsin
sin2 (a2 a1 )
sin2 (b2 b1 )
R-code
Note that hav 1 ( hav(x) ) = x. for every x belongs to the domain of hav.