trueSun function

({double anomaly, double lon}) trueSun(
  1. double t
)

True geometric longitude and anomaly of the Sun.

t is centuries from J2000 (see j2000Century). Returns (lon, anomaly) referenced to mean equinox of date.

Implementation

({double lon, double anomaly}) trueSun(double t) {
  final l0 = toRad(horner(t, [280.46646, 36000.76983, 0.0003032]));
  final m = meanAnomaly(t);
  final c = toRad(
      horner(t, [1.914602, -0.004817, -0.000014]) * math.sin(m) +
          (0.019993 - 0.000101 * t) * math.sin(2 * m) +
          0.000289 * math.sin(3 * m));
  return (
    lon: mod2pi(l0 + c),
    anomaly: mod2pi(m + c),
  );
}