# How to convert celestial Coordinates with a radius, to max and min celestial coordinates?

I am writing a piece of python code to convert right ascension and declination with a given radius to minimum and maximum right ascension and declination. I firstly can't understand why the min and max is not always just the given coordinates +- the radius, and secondly how I would write a piece of code to make this conversion. Cheers.

• Could you give more detail of what you are trying to do and why. I have read your question several times, and I cannot understand what you are trying to do. As an aside, you can't just add radius (a length) to Ra/dec (an angle and hence dimensionless). – Dr Chuck Feb 4 at 22:52
• I think Ronan's question can be interpreted as follows. Let the unit sphere be parametrized by $(\cos\alpha \cos\delta, \sin\alpha \cos\delta, \sin\delta)$. For a given point $p$ on the sphere with coordinates $(\alpha_p,\delta_p)$ and a distance $d$ what are the maximum and minimum values of $\alpha$ and $\delta$ among all points on the sphere within $d$ units of $p$. (Assuming $2 \sin\theta = d$, the maximum $\alpha$ is $\min(\delta_p + 2\theta, \pi/2)$, the minimum $\alpha$ is $\max(\delta_p - 2\theta, -\pi/2)$. Finding the minimum and maximum $\alpha$ is harder.) ("radius"=$2\theta$) – irchans Feb 6 at 6:04
• @irchans. I think you intended to write that the max declination $\delta$ is $\min(\delta_p + 2\theta, \pi/2)$ instead of the maximum right ascension $\alpha$. Likewise for the minimum declination. – JohnHoltz Feb 9 at 22:43
• @JohnHoltz Yes, of course, you are right ! – irchans Feb 10 at 22:42

If you were working with a rectangular coordinate system as shown in the figure below (that also had no bounds), then it is correct that the right ascension would be $$RA=RA_p\pm d$$ (points 1 and 3) and the declination would be $$Dec=Dec_p \pm d$$ (points 2 and 4) where d is the radius of the circle. The sky is spherical, so the lines of RA are not a constant separation. (It also has limits such as declination less than $$\pm 90$$.) Therefore you need to use an equation for spherical trigonometry. The angle d between two points i and j is

$$\cos(d) = \sin(Dec_i)\sin(Dec_j) + \cos(Dec_i)\cos(Dec_j)\cos(RA_i - RA_j)$$ For points 1 and 3 on the circle, $$Dec_i=Dec_j=Dec_p$$ in the above equation, and you can solve for the difference in right ascension $$RA_i - RA_j$$ to be added to or subtracted from $$RA_p$$. For points 2 and 4, $$RA_i=RA_j=RA_p$$ and the above equation simplifies to $$Dec=Dec_p \pm d$$. Of course, keep in mind that declination is between -90 and +90. For any other point on the circle, you can assume either an RA or Dec (within the bounds of the above 4 points) and solve for the other unknown. Imagine that you are at 80 degrees north and 0 degrees east (on the Prime Meridian).

It is only 10 latitude degrees from you to the north pole.

Notice that the distance from you to the 45th meridian (shown in green) is about 7 latitude degrees ($$\sin{\pi/4}\cdot 10$$) because if you walked to the closest point on the 45th meridian, the north pole would be directly to your left and the three points 1) the closest point on the 45th meridian, 2) the north pole, and 3) 80 degrees north on the prime meridian almost form an isosceles 45-45-90 triangle.

If you draw a circle around the position (80 North, 0 East) with radius of 7 latitude degrees, the maximum latitude would be 87, the minimum latitude would be 73, the maximum longitude would be about 45 degrees east, and the minimum longitude would be about -45 degrees (45 degrees west).

Also, the point on the 45th meridian closest to your starting position (80N 0E) would have a latitude of about 83 degrees, not 80 degrees.

The example above illustrates that the spacing between longitude lines gets closer near the poles.

In general, if you are at the position ($$\delta$$ north, $$\alpha$$ east) and you draw a circle around yourself with "radius" $$\rho$$, then the min/max latitude/longitude of the enclosed points would be $$\delta-\rho$$, $$\delta+\rho$$, $$\alpha - \gamma$$, $$\alpha + \gamma$$ where $$\gamma = \mathrm{arcsin}\left(\frac{\sin\rho}{\cos\delta}\right).$$ (where $$\rho$$ is the angle between you and the edge of the circle as seen from the center of the Earth). Notice that

• if $$\delta=0$$, then $$\gamma=\rho$$,
• $$\gamma\geq\rho$$,
• if $$\pi/2-|\delta|=\rho$$, then $$\sin\rho=\cos\delta$$ and $$\gamma=\mathrm{arcsin}(1)=\pi/2$$, and
• if $$\pi/2-|\delta|<\rho$$, then there is no solution for $$\gamma$$ because a pole is enclosed by the circle.

The formula can be derived from dot products between your position vector and the vector perpendicular to the either extreme meridian. I need to do a lot of visualization and to fix several false starts to get it right.

For the original example of a circle around 80N 0E with radius 7 degrees, the formula yields $$\gamma = \mathrm{arcsin}( \sin(7\pi/180)/\cos( 80\pi/180))\cdot180/\pi = 44.573 \mathrm{\ degrees}$$ which is close to the estimated 45 degrees.