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.
Example:
Plot[AzElToRADec[{0, 30}, 0, x*15], {x, 0, 48}, AxesLabel -> {"LST (hrs)", "angle"}]