Phases of the moon

launcher   home   guestbook  other ephemerides   lunar calendar for the month   Astro-MoonPhase-0.60   Total eclipse at the new moon 
the current attributes of the moon

T he phase of the moon the day before is shown in brackets. Since this web site is hosted in America, for you the day may be the day before and the day before the day before that.

Explanation and simulation of what you see
T here are 3 scripts moondisplayyellow.cgi, moonwrite.cgi and moontextimage.cgi.
This is moondisplayyellow.cgi :- top
#!/usr/bin/perl -w
use strict;
use GD;
#use CGI qw(:standard);
#print "Content-type: text/html\n\n";
#$| = 1;
#open (STDERR, ">&STDOUT");
#use CGI::Carp qw(fatalsToBrowser);
my ($xm, $xm1, $xs, $xs1, $S, $xd, $hp, $sw1, $sw3);
my ($dy, $mn, $yr, $lam, $dpsi, $bet, $p, $q, $x, $y, $f, $r, $thet, $djd);
my ($cd, $lsn, $sd, $i, $k, $md, $ms, $an, $mn1, $yr1, $a, $b, $c, $d);
my ($t, $eps, $epsr, $tpi, $deps, $eps1, $seps, $ceps, $cy, $ty, $sy);
my ($cx, $sx, $tx, $sq, $t2, $ls, $ld, $tls, $tld, $nm, $tnm, $m, $ma);
my ($ea, $SS, $dla, $tnu2, $nu, $a1, $b1, $d1, $e1, $c1, $h1, $dl, $dr, $rsn);
my ($m1, $m2, $m3, $m4, $m5, $m6, $de, $sa, $sb, $sn, $n, $e, $l, $sc, $e2);
my ($g, $w1, $w2, $xd1, $xp, $minmoon);
my ($im, , $im2, $white, $black, $red, $blue, $yellow);
my ($PHASE, $PHASE1, $PHASE2, $head, $dayte, $W ,$outfile ,$footnote);
my ($buff1, $buff2, $para, $fromangle, $toangle, $waxwan, $fillpos, $adjust);
my $pi = 3.1415926535;
print "Content-type: image/gif\n\n";
binmode STDOUT;
my $POTM = &CalcyMoon(0);
my $POTM1 = &CalcyMoon(1);
$minmoon = 0.010; # no moon if phase of the moon less than this
&moondraw;
syswrite(STDOUT, $buff1);

#print << "(MOONHEAD)";
#<HTML><HEAD><TITLE>Phase of the moon the day before</TITLE>
#<LINK REL="SHORTCUT ICON" HREF="/moon.ico">
#</HEAD>
#<BODY bgcolor=#CCCCCC><FONT FACE=ARIAL>
#<CENTER><H3>Phase of the moon the day before</H3></CENTER>
#(MOONHEAD)
#print "The phase of the moon for day $dy in month $mn of year $yr was $POTM<BR>\n";
#print "The phase of the moon for the day before day $dy in month $mn of year $yr was $POTM1<BR>\n";
#print "</BODY></HTML>\n";

sub moondraw {
# draw the moon Devendra December 24th 1998 updated July 10th 2013.
    $im = new GD::Image(400,380);  # background color is the next colorAllocate
    $white = $im->colorAllocate(255,255,255);
    $black = $im->colorAllocate(0,0,0);       
    $red = $im->colorAllocate(255,0,0);      
    $blue = $im->colorAllocate(0,0,255);
    $yellow = $im->colorAllocate(255,255,0);
$head = "THE STATUS OF THE MOON";
$dayte = 'FOR DAY '.$dy.' IN MONTH '.$mn.' OF THE YEAR '.$yr;
$PHASE1 = 300 - ($POTM * 600);
$PHASE2 = 300 - ((1 - $POTM) * 600);
if (abs($POTM) <= $minmoon) {
             $fromangle = 0;
             $toangle = 360;
             $waxwan = "no moon";
             $fillpos = 349;
} else {
if ($POTM > $POTM1) {
             $fromangle = 270;
             $toangle = 90;
             if ($POTM < 0.5) {
             $waxwan = "waxing crescent (growing)";
             }else{ $waxwan = "waxing gibbous (growing)";}
             $fillpos = 349;
} else {
             $fromangle = 90;
             $toangle = 270;
             if ($POTM < 0.5) {
             $waxwan = "waning crescent (shrinking)";
             }else{ $waxwan = "waning gibbous (shrinking)";}
             $fillpos = 51;
}}
if (abs($POTM - 1) <= $minmoon) {
	     $im->arc(200,200,300,300,0,360,$black);
	     $im->fill(200,200,$yellow); # full moon
             $waxwan = "full moon";
             } 
             else    {
                if (abs($POTM) <= $minmoon) 
	       {	$im->arc(200,200,300,300,$fromangle,$toangle,$yellow); # new moon - draw yellow circle
                        $im->fill(60,200,$black); # and fill it with black
	       }
              else { 
        		$im->arc(200,200,300,300,$fromangle,$toangle,$black); # draw left hand arc

                       if ($POTM<0.5) { $im->arc(200,200,$PHASE1,300,$fromangle,$toangle,$black); # draw an ellipse - left hand arc
                                        }
			if (abs($POTM-0.5)<0.001) { $im->GD::Image::line(200,50,200,350,$black); # draw a vertical line
                                                   }
                        if ($POTM>0.5) { $im->arc(200,200,$PHASE2,300,$toangle,$fromangle,$black); #draw an ellipse - right hand arc
                                        }
                        $im->fill($fillpos,200,$yellow); # in any case fill it with yellow
                   }
          }
$footnote = 'Phase = '.$POTM." (".$POTM1.") ".$waxwan;
$im->fill(25,10,$black); 
$im->GD::Image::string (gdLargeFont, 25, 10, $head, $white);
$im->GD::Image::string (gdLargeFont, 25, 25, $dayte, $white);
$im->GD::Image::string (gdLargeFont, 7, 360, $footnote ,$white);
$buff1 = $im->gif;
}
 
sub CalcyMoon {
   $adjust = $_[0];
   ($dy, $mn, $yr) = (localtime)[3,4,5];
   $yr = $yr + 1900; $mn = $mn + 1;
   &moon($adjust);
   
   &sun($adjust);
   $cd = cos($lam - $lsn) * cos($bet);
   $d = &acs($cd); 
   $sd = sin($d);
   $i = (.1468 * $sd * (1 - .0549 * sin($md))) / (1 - .0167 * sin($ms));
   $i = $pi - $d - &rad($i); $k = (1 + cos($i)) / 2;
   return &rou($k, 1000);
}

sub acs {
   $W = $_[0];
   return 1.570796327 - &asn($W); 
}

sub rou {
   $x = $_[0];
   $y = $_[1];
   return int($x * $y + .5) / $y;
} 

