Astronomical Functions
>load astro
Astronomical functions taken from
Jean Meeus - 'Astronomical Algorithms'
Montenbruck and Pfleger - 'Astronomy on the Personal Computer'
Duffett-Smith - 'Practical astronomy with your calculator'
and other sources.
Written by Keith Burnett.
>now = day(2008, 1, 2, 22, 00)
2923.41666667
>jday(2008, 1, 2, 22, 00)
2454468.41667
>gst(now)
71.9185589233
>psun = sun(now)
[ 282.914502853 -22.9093960506 0.983280777656 ]
>gmoon = moon(now)
[ 216.062120546 -19.4451038467 405224.725114 ]
>locIngolstadt
[ 11.433 48.767 400 ]
>here = [locIngolstadt,0,1020]
[ 11.433 48.767 400 0 1020 ]
>raltaz(now, here, psun)
[ 322.09664678 -59.8739592678 ]
>function altSun (now,loc=here) ...
r=raltaz(now,loc,sun(now));
return r[2];
endfunction
>plot2d("altSunmap(daymap(2008,1,2,x,0))",a=0,b=24):

>hmsprint(secant("altSun(day(2008,1,2,x,0))",6,8))
07:09:04
>hmsprint(secant("altSun(day(2008,1,2,x,0))",14,16))
15:27:12
>hmsprint(fmax("altSun(day(2008,1,2,x,0))",10,12))
11:18:07
>printday(rise("sun",now,here))
2008-01-03 07:08:59
>printday(set("sun",now,here))
2008-01-03 15:28:13
>function map computehour (month,year,planet;loc,compute) ...
now=day(year,floor(month),floor((month-floor(month))*30)+1);
r=compute(planet,now,loc);
t=getymdhms(r);
return t[4]+t[5]/60+t[6]/3600;
endfunction
>plot2d("computehour";2008,"sun",here,"rise",a=1,b=13,c=0,d=24,n=25,adaptive=0);
>plot2d("computehour";2008,"sun",here,"set",a=1,b=13,n=25,add=1,adaptive=0);
>plot2d("computehour";2008,"sun",here,"highest",a=1,b=13,n=25,add=1,adaptive=0);
>title("Sunrise and Sunset over one year"):

>printday(rise("moon",now,here))
2008-01-03 02:34:08
>printday(set("moon",now,here))
2008-01-03 11:32:10
Examples Homepage