VenusApparent.frink

Download or view VenusApparent.frink in plain text format


/**
   This program plots the apparent position of Venus as seen from Earth.

   The pattern of Venus's orbit as seen from earth seems to *almost*
   repeat 5 times every 8 Earth years.  However, during that 8 Earth
   years, Venus actually completes 13 orbits around the Sun.

   Successively better approximations to this 8/13 ratio can be found by:

   use continuedFraction.frink">continuedFraction.frink
   formatTable[approximationsWithErrors[venusyear/earthyear, 20]]
*/

use planets.frink

g = new graphics
p = new polyline

// Draw Earth 100x normal diameter
g.fillEllipseCenter[0,0,200 earthradius/m, 200 earthradius/m]

for date = now[] to now[] + 8 years step day
{
   [x, y, z, dist, L0, L, B, R] = pos = Planet.Earth.apparentPosition[date, Planet.Venus]
   p.addPoint[x/m, y/m]  // Divide by meters cuz we don't want to plot to actual size.
   // println[pos]
}

g.add[p]
g.write["VenusApparent.svg", 800, 800]
g.write["VenusApparent.png", 1000, 1000]
g.show[]


Download or view VenusApparent.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 19945 days, 13 hours, 47 minutes ago.