sub sun {
   my $adjust = $_[0];
   &julday; $djd = $djd - $adjust;
   $t = $djd / 36525; $t2 = $t * $t;
   $a = 100.0021359 * $t; $b = 360 * ($a - int($a));
   $ls = 279.69668 + (.0003025 * $t2) + $b;
   $a = 99.9973604200004 * $t; $b = 360 * ($a - int($a));
   $ms = 358.47583 - ((.00015 + (.0000033 * $t)) * $t2) + $b;
   $SS = .016751 - (.0000418 * $t) - (1.26E-07 * $t2);
   $ma = &rad($ms);
   &anomaly;
   $a = 62.5520947200002 * $t; $b = 360 * ($a - int($a));
   $a1 = &rad(153.23 + $b);
   $a = 125.1041894 * $t; $b = 360 * ($a - int($a));
   $b1 = &rad(216.57 + $b);
   $a = 91.56766028 * $t; $b = 360 * ($a = int($a));
   $c1 = &rad(312.69 + $b);
   $a = 1236.853095 * $t; $b = 360 * ($a - int($a));
   $d1 = &rad(350.74 - .00144 * $t2 + $b);
   $e1 = &rad(231.19 + 20.2 * $t);
   $a = 183.1353208 * $t; $b = 360 * ($a - int($a));
   $h1 = &rad(353.4 + $b);
   $dl = .00134 * cos($a1) + .00154 * cos($b1) + .002 * cos($c1);
   $dl = $dl + .00179 * sin($d1) + .00178 * sin($e1);
   $dr = 5.43E-06 * sin($a1) + 1.575E-05 * sin($b1) + 1.627E-05 * sin($c1);
   $dr = $dr + 3.076E-05 * cos($d1) + 9.27E-06 * sin($h1);
   $lsn = $nu + &rad($ls - $ms + $dl); $tpi = 6.28318530800002;
   $rsn = 1.0000002 * (1 - $SS * cos($ea)) + $dr;
   while ($lsn < 0) {
      $lsn = $lsn + $tpi;}
   while ($lsn > $tpi) {
      $lsn = $lsn - $tpi;}
} 

sub julday {
{
   $mn1 = $mn; $yr1 = $yr; $b = 0;
   if ($yr1 < 0) { $yr1 = $yr1 + 1;}
   if ($mn < 3) { $mn1 = $mn + 12; $yr1 = $yr1 - 1;}
if (($yr >= 1582) || (($yr == 1582) && ($mn < 10)) || (($yr == 1582) && ($mn == 10) && ($dy < 15))) {
      $a = int($yr1 / 100); $b = 2 - $a + int($a / 4);
	}
   if ($yr1 >= 0) {
      $c = int(365.25 * $yr1) - 694025;
   } else {
      $c = &itg((365.25 * $yr1) - .75) - 694025;
	}
   $d = int(30.6001 * ($mn1 + 1));
   $djd = $b + $c + $d + $dy - 0.5 ;
}}

sub rad {
   $W = $_[0];
   return .01745329252 * $W;
} 

