<p><strong>(1)</strong> Distance between 2 points, knowing their <em><strong>equatorial coordinates</strong></em>:</p>
<p><strong>Galactic Center</strong>:</p>
<p>Note that <span class="math-container">$\alpha_1=271.087458^o$</span> and <span class="math-container">$\delta_1=-29.519139^o$</span> <strong>are not correct values</strong>. According <a href="https://www.scientificlib.com/en/Astronomy/Galaxies/GalacticCoordinateSystem.html" rel="nofollow noreferrer"><strong>Galactic coordinate system</strong></a> the correct values referred to J2000 are:</p>
<p><span class="math-container">$\alpha_1=17^h \ 45^m \ 37.22^s=266.4051^o$</span></p>
<p><span class="math-container">$\delta_1=-28^o \ 56' \ 10.23''=-28.936175^o$</span></p>
<p><strong>Andromeda galaxy (M31)</strong></p>
<p><span class="math-container">$\alpha_2=00^h \ 42^m \ 44.3^s=10.6845833^o$</span></p>
<p><span class="math-container">$\delta_2=+41^0 \ 16' \ 09''=+41.2691667^o$</span></p>
<p><strong>Distance</strong>:</p>
<p><span class="math-container">$$d=\arccos \Big [ \sin \delta_1 \sin \delta_2 + \cos \delta_1 \cos \delta_2 \cos (\alpha_1-\alpha_2) \Big ]$$</span></p>
<p><span class="math-container">$$\boxed{d=118.775612^o}$$</span></p>
<p><strong>(2)</strong> Distance between 2 points, knowing their <em><strong>galactic coordinates</strong></em>:</p>
<p><strong>Galactic Center</strong>:</p>
<p>Galactic Longitude <span class="math-container">$l_1=0^o$</span></p>
<p>Galactic Latitude <span class="math-container">$b_1=0^o$</span></p>
<p><strong>Andromeda galaxy (M31)</strong></p>
<p>Galactic Longitude is not <span class="math-container">$l_2=-21.573309^o$</span> is <span class="math-container">$l_2=121.174329^o$</span></p>
<p>Galactic Latitude is not <span class="math-container">$b_2=121.174329^o$</span> is <span class="math-container">$b_2=-21.573309^o$</span></p>
<p><strong>Distance</strong>:</p>
<p><span class="math-container">$$d=\arccos \Big [ \sin b_1 \sin b_2 + \cos b_1 \cos b_2 \cos (l_1-l_2) \Big ]$$</span></p>
<p><span class="math-container">$$\boxed{d=118.775680^o}$$</span></p>
<p>Perhaps it might be interesting to browse the thread: <a href="https://astronomy.stackexchange.com/a/53403/31201">How can I convert my sky coordinate system (RA, Dec) into galactic coordinate system (l, b)?</a></p>
<p>Best regards.</p>

CC BY-SA 4.0
2023-06-12T06:58:23.887Z
2023-06-13T11:04:51.200Z
2023-06-13T11:04:51.200Z
Albert
<p>I calculated the angular distance between the Galactic Center and Andromeda in Equatorial and Galactic coordinates and observed that the distance is calculated differently depending on the coordinate system.</p>
<p>In Equatorial coordinates their locations are</p>
<pre><code>Galactic Center 
    Ra 271.087458 degrees
    Dec -29.519139 degrees     
Andromeda 
    Ra 00h 42m 44.3s  (10.6845833 degrees)   
    Dec +41° 16′ 9″   (41.2691667 degrees)
</code></pre>
<p>In Galactic Coordinates</p>
<pre><code>Galactic Center
    latitude 0.0
    longitude 0.0
Andromeda
    latitude 121.174329 
    longitude -21.573309
</code></pre>
<p>This is my Python codes for calculating the distance.</p>
<pre><code>import numpy as np 

def get_psi(Ra1, Dec1, Ra2, Dec2):
    psi = np.arccos(np.sin(Dec1)*np.sin(Dec2) \
                    + np.cos(Dec1)*np.cos(Dec2)\
                    * np.cos(Ra1-Ra2))
    return psi

GC_ra = np.radians(271.087458)
GC_dec = np.radians(-29.519139)

M31_ra = np.radians(10.6845833)
M31_dec = np.radians(41.2691667)

psi_GC_to_M31 = get_psi(GC_ra, GC_dec, M31_ra, M31_dec)
print(np.degrees(psi_GC_to_M31))
print(np.degrees(get_psi(0,0, np.radians(121.174329), np.radians(-21.573309))))
</code></pre>
<p>The results are</p>
<pre><code>115.72397726560764
118.77568027887287
</code></pre>
<p>Why would the values differ by 3 degrees?</p>

CC BY-SA 4.0
2023-06-11T23:46:48.523Z
@stretch The law of cosines in the posting above would be correct. See https://en.wikipedia.org/wiki/Angular_distance
Nownuri
CC BY-SA 4.0
2023-06-11T23:51:15.433Z
@stretch I got the galactic coordinates of Andromeda from SIMBAD and added it to the question.
Nownuri
CC BY-SA 4.0
2023-06-12T01:23:18.550Z
There’s probably an error in your coordinates. Using 2023.4 (current) coordinates, I get the same angular distance between the two, in both equatorial and galactic coordinates. What is the source of your coordinates for the galactic center?
Pierre Paquette
CC BY-SA 4.0
2023-06-13T15:53:51.437Z
@Nownuri your formula is correct - at a glance it looks wrong.
stretch
<positional-astronomy><galaxy-center><coordinate-systems><spherical-astronomy><angular-distance>
Angular distance calculation in Equatorial and Galactic coordinates
Nownuri
# Angular distance calculation in Equatorial and Galactic coordinates

(Asked by: username_0 on 2023-06-11)

I calculated the angular distance between the Galactic Center and Andromeda in Equatorial and Galactic coordinates and observed that the distance is calculated differently depending on the coordinate system.

In Equatorial coordinates their locations are

```
Galactic Center 
    Ra 271.087458 degrees
    Dec -29.519139 degrees     
Andromeda 
    Ra 00h 42m 44.3s  (10.6845833 degrees)   
    Dec +41° 16′ 9″   (41.2691667 degrees)

```

In Galactic Coordinates

```
Galactic Center
    latitude 0.0
    longitude 0.0
Andromeda
    latitude 121.174329 
    longitude -21.573309

```

This is my Python codes for calculating the distance.

```
import numpy as np 

def get_psi(Ra1, Dec1, Ra2, Dec2):
    psi = np.arccos(np.sin(Dec1)*np.sin(Dec2) \
                    + np.cos(Dec1)*np.cos(Dec2)\
                    * np.cos(Ra1-Ra2))
    return psi

GC_ra = np.radians(271.087458)
GC_dec = np.radians(-29.519139)

M31_ra = np.radians(10.6845833)
M31_dec = np.radians(41.2691667)

psi_GC_to_M31 = get_psi(GC_ra, GC_dec, M31_ra, M31_dec)
print(np.degrees(psi_GC_to_M31))
print(np.degrees(get_psi(0,0, np.radians(121.174329), np.radians(-21.573309))))

```

The results are

```
115.72397726560764
118.77568027887287

```

Why would the values differ by 3 degrees?

**Tags:** positional-astronomy, galaxy-center, coordinate-systems, spherical-astronomy, angular-distance

> **Comments:**
> **username_0**: @username_2 The law of cosines in the posting above would be correct. See https://en.wikipedia.org/wiki/Angular_distance  
> **username_0**: @username_2 I got the galactic coordinates of Andromeda from SIMBAD and added it to the question.  
> **username_1**: There’s probably an error in your coordinates. Using 2023.4 (current) coordinates, I get the same angular distance between the two, in both equatorial and galactic coordinates. What is the source of your coordinates for the galactic center?  
> **username_2**: @username_0 your formula is correct - at a glance it looks wrong.  

---

## 1 answers

### Answer by username_3 on 2023-06-12. Score: 2 | Accepted answer

**(1)** Distance between 2 points, knowing their ***equatorial coordinates***:

**Galactic Center**:

Note that $\alpha\_1=271.087458^o$ and $\delta\_1=-29.519139^o$ **are not correct values**. According [**Galactic coordinate system**](https://www.scientificlib.com/en/Astronomy/Galaxies/GalacticCoordinateSystem.html) the correct values referred to J2000 are:

$\alpha\_1=17^h \ 45^m \ 37.22^s=266.4051^o$

$\delta\_1=-28^o \ 56' \ 10.23''=-28.936175^o$

**Andromeda galaxy (M31)**

$\alpha\_2=00^h \ 42^m \ 44.3^s=10.6845833^o$

$\delta\_2=+41^0 \ 16' \ 09''=+41.2691667^o$

**Distance**:

$$d=\arccos \Big [ \sin \delta\_1 \sin \delta\_2 + \cos \delta\_1 \cos \delta\_2 \cos (\alpha\_1-\alpha\_2) \Big ]$$

$$\boxed{d=118.775612^o}$$

**(2)** Distance between 2 points, knowing their ***galactic coordinates***:

**Galactic Center**:

Galactic Longitude $l\_1=0^o$

Galactic Latitude $b\_1=0^o$

**Andromeda galaxy (M31)**

Galactic Longitude is not $l\_2=-21.573309^o$ is $l\_2=121.174329^o$

Galactic Latitude is not $b\_2=121.174329^o$ is $b\_2=-21.573309^o$

**Distance**:

$$d=\arccos \Big [ \sin b\_1 \sin b\_2 + \cos b\_1 \cos b\_2 \cos (l\_1-l\_2) \Big ]$$

$$\boxed{d=118.775680^o}$$

Perhaps it might be interesting to browse the thread: [How can I convert my sky coordinate system (RA, Dec) into galactic coordinate system (l, b)?](https://astronomy.stackexchange.com/a/53403/31201)

Best regards.


---

