Download or view summerSolsticePlot.frink in plain text format
// This program calculates and plots the date of the summer solstice
// over the course of a few centuries. I made this because I'm old
// and I remember the equinoxes usually being on the 21st (probably
// in UTC.) This shows how the date of the equinox drifts over
// time (and is corrected back by leap year rules.)
use sun.frink
use planets.frink
use secant.frink
longfunc = {|date| highAccuracySunApparentLongitude[date]}
// Let's calculate the longitude angle that corresponds to 1 millisecond of
// time
angleres = ms circle/solaryear
tz = "US/Mountain"
startyear = 1800
endyear = 2150
g = new graphics
g.font["Monospaced", .1 day]
p = new polyline
for y = startyear to endyear
{
summerSolstice = secantInvert[longfunc,
270 degrees,
summerSolstice[y] - 1 hour,
summerSolstice[y] + 1 hour,
angleres]
d = summerSolstice - parseDate["$y $tz"]
println["$y\t" + (summerSolstice -> tz) + "\t" + format[d, "days", 2]]
p.addPoint[y,-d]
g.fillEllipseCenter[y, -d, 1, .01 day]
}
g.color[0,0,0,.3]
g.add[p]
for y = startyear to endyear step 50
{
g.color[0,0,0,.3]
g.line[y, -170 days, y, -173 days]
g.color[0,0,0]
g.text["$y", y, -170 days, "center", "top"]
}
df = ### MM-dd ###
for d = 170 days to 173 days step day
{
g.color[0,0,0,.3]
g.line[startyear, -d, endyear, -d]
usualDate = (parseDate["2015 $tz"] + d) -> [df, tz]
leapDate = (parseDate["2016 $tz"] + d) -> [df, tz]
g.color[0,0,0]
g.text[format[d,"days",0] + " \n(usually " + usualDate + " \n on leap years, $leapDate) ", startyear, -d, "right", "center"]
}
g.color[0,0,0,0]
g.line[startyear-100, -170 days, startyear-100, -173 days]
g.color[0,0,0]
g.font["SansSerif", .15 day]
g.text["Summer Solstice (days after beginning of year, $tz)", 1975, -173.1 days, "center", "bottom"]
g.show[]
stz = tz =~ %s/\//./g
g.write["summersolstice$stz.png",2000,1000]
g.write["summersolstice$stz.html",2000,1000]
g.write["summersolstice$stz.svg",2000,1000]
browse["summersolstice$stz.html"]
browse["summersolstice$stz.svg"]
Download or view summerSolsticePlot.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, 8 hours, 2 minutes ago.