sub moon {
   my $adjust = $_[0];
   &julday; $djd = $djd - $adjust;
   $t = $djd / 36525; $t2 = $t * $t;
   $m1 = 27.32158213; $m2 = 365.2596407;
   $m3 = 27.55455094; $m4 = 29.5305886800001;
   $m5 = 27.21222039; $m6 = 6798.36330700001;
   $m1 = $djd / $m1; $m2 = $djd / $m2; $m3 = $djd / $m3;
   $m4 = $djd / $m4; $m5 = $djd / $m5; $m6 = $djd / $m6;
   $m1 = 360 * ($m1 - int($m1)); $m2 = 360 * ($m2 - int($m2));
   $m3 = 360 * ($m3 - int($m3)); $m4 = 360 * ($m4 - int($m4));
   $m5 = 360 * ($m5 - int($m5)); $m6 = 360 * ($m6 - int($m6));
   $ld = 270.434164 + $m1 - (.001133 - .0000019 * $t) * $t2;
   $ms = 358.475833 + $m2 - (.00015 + .0000033 * $t) * $t2;
   $md = 296.104608 + $m3 + (.009192 + .0000144 * $t) * $t2;
   $de = 350.737486 + $m4 - (.001436 - .0000019 * $t) * $t2;
   $f = 11.250889 + $m5 - (.003211 + .0000003 * $t) * $t2;
   $n = 259.183275 - $m6 + (.002078 + .000022 * $t) * $t2;
   $a = &rad(51.2 + 20.2 * $t); $sa = sin($a);
   $sn = sin(&rad($n));
   $b = 346.56 + (132.87 - .0091731 * $t) * $t;
   $sb = .003964 * sin(&rad($b));
   $c = &rad($n + 275.05 - 2.3 * $t); $sc = sin($c);
   $ld = $ld + .000233 * $sa + $sb + .001964 * $sn;
   $ms = $ms - .001778 * $sa;
   $md = $md + .000817 * $sa + $sb + .002541 * $sn;
   $f = $f + $sb - .024691 * $sn - .004328 * $sc;
   $de = $de + .002011 * $sa + $sb + .001964 * $sn;
   $e = 1 - (.002495 + 7.52E-06 * $t) * $t; $e2 = $e * $e;
   $ld = &rad($ld); $ms = &rad($ms); $n = &rad($n);
   $de = &rad($de); $f = &rad($f); $md = &rad($md);
   $l = 6.28875 * sin($md) + 1.27402 * sin(2 * $de - $md) + .658309 * sin(2 * $de);
   $l = $l + .213616 * sin(2 * $md) - $e * .185596 * sin($ms) - .114336 * sin(2 * $f);
   $l = $l + .058793 * sin(2 * ($de - $md)) + .057212 * $e * sin(2 * $de - $ms - $md);
   $l = $l + .05332 * sin(2 * $de + $md) + .045874 * $e * sin(2 * $de - $ms);
   $l = $l + .041024 * $e * sin($md - $ms);
   $l = $l - .034718 * sin($de) - $e * .030465 * sin($ms + $md);
   $l = $l + .015326 * sin(2 * ($de - $f)) - .012528 * sin(2 * $f + $md);
   $l = $l - .01098 * sin(2 * $f - $md) + .010674 * sin(4 * $de - $md);
   $l = $l + .010034 * sin(3 * $md) + .008548 * sin(4 * $de - 2 * $md);
   $l = $l - $e * .00791 * sin($ms - $md + 2 * $de) - $e * .006783 * sin(2 * $de + $ms);
   $l = $l + .005162 * sin($md - $de) + $e * .005 * sin($ms + $de);
   $l = $l + .003862 * sin(4 * $de) + $e * .004049 * sin($md - $ms + 2 * $de);
   $l = $l + .003996 * sin(2 * ($md + $de)) + .003665 * sin(2 * $de - 3 * $md);
   $l = $l + $e * .002695 * sin(2 * $md - $ms) + .002602 * sin($md - 2 * ($f + $de));
   $l = $l + $e * .002396 * sin(2 * ($de - $md) - $ms) - .002349 * sin($md + $de);
   $l = $l + $e2 * .002249 * sin(2 * ($de - $ms)) - $e * .002125 * sin(2 * $md + $ms);
   $l = $l - $e2 * .002079 * sin(2 * $ms) + $e2 * .002059 * sin(2 * ($de - $ms) - $md);
   $l = $l - .001773 * sin($md + 2 * ($de - $f)) - .001595 * sin(2 * ($f + $de));
   $l = $l + $e * .00122 * sin(4 * $de - $ms - $md) - .00111 * sin(2 * ($md + $f));
   $l = $l + .000892 * sin($md - 3 * $de);
   $l = $l - $e * .000811 * sin($ms + $md + 2 * $de);
   $l = $l + $e * .000761 * sin(4 * $de - $ms - 2 * $md);
   $l = $l + $e2 * .000704 * sin($md - 2 * ($ms + $de));
   $l = $l + $e * .000693 * sin($ms - 2 * ($md - $de));
   $l = $l + $e * .000598 * sin(2 * ($de - $f) - $ms) + .00055 * sin($md + 4 * $de);
   $l = $l + .000538 * sin(4 * $md) + $e * .000521 * sin(4 * $de - $ms);
   $l = $l + .000486 * sin(2 * $md - $de);
   $l = $l + $e2 * .000717 * sin($md - 2 * $ms);
   $lam = $ld + &rad($l); $tpi = 6.28318530800002;
   while ($lam < 0) {
      $lam = $lam + $tpi;
   }
   while ($lam > $tpi) {
      $lam = $lam - $tpi;
   }
   $g = 5.12819 * sin($f) + .280606 * sin($md + $f) + .277693 * sin($md - $f);
   $g = $g + .173238 * sin(2 * $de - $f) + .055413 * sin(2 * $de + $f - $md);
   $g = $g + .046272 * sin(2 * $de - $f - $md) + .032573 * sin(2 * $de + $f);
   $g = $g + .017198 * sin(2 * $md + $f) + .009267 * sin(2 * $de + $md - $f);
   $g = $g + .008823 * sin(2 * $md - $f) + $e * .008247 * sin(2 * $de - $ms - $f);
   $g = $g + .004323 * sin(2 * ($de - $md) - $f) + .0042 * sin(2 * $de + $f + $md);
   $g = $g + $e * .003372 * sin($f - $ms - 2 * $de);
   $g = $g + $e * .002472 * sin(2 * $de + $f - $ms - $md);
   $g = $g + $e * .002222 * sin(2 * $de + $f - $ms);
   $g = $g + $e * .002072 * sin(2 * $de - $f - $ms - $md);
   $g = $g + $e * .001877 * sin($f - $ms + $md) + .001828 * sin(4 * $de - $f - $md);
   $g = $g - $e * .001803 * sin($f + $ms) - .00175 * sin(3 * $f);
   $g = $g + $e * .00157 * sin($md - $ms - $f) - .001487 * sin($f + $de);
   $g = $g - $e * .001481 * sin($f + $ms + $md) + $e * .001417 * sin($f - $ms - $md);
   $g = $g + $e * .00135 * sin($f - $ms) + .00133 * sin($f - $de);
   $g = $g + .001106 * sin($f + 3 * $md) + .00102 * sin(4 * $de - $f);
   $g = $g + .000833 * sin($f + 4 * $de - $md) + .000781 * sin($md - 3 * $f);
   $g = $g + .00067 * sin($f + 4 * $de - 2 * $md);
   $g = $g + .000606 * sin(2 * $de - 3 * $f) + .000597 * sin(2 * ($de + $md) - $f);
   $g = $g + $e * .000492 * sin(2 * $de + $md - $ms - $f);
   $g = $g + .00045 * sin(2 * ($md - $de) - $f) + .000439 * sin(3 * $md - $f);
   $g = $g + .000423 * sin($f + 2 * ($de + $md)) + .000422 * sin(2 * $de - $f - 3 * $md);
   $g = $g - $e * .000367 * sin($ms + $f + 2 * $de - $md);
   $g = $g - $e * .000353 * sin($ms + $f + 2 * $de) + .000331 * sin($f + 4 * $de);
   $g = $g + $e * .000317 * sin(2 * $de + $f - $ms + $md);
   $g = $g + $e2 * .000306 * sin(2 * ($de - $ms) - $f) - .000283 * sin($md + 3 * $f);
   $w1 = .0004664 * cos($n); $w2 = .0000754 * cos($c);
   $bet = &rad($g) * (1 - $w1 - $w2);
   $hp = .950724 + .051818 * cos($md) + .009531 * cos(2 * $de - $md);
   $hp = $hp + .007843 * cos(2 * $de) + .002824 * cos(2 * $md);
   $hp = $hp + .000857 * cos(2 * $de + $md) + $e * .000533 * cos(2 * $de - $ms);
   $hp = $hp + $e * .000401 * cos(2 * $de - $md - $ms) + $e * .00032 * cos($md - $ms);
   $hp = $hp - .000271 * cos($de) - $e * .000264 * cos($ms + $md);
   $hp = $hp - .000198 * cos(2 * $f - $md);
   $hp = $hp + .000173 * cos(3 * $md) + .000167 * cos(4 * $de - $md);
   $hp = $hp - $e * .000111 * cos($ms) + .000103 * cos(4 * $de - 2 * $md);
   $hp = $hp - .000084 * cos(2 * $md - 2 * $de) - $e * .000083 * cos(2 * $de + $ms);
   $hp = $hp + .000079 * cos(2 * $de + 2 * $md) + .000072 * cos(4 * $de);
   $hp = $hp + $e * .000064 * cos(2 * $de - $ms + $md);
   $hp = $hp - $e * .000063 * cos(2 * $de + $ms - $md) + $e * .000041 * cos($ms + $de);
   $hp = $hp + $e * .000035 * cos(2 * $md - $ms) - .000033 * cos(3 * $md - 2 * $de);
   $hp = $hp - .00003 * cos($md + $de) - .000029 * cos(2 * ($f - $de));
   $hp = $hp - $e * .000029 * cos(2 * $md + $ms) + $e2 * .000026 * cos(2 * ($de - $ms));
   $hp = $hp - .000023 * cos(2 * ($f - $de) + $md);
   $hp = $hp + $e * .000019 * cos(4 * $de - $ms - $md);
   $hp = &rad($hp);
}

sub anomaly {
   $tpi = 6.283185308;
   $m = $ma - $tpi * int($ma / $tpi); $ea = $m;
   $dla = $ea - ($SS * sin($ea)) - $m;
   while (abs($dla) >= .000001) {   
      $dla = $dla / (1 - ($SS * cos($ea)));
      $ea = $ea - $dla;
      $dla = $ea - ($SS * sin($ea)) - $m; # set up for next time around
   }

   $tnu2 = sqrt((1 + $SS) / (1 - $SS)) * tan($ea / 2);
   $nu = 2 * atan2($tnu2, 1);
} 

sub tan {
	$W = $_[0];
	return sin($W)/cos($W);
}


sub asn {
   $W = $_[0];
   return atan2($W / (sqrt(1.000001 - $W * $W) + 1E-20), 1);
}

This is moonwrite.cgi :- top
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
print "Content-type: text/html\n\n";
$| = 1;
open (STDERR, ">&STDOUT");
use CGI::Carp qw(fatalsToBrowser);
my (@lines, $storey, $source, $storey, $dy, $mn, $yr);
my ($apollo, $source1, $source2, $source3, $windows8, $server, $software);
$server = $ENV{SERVER_NAME}; # like onwardoverland.com
$software = $ENV{SERVER_SOFTWARE}; # like Microsoft-IIS/8.0
$windows8 = "";
if (substr($software, 0, 13) eq "Microsoft-IIS"){$windows8 = "c:\\devhtml\\cgi-bin\\";}
$source1 = "moondisplayyellow.cgi";
$source2 = "moonwrite.cgi"; 
$source3 = "moontextimage.cgi";

print << "(MOONHEAD)";
<HTML><HEAD><TITLE>Phases of the moon</TITLE>
<LINK REL="SHORTCUT ICON" HREF="/moon.ico">
</HEAD>
<BODY bgcolor=#CCCCCC><A NAME = TOP><FONT FACE=ARIAL>
<H3>Phases of the moon</H3>
<FONT SIZE=2>
<A HREF=/launcher.html>launcher</A>&nbsp;&nbsp; 
<A HREF=/index.html>home</A>&nbsp;&nbsp; 
<a href="#" onkeypress="bar" onclick="MyWindow=window.open('/formost.html?ref=moonwrite','MyWindow','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=800,height=600'); return false;">guestbook</a>&nbsp;
<A HREF=http://xjubier.free.fr/en/site_pages/astronomy/ephemerides.html>other ephemerides</A>&nbsp;&nbsp;
<A HREF=http://aa.usno.navy.mil/cgi-bin/aa_moonphases.pl?year=2014&ZZZ=END>lunar calendar for the month</A>&nbsp;&nbsp;
<A HREF=http://search.cpan.org/~brett/Astro-MoonPhase-0.60/>Astro-MoonPhase-0.60</A>&nbsp;&nbsp;
<A HREF=http://www.bbc.co.uk/news/world-asia-20307900>Total eclipse at the new moon</A>&nbsp;
<FONT SIZE=2>
<TABLE><tr>
<TD WIDTH=50%><IMG SRC = $source3 alt = "the current attributes of the moon"  
VALIGN = TOP HSPACE = 20 VSPACE = 10 height=220 width=400><BR CLEAR=ALL>
<P><FONT FACE=ARIAL SIZE=6>T<FONT FACE=ARIAL SIZE=1>
he phase of the moon the day before is shown in brackets.
Since this web site is hosted in America,
for you the day may be the day before 
and the day before the day before that.
</TD>
<TD><A HREF="http://aspire.cosmic-ray.org/labs/moon/lunar_phase3.swf">
<IMG SRC = $source1 alt = "Explanation and simulation of what you see" border=0
VALIGN = TOP HSPACE = 20 VSPACE = 10 height=380 width=400></A></TD>
</tr></TABLE>
<FONT FACE=ARIAL SIZE=6>T<FONT FACE=ARIAL SIZE=3>
here are 3 scripts <A HREF=#$windows8$source1>$source1</A>, <A HREF=#$windows8$source2>$source2</A> and <A HREF=#$windows8$source3>$source3</A>.
<PRE>
(MOONHEAD)
&disp($source1); 
&disp($source2);
&disp($source3); 
print << "(MOONTAIL)";
</PRE><FONT SIZE=2 COLOR=BLACK>
Page updated on August 5th. 2015. You are visitor number&nbsp;&nbsp;
<IMG SRC=number9.cgi?style=I&width=7&update=Yes&countfile=jblack_moonwrite.txt
width=140 height=27 alt="number of hits">&nbsp;&nbsp;
<A HREF=/launcher.html>launcher</A>&nbsp;&nbsp; 
<A HREF=/index.html>home</A>&nbsp;&nbsp; 
&nbsp;
<a href="#" onkeypress="bar" onclick="MyWindow=window.open('/formost.html?ref=moonwrite','MyWindow','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=800,height=600'); return false;">guestbook</a>
<BR><BR>
<A HREF=#TOP>top</A>&nbsp;&nbsp;
<A HREF=http://xjubier.free.fr/en/site_pages/astronomy/ephemerides.html>other ephemerides</A>&nbsp;&nbsp;
<A HREF=http://aa.usno.navy.mil/cgi-bin/aa_moonphases.pl?year=2014&ZZZ=END>lunar calendar for the month</A>&nbsp;&nbsp;
<A HREF=http://search.cpan.org/~brett/Astro-MoonPhase-0.60/>Astro-MoonPhase-0.60</A>&nbsp;&nbsp;
<A HREF=http://www.bbc.co.uk/news/world-asia-20307900>Total eclipse at the new moon</A>&nbsp;
<BR><BR>
</BODY></HTML>
(MOONTAIL)

sub disp{
$source = $windows8 . $_[0];
# print "/$source = $source<BR>/n"; exit;
open(SOURCE, $source) or die ("5 Can't open $source: $!");
@lines = <SOURCE>;
close(SOURCE) or die ("6 Can't close $source: $!");
print "<A NAME = $source><FONT COLOR = red>This is $source :- <A HREF=#TOP>top</A><FONT COLOR = black>\n";
foreach $storey (@lines){
chop($storey);
$storey =~s/&/&amp;/g;
$storey =~s/</&lt;/g;
$storey =~s/>/&gt;/g;
print "$storey\n";
}
}

This is moontextimage.cgi :- top
#!/usr/bin/perl -w
use strict;
#use CGI qw(:standard);
use GD;
my %Degtype = (
"PosNeg" => "-",
"Degr" => 23,
"Min" => 45,
"Sec" => 23
);
my %HMSType = (
"PosNeg" => "+",
"Hour" => 12,
"Min" => 27,
"Sec" => 2
);
my %MoonStatus = (
"Longitude" => {%Degtype}, 
"Latitude" => {%Degtype}, 
"Rascend" => {%HMSType}, 
"Declination" => {%Degtype}, 
"HParallax" => {%Degtype},
"AngularDim" => {%Degtype}, 
"EarthMoon" => 12345, 
"POTM" => 0.5
);
my @flag = (1 .. 7);
my ($xm, $xm1, $xs, $xs1, $S, $xd, $hp, $sw1, $sw3);
my ($dy, $mn, $yr, $lam, $dpsi, $bet, $p, $q, $x, $y, $f, $r, $thet, $djd);
my ($cd, $lsn, $sd, $i, $k, $md, $ms, $an, $mn1, $yr1, $a, $b, $c, $d);
my ($t, $eps, $epsr, $tpi, $deps, $eps1, $seps, $ceps, $cy, $ty, $sy);
my ($cx, $sx, $tx, $sq, $t2, $ls, $ld, $tls, $tld, $nm, $tnm, $m, $ma);
my ($ea, $SS, $dla, $tnu2, $nu, $a1, $b1, $d1, $e1, $c1, $h1, $dl, $dr, $rsn);
my ($m1, $m2, $m3, $m4, $m5, $m6, $de, $sa, $sb, $sn, $n, $e, $l, $sc, $e2);
my ($g, $w1, $w2, $xd1, $xp);
my ($im, , $im2, $white, $black, $red, $blue, $yellow);
my ($PHASE, $PHASE1, $PHASE2, $head, $dayte, $W ,$outfile ,$footnote);
my ($buff1, $buff2, $para, $fromangle, $toangle, $waxwan, $fillpos, $grey);
my $pi = 3.1415926535;
#if (!defined ($para = param('gifgif'))) {$para = 'textgif';}
print "Content-type: image/gif\n\n";
binmode STDOUT;
&CalcMoon; # this does all the work
&datadisplay; # this displays the text of the current moon attributes as an image (text doesn't work)
syswrite(STDOUT, $buff2);

sub CalcMoon {
   ($dy, $mn, $yr) = (localtime)[3,4,5];
   $yr = $yr + 1900; $mn = $mn + 1;
   &moon;
   &nutat;
   $x = &deg($lam) + $dpsi; $sw1 = 1; 
&minsec;
   $MoonStatus{"Longitude"}{"PosNeg"} = $S;
   $MoonStatus{"Longitude"}{"Degr"} = $xd;
   $MoonStatus{"Longitude"}{"Min"} = $xm;
   $MoonStatus{"Longitude"}{"Sec"} = $xs;
   $x = &deg($bet);
&minsec;
   $MoonStatus{"Latitude"}{"PosNeg"} = $S;
   $MoonStatus{"Latitude"}{"Degr"} = $xd;
   $MoonStatus{"Latitude"}{"Min"} = $xm;
   $MoonStatus{"Latitude"}{"Sec"} = $xs;
   $x = $lam; $y = $bet; $sw3 = -1; 
&eqecl;
   $x = &deg($p / 15);
&minsec;
   $MoonStatus{'Rascend'}{'PosNeg'} = $S;
   $MoonStatus{'Rascend'}{'Hour'} = $xd;
   $MoonStatus{'Rascend'}{'Min'} = $xm;
   $MoonStatus{'Rascend'}{'Sec'} = $xs;
   $x = &deg($q); &minsec;
   $MoonStatus{'Declination'}{'PosNeg'} = $S;
   $MoonStatus{'Declination'}{'Degr'} = $xd;
   $MoonStatus{'Declination'}{'Min'} = $xm;
   $MoonStatus{'Declination'}{'Sec'} = $xs;
   $x = &deg($hp); &minsec;
   $MoonStatus{'HParallax'}{'Degr'} = $xd;
   $MoonStatus{'HParallax'}{'Min'} = $xm;
   $MoonStatus{'HParallax'}{'Sec'} = $xs;
   $r = 6378.14 / sin($hp);
   $MoonStatus{'EarthMoon'} = $r;
   $f = $r / 384401;
   $thet = .5181 / $f;
   $x = ($thet); &minsec;
   $MoonStatus{'AngularDim'}{'Degr'} = $xd;
   $MoonStatus{'AngularDim'}{'Min'} = $xm;
   $MoonStatus{'AngularDim'}{'Sec'} = $xs;
   &sun;
   $cd = cos($lam - $lsn) * cos($bet);
   $d = &acs($cd); 
   $sd = sin($d);
   $i = (.1468 * $sd * (1 - .0549 * sin($md))) / (1 - .0167 * sin($ms));
   $i = $pi - $d - &rad($i); $k = (1 + cos($i)) / 2;
   $MoonStatus{'POTM'} = &rou($k, 1000);
   $flag[1] = 0; $flag[5] = 0; $flag[6] = 0;
   $flag[7] = 0;
} 

sub datadisplay {
    $im2 = new GD::Image(400,220);
    $grey = $im2->colorAllocate(204,204,204); # background color
    $white = $im2->colorAllocate(255,255,255); 
    $black = $im2->colorAllocate(0,0,0);       
    $red = $im2->colorAllocate(255,0,0);      
    $blue = $im2->colorAllocate(0,0,255);
    $yellow = $im2->colorAllocate(255,255,0);
$a = "THE STATUS OF THE MOON FOR DAY $dy";
$b = "IN MONTH $mn OF THE YEAR $yr IS:-";
$c = "ATTRIBUTE             DEG      MIN     SEC ";
$im2->GD::Image::string (gdLargeFont, 25, 10, $a, $black);
$im2->GD::Image::string (gdLargeFont, 25, 25, $b, $black);
$im2->GD::Image::string (gdLargeFont, 25, 45, $c, $black);
$a = $MoonStatus{'Longitude'}{'PosNeg'}; $b =  $MoonStatus{'Longitude'}{'Degr'}; $c = $MoonStatus{'Longitude'}{'Min'}; $d = $MoonStatus{'Longitude'}{'Sec'};
$e = sprintf("Longitude            $a %3d     %3d     %2.2f", $b, $c, $d);
$im2->GD::Image::string (gdLargeFont, 25, 65, $e, $black);
$a = $MoonStatus{'Latitude'}{'PosNeg'}; $b = $MoonStatus{'Latitude'}{'Degr'}; $c = $MoonStatus{'Latitude'}{'Min'}; $d = $MoonStatus{'Latitude'}{'Sec'};
$e = sprintf("Latitude             $a %3d     %3d     %2.2f", $b, $c, $d);
$im2->GD::Image::string (gdLargeFont, 25, 85, $e, $black);
$a = $MoonStatus{'Rascend'}{'PosNeg'}; $b = $MoonStatus{'Rascend'}{'Hour'}; $c = $MoonStatus{'Rascend'}{'Min'}; $d = $MoonStatus{'Rascend'}{'Sec'};
$e = sprintf("Right Ascension      $a %3d     %3d     %2.2f", $b, $c, $d);
$im2->GD::Image::string (gdLargeFont, 25, 105, $e, $black);
$a = $MoonStatus{'Declination'}{'PosNeg'}; $b = $MoonStatus{'Declination'}{'Degr'}; $c = $MoonStatus{'Declination'}{'Min'}; $d = $MoonStatus{'Declination'}{'Sec'};
$e = sprintf("Declination          $a %3d     %3d     %2.2f", $b, $c, $d);
$im2->GD::Image::string (gdLargeFont, 25, 125, $e, $black);
$a = $MoonStatus{'HParallax'}{'Degr'}; $b = $MoonStatus{'HParallax'}{'Min'}; $c = $MoonStatus{'HParallax'}{'Sec'};
$e = sprintf("Horizontal Parallax    %3d     %3d     %2.2f", $a, $b, $c);
$im2->GD::Image::string (gdLargeFont, 25, 145, $e, $black);
$a = $MoonStatus{'AngularDim'}{'Degr'}; $b = $MoonStatus{'AngularDim'}{'Min'}; $c = $MoonStatus{'AngularDim'}{'Sec'};
$e = sprintf("Angular Dimension      %3d     %3d     %2.2f", $a, $b, $c);
$im2->GD::Image::string (gdLargeFont, 25, 165, $e, $black);
$a = $MoonStatus{'EarthMoon'};
$e = sprintf("Earth Moon Status       %10.2f", $a);
$im2->GD::Image::string (gdLargeFont, 25, 185, $e, $black);
$a = $MoonStatus{'POTM'};
$e =sprintf("Phase of the moon       %1.3f", $a);
$im2->GD::Image::string (gdLargeFont, 25, 205, $e, $black);
$buff2 = $im2->gif;
} 

sub acs {
   $W = $_[0];
   return 1.570796327 - &asn($W); 
}

sub anomaly {
   $tpi = 6.283185308;
   $m = $ma - $tpi * int($ma / $tpi); $ea = $m;
   $dla = $ea - ($SS * sin($ea)) - $m;
   while (abs($dla) >= .000001) {   
      $dla = $dla / (1 - ($SS * cos($ea)));
      $ea = $ea - $dla;
      $dla = $ea - ($SS * sin($ea)) - $m; # set up for next time around
   }

   $tnu2 = sqrt((1 + $SS) / (1 - $SS)) * tan($ea / 2);
   $nu = 2 * atan2($tnu2, 1);
} 

sub tan {
	$W = $_[0];
	return sin($W)/cos($W);
}

sub asn {
   $W = $_[0];
   return atan2($W / (sqrt(1.000001 - $W * $W) + 1E-20), 1);
} 


sub deg {
   $W = $_[0];
   return 57.29577951 * $W;
} 

sub eqecl {
      if ($flag[7] != 1) {
      $tpi = 2 * $pi; $flag[7] = 1;
      if ($flag[6] == 0) {$deps = 0;}
      &obliq;
      $eps1 = &rad($eps + $deps);
      $seps = sin($eps1); $ceps = cos($eps1);
   }
   $cy = cos($y); $sy = sin($y);
   if (abs($cy) < 1E-20) {$cy = 1E-20;}
   $ty = $sy / $cy; $cx = cos($x); $sx = sin($x);
   $sq = ($sy * $ceps) - ($cy * $seps * $sx * $sw3);
   $q = &asn($sq); $a = ($sx * $ceps) + ($ty * $seps * $sw3);
   $p = atan2($a/$cx, 1);
   if ($cx < 0) {$p = $p + $pi;}
   if ($p > $tpi) {$p = $p - $tpi;}
   if ($p < 0) {$p = $p + $tpi;}
}

sub sgn {
        $W = $_[0];
	if ($W<0) { return -1; }
	if ($W==0) { return 0; }
	if ($W>0) { return 1;}
}

sub itg {
   $W = $_[0];
   return int($W) + 1 * &sgn($W) * int((&sgn($W) - 1) / 2);
} 

sub julday {
   if ($flag[1] != 1) {
   $mn1 = $mn; $yr1 = $yr; $flag[1] = 1; $b = 0;
   if ($yr1 < 0) { $yr1 = $yr1 + 1;}
   if ($mn < 3) { $mn1 = $mn + 12; $yr1 = $yr1 - 1;}
if (($yr >= 1582) || (($yr == 1582) && ($mn < 10)) || (($yr == 1582) && ($mn == 10) && ($dy < 15))) {
      $a = int($yr1 / 100); $b = 2 - $a + int($a / 4);
	}
   if ($yr1 >= 0) {
      $c = int(365.25 * $yr1) - 694025;
   } else {
      $c = &itg((365.25 * $yr1) - .75) - 694025;
	}
   $d = int(30.6001 * ($mn1 + 1));
   $djd = $b + $c + $d + $dy - 0.5 ;
}}

sub minsec {
if ($sw1 == -1) {
   $sn = 1;
   if (($xd < 0) || ($xm < 0) || ($xs < 0)) { $sn = -1;}
   $xd1 = abs($xd); $xm1 = abs($xm); $xs1 = abs($xs);
   $x = (((($xs1 / 60) + $xm1) / 60) + $xd1) * $sn;
} else {
   $sn = &sgn($x); $xp = abs($x); $xd = int($xp);
   $a = ($xp - $xd) * 60; $xm = int($a);
   $xs = int((($a - $xm) * 600) + .5) / 10;
   if ($sn == -1) {$S = "-";} else {$S = "+";}
}
}

