I'm using Mathematica 10. Giving a longitude & latitude on Earth, giving a local time, how can I transform Horizon Coordinte (az , alt) to Equatorial Coordinate (RA , DEC). Use function so I can change longitude, latitude & time when I call it.


Given the local sidereal time (LST) and local latitude you can convert (az,alt) to (ra,dec) with the following function (Input and Output are in degree (not radians!)):

AzElToRADec[{azimuth_, elevation_}, lattitude_, LST_] := 
 Module[{sinDec, cosLHA, sinLHA, Dec, RA, LHA}, 
  sinDec = Sin[elevation Degree] Sin[lattitude Degree] + 
  Cos[elevation Degree] Cos[lattitude Degree] Cos[azimuth Degree];
  Dec = ArcSin[sinDec]/Degree;
  sinLHA = -((Sin[azimuth Degree] Cos[elevation Degree])/Cos[Dec Degree]);
  cosLHA = (Sin[elevation Degree] - Sin[lattitude Degree] Sin[Dec Degree])/(Cos[Dec Degree] Cos[lattitude Degree]);
  LHA = ArcTan[cosLHA, sinLHA]/Degree;
  RA = Mod[LST - LHA, 360];
  {RA, Dec}]   

To get the LST, see this post. The conversion is explained here.


Plot[AzElToRADec[{0, 30}, 0, x*15], {x, 0, 48},  AxesLabel -> {"LST (hrs)", "angle"}]

enter image description here

  • 2
    $\begingroup$ Sidereal time can now be computed with the SiderealTime function in version 10. $\endgroup$
    – kale
    Dec 19 '14 at 15:23
  • $\begingroup$ I am a new comer here. I want to thank Markus Roellig & kale. Thanks for your help. $\endgroup$
    – iStar
    Jan 3 '15 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.