convergatronMoon.frink

Download or view convergatronMoon.frink in plain text format

/*
   This program is a version of the full convergatron.frink program
   that adaptively calculates Moon-planet convergences.  It uses
   adaptive timesteps to make calculation more efficient and to
   accurately calculate closer convergences.  The moon moves about
   12 degrees across the sky each day so the 12-hour timestep in
   convergatron.frink is not adequate.

   TODO:  Correct for lat/long and parallax.  These are geocentric
   calculations.
*/

use planets.frink

df = ### yyyy-MM-dd-HH:mm ###
d1 = beginningOfYear[now[]]
e = beginningOfYearPlus[now[], 1]

for p1 = Planet.planetsMinusEarth
{
   d = d1
   while d < e
   {
      [mra, mdecl] = moonApparentRADecl[d]
      // 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 day
      else
         d = d + 1 hour

      println[]
   }
}


Download or view convergatronMoon.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, eliasen@mindspring.com