sub moon {
   &julday;
   $t = $djd / 36525; $t2 = $t * $t;
   $m1 = 27.32158213; $m2 = 365.2596407;
   $m3 = 27.55455094; $m4 = 29.5305886800001;
   $m5 = 27.21222039; $m6 = 6798.36330700001;
   $m1 = $djd / $m1; $m2 = $djd / $m2; $m3 = $djd / $m3;
   $m4 = $djd / $m4; $m5 = $djd / $m5; $m6 = $djd / $m6;
   $m1 = 360 * ($m1 - int($m1)); $m2 = 360 * ($m2 - int($m2));
   $m3 = 360 * ($m3 - int($m3)); $m4 = 360 * ($m4 - int($m4));
   $m5 = 360 * ($m5 - int($m5)); $m6 = 360 * ($m6 - int($m6));
   $ld = 270.434164 + $m1 - (.001133 - .0000019 * $t) * $t2;
   $ms = 358.475833 + $m2 - (.00015 + .0000033 * $t) * $t2;
   $md = 296.104608 + $m3 + (.009192 + .0000144 * $t) * $t2;
   $de = 350.737486 + $m4 - (.001436 - .0000019 * $t) * $t2;
   $f = 11.250889 + $m5 - (.003211 + .0000003 * $t) * $t2;
   $n = 259.183275 - $m6 + (.002078 + .000022 * $t) * $t2;
   $a = &rad(51.2 + 20.2 * $t); $sa = sin($a);
   $sn = sin(&rad($n));
   $b = 346.56 + (132.87 - .0091731 * $t) * $t;
   $sb = .003964 * sin(&rad($b));
   $c = &rad($n + 275.05 - 2.3 * $t); $sc = sin($c);
   $ld = $ld + .000233 * $sa + $sb + .001964 * $sn;
   $ms = $ms - .001778 * $sa;
   $md = $md + .000817 * $sa + $sb + .002541 * $sn;
   $f = $f + $sb - .024691 * $sn - .004328 * $sc;
   $de = $de + .002011 * $sa + $sb + .001964 * $sn;
   $e = 1 - (.002495 + 7.52E-06 * $t) * $t; $e2 = $e * $e;
   $ld = &rad($ld); $ms = &rad($ms); $n = &rad($n);
   $de = &rad($de); $f = &rad($f); $md = &rad($md);
   $l = 6.28875 * sin($md) + 1.27402 * sin(2 * $de - $md) + .658309 * sin(2 * $de);
   $l = $l + .213616 * sin(2 * $md) - $e * .185596 * sin($ms) - .114336 * sin(2 * $f);
   $l = $l + .058793 * sin(2 * ($de - $md)) + .057212 * $e * sin(2 * $de - $ms - $md);
   $l = $l + .05332 * sin(2 * $de + $md) + .045874 * $e * sin(2 * $de - $ms);
   $l = $l + .041024 * $e * sin($md - $ms);
   $l = $l - .034718 * sin($de) - $e * .030465 * sin($ms + $md);
   $l = $l + .015326 * sin(2 * ($de - $f)) - .012528 * sin(2 * $f + $md);
   $l = $l - .01098 * sin(2 * $f - $md) + .010674 * sin(4 * $de - $md);
   $l = $l + .010034 * sin(3 * $md) + .008548 * sin(4 * $de - 2 * $md);
   $l = $l - $e * .00791 * sin($ms - $md + 2 * $de) - $e * .006783 * sin(2 * $de + $ms);
   $l = $l + .005162 * sin($md - $de) + $e * .005 * sin($ms + $de);
   $l = $l + .003862 * sin(4 * $de) + $e * .004049 * sin($md - $ms + 2 * $de);
   $l = $l + .003996 * sin(2 * ($md + $de)) + .003665 * sin(2 * $de - 3 * $md);
   $l = $l + $e * .002695 * sin(2 * $md - $ms) + .002602 * sin($md - 2 * ($f + $de));
   $l = $l + $e * .002396 * sin(2 * ($de - $md) - $ms) - .002349 * sin($md + $de);
   $l = $l + $e2 * .002249 * sin(2 * ($de - $ms)) - $e * .002125 * sin(2 * $md + $ms);
   $l = $l - $e2 * .002079 * sin(2 * $ms) + $e2 * .002059 * sin(2 * ($de - $ms) - $md);
   $l = $l - .001773 * sin($md + 2 * ($de - $f)) - .001595 * sin(2 * ($f + $de));
   $l = $l + $e * .00122 * sin(4 * $de - $ms - $md) - .00111 * sin(2 * ($md + $f));
   $l = $l + .000892 * sin($md - 3 * $de);
   $l = $l - $e * .000811 * sin($ms + $md + 2 * $de);
   $l = $l + $e * .000761 * sin(4 * $de - $ms - 2 * $md);
   $l = $l + $e2 * .000704 * sin($md - 2 * ($ms + $de));
   $l = $l + $e * .000693 * sin($ms - 2 * ($md - $de));
   $l = $l + $e * .000598 * sin(2 * ($de - $f) - $ms) + .00055 * sin($md + 4 * $de);
   $l = $l + .000538 * sin(4 * $md) + $e * .000521 * sin(4 * $de - $ms);
   $l = $l + .000486 * sin(2 * $md - $de);
   $l = $l + $e2 * .000717 * sin($md - 2 * $ms);
   $lam = $ld + &rad($l); $tpi = 6.28318530800002;
   while ($lam < 0) {
      $lam = $lam + $tpi;
   }
   while ($lam > $tpi) {
      $lam = $lam - $tpi;
   }
   $g = 5.12819 * sin($f) + .280606 * sin($md + $f) + .277693 * sin($md - $f);
   $g = $g + .173238 * sin(2 * $de - $f) + .055413 * sin(2 * $de + $f - $md);
   $g = $g + .046272 * sin(2 * $de - $f - $md) + .032573 * sin(2 * $de + $f);
   $g = $g + .017198 * sin(2 * $md + $f) + .009267 * sin(2 * $de + $md - $f);
   $g = $g + .008823 * sin(2 * $md - $f) + $e * .008247 * sin(2 * $de - $ms - $f);
   $g = $g + .004323 * sin(2 * ($de - $md) - $f) + .0042 * sin(2 * $de + $f + $md);
   $g = $g + $e * .003372 * sin($f - $ms - 2 * $de);
   $g = $g + $e * .002472 * sin(2 * $de + $f - $ms - $md);
   $g = $g + $e * .002222 * sin(2 * $de + $f - $ms);
   $g = $g + $e * .002072 * sin(2 * $de - $f - $ms - $md);
   $g = $g + $e * .001877 * sin($f - $ms + $md) + .001828 * sin(4 * $de - $f - $md);
   $g = $g - $e * .001803 * sin($f + $ms) - .00175 * sin(3 * $f);
   $g = $g + $e * .00157 * sin($md - $ms - $f) - .001487 * sin($f + $de);
   $g = $g - $e * .001481 * sin($f + $ms + $md) + $e * .001417 * sin($f - $ms - $md);
   $g = $g + $e * .00135 * sin($f - $ms) + .00133 * sin($f - $de);
   $g = $g + .001106 * sin($f + 3 * $md) + .00102 * sin(4 * $de - $f);
   $g = $g + .000833 * sin($f + 4 * $de - $md) + .000781 * sin($md - 3 * $f);
   $g = $g + .00067 * sin($f + 4 * $de - 2 * $md);
   $g = $g + .000606 * sin(2 * $de - 3 * $f) + .000597 * sin(2 * ($de + $md) - $f);
   $g = $g + $e * .000492 * sin(2 * $de + $md - $ms - $f);
   $g = $g + .00045 * sin(2 * ($md - $de) - $f) + .000439 * sin(3 * $md - $f);
   $g = $g + .000423 * sin($f + 2 * ($de + $md)) + .000422 * sin(2 * $de - $f - 3 * $md);
   $g = $g - $e * .000367 * sin($ms + $f + 2 * $de - $md);
   $g = $g - $e * .000353 * sin($ms + $f + 2 * $de) + .000331 * sin($f + 4 * $de);
   $g = $g + $e * .000317 * sin(2 * $de + $f - $ms + $md);
   $g = $g + $e2 * .000306 * sin(2 * ($de - $ms) - $f) - .000283 * sin($md + 3 * $f);
   $w1 = .0004664 * cos($n); $w2 = .0000754 * cos($c);
   $bet = &rad($g) * (1 - $w1 - $w2);
   $hp = .950724 + .051818 * cos($md) + .009531 * cos(2 * $de - $md);
   $hp = $hp + .007843 * cos(2 * $de) + .002824 * cos(2 * $md);
   $hp = $hp + .000857 * cos(2 * $de + $md) + $e * .000533 * cos(2 * $de - $ms);
   $hp = $hp + $e * .000401 * cos(2 * $de - $md - $ms) + $e * .00032 * cos($md - $ms);
   $hp = $hp - .000271 * cos($de) - $e * .000264 * cos($ms + $md);
   $hp = $hp - .000198 * cos(2 * $f - $md);
   $hp = $hp + .000173 * cos(3 * $md) + .000167 * cos(4 * $de - $md);
   $hp = $hp - $e * .000111 * cos($ms) + .000103 * cos(4 * $de - 2 * $md);
   $hp = $hp - .000084 * cos(2 * $md - 2 * $de) - $e * .000083 * cos(2 * $de + $ms);
   $hp = $hp + .000079 * cos(2 * $de + 2 * $md) + .000072 * cos(4 * $de);
   $hp = $hp + $e * .000064 * cos(2 * $de - $ms + $md);
   $hp = $hp - $e * .000063 * cos(2 * $de + $ms - $md) + $e * .000041 * cos($ms + $de);
   $hp = $hp + $e * .000035 * cos(2 * $md - $ms) - .000033 * cos(3 * $md - 2 * $de);
   $hp = $hp - .00003 * cos($md + $de) - .000029 * cos(2 * ($f - $de));
   $hp = $hp - $e * .000029 * cos(2 * $md + $ms) + $e2 * .000026 * cos(2 * ($de - $ms));
   $hp = $hp - .000023 * cos(2 * ($f - $de) + $md);
   $hp = $hp + $e * .000019 * cos(4 * $de - $ms - $md);
   $hp = &rad($hp);
}

