e function

double e(
  1. double jde,
  2. Planet earth
)

Equation of time using VSOP87 Earth position.

jde is Julian ephemeris day, earth is a Planet object for Earth. Returns the equation of time in radians (multiply by 180/π × 4 for minutes).

Implementation

double e(double jde, Planet earth) {
  final tau = j2000Century(jde) * 0.1; // Julian millennia
  final sunPos = earth.position2000(jde);
  // Sun longitude is Earth + π.
  final sunLon = pMod(sunPos.lon + math.pi, 2 * math.pi);
  // Nutation and obliquity.
  final n = nut.nutation(jde);
  final eps = nut.meanObliquity(jde) + n.dEps;
  // Sun's apparent RA from ecliptic coords.
  final eq = eclToEq(sunLon + n.dPsi, -sunPos.lat, math.sin(eps), math.cos(eps));
  // Mean longitude L0.
  final meanLon = pMod(toRad(l0(tau)), 2 * math.pi);
  // (28.1) p. 183.
  var eot = meanLon - toRad(0.0057183) - eq.ra + n.dPsi * math.cos(eps);
  // Normalize to [-π, π].
  eot = pMod(eot + math.pi, 2 * math.pi) - math.pi;
  return eot;
}