Wolfram Research

Function Repository Resource:

AstroDistance

Source Notebook

Computes the distance between astronomical entities

Contributed by: Jeff Bryant

ResourceFunction["AstroDistance"][entity1,entity2]

Compute the distance between entity1 and entity2 for the current date and time.

ResourceFunction["AstroDistance"][entity1,entity2,date]

Compute the distance between entity1 and entity2 for the specified date.

ResourceFunction["AstroDistance"][{entity1,,entityn}]

Compute the distance between entity1 and entityn,through all the intermediate entityi, for the current date and time.

ResourceFunction["AstroDistance"][{entity1,,entityn},date]

Compute the total distance from entity1 to entityn, through all the intermediate entityi, for the specified date.

Details and Options

An internet connection is required.
date must be a DateObject.
Shorter dates can be used: DateObject[{y}] is equivalent to DateObject[{y,1,1,0,0,0}], DateObject[{y,m}] to DateObject[{y,m,1,0,0,0}], etc.
The coordinates of all entities must be known or a missing result will be returned.
Distances are all measured from center to center and along a straight line.
Distances are returned in astronomical units by default.
Distances to extra‐solar system objects are based on light‐travel distances for a fixed epoch and ignore effects such as proper motion.

Examples

Basic Examples

Compute the current distance between Mars and Jupiter:

In[1]:=
ResourceFunction["AstroDistance"][Entity["Planet", "Mars"], Entity["Planet", "Jupiter"]]
Out[1]=

Compute the distance between Mars and Jupiter on a specified date:

In[2]:=
ResourceFunction["AstroDistance"][Entity["Planet", "Mars"], Entity["Planet", "Jupiter"], DateObject[{2018, 9, 13}, "Day", "Gregorian", -5.`]]
Out[2]=

Compute the current total distance between entities:

In[3]:=
ResourceFunction[
 "AstroDistance"][{Entity["Planet", "Mars"], Entity["Planet", "Jupiter"], Entity["Planet", "Saturn"], Entity["Planet", "Uranus"]}]
Out[3]=

Compute the total distance between entities on a specified date:

In[4]:=
ResourceFunction[
 "AstroDistance"][{Entity["Planet", "Mars"], Entity["Planet", "Jupiter"], Entity["Planet", "Saturn"], Entity["Planet", "Uranus"]}, DateObject[{2018, 9, 13}, "Day", "Gregorian", -5.`]]
Out[4]=

Scope

Entities can be in different domains:

In[5]:=
ResourceFunction["AstroDistance"][Entity["Planet", "Mars"], Entity["Star", "ProximaCentauri"]]
Out[5]=
In[6]:=
ResourceFunction["AstroDistance"][Entity["Exoplanet", "55Cancrie"], Entity["Planet", "Uranus"]]
Out[6]=

Results are automatically given in appropriate units by default:

In[7]:=
ResourceFunction["AstroDistance"][Entity["Star", "Rigel"], Entity["Star", "Zubenelgenubi"]]
Out[7]=

Options

Target units can be specified:

In[8]:=
ResourceFunction["AstroDistance"][Entity["Planet", "Mars"], Entity["Star", "ProximaCentauri"], TargetUnits -> "Kilometers"]
Out[8]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

See Also

License Information