sub nutat {
   if ($flag[6] != 1) {
   $flag[6] = 1; $flag[7] = 0;
   &julday;
   $t = $djd / 36525; $t2 = $t * $t;
   $a = 100.0021358 * $t; $b = 360 * ($a - int($a));
   $ls = 279.697 + .000303 * $t2 + $b;
   $a = 1336.855231 * $t; $b = 360 * ($a - int($a));
   $ld = 270.434 - .001133 * $t2 + $b;
   $a = 99.9973605600003 * $t; $b = 360 * ($a - int($a));
   $ms = 358.476 - .00015 * $t2 + $b;
   $a = 13255523.59 * $t; $b = 360 * ($a - int($a));
   $md = 296.105 + .009192 * $t2 + $b;
   $a = 5.372616667 * $t; $b = 360 * ($a - int($a));
   $nm = 259.183 + .002078 * $t2 - $b;
   $tls = 2 * &rad($ls); $nm = &rad($nm);
   $tnm = 2 * &rad($nm); $ms = &rad($ms);
   $tld = 2 * &rad($ld); $md = &rad($md);
   $dpsi = (-17.2327 - .01737 * $t) * sin($nm);
   $dpsi = $dpsi + (-1.2729 - .00013 * $t) * sin($tls) + .2088 * sin($tnm);
   $dpsi = $dpsi - .2037 * sin($tld) + (.1261 - .00031 * $t) * sin($ms);
   $dpsi = $dpsi + .0675 * sin($md) - (.0497 - .00012 * $t) * sin($tls + $ms);
   $dpsi = $dpsi - .0342 * sin($tld - $nm) - .0261 * sin($tld + $md);
   $dpsi = $dpsi + .0214 * sin($tls - $ms) - .0149 * sin($tls - $tld + $md);
   $dpsi = $dpsi + .0124 * sin($tls - $nm) + .0114 * sin($tld - $md);
   $deps = (9.21 + .00091 * $t) * cos($nm) + (.5522 - .00029 * $t) * cos($tls);
   $deps = $deps - .0904 * cos($tnm) + .0884 * cos($tld) + .0216 * cos($tls + $ms);
   $deps = $deps + .0183 * cos($tld - $nm) + .0113 * cos($tld + $md);
   $deps = $deps - .0093 * cos($tls - $ms) - .0066 * cos($tls - $nm);
   $dpsi = $dpsi / 3600; $deps = $deps / 3600;
}}

sub obliq {
   if ($flag[5] != 1) {
   $flag[5] = 1;
   &julday;
   $t = $djd / 36525;
   $c = (((-.00181 * $t) + .0059) * $t + 46.845) * $t;
   $eps = 23.45229444 - ($c / 3600);
   $epsr = $eps * .01745329252;
}}

sub rad {
   $W = $_[0];
   return .01745329252 * $W;
} 

sub rou {
   $x = $_[0];
   $y = $_[1];
   return int($x * $y + .5) / $y;
} 

sub sun {
   &julday;
   $t = $djd / 36525; $t2 = $t * $t;
   $a = 100.0021359 * $t; $b = 360 * ($a - int($a));
   $ls = 279.69668 + (.0003025 * $t2) + $b;
   $a = 99.9973604200004 * $t; $b = 360 * ($a - int($a));
   $ms = 358.47583 - ((.00015 + (.0000033 * $t)) * $t2) + $b;
   $SS = .016751 - (.0000418 * $t) - (1.26E-07 * $t2);
   $ma = &rad($ms);
   &anomaly;
   $a = 62.5520947200002 * $t; $b = 360 * ($a - int($a));
   $a1 = &rad(153.23 + $b);
   $a = 125.1041894 * $t; $b = 360 * ($a - int($a));
   $b1 = &rad(216.57 + $b);
   $a = 91.56766028 * $t; $b = 360 * ($a = int($a));
   $c1 = &rad(312.69 + $b);
   $a = 1236.853095 * $t; $b = 360 * ($a - int($a));
   $d1 = &rad(350.74 - .00144 * $t2 + $b);
   $e1 = &rad(231.19 + 20.2 * $t);
   $a = 183.1353208 * $t; $b = 360 * ($a - int($a));
   $h1 = &rad(353.4 + $b);
   $dl = .00134 * cos($a1) + .00154 * cos($b1) + .002 * cos($c1);
   $dl = $dl + .00179 * sin($d1) + .00178 * sin($e1);
   $dr = 5.43E-06 * sin($a1) + 1.575E-05 * sin($b1) + 1.627E-05 * sin($c1);
   $dr = $dr + 3.076E-05 * cos($d1) + 9.27E-06 * sin($h1);
   $lsn = $nu + &rad($ls - $ms + $dl); $tpi = 6.28318530800002;
   $rsn = 1.0000002 * (1 - $SS * cos($ea)) + $dr;
   while ($lsn < 0) {
      $lsn = $lsn + $tpi;}
   while ($lsn > $tpi) {
      $lsn = $lsn - $tpi;}
} 

Page updated on August 5th. 2015. You are visitor number   number of hits   launcher   home     guestbook

top   other ephemerides   lunar calendar for the month   Astro-MoonPhase-0.60   Total eclipse at the new moon