Post Reply 
(49g) (50g) Saison begin and Julian Day conversion
01-03-2021, 11:02 PM (This post was last modified: 02-17-2021 10:48 PM by Gene.)
Post: #1
(49g) (50g) Saison begin and Julian Day conversion
HP49-50G
Season begin calculator
Julian Day conversion calculator

Just took the formulae given by Jean Mueeus in his Astronomical Algorithms
to calculate the begin of the seasons.

Accurateness within about 60"
(about 3 times in 4 within 20").

Years of validity: -1000 to +3000.

Possible to calculate the season begins for times outside that validity period, but with greater errors margins.

Given times are all in Time "dynamical" (TD), which varies along the years and differs from UT of about 72" in 2021.

To have the corresponding "normal time", or the so called Universal Time (UT), subtract then the Delta time (about 72" in 2021) from the given Time "dynamical":
Delta Time = DT-UT or UT = DT-Delta Time.

A program to calculate Delta Time for current years (from 2005 to 2050) is also included here.

For different periods, other useful delta times approximations can be found at
https://eclipse.gsfc.nasa.gov/SEcat5/deltatpoly.html

Important observation
The formulae use the Julian Day (JD—> and —>JD) calculation.
I adopted the same notation as the one of Jean Meuw.
However, I proceeded in two steps:
- integer part of Julian Day has to be put in stack level 2 (no fraction);
- fractional part of the Julian Day in stack level 1 (if no fraction, then put nevertheless the value 0).

The same applies for the reverse procedure:
- date YY.MMDD in stack level 2 (no fraction of the day here);
- requested fraction of the day in hour format,
i.e. hour of the day (in DT) like h.MM.SSSS.

Example
Suppose you look for the JD corresponding to March 20, 2021, at 4am5'6.77".

How to procede
2021.0320 or (2021.032) ENTER
4.050677 ENTER
—>JD

Answer
JD: 2458828 (stack level 2)
+ JD: .670217245371 (stack level 1)
So that the requested JD
is 2458828.670217245371
(a number with many digits sumwhat diificult to deal with).

Now leave those two values as they appeared in stack 2 and 1.
Press JD—>
You will get the exact date and time (to the split second!) given at the beginning.

If we had built a program to procede in one single step,
trying to take directly the exact JD (with its possible fractional part),
we could not WRITE the full JD.
Indeed, 2458828.670217245371 ENTER
will be rounded to 2458828.67022
And 2458828.67022 JD—>
would give the correct date but a slightly wrong (dynamic) time:
4h05'07.008'', instead of the due time 4.05' 06.77".

Test for the season in 2021
2021 SEASON ENTER gives
{ :y.mmddd: 2021.032 :+ TD h.mmss: 9.3840704 }
{ :y.mmddd: 2021.0621 :+ TD h.mmss: 3.3308928 }
{ :y.mmddd: 2021.0922 :+ TD h.mmss: 19.2206528 }
{ :y.mmddd: 2021.1221 :+ TD h.mmss: 16.0030528 }

From the above TD, you should substract, as mentioned, some 72" to get your UT.

Regards,
Gil

Copy into your calculator the given file/Directory EPHEM.DOC.
It contains four programs:
- Season: the program itself;
- Delta.time = TD-UT;
—>JD: gives the Julian Day
(takes 2 stack values: an initial date of the form YYYY.MM.DD and time of the day h.mmss)
JD—> (the reverse procedure with 2 stack values : value one in stack 2 is integer part of JD; in stack 1,its fractional part)

Here are the full codes of those 4 "programs
in 2 formats, the second one keeping track o the special characters like —>.

SEASON
«  y
« y -1000 < y 3000 > OR "Not very accurate" 1 IFTE DEG y 1000. /
[[ 485 ]
[ 203 ]
[ 199 ]
[ 182 ]
[ 156 ]
[ 136 ]
[ 77 ]
[ 74 ]
[ 70 ]
[ 58 ]
[ 52 ]
[ 50 ]
[ 45 ]
[ 44 ]
[ 29 ]
[ 18 ]
[ 17 ]
[ 16 ]
[ 14 ]
[ 12 ]
[ 12 ]
[ 12 ]
[ 9 ]
[ 8 ]]
[[ 324.96 ]
[ 337.23 ]
[ 342.08 ]
[ 27.85 ]
[ 73.14 ]
[ 171.52 ]
[ 222.54 ]
[ 296.72 ]
[ 243.58 ]
[ 119.81 ]
[ 297.17 ]
[ 21.02 ]
[ 247.54 ]
[ 325.15 ]
[ 60.93 ]
[ 155.12 ]
[ 288.79 ]
[ 198.04 ]
[ 199.76 ]
[ 95.39 ]
[ 287.11 ]
[ 320.81 ]
[ 227.73 ]
[ 15.45 ]]
[[ 1934.136 ]
[ 32964.467 ]
[ 20.186 ]
[ 445267.112 ]
[ 45036.886 ]
[ 22518.443 ]
[ 65928.934 ]
[ 3034.906 ]
[ 9037.513 ]
[ 33718.147 ]
[ 150.678 ]
[ 2281.226 ]
[ 29929.562 ]
[ 31555.956 ]
[ 4443.417 ]
[ 67555.328 ]
[ 4562.452 ]
[ 62894.029 ]
[ 31436.921 ]
[ 14577.848 ]
[ 31931.756 ]
[ 34777.259 ]
[ 1222.114 ]
[ 16859.074 ]] 0 { } { } { } { }  Y A B C JDE0 T W ›– S
«
IF y 1000 ‰
THEN '1721139.29189+365242.1374*Y+.06134*Y^2+.00111*Y^3-.00071*Y^4' EVAL '1721233.25401+365241.72562*Y-.05323*Y^2+.00907*Y^3+.00025*Y^4' EVAL '1721325.70455+365242.49558*Y-.11677*Y^2-.00297*Y^3+.00074*Y^4' EVAL '1721414.39987+365242.88257*Y-.00769*Y^2-.00933*Y^3-.00006*Y^4' EVAL
ELSE Y 2 - 'Y' STO '2451623.80984+365242.37404*Y+.05169*Y^2-.00411*Y^3-.00057*Y^4' EVAL '2451716.56767+365241.62603*Y+.00325*Y^2+.00888*Y^3-.0003*Y^4' EVAL '2451810.21715+365242.01767*Y-.11575*Y^2+.00337*Y^3+.00078*Y^4' EVAL '2451900.05952+365242.74049*Y-.06223*Y^2-.00823*Y^3+.00032*Y^4' EVAL
END 4 LIST 'JDE0' STO 1 4
FOR i T JDE0 i GET 2451545 - 36525 / + 'T' STO W T i GET 35999.373 * 2.47 - + 'W' STO ›– 1 .0334 W i GET COS * + .0007 W i GET 2 * COS * + + '›–' STO S 0 1 24
FOR j A j GET B j GET C j GET T i GET * + COS * +
NEXT + 'S' STO JDE0 i GET S i GET .00001 * ›– i GET / + DUP IP SWAP FP JD 4 ROLL 4 ROLL DROP2 2 LIST
NEXT
»
» 5 ROLL DUP 1 ==
IF
THEN DROP
END
»

Or SEASON
\<< \-> y
\<< y -1000 < y 3000 > OR "Not very accurate" 1 IFTE DEG y 1000. /
[[ 485 ]
[ 203 ]
[ 199 ]
[ 182 ]
[ 156 ]
[ 136 ]
[ 77 ]
[ 74 ]
[ 70 ]
[ 58 ]
[ 52 ]
[ 50 ]
[ 45 ]
[ 44 ]
[ 29 ]
[ 18 ]
[ 17 ]
[ 16 ]
[ 14 ]
[ 12 ]
[ 12 ]
[ 12 ]
[ 9 ]
[ 8 ]]
[[ 324.96 ]
[ 337.23 ]
[ 342.08 ]
[ 27.85 ]
[ 73.14 ]
[ 171.52 ]
[ 222.54 ]
[ 296.72 ]
[ 243.58 ]
[ 119.81 ]
[ 297.17 ]
[ 21.02 ]
[ 247.54 ]
[ 325.15 ]
[ 60.93 ]
[ 155.12 ]
[ 288.79 ]
[ 198.04 ]
[ 199.76 ]
[ 95.39 ]
[ 287.11 ]
[ 320.81 ]
[ 227.73 ]
[ 15.45 ]]
[[ 1934.136 ]
[ 32964.467 ]
[ 20.186 ]
[ 445267.112 ]
[ 45036.886 ]
[ 22518.443 ]
[ 65928.934 ]
[ 3034.906 ]
[ 9037.513 ]
[ 33718.147 ]
[ 150.678 ]
[ 2281.226 ]
[ 29929.562 ]
[ 31555.956 ]
[ 4443.417 ]
[ 67555.328 ]
[ 4562.452 ]
[ 62894.029 ]
[ 31436.921 ]
[ 14577.848 ]
[ 31931.756 ]
[ 34777.259 ]
[ 1222.114 ]
[ 16859.074 ]] 0 { } { } { } { } \-> Y A B C JDE0 T W \GD\Gl S
\<<
IF y 1000 \<=
THEN '1721139.29189+365242.1374*Y+.06134*Y^2+.00111*Y^3-.00071*Y^4' EVAL '1721233.25401+365241.72562*Y-.05323*Y^2+.00907*Y^3+.00025*Y^4' EVAL '1721325.70455+365242.49558*Y-.11677*Y^2-.00297*Y^3+.00074*Y^4' EVAL '1721414.39987+365242.88257*Y-.00769*Y^2-.00933*Y^3-.00006*Y^4' EVAL
ELSE Y 2 - 'Y' STO '2451623.80984+365242.37404*Y+.05169*Y^2-.00411*Y^3-.00057*Y^4' EVAL '2451716.56767+365241.62603*Y+.00325*Y^2+.00888*Y^3-.0003*Y^4' EVAL '2451810.21715+365242.01767*Y-.11575*Y^2+.00337*Y^3+.00078*Y^4' EVAL '2451900.05952+365242.74049*Y-.06223*Y^2-.00823*Y^3+.00032*Y^4' EVAL
END 4 \->LIST 'JDE0' STO 1 4
FOR i T JDE0 i GET 2451545 - 36525 / + 'T' STO W T i GET 35999.373 * 2.47 - + 'W' STO \GD\Gl 1 .0334 W i GET COS * + .0007 W i GET 2 * COS * + + '\GD\Gl' STO S 0 1 24
FOR j A j GET B j GET C j GET T i GET * + COS * +
NEXT + 'S' STO JDE0 i GET S i GET .00001 * \GD\Gl i GET / + DUP IP SWAP FP JD\-> 4 ROLL 4 ROLL DROP2 2 \->LIST
NEXT
\>>
\>> 5 ROLL DUP 1 ==
IF
THEN DROP
END
\>>

DELTA.T
«  t
« t 2005 < t 2050 > OR
IF
THEN "Form.NOT.av"
ELSE t 2000 - 't' STO '62.92+.32217*t+.005589*t^2' EVAL 2 RND "›T(s)=TAI-TUC" TAG
END
»
»

Or DELTA.T
\<< \-> t
\<< t 2005 < t 2050 > OR
IF
THEN "Form.NOT.av"
ELSE t 2000 - 't' STO '62.92+.32217*t+.005589*t^2' EVAL 2 RND "\GDT(s)=TAI-TUC" \->TAG
END
\>>
\>>

—>JD
« "Input
y.mmddd h.mmsss" DROP DUP2 SWAP 0. 0.  h.mmsss date A B
« date IP date FP 100. * ABS DUP FP 100. * SWAP IP SWAP  y m d
«
IF m 2. ‰
THEN y 1. - 'y' STO m 12. + 'm' STO
END y 100. / IP 'A' STO
IF date 1582.1004 ‰
THEN 0.
ELSE 2. A - A 4. / IP +
END 'B' STO 365.25 y 4716. + * IP 30.6001 m 1. + * IP + d + B + 1524.5 - h.mmsss 12. Š
IF
THEN .5 + "JD" TAG h.mmsss 12. -
ELSE IP "JD" TAG h.mmsss 12. +
END HMS 24. / "+JD" TAG
»
»
»

Or —>JD
\<< "Input
y.mmddd h.mmsss" DROP DUP2 SWAP 0. 0. \-> h.mmsss date A B
\<< date IP date FP 100. * ABS DUP FP 100. * SWAP IP SWAP \-> y m d
\<<
IF m 2. \<=
THEN y 1. - 'y' STO m 12. + 'm' STO
END y 100. / IP 'A' STO
IF date 1582.1004 \<=
THEN 0.
ELSE 2. A - A 4. / IP +
END 'B' STO 365.25 y 4716. + * IP 30.6001 m 1. + * IP + d + B + 1524.5 - h.mmsss 12. \>=
IF
THEN .5 + "JD" \->TAG h.mmsss 12. -
ELSE IP "JD" \->TAG h.mmsss 12. +
END HMS\-> 24. / "+JD" \->TAG
\>>
\>>
\>>

JD—>
\<< "Input
y.mmddd h.mmsss" DROP DUP2 SWAP 0. 0. \-> h.mmsss date A B
\<< date IP date FP 100. * ABS DUP FP 100. * SWAP IP SWAP \-> y m d
\<<
IF m 2. \<=
THEN y 1. - 'y' STO m 12. + 'm' STO
END y 100. / IP 'A' STO
IF date 1582.1004 \<=
THEN 0.
ELSE 2. A - A 4. / IP +
END 'B' STO 365.25 y 4716. + * IP 30.6001 m 1. + * IP + d + B + 1524.5 - h.mmsss 12. \>=
IF
THEN .5 + "JD" \->TAG h.mmsss 12. -
ELSE IP "JD" \->TAG h.mmsss 12. +
END HMS\-> 24. / "+JD" \->TAG
\>>
\>>
\>>

Or JD—>
\<< "Input
 JD IP!
JD FP!
" DROP DUP2 \-> Z F
\<< .5 F + DUP FP 'F' STO 'Z' STO+ 0 0 0 0 0 0 0 0 0 0 \-> \Ga A B C D E m d y s
\<<
IF Z 2291161 <
THEN Z
ELSE Z 1867216.25 - 36524.25 / IP '\Ga' STO Z 1 + \Ga + \Ga 4 / IP -
END 'A' STO A 1524 + 'B' STO B 122.1 - 365.25 / IP 'C' STO 365.25 C * IP 'D' STO B D - 30.6001 / IP 'E' STO B D - 30.6001 E * IP - IP 'd' STO
IF E 14 <
THEN E 1 -
ELSE E 13 -
END 'm' STO m 2 >
IF
THEN C 4716 -
ELSE C 4715 -
END 'y' STO y SIGN 's' STO y ABS 'y' STO y m 100 / + d 10000 / + s * "y.mmddd" \->TAG F 24 * \->HMS "+ TD h.mmss" \->TAG
\>>
\>>
\>>


Attached File(s)
.doc  EPHEM.DOC (Size: 3.82 KB / Downloads: 5)
Find all posts by this user
Quote this message in a reply
01-10-2021, 08:46 PM
Post: #2
RE: HP49-50G: Saison begin and Julian Day conversion
Thanks to John Keith and DavidM, here is a shorter version of SEASON (no more IF... THEN DROP END).

In bold the change — at the very end of the program.

\<< \-> y
\<< y -1000 < y 3000 > OR "Not very accurate" 1 IFTE DEG y 1000. /
[[ 485 ]
[ 203 ]
[ 199 ]
[ 182 ]
[ 156 ]
[ 136 ]
[ 77 ]
[ 74 ]
[ 70 ]
[ 58 ]
[ 52 ]
[ 50 ]
[ 45 ]
[ 44 ]
[ 29 ]
[ 18 ]
[ 17 ]
[ 16 ]
[ 14 ]
[ 12 ]
[ 12 ]
[ 12 ]
[ 9 ]
[ 8 ]]
[[ 324.96 ]
[ 337.23 ]
[ 342.08 ]
[ 27.85 ]
[ 73.14 ]
[ 171.52 ]
[ 222.54 ]
[ 296.72 ]
[ 243.58 ]
[ 119.81 ]
[ 297.17 ]
[ 21.02 ]
[ 247.54 ]
[ 325.15 ]
[ 60.93 ]
[ 155.12 ]
[ 288.79 ]
[ 198.04 ]
[ 199.76 ]
[ 95.39 ]
[ 287.11 ]
[ 320.81 ]
[ 227.73 ]
[ 15.45 ]]
[[ 1934.136 ]
[ 32964.467 ]
[ 20.186 ]
[ 445267.112 ]
[ 45036.886 ]
[ 22518.443 ]
[ 65928.934 ]
[ 3034.906 ]
[ 9037.513 ]
[ 33718.147 ]
[ 150.678 ]
[ 2281.226 ]
[ 29929.562 ]
[ 31555.956 ]
[ 4443.417 ]
[ 67555.328 ]
[ 4562.452 ]
[ 62894.029 ]
[ 31436.921 ]
[ 14577.848 ]
[ 31931.756 ]
[ 34777.259 ]
[ 1222.114 ]
[ 16859.074 ]] 0 { } { } { } { } \-> Y A B C JDE0 T W \GD\Gl S
\<<
IF y 1000 \<=
THEN '1721139.29189+365242.1374*Y+.06134*Y^2+.00111*Y^3-.00071*Y^4' EVAL '1721233.25401+365241.72562*Y-.05323*Y^2+.00907*Y^3+.00025*Y^4' EVAL '1721325.70455+365242.49558*Y-.11677*Y^2-.00297*Y^3+.00074*Y^4' EVAL '1721414.39987+365242.88257*Y-.00769*Y^2-.00933*Y^3-.00006*Y^4' EVAL
ELSE Y 2 - 'Y' STO '2451623.80984+365242.37404*Y+.05169*Y^2-.00411*Y^3-.00057*Y^4' EVAL '2451716.56767+365241.62603*Y+.00325*Y^2+.00888*Y^3-.0003*Y^4' EVAL '2451810.21715+365242.01767*Y-.11575*Y^2+.00337*Y^3+.00078*Y^4' EVAL '2451900.05952+365242.74049*Y-.06223*Y^2-.00823*Y^3+.00032*Y^4' EVAL
END 4 \->LIST 'JDE0' STO 1 4
FOR i T JDE0 i GET 2451545 - 36525 / + 'T' STO W T i GET 35999.373 * 2.47 - + 'W' STO \GD\Gl 1 .0334 W i GET COS * + .0007 W i GET 2 * COS * + + '\GD\Gl' STO S 0 1 24
FOR j A j GET B j GET C j GET T i GET * + COS * +
NEXT + 'S' STO JDE0 i GET S i GET .00001 * \GD\Gl i GET / + DUP IP SWAP FP JD\-> 4 ROLL 4 ROLL DROP2 2 \->LIST
NEXT
\>>
\>> 5 ROLL DUP 1 == DROPN
\>>

'SEASON' STO

Just added here the new full Directory EPHEM.V2.DOC, with the SEASON file/program corrected.

Regards,
Gil


Attached File(s)
.doc  EPHEM.V2.DOC (Size: 3.81 KB / Downloads: 4)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)