Implementing angular distance calculator#

Write a function called angular_dist that calculates the angular distance between any two points on the celestial sphere given their right ascension and declination.

Your function should take arguments in decimal degrees and return the distance in decimal degrees too.

Here’s an example of how your function should work:

>>> ra1, dec1 = 21.07, 0.1
>>> ra2, dec2 = 21.15, 8.2
>>> angular_dist(ra1, dec1, ra2, dec2)
8.1003923181465041

Here’s another example:

>>> angular_dist(10.3, -3, 24.3, -29)
29.208498180546595
# Write your angular_dist function here.
from typing import Sequence, Union
import numpy as np

def angular_dist(ra1: Union[float, Sequence],
                 dec1: Union[float, Sequence],
                 ra2: Union[float, Sequence],
                 dec2: Union[float, Sequence]) -> Union[float, Sequence]:
    pass

You can use this to test your function.

# Run your function with the first example in the question.
print(angular_dist(21.07, 0.1, 21.15, 8.2))

# Run your function with the second example in the question
print(angular_dist(10.3, -3, 24.3, -29))