gives the haversine function .


  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • The haversine function is defined by .
  • The argument of haversine is assumed to be in radians. (Multiply by Degree to convert from degrees.)
  • Haversine[z] is the entire function of z with no branch cut discontinuities.
  • Haversine can be evaluated to arbitrary numerical precision.
  • Haversine automatically threads over lists.


open allclose all

Basic Examples  (4)

Evaluate numerically:

Plot over a subset of the reals:

Plot over a subset of the complexes:

Series expansion at 0:

Scope  (31)

Numerical Evaluation  (5)

Evaluate numerically:

Evaluate to high precision:

The precision of the output tracks the precision of the input:

Complex number input:

Evaluate efficiently at high precision:

Haversine threads elementwise over lists and matrices:

Specific Values  (3)

The values of Haversine at fixed points:

Value at zero:

Find the first positive extremum of Haversine using Solve:

Substitute in the result:

Visualize the result:

Visualization  (3)

Plot the Haversine function:

Plot the real part of Haversine(x+y):

Plot the imaginary part of Haversine(x+y):

Polar plot with r=hav(k phi):

Function Properties  (6)

Haversine is defined for all real and complex values:

Haversine achieves all values between zero and one, inclusive, on the reals:

The range for complex values is the whole plane:

Haversine is periodic with period :

Expand using ComplexExpand assuming real variables x and y:

Haversine has the mirror property hav(TemplateBox[{z}, Conjugate])=TemplateBox[{{hav, (, z, )}}, Conjugate]:

TraditionalForm formatting:

Differentiation  (3)

The first derivative:

Higher derivatives:

Plot the higher derivatives:

The formula for the ^(th) derivative:

Integration  (3)

Compute the indefinite integral using Integrate:

Verify the anti-derivative:

The definite integral:

More integrals:

Series Expansions  (4)

Find the Taylor expansion using Series:

Plots of the first three approximations around :

The general term in the series expansion using SeriesCoefficient:

The first-order Fourier series:

This happens to be the complete series:

The Taylor expansion at a generic point:

Haversine can be applied to a power series:

Function Representations  (4)

Haversine can be represent in terms of Sin:

Series representation:

Haversine can be represented in terms of MeijerG:

Haversine can be represented as a DifferentialRoot:

Applications  (1)

Distance between two points on a sphere:

Distance between two cities in kilometers (assuming spherical Earth):

Properties & Relations  (2)

Derivative of haversine function:

Integral of haversine function:

Use FunctionExpand to expand Haversine in terms of standard trigonometric functions:

Wolfram Research (2008), Haversine, Wolfram Language function, https://reference.wolfram.com/language/ref/Haversine.html.


Wolfram Research (2008), Haversine, Wolfram Language function, https://reference.wolfram.com/language/ref/Haversine.html.


@misc{reference.wolfram_2020_haversine, author="Wolfram Research", title="{Haversine}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/Haversine.html}", note=[Accessed: 03-December-2020 ]}


@online{reference.wolfram_2020_haversine, organization={Wolfram Research}, title={Haversine}, year={2008}, url={https://reference.wolfram.com/language/ref/Haversine.html}, note=[Accessed: 03-December-2020 ]}


Wolfram Language. 2008. "Haversine." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Haversine.html.


Wolfram Language. (2008). Haversine. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Haversine.html