public static double GetVariationEclipticLongitude(double julianDate) { var millenniasCount = Tools.GetMillenniasCount(julianDate); double deltaLambda = 3548.193 + 118.568 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(87.5287 + 359993.7286 * millenniasCount)) + 2.476 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(85.0561 + 719987.4571 * millenniasCount)) + 1.376 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(27.8502 + 4452671.1152 * millenniasCount)) + 0.119 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(73.1375 + 450368.8564 * millenniasCount)) + 0.114 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(337.2264 + 329644.6718 * millenniasCount)) + 0.086 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(222.5400 + 659289.3436 * millenniasCount)) + 0.078 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(162.8136 + 9224659.7915 * millenniasCount)) + 0.054 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(82.5823 + 1079981.1857 * millenniasCount)) + 0.052 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(171.5189 + 225184.4282 * millenniasCount)) + 0.034 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(30.3214 + 4092677.3866 * millenniasCount)) + 0.033 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(119.8105 + 337181.4711 * millenniasCount)) + 0.023 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(247.5418 + 299295.6151 * millenniasCount)) + 0.023 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(325.1526 + 315559.5560 * millenniasCount)) + 0.021 * Math.Sin(CoordinateTransformation.SetDegreesToRadians(155.1241 + 675553.2846 * millenniasCount)) + 7.311 * millenniasCount * Math.Sin(CoordinateTransformation.SetDegreesToRadians(333.4515 + 359993.7286 * millenniasCount)) + 0.305 * millenniasCount * Math.Sin(CoordinateTransformation.SetDegreesToRadians(330.9814 + 719987.4571 * millenniasCount)) + 0.010 * millenniasCount * Math.Sin(CoordinateTransformation.SetDegreesToRadians(328.5170 + 1079981.1857 * millenniasCount)) + 0.309 * Tools.GetRaisedValue(millenniasCount, Power.Square) * Math.Sin(CoordinateTransformation.SetDegreesToRadians(241.4518 + 359993.7286 * millenniasCount)) + 0.021 * Tools.GetRaisedValue(millenniasCount, Power.Square) * Math.Sin(CoordinateTransformation.SetDegreesToRadians(205.0482 + 719987.4571 * millenniasCount)) + 0.004 * Tools.GetRaisedValue(millenniasCount, Power.Square) * Math.Sin(CoordinateTransformation.SetDegreesToRadians(297.8610 + 4452671.1152 * millenniasCount)) + 0.010 * Tools.GetRaisedValue(millenniasCount, Power.Cube) * Math.Sin(CoordinateTransformation.SetDegreesToRadians(154.7066 + 359993.7286 * millenniasCount)); return(deltaLambda); }
//A lot of magic number. The subject to determine all of coefficients public static double NutationInLongitude(double julianDate) { const int epoch = 2451545; // In Julian 1/1/2000 const int daysInCentury = 36525; var meanSiderealTime = (julianDate - epoch) / daysInCentury; var squaredTime = meanSiderealTime * meanSiderealTime; var cubedTime = squaredTime * meanSiderealTime; var nutations = NutationValueArray.GetArray(); int length = nutations.Length; double value = 0; for (int i = 0; i < length; i++) { double argument = nutations[i].ElongationOfMoon * GetElongationOfMoon() + nutations[i].AnomalyOfSun * GetAnomalyOfSun() + nutations[i].AnomalyOfMoon * GetAnomalyOfMoon() + nutations[i].LatitudeOfMoon * GetLatitudeOfMoon() + nutations[i].LongitudeOfAscendingNode * GetLongitudeOfAscendingNode(); double radargument = CoordinateTransformation.SetDegreesToRadians(argument); value += (nutations[i].SinusOfMoon + nutations[i].SinusOfSun * meanSiderealTime) * Math.Sin(radargument) * 0.0001; } return(value); double GetElongationOfMoon() { var meanElongationOfMoon = 297.85036 + 445267.111480 * meanSiderealTime - 0.0019142 * squaredTime + cubedTime / 189474; return(CoordinateTransformation.MapTo0To360Range(meanElongationOfMoon)); } double GetAnomalyOfSun() { double anomalyOfSun = 357.52772 + 35999.050340 * meanSiderealTime - 0.0001603 * squaredTime - cubedTime / 300000; return(CoordinateTransformation.MapTo0To360Range(anomalyOfSun)); } double GetAnomalyOfMoon() { double anomalyOfMoon = 134.96298 + 477198.867398 * meanSiderealTime + 0.0086972 * squaredTime + cubedTime / 56250; return(CoordinateTransformation.MapTo0To360Range(anomalyOfMoon)); } double GetLatitudeOfMoon() { double latitudeOfMoon = 93.27191 + 483202.017538 * meanSiderealTime - 0.0036825 * squaredTime + cubedTime / 327270; //F is ? return(CoordinateTransformation.MapTo0To360Range(latitudeOfMoon)); } double GetLongitudeOfAscendingNode() { double longitudeOfAscendingNode = 125.04452 - 1934.136261 * meanSiderealTime + 0.0020708 * squaredTime + cubedTime / 450000; //omega is ? return(CoordinateTransformation.MapTo0To360Range(longitudeOfAscendingNode)); } }