SphericalDistance

SphericalDistance[{θ1,ϕ1},{θ2,ϕ2}]

returns the great-circle distance between points {θ1,ϕ1} and {θ2,ϕ2} on the surface of a unit sphere.

SphericalDistance[{θ1,1,θ1,2,,ϕ1},{θ2,1,θ2,2,,ϕ2}]

returns the geodesic distance between arbitrary-dimensional points on the surface of a unit hypersphere.

Details

  • Spherical or hyperspherical coordinate vectors use the same conventions of CoordinateChartData and CoordinateTransformData, but with the leading r coordinate dropped.
  • The geodesic distance on the surface of a radius-r hypersphere can be obtained by multiplying the result of SphericalDistance by radius r.
  • Points on a 2D sphere can also be specified using GeoPosition[{lat,lon}] notation, with latitudes and longitudes in degrees.
  • SphericalDistance threads over lists of points, with SphericalDistance[point,points] returning a list of distances, and SphericalDistance[points1,points2] returning a matrix of distances.
  • When working with numerical data, SphericalDistance does not accept complex-valued inputs and returns only real-valued outputs.

Examples

open allclose all

Basic Examples  (3)

The distance between a pair of points on the unit sphere:

The distance between a pair of points on the unit 3-sphere:

Take several points on the equator of the sphere:

Show that they are all equidistant from the north pole:

Scope  (5)

SphericalDistance accepts exact numerical inputs:

SphericalDistance accepts arbitrary-precision numerical inputs:

SphericalDistance works with symbolic inputs:

Calculate a rectangular DistanceMatrix and display the results with ArrayPlot:

SphericalDistance accepts points in GeoPosition[{lat,lon}] notation:

Use GeoPosition lists of points:

Applications  (3)

Generate three points in an octant of the unit sphere:

Find edge lengths of the corresponding spherical triangle:

Verify the spherical triangle inequality:

Define a parametric trajectory in spherical coordinates:

Represent the curve as a series of points and plot:

Estimate the curve's arc length:

Take the angular coordinates for the vertices of an octahedron:

Compute distances from one point to all others:

Find the symmetric matrix of distances between any pair of points:

Properties & Relations  (5)

Calculate an angular distance along the great circle :

Calculate the same distance along the great circle :

Both results are just the difference of component values:

Choose two points on a sphere:

Convert to Cartesian coordinates on a unit sphere:

Compare the results of SphericalDistance and VectorAngle:

The result of EuclideanDistance is always less than the result of SphericalDistance:

Locate two stars in the constellation Orion:

Calculate their angular separation in radians:

Compare with the result of AstroAngularSeparation:

Specify coordinates using GeoPosition:

Compute the GeoDistance on an ellipsoidal Earth:

Divide by Earth's average radius to a comparable result:

Calculate a symbolic distance between arbitrary points on a sphere:

Compare with the result of VectorAngle, simplified over the reals:

Possible Issues  (1)

Different usages of SphericalDistance may return different results:

Check that both results are equivalent:

Neat Examples  (1)

List spherical coordinates for the vertices of a tetrahedron:

Plot the tetrahedron with arcs between its vertices:

Verify all points have equal angular separation:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_sphericaldistance, author="Wolfram Research", title="{SphericalDistance}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/SphericalDistance.html}", note=[Accessed: 30-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_sphericaldistance, organization={Wolfram Research}, title={SphericalDistance}, year={2023}, url={https://reference.wolfram.com/language/ref/SphericalDistance.html}, note=[Accessed: 30-December-2024 ]}