PureBytes Links
Trading Reference Links
|
Dennis,
The attached shows your function compared
to the values
generated from the following
function.
The following function which was
contributed by Gary Funk
has some verbage that may be of interest to
those who
want to know more about how the calculation
of moon phase
is accomplished over time.
Note that this function goes from ZERO to
29.xxxx rather
than from zero to one and back
down.
I use this in preference to your
implementation because
I can tell exactly which side of new/full I
am on simply
by looking at a value and not having to
look at the
direction of movement of the
function.
Clyde
{ Function Moondays returns the
number of days since a new moon. The values returned range between 0
and 29. (0 = new, and 15 is a full moon to +/- 2 day
accuracy.) Author: Gary Funck, <A
href="mailto:gary@xxxxxxxxxxxx">gary@xxxxxxxxxxxx, 7/15/97 No
restrictions on use/copying. No warranties, expressed/implied.
This code uses an approximation
described in the "Astro FAQ"; summarized below:
Subject: C.11 How do I
calculate the phase of the moon? Author: Bill Jefferys <<A
href="mailto:bill@xxxxxxxxxxxxxxxxxxx">bill@xxxxxxxxxxxxxxxxxxx>
John Horton Conway (the Princeton mathematician who is responsible
for "the Game of Life") wrote a book with Guy and Berlekamp,
_Winning Ways_, that describes in Volume 2 a number of useful
calendrical rules. One of these is an easy "in your head"
algorithm for calculating the phase of the Moon, good to a day or
better depending on whether you use his refinements or not.
In the 20th century, calculate the remainder upon dividing
the last two digits of the year by 19; if greater than 9,
subtract 19 from this to get a number between -9 and 9.
Multiply the result by 11 and reduce modulo 30 to obtain a
number between -29 and +29. Add the day of the month and
the number of the month (except for Jan and Feb use 3 and 4 for the
month number instead of 1 and 2). Subtract
4. Reduce modulo 30 to get a number between 0 and 29. This
is the age of the Moon. Example: What was the
phase of the Moon on D-Day (June 6, 1944)?
Answer: 44/19=2 remainder 6. 6*11=66, reduce modulo 30 to
get 6. Add 6+6 to this and subtract 4: 6+6+6-4=14; the Moon
was (nearly) full. I understand that the planners of D-day did care
about the phase of the Moon, either because of illumination or because
of tides. I think that Don Olsen recently discussed this in _Sky and
Telescope_ (within the past several years). In
the 21st century use -8.3 days instead of -4 for the last number.
Conway also gives refinements for the leap year cycle and
also for the slight variations in the lengths of months; what I
have given should be good to +/- a day or so.}inputs:
dt(numericsimple);variables: x1(0), x2(0), x3(0),
x4(0); x1 = Mod(year(dt), 19); if x1
> 9 then x1 = x1 - 19; x2 = Mod(x1 * 11,
30); x3 = month(dt); if month(dt)
< 3 then x3 = x3 + 2; x4 = x2 + dayofmonth(dt) + x3 -
4; Moondays = Mod(x4, 30);
- - - - - - - - - - - - - - - - - - - - - - - - - - - -Clyde
Lee
Chairman/CEO (Home of
SwingMachine)SYTECH
Corporation email: <A
href="mailto:clydelee@xxxxxxxxxxxx">clydelee@xxxxxxxxxxxx 7910
Westglen, Suite 105
Office: (713) 783-9540Houston, TX
77063
Fax: (713) 783-1092Details
at:
www.theswingmachine.com- - - -
- - - - - - - - - - - - - - - - - - - - - - - -
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
----- Original Message -----
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black">From:
<A title=catapult@xxxxxxxxxxxxxxxxxx
href="mailto:catapult@xxxxxxxxxxxxxxxxxx">DH
To: <A title=realtraders@xxxxxxxxxxxxxxx
href="mailto:realtraders@xxxxxxxxxxxxxxx">realtraders@xxxxxxxxxxxxxxx
Sent: Sunday, April 29, 2001 15:37
Subject: Re: [RT] The moon cycle - how
strong?
Here's a simple moon phase indicator for TS. A new moon is
zero and a full moon is 1.{******************Indicator:
dhMoon3DH, 2000******************}Var: Phase(0);Phase
= AbsValue(2 * (FracPortion(DateToJulian(Date)/29.53059 + .4137)
-.5));Plot1(Phase,"Phase");-- Dennis To
unsubscribe from this group, send an email
to:realtraders-unsubscribe@xxxxxxxxxxxxxxxYour
use of Yahoo! Groups is subject to the <A
href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service.
<IMG
src="cid:{4513CAC3-3CE5-11D5-942B-00C0F03D4A44}/Image2.gif">
Yahoo! Groups Sponsor
To unsubscribe from this group, send an email to:
realtraders-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Attachment:
Description: "junk3.gif"
|