Function Repository Resource:

AstroDistance

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

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

 In[2]:=
 Out[2]=

Compute the current total distance between entities:

 In[3]:=
 Out[3]=

Compute the total distance between entities on a specified date:

 In[4]:=
 Out[4]=

Scope

Entities can be in different domains:

 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=

Results are automatically given in appropriate units by default:

 In[7]:=
 Out[7]=

Options

Target units can be specified:

 In[8]:=
 Out[8]=

Requirements

Wolfram Language 11.3 (March 2018) or above