WOLFRAM

gives the haversine function .

Details

  • 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. »
  • Haversine can be used with Interval and CenteredInterval objects. »

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Evaluate numerically:

Out[1]=1

Plot over a subset of the reals:

Out[1]=1

Plot over a subset of the complexes:

Out[1]=1

Series expansion at 0:

Out[1]=1

Scope  (39)Survey of the scope of standard use cases

Numerical Evaluation  (6)

Evaluate numerically:

Out[1]=1

Evaluate to high precision:

Out[1]=1

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

Out[2]=2

Complex number input:

Out[1]=1

Evaluate efficiently at high precision:

Out[1]=1
Out[2]=2

Compute the elementwise values of an array using automatic threading:

Out[1]=1

Or compute the matrix Haversine function using MatrixFunction:

Out[2]=2

Haversine can be used with Interval and CenteredInterval objects:

Out[1]=1
Out[2]=2

Or compute average-case statistical intervals using Around:

Out[3]=3

Specific Values  (3)

The values of Haversine at fixed points:

Out[1]=1

Value at zero:

Out[1]=1

Find the first positive extremum of Haversine using Solve:

Out[1]=1

Substitute in the result:

Out[2]=2

Visualize the result:

Out[3]=3

Visualization  (3)

Plot the Haversine function:

Out[1]=1

Plot the real part of Haversine(z):

Out[1]=1

Plot the imaginary part of Haversine(z):

Out[2]=2

Polar plot with r=hav(k phi):

Out[1]=1

Function Properties  (13)

Haversine is defined for all real and complex values:

Out[1]=1
Out[2]=2

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

Out[1]=1

The range for complex values is the whole plane:

Out[2]=2

Haversine is periodic with period :

Out[1]=1

Expand using ComplexExpand assuming real variables x and y:

Out[1]=1

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

Out[1]=1

Haversine is an analytic function:

Out[1]=1

Haversine is neither non-decreasing nor non-increasing:

Out[1]=1

Haversine is not injective:

Out[1]=1
Out[2]=2

Haversine is not surjective:

Out[1]=1
Out[2]=2

Haversine is non-negative:

Out[1]=1

Haversine has no singularities or discontinuities:

Out[1]=1
Out[2]=2

Haversine is neither convex nor concave:

Out[1]=1

TraditionalForm formatting:

Differentiation  (3)

The first derivative:

Out[1]=1

Higher derivatives:

Out[1]=1

Plot the higher derivatives:

Out[2]=2

The formula for the ^(th) derivative:

Out[1]=1

Integration  (3)

Compute the indefinite integral using Integrate:

Out[1]=1

Verify the anti-derivative:

Out[2]=2

The definite integral:

Out[1]=1

More integrals:

Out[1]=1
Out[2]=2

Series Expansions  (4)

Find the Taylor expansion using Series:

Out[1]=1

Plots of the first three approximations around :

Out[2]=2

The general term in the series expansion using SeriesCoefficient:

Out[1]=1

The first-order Fourier series:

Out[1]=1

This happens to be the complete series:

Out[2]=2

The Taylor expansion at a generic point:

Out[1]=1

Haversine can be applied to a power series:

Out[2]=2

Function Representations  (4)

Haversine can be represent in terms of Sin:

Out[1]=1

Series representation:

Out[1]=1

Haversine can be represented in terms of MeijerG:

Out[1]=1

Haversine can be represented as a DifferentialRoot:

Out[1]=1

Applications  (1)Sample problems that can be solved with this function

Distance between two points on a sphere:

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

Out[3]=3

Find the distance between the North Pole and the nearest city to it, using the defined function with Haversine:

Out[4]=4

Properties & Relations  (2)Properties of the function, and connections to other functions

Derivative of haversine function:

Out[1]=1

Integral of haversine function:

Out[2]=2

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

Out[1]=1
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.

Text

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.

CMS

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. Wolfram Research. https://reference.wolfram.com/language/ref/Haversine.html.

APA

Wolfram Language. (2008). Haversine. Wolfram Language & System Documentation Center. Retrieved from 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

BibTeX

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

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

BibLaTeX

@online{reference.wolfram_2025_haversine, organization={Wolfram Research}, title={Haversine}, year={2008}, url={https://reference.wolfram.com/language/ref/Haversine.html}, note=[Accessed: 06-June-2025 ]}

@online{reference.wolfram_2025_haversine, organization={Wolfram Research}, title={Haversine}, year={2008}, url={https://reference.wolfram.com/language/ref/Haversine.html}, note=[Accessed: 06-June-2025 ]}