UNPKG

2.15 kBJavaScriptView Raw
1import circle from '@robireton/circle'
2import dataNutation from './nutation-obliquity.json'
3
4// c.f. Chapter 21 of Astronomical Algorithms by Jean Meeus
5export default function calculateNutationAndObliquity (JDE) {
6 const T = (JDE - 2451545) / 36525 // time in centuries from 2000.0
7 const D = circle.normalizedDegrees(297.85036 + T * (445267.111480 + T * (-0.0019142 + T / 189474))) // mean elongation of the Moon from the Sun in degrees
8 const M = circle.normalizedDegrees(357.52772 + T * (35999.050340 + T * (-0.0001603 - T / 300000))) // mean anomoly of the Sun (Earth) in degrees
9 const M_ = circle.normalizedDegrees(134.96298 + T * (477198.867398 + T * (0.0086972 + T / 56250))) // mean anomoly of the Moon in degrees
10 const F = circle.normalizedDegrees(93.27191 + T * (483202.017538 + T * (-0.0036825 + T / 327270))) // Moon's argument of latitude in degrees
11 const Ω = circle.normalizedDegrees(125.04452 + T * (-1934.136261 + T * (0.0020708 + T / 450000))) // longitude of the ascending node of the Moon's mean orbit on the ecliptic, measured from the mean equinox of the date in degrees
12
13 let Δψ = 0
14 let Δε = 0
15 for (const n of dataNutation) {
16 const arg = circle.DegreesToRadians(n.D * D + n.M * M + n.M_ * M_ + n.F * F + n.Ω * Ω)
17 Δψ += (n.Δψ.A + n.Δψ.B * T) * Math.sin(arg)
18 Δε += (n.Δε.A + n.Δε.B * T) * Math.cos(arg)
19 }
20 Δψ /= 36000000 // coefficients above were in units of 0ʺ.0001
21 Δε /= 36000000 // coefficients above were in units of 0ʺ.0001
22
23 const U = T / 100
24 const ε0 = 23 + 26 / 60 + 21.448 / 3600 + U * (-4680.93 / 3600 +
25 U * (-1.55 / 3600 +
26 U * (1999.25 / 3600 +
27 U * (-51.38 / 3600 +
28 U * (-249.67 / 3600 +
29 U * (-39.05 / 3600 +
30 U * (7.12 / 3600 +
31 U * (27.87 / 3600 +
32 U * (5.79 / 3600 +
33 U * 2.45 / 3600))))))))) // mean obliquity of the ecliptic
34
35 const ε = ε0 + Δε
36
37 return {
38 Δψ: Δψ, // nutation in longitude
39 Δε: Δε, // nutation in obliquity
40 ε: ε // obliquity of the ecliptic
41 }
42}