moonangle.frink

View or download moonangle.frink in plain text format


// Program to calculate the minimum and maximum diameter of the moon as seen
// from earth over a specified time span.

use sun.frink

minangle = 1000 radians
maxangle = 0 radians
closestAngle = 0 radians

startDate = #2000-01-01#
endDate = #2010-01-01# 

for date= startDate to endDate step 1 hours
{
   // Calculate geocentric angle (as seen from center of earth.)
   angle = 2 moonRadiusAngle[date]
   
   // Also calculate angle as seen from closest position on earth.
   closeAngle = 2 arcsin[moonradius / (moonradius + moonDistance[date] - earthradius)]
   
   if (angle < minangle)
      minangle = angle
   if (angle > maxangle)
      maxangle = angle
   if (closeAngle > closestAngle)
      closestAngle = closeAngle
}

println["Min is " + (minangle->"degrees")]
println["Max is " + (maxangle->"degrees")]
println["Closest angle is " + (closestAngle->"degrees")]

println[]
println["Interval estimate:"]
d = new interval[startDate, endDate]
aa = 2 moonRadiusAngle[d]
println[aa->"degrees"]


View or download moonangle.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 17590 days, 6 hours, 55 minutes ago.