convergatron2.frink

Download or view convergatron2.frink in plain text format


// This program is a simplified version of the full convergatron.frink program
// intended to debunk the myth that I've seen copied by lots of journalists
// today that the upcoming Moon-Jupiter convergence is the closest until 2026,
// like:  http://newswatch.nationalgeographic.com/2013/01/19/sky-show-jupiter-and-moon-closest-until-2026/
use planets.frink

df = ### yyyy-MM-dd-HH:mm ###

d = beginningOfYear[now[]]
e = beginningOfYearPlus[now[], 2]
while d < e
{
   [mra, mdecl] = moonApparentRADecl[d]
   p1 = Planet.Jupiter

   // Check for moon convergences
   [ra1, decl1] = p1.geocentricCoordinates[d]
   dist = angularSeparation[mra, mdecl, ra1, decl1]
   print[(d->df) + "\tMoon\t" + p1.getName[] + "\t" + format[dist,degrees,5]]

   // Use adaptive step when we get close; the moon moves about 12 degrees/day
   // so we want to take smaller steps.
   if dist < 1 degree
   {
      d = d + 10 min
      print["\t*"]
   } else
      if dist < 20 degrees
         d = d + 1 hour
      else
         d = d + 1 day

   println[]
}


Download or view convergatron2.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20139 days, 6 hours, 15 minutes ago.