4
$\begingroup$

I would like to convert equatoral coordinates to ecliptique coordinates. I am following the source below:

Practical Astronomy with Your Calculator

The formula I am using is:

enter image description here

enter image description here

When I solve this example, I find the same value. And I am checking the result using the website below:

https://frostydrew.org/utilities.dc/convert/tool-eq_coordinates/

enter image description here

enter image description here

As you see the results are same.

However when I want to find the ecliptic coordinates of Sagittarius A, I am getting different results:

Right Ascension of Sagittarius A is: 17h 45m 40.0409s Declination of Sagittarius A is: −29° 0′ 28.118″

I found the results in the previous example with the following program, and the result was the same when I encountered the results on the site I mentioned to you.

I tried the same Python program this time to find the ecliptic coordinates of Sagittarius A, but the results were very different from the results on the site I mentioned.

from math import cos, sin, tan, asin, atan, radians, degrees


def dd_to_dms(dd):
    degree = int(dd)
    minute = int((dd - degree) * 60)
    second = round(float((dd - degree - minute / 60) * 3600))
    return f"{degree}\u00b0 {minute}\' {second}\""


def dms_to_dd(dms):
    dms = dms.replace("\u00b0", " ").replace("\'", " ").replace("\"", " ")
    degree = int(dms.split(" ")[0])
    minute = float(dms.split(" ")[1]) / 60
    second = float(dms.split(" ")[2]) / 3600
    return degree + minute + second


def from_equatoral_to_ecliptique(ra, dec, ob):
    ob = dms_to_dd(ob)
    ra = dms_to_dd(ra) * 15
    dec = dms_to_dd(dec)
    lat = (sin(radians(ra)) * cos(radians(ob)) + tan(radians(dec)) * sin(radians(ob))) / cos(radians(ra))
    lon = sin(radians(dec)) * cos(radians(ob)) - cos(radians(dec)) * sin(radians(ra)) * sin(radians(ob))
    return degrees(atan(lat)), degrees(asin(lon))


x, y = from_equatoral_to_ecliptique(
    ra="17°45'40.0409\"",
    dec="-29°0'28.118",
    ob="23°26'0\""
)
print(x, y)

When I run this program, I am getting the results below:

86.85130704210478 -5.598002197452088

In order to remove the ambiguity of the longitude value, as mentioned in the article I shared with you, I am adding 180 degrees to the result. But when I add 180, the longitude value becomes 174.40199780254792

But when I check this value using the website I mentioned, I am seeing that the result equals to 264.862492. enter image description here

enter image description here

I wonder what I am missing while trying to find the ecliptic coordinates of Sagittarius A. And I would like learn why I found the result similar in the first example but different in the second example.

Thanks in advance.

$\endgroup$
6
  • $\begingroup$ I was initially mis-led by RA being quoted as 17° in the script, but later this being converted to actual decimal degrees. While this works numerically in this case, this sloppy treatment of units is IMHO not ideal and dedicated treatment should be sought $\endgroup$ Sep 5, 2022 at 14:03
  • $\begingroup$ The main problem is, I made 2 examples trying to find ecliptic coordinates using equatoral coordinates. In the first of these examples, I got the same results as the website I used to validate the result. In the second example, I got a different result. And I wonder why this happened. :/ $\endgroup$ Sep 5, 2022 at 14:06
  • 2
    $\begingroup$ BTW, you should use atan2 to get the correct quadrant. $\endgroup$
    – PM 2Ring
    Sep 5, 2022 at 14:11
  • $\begingroup$ There's an issue with your dms_to_dd function improperly handling the minutes and seconds value of negative dms input (it takes them in the wrong direction, so that your input value of "-29°0'28.118" outputs -28.992189444444445 ) but that's not the major issue., $\endgroup$
    – notovny
    Sep 5, 2022 at 14:25
  • $\begingroup$ @RM 2Ring, for this example, atan and atan2 returns the same value. And this is not related to the problem. $\endgroup$ Sep 5, 2022 at 14:58

1 Answer 1

3
$\begingroup$

I have to agree with PM2Ring. The issue is that you're incorrectly determining the quadrant of the longitude from the atan function, by ignoring the individual signs of x and y in the provided algorithm. If you use atan2, that's handled for you.

Using the following:

def from_equatoral_to_ecliptique2(ra, dec, ob):
    ob = radians(dms_to_dd(ob))
    ra = radians(dms_to_dd(ra) * 15)
    dec = radians(dms_to_dd(dec))

    beta = asin(sin(dec) * cos(ob) - cos(dec) * sin(ob) * sin(ra))
    y = sin(ra) * cos(ob) + tan(dec) * sin(ob)
    x = cos(ra)

    lambda_prime = math.atan2(y, x)

    return degrees(lambda_prime), degrees(beta)

Returns -93.14846713531182 -5.613954797554798 as the pair longitude, latitude (with the fix for negative declinations included)

And $360° + -93.1° = 266.9°$, which is still a bit off from what you're getting from the FrostyDew website, but is at least closer.

That said, the Frostydew website's value appears to disagree with the the NASA/IPAC Extragalactic Database's calculator, which converts the provided Equatorial coordinate values to 266.85° Ecliptic Longitude, -5.60 Ecliptic Latitude, and with the Ecliptic longitude of Sagittarius A* from Wolfram Alpha, which gives 266 degrees 51 arcminutes

$\endgroup$
7
  • $\begingroup$ But isn't -93.1 the latitude value? I am getting the same result by the way. The latitude value should be close to 52 while the longitude value should be close 264. Could u please look at the result of the website again? $\endgroup$ Sep 5, 2022 at 16:10
  • $\begingroup$ @dildeolupbiten I think there's a bug in the website you've chosen to use to check your values. I used Caltech's coordinate calculator: ned.ipac.caltech.edu/… $\endgroup$
    – notovny
    Sep 5, 2022 at 16:24
  • $\begingroup$ So we are getting same results. But It should be 264. Because Sagittarius is between 240 and 270 degrees. So 264 degree corresponds to 24 degree Sagittarius, that's why it is called Sagittarius A. Where am I making mistake? :/ Also, the 24 of 24 Sagittarius A should come from longitude, not latitude. $\endgroup$ Sep 5, 2022 at 16:27
  • $\begingroup$ @dildeolupbiten The astronomical Sagittarius constellation does not cover the same amount of the ecliptic as Astrological Sagittarius, the latter is hard-pinned to 240° to 270°. Sagittarius A* is named because it's in the Sagittarius constellation. $\endgroup$
    – notovny
    Sep 5, 2022 at 16:38
  • $\begingroup$ I know that but Sagittarius A is at 24 degree of Sagittarius. And 24 degree Sagittarius equals to 264 degree. $\endgroup$ Sep 5, 2022 at 16:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .