The Museum of HP Calculators


Phases of the Moon for the HP-41

This program is Copyright © 1999-2007 by Jean-Marc Baillard and is used here by permission.

This program is supplied without representation or warranty of any kind. Jean-Marc Baillard and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

-The following program computes the date & time of a phase of the Moon that occurs near a given date.
-It's slightly more accurate than the previous version for the New Moon and the Full Moon.
-The results are unchanged for the First & Last Quarters.
 ( errors are of the order of 5 minutes over the time span 1900 - 2100 )
-Moreover, a few bytes have been saved.

Note:  The subroutines "J0" & "DT" which were presented below are now listed in another page: "Julian & Gregorian Calendars for the HP-41"
 

Program Listing
 

Data Registers:    R00 thru R06: temp
Flags: /
Subroutines:  "J0" & "DT"  ( cf "Julian & Gregorian Calendars for the HP-41" )  or "J1" & "D1" or "J2" & "D2"
                         none if you have a TIME Module
 
 

  01  LBL "PHASE"
  02  DEG
  03  XEQ "J0"                   If you have a TIME Module, line 03 may be replaced by   1.012   STO 07   X<>Y   DDAYS
  04  7.382647                   In this case, key in the date in the current format:  MDY or DMY
  05  STO 03
  06  /
  07  INT
  08  STO 06
  09  ST* 03
  10  4
  11  MOD
  12  STO 04
  13  2
  14  STO 02
  15  X#Y?
  16  ST- 02
  17  ST/ 02
  18  MOD
  19  STO 05
  20  221
  21  *
  22  RCL 02
  23  -
  24  407
  25  +
  26  RCL 06
  27  96.45423
  28  *
  29  21.6
  30  +
  31  STO 00
  32  SIN
  33  *
  34  RCL 06
  35  7.2763
  36  *
  37  2.6
  38  +
  39  STO 01
  40  SIN
  41  172
  42  RCL 02
  43  +
  44  *
  45  +
  46  RCL 05
  47  7
  48  *
  49  16
  50  -
  51  RCL 00
  52  ST+ X
  53  SIN
  54  *
  55  -
  56  RCL 05
  57  5
  58  -
  59  ST+ X
  60  RCL 06
  61  195.335
  62  *
  63  39
  64  -
  65  STO 02
  66  SIN
  67  *
  68  -
  69  RCL 05
  70  ST+ X
  71  7
  72  -
  73  RCL 00
  74  RCL 01
  75  -
  76  SIN
  77  *
  78  +
  79  RCL 05
  80  7
  81  *
  82  5
  83  +
  84  RCL 00
  85  RCL 01
  86  +
  87  SIN
  88  *
  89  +
  90  RCL 01
  91  ST+ X
  92  SIN
  93  ST+ X
  94  +
  95  RCL 05
  96  RCL 00
  97  RCL 02
  98  -
  99  SIN
100  ST* Y
101  +
102  +
103  RCL 04
104  90
105  *
106  SIN
107  3
108  *
109  +
110  5598
111  +
112   E3
113  /
114  RCL 03
115  +
116  INT
117  LASTX
118  FRC
119  X<0?
120  DSE Y
121  ""                           TEXT0  or another  NOP  like  STO X  or here:   FRC
122  24
123  ST* Y
124  MOD
125  HMS
126  X<>Y                   If you have a TIME Module, lines 126-127 may be replaced by   RCL 07   RCL Z   DATE+
127  XEQ "DT"
128  RCL 04
129  END

( 200 bytes / SIZE 007 )
 
 
      STACK        INPUTS      OUTPUTS
           Z             /      HH.MNSS
           Y             /  YYYY.MNDD
           X      yyyy.mndd        Phase

  where  yyyy.mndd  is an approximate date
               Phase = 0  for a New Moon
               Phase = 1  for a First Quarter
               Phase = 2  for a Full Moon
               Phase = 3  for a Last Quarter
     YYYY.MNDD  &  HH.MNSS  are the date & time ( in Terrestrial Time ) of the Phase

Examples:

-We want to know the instant of a phase of the Moon near July 4th 2002

            2002.0704   XEQ "PHASE"  >>>>     3                            ( Execution time = 14 seconds )
                                          RDN                2002.0702
                                          RDN                 17.2338

-There is a Last Quarter on July 2nd 2002  at 17h24 TT or 17h23 UT  ( the exact value is 17h21 UT )

-If we seek a New Moon, we can guess it happens about 7 days later,
  so we execute "PHASE" again with this new initial value:

           2002.0709    R/S       yields         0
                               RDN                 2002.0710
                               RDN                   10.2659

-The New Moon occurs on July 10th 2002 at 10h27 TT or 10h26 UT  ( the exact value is 10h26 UT )
 

Reference:     Jean Meeus , "Astronomical Algorithms" - Willmann-Bell  -  ISBN 0-943396-35-2
 
 
 
 

Go back to the HP-41 software library
Go back to the general software library
Go back to the main exhibit hall