venusPositionAngle.frink

Download or view venusPositionAngle.frink in plain text format


/** Program to test this interesting tweet:

    https://twitter.com/isislovecruft/status/1693836333226336453

    "what is your favourite celestial navigation fact?

    "i’ll start: drawing a line connecting the two points of a crescent moon
    points to true south in the northern hemisphere and points to true north
    in the southern hemisphere"

    This tests the hypothesis for Venus instead of the moon.

    The result is that this statement is only approximately correct.  The
    angle between the points and true north/south oscillates somewhat strongly
    around zero degrees, but with a rather large typical amplitude error of
    20-25 degrees, which goes to 90 degrees at times.  The RMS error in the
    original statement is about 33.9 degrees, as found by this program.

    Result tweet:
    https://twitter.com/Frinklang/status/1694626851669540918

    See the following graphs (which are produced by this program):
     https://futureboy.us/temp/venusnav.svg
     https://futureboy.us/temp/venusnav.html
     https://futureboy.us/temp/venusnav.png
*/


use sun.frink
use planets.frink
use Grid.frink

start = beginningOfYear[now[]]
end =   beginningOfYearPlus[now[], 11]

g = new graphics
p = new polyline

points = 0
sum = 0 deg^2
for d = start to end step day
{
   points = points + 1
   a = Planet.Venus.limbPositionAngle[d]
   a1 = abs[a] - (90 deg)
   sum = sum + a1^2
   p.addPoint[MJD[d]-MJD[start], a1]
   println["$d\t" + (a -> degrees)]
}

RMS = sqrt[sum/points]
println["RMS is " + format[RMS, "deg", 3]]

g.add[p]

// Add semi-automatic grid lines to the graph
grid = new Grid
grid.setUnits[day, degree]
grid.auto[g]
g.add[grid.getGrid[]]

// Draw horizontal red line indicating where the original tweet
// is correct.
g.color[1,0,0,.5]
g.line[0 day, 0 deg, (end-start), 0 deg]

g.show[]
g.write["venusnav.png", 1000,800]
g.write["venusnav.svg", 1000,800]
g.write["venusnav.html", 1000,800]


Download or view venusPositionAngle.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 19908 days, 4 hours, 44 minutes ago.