Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Saturday, April 18, 2026

DM41X: Interest Rate of a Forward-Forward Agreement

DM41X: Interest Rate of a Forward-Forward Agreement



A Future Interest Contract: Forward-Forward Agreement


A forward-forward agreement (yes, forward-forward is not a typo, that is what’s really called) is a financial transaction which starts on a forward date and ends on another forward date. An example transaction involves one party borrowing a sum amount to be paid back, only at the same time to deposit such amount in another short-term investment. The forward-forward rate, which I designate as FFR, is combined interest rate taking both transactions at the same time. The FFR is calculated as such:


FFR = [ (1 + IL * DL ÷ 365) ÷ (1 + IS * DS ÷ 365) – 1 ] * (365 ÷ (DL – DS))


IL: interest rate for the longer period, in decimal

DL: length of the long period

IS: interest rate for the shorter period, in decimal

DS: length of the short period

365: number of days in a year. It gets replaced with 360 if a 30/360 year is used.


If the loan lasts longer, the FFR represents the interest cost.

If the deposit lasts longer, the FFR represents the interest earned.



DM41X and HP 41C Code: FFR


01 LBL T^FFR

02 ^T FWD-FWD RATE

03 AVIEW

04 PSE

05 ^T LONG TRM DYS?

06 PROMPT

07 STO 01

08 STO 06

09 ^T LONG TRM %?

10 PROMPT

11 STO 02

12 %

13 365

14 /

15 1

16 +

17 STO 05

18 ^T SHORT TRM DYS?

19 PROMPT

20 STO 03

21 ST- 06

22 ^T SHORT TRM %?

23 PROMPT

24 STO 04

25 %

26 365

27 /

28 1

29 +

30 ST/ 05

31 RCL 05

32 1

33 -

34 365

35 *

36 RCL 06

37 /

38 2

39 10↑X

40 *

41 STO 07

42 ^T FFR=_

43 ARCL 07

44 AVIEW

45 RTN


Notes:

^T: It starts an alpha string.

Line 42: ^T FFR+_: The underscore is used as a space

Alpha strings are abbreviated in attempt for the message to fit the screen without scrolling.

Periods are assumed to be one year or less, and a 365-day year is assumed.


Examples


Example 1:

Longer Period (borrow): 49 days, 11%

Shorter Period (deposit): 30 days, 8%

Result: FFR= 15.6340


Example 2:

Longer Period (borrow): 63 days, 10.2%

Shorter Period (deposit): 31 days, 11.1%

Result: FFR= 9.2410


Source


Steiner, Bob. Mastering Financial Calculations. Second Edition. Prentice Hall: Financial Times. 2007. ISBN 978-0-273-70444-7. pp. 68-70



Eddie


All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Saturday, March 16, 2024

DM42 and DM41X: Timing Programs

DM42 and DM41X: Timing Programs


How Long Does it Take?

There is a convenient way of timing programs on the Swiss Micros DM42 and DM41X. This is accomplished by the TIME function. The TIME function returns the time, initially shown in HH:MM:SS format. HH represents hours, MM represents minutes, and SS represents seconds. The time is stored internally in HH.MMSS format.

We will also use the HMS- function. The HMS- subtracts two time values in HH.MMSS format.

A format that time the performance of an algorithm:


TIME

STO ## (store in any variable desired)

...

[main code here]

TIME

RCL ## (recall time stored in the beginning)

HMS-

“TIME=” (shows the time using a message, optional)

ARCL ST X

AVIEW

RTN


The elapsed time is in HH.MMSS format.


One word of caution, I would not use this method if you plan to run the test and midnight (12:00 AM or 0:00 hours) comes in between execution.



Example Code


Here is an example program that measure long a loop takes. In the example, the loop requires to display the x and y values for the function:


y = 2/5 × ln((x + 1)^2 ÷ 5) for x = 0 to 25.



Swiss Micros DM41X Code


01 LBL ^T TIMETST

02 0.025

03 STO 00

04 TIME

05 STO 01

06 LBL 00

07 RCL 00

08 INT

09 ^T X=

10 ARCL X

11 AVIEW

12 PSE

13 XEQ 01

14 ^T Y=

15 ARCL X

16 AVIEW

17 PSE

18 ISG 00

19 GTO 00

20 TIME

21 RCL 01

22 HMS-

23 ^T TIME=

24 ARCL X

25 AVIEW

26 RTN

27 LBL 01

28 1

29 +

30 X↑2

31 5

32 /

33 LN

34 2

35 *

36 5

37 /

38 RTN


Swiss Micros DM42 Code


00 {75-byte Prgm}

01 LBL “TIMETST”

02 0.025

03 STO 00

04 TIME

05 STO 01

06 LBL 00

07 RCL 00

08 IP

09 “X=”

10 ARCL ST X

11 AVIEW

12 PSE

13 XEQ 01

14 “Y=”

15 ARCL ST X

16 AVIEW

17 PSE

18 ISG 00

19 GTO 00

20 TIME

21 RCL 01

22 HMS-

23 “TIME=”

24 ARCL ST X

25 AVIEW

26 RTN

27 LBL 01

28 1

29 +

30 X↑2

31 5

32 ÷

33 LN

34 2

35 ×

36 5

37 ÷

38 RTN



The results that I have:


DM41X (SN 00843): 0.0049 (49 seconds)

DM42 (SN 03911): 0.0053 (53 seconds)


For reference, here are the values (rounded to 4 digits):


X

Y

0

-0.6438

1

-0.0893

2

0.2351

3

0.4653

4

0.6438

5

0.7896

6

0.9130

7

1.0198

8

1.1140

9

1.1983

10

1.2745

11

1.3442

12

1.4082

13

1.4675

14

1.5227

15

1.5743

16

1.6228

17

1.6685

18

1.7118

19

1.7528

20

1.7918

21

1.8291

22

1.8646

23

1.8987

24

1.9313

25

1.9627



I hope you find this helpful. Take care and until next time,


Eddie

All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.



Sunday, December 10, 2023

HP 71B and HP 75C: Degrees and DMS Conversions

HP 71B and HP 75C:  Degrees and DMS Conversions



At default, the HP 71B and HP 75C do not have conversions between degrees and degrees-minutes-seconds.   Here are two short programs to remedy this and can be used as subroutines.  The language used is BASIC.



HP 71B and HP 75C Code:  DMS to Degrees.  File Name: DMS2D


10 INPUT "d, m, s? ": H, M, S

20 D=SGN(H)*(ABS(H)+M/60+S/3600)

30 PRINT D; "°"




HP 71B and HP 75C Code:   Degrees to DMS.   File Name:  D2DMS


10  INPUT "DEC DEG? "; D

20 G=SGN(D) @ D=ABS(D) @ H=IP(D)

30 M=IP(FP(D)*60)

40 S=FP(FP(D)*60)*60

50 PRINT G*H; "°"; M; "m"; S; "s"



Notes:  


1.  The degree character, °, can be typed by the following combinations:

HP 71B:  g, CTRL, A

HP 75C:  CTL + A


2.  When entering DMS, separate degrees, minutes, and seconds by commas.  For negative degrees in DMS format, enter the negative sign in front of degrees.  


3.  Repeating decimals (like 42.606666666...) may produce approximate conversions.  



Examples to Try


43.25° ←→ 43° 15m 0s 


-63.27°  ←→ -63° 16m 12s


42.60166667° ←→ 42° 36m 6s  (about)




Eddie


All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Saturday, October 28, 2023

Numworks: Polynomial Fit with Numpy (Software version 21 or later)

Numworks:  Polynomial Fit with Numpy  (Software version 21 or later)



The scripts polyfit.py and polyfitg.py perfectly fit a polynomial to a set of points.  For a set of n points, a polynomial of degree n-1 can be perfect fit to the set of points.   For instance,  2 points fit a perfect line,  3 points fit a quadratic polynomial, and 4 points fit a cubic polynomial.    Software version 21 or later is required as the numpy module is used.  


Numworks:  polyfit


polyfit.py:    Fit a number of points to a curve using the numpy module

403 bytes


from math import *

import numpy as np


# 2023-09-25 EWS


n=input("number of points? ")

n=int(n)

d=n-1

x=np.ones(n)

y=np.ones(n)

k=0


while k<n:

  print("point "+str(k+1))

  x[k]=float(input("x? "))

  y[k]=float(input("y? "))

  k+=1


p=np.polyfit(x,y,d)

# list coefficients

print("polynomial vector:")

print("x**n:  coef")


for k in range(n):

  print(str(n-k-1),":  ",str(p[k]))


print(p)




Numworks:  polyfitg


polyfitg.py:   Same as polyfit except a graph of the polynomial is drawn.   The coefficients are shown for 3 before the graph is drawn.  

743 bytes 


from math import *

from time import *

from matplotlib.pyplot import *

import numpy as np


# 2023-09-25 EWS

n=input("number of points? ")

n=int(n)

d=n-1

x=np.ones(n)

y=np.ones(n)

k=0


while k<n:

  print("point "+str(k+1))

  x[k]=float(input("x? "))

  y[k]=float(input("y? "))

  k+=1


p=np.polyfit(x,y,d)


# list coefficients

print("polynomial vector:")

print("x**n:  coef")


for k in range(n):

  print(str(n-k-1),":  ",str(p[k]))


print("\nplotting...")

sleep(3)


# graphing portion

c=(np.max(x)-np.min(x))/100

xc=[]

yc=[]


for i in range(101):

  xp=np.min(x)+i*c

  yp=np.polyval(p,xp)

  xc.append(xp)

  yc.append(yp)


axis((min(xc)-.5,max(xc)+.5,min(yc)-.5,max(yc)+.5)) 

axis(True)

grid(True)

plot(xc,yc,color="purple")

show()





Eddie


All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Saturday, September 2, 2023

TI-84 Plus CE Python: Drawing Random Paths

TI-84 Plus CE Python: Drawing Random Paths



Introduction



The Python script PATHS draws a path from the left side to one of the other three sides of the screen:  bottom, right, or up.  


The path is laid on a 70 x 70 grid, consisting on 10 x 10 blocks.  Due to the how the screen is set up, the grid does not look like squares.   A random number between 1 and 3 is picked and the path moves in one of three ways:


1:  The path moves up

2:  The path moves right

3:  The path moves down


Three modules are used:


>  random module

>  ti_draw module (exclusive to TI):  drawing commands

>  time module (exclusive to TI):  used for the sleep command



TI-84 Plus CE Python Script:  paths.py


This code should work on the TI-83 Premium CE and the TI-Nspire CX II.  


# draw a random path

# EWS 2023-06-19


from ti_draw import *

from random import *

from time import *



clear()

set_window(0,70,0,70)


# initialization

set_color(0,128,0)

x=0

y=40

# draw using upper left corner

fill_rect(x,y,10,10)


# main loop

while x<60 and y>10 and y<60:

  r=randint(1,3)

  if r==1:

    y+=10

    set_color(0,0,224)

  if r==2:

    x+=10

    set_color(0,128,0)

  if r==3:

    y-=10

    set_color(255,165,0)

  fill_rect(x,y,10,10)

  sleep(.25)


# set end indicator

set_color(0,0,0)

fill_rect(0,40,10,10)

fill_rect(x,y,10,10)


# text - allow for text height

# have to play around

set_color(255,255,255)

draw_text(2,42,"BGN")

draw_text(x+2,y+2,"END")

show_draw()


Notes:


>  The show_draw() command on the end let's us see all the steps.   A sleep command (time module) at the end of the loop to slow down between each execution of the loop.

>  The fill_rect both take coordinates to be the upper-left hand corner of box.  

>  The draw_text works similarly to fill_rect except we have to account for the size of the font.   

>  The set_window command allows us to set the coordinates for the window.  If there is no set_window command, the screen would operate by pixels instead. The TI-84 Plus CE screen is 319 x 209 pixels.  


Three example paths are shown below:  






Eddie 


All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Monday, April 11, 2022

Retro Review: Calculated Industries NautiCalc Plus

 Retro Review:   Calculated Industries NautiCalc Plus









Quick Facts:


Model:  NautiCalc Plus

Company:  Calculated Industries

Years:  1996-1998

Type:  Nautical

Batteries: 1 x CR-2032

Operating Mode:  Chain

Memory Registers: 10


Features


For a company that produces specialized calculators, the NautiCalc Plus is a rare calculator.   I purchased mine from Calculator Source's eBay page.   Calculations that the NautiCalc offers are:


*  conversions of time

*  conversions of distance

*  conversions of speed

*  triangulation calculations:  course direction, 1st bearing, 2nd bearing, distance of the bearing object, distance abeam

*  solver:  speed, distance, time

*  solver:  tank capacity in gallons, fuel efficiency (statute miles per gallon), range (how far can you travel with a fuel tank)

*  paperless tape with the capacity of 10 entries, accessed by the [ Rcl ] [ = ], which is not marked on the calculator.   Scroll the entries by the plus and minus keys.  


Memory Registers


The NautiCalc has ten memory registers, M0 through M9.   What is unusual is that the [ Stor ] key acts a memory-plus for M0.   For example:


[ Conv ] [ + ] (Clr Mem)

25 [ Stor ] 0  (M-0   25)

[ Stor ] 1    (M-1  25)

50 [ Stor ] 0  (M-0  50)

[ Stor ] 1  (M-1 50)


[ Rcl ] 0   (M-0 75)   75 is stored in M0,  50 and 25 were added together

[ Rcl ] 1   (M-1 50)   50 is stored in M1, 50 replaced 25 in M1


Miles


There are two measurements for miles:  statute miles and nautical miles.   Statue miles, also known as survey miles, are miles related to road distance, equal to 5,280 feet.   Nautical miles, which are used in sailing and air travel, are measure from 1% of 1 degree of the Earth's curvature (see source, "What Are Statute Miles?").   


Statue Miles:  [ Conv ] [ 7 ]


Nautical Miles:  [ Miles ]


1 nautical mile ≈1.1507794 statute mile


Entering Time 


Time can be entered with several ways:


*  [ AM ] and [ PM ] keys.  We can use the shortcut method hhmmss or hhmm format to enter time.

*  The colon [ : ] key.   

*  The use hours, minutes, and second keys ([ Hr ], [ Min ], [ Sec ]).  


The [ Conv ] [ : ] changes the time format between 12-hour and 24-hour military time format.  


If we want to enter degrees-minutes-seconds, we must use the [ d:m:s ] key.  


Stopwatch 


The stopwatch can be started and stopped with the [ Timer ] key twice.  The stopwatch also has a split/lap feature with the [ S/Lap ].  While the stopwatch is running, a clock icon is on the display.


Timer


The timer is started with pressing the [ Timer ] key, entering the time, then pressing the [ Timer ] key again.   The NautiCalc Plus has a buzzer, not very loud, that can be turned on and off.  While the timer is going, we see a clock and star on the display.  The entire display flashes when the timer is completed. 


Not many calculators as a whole have the stopwatch and timer, so to have it is a nice feature.  


Now let's demonstrate some of the main calculations that are done wiht the NautiCalc Plus.  


Example:  Fuel Efficiency


If a tank can carry 15 gallons and has an average efficiency of 30 miles per gallon, what is the range?


[ On/C ] [ On/C ]

15 [ Conv ] [ Speed ] (Cap) (display has GAL)

30 [ Conv ] [ Time ] (Eff)   (display has MPG)

[ Conv ] [ Dist ] (Range)

Result:  RNG:  450 MI S  (450 statute miles)


Example:  Distance of Objects and Abeam


Traveling with 30° course with bearings reading 45°12' and 58°42', respectively.   You have traveled 5 nautical miles.   Find the distance bearing from the bearing object and distance abeam.  


[ On/C ] [ On/C ]

30 [ Course° ]   (CRSE)

45 [ d:m:s ] 12 [ 1stÏ• ]  (BRG1)

58 [ d:m:s ] 42 [ 2ndϕ ] (BRG2)

5 [ Miles ] [ Dist ] (DIST   5  N MI)

[ Dist ]    (Display:   TRVL 5  N MI)

[ Dist ]    (Display:  DOBJ 5.6156432 N MI)

[ Dist ]    (Display:  BEAM 3.1139547 N MI)


TRVL:  distance traveled

DOBJ:  distance from object

BEAM:  distance abeam


Example:  Speed/Time/Distance 


If a boat travels 13.5 nautical miles and it took 2 hours 23 minutes, what is the speed of the boat?


[ On/C ] [ On/C ]

13.5 [ Miles ] [ Dist ]

2 [ Hr ] 23 [ Min ] [ Time ]

[ Speed ] 

Display:  SPD 5.6643357 K NO T  (5.6643357 knots, 6.5184011 miles an hour)



Closing Thoughts


The keyboard is solid with the keys have a nice feel to them.  The NautiCalc Plus comes with a protective wallet, where the user guide can fit in the pockets.   


I really like this calculator and how Calculated Industries makes calculators for specific applications.  I would have loved to have seen the NautiCalc had a longer life than it did.   It's really cool to collect.  


I'm now retired from purchasing vintage calculators online.  I still will be posting retro reviews in the next few months, including the recently purchased the Texas Instruments TI-57 LCD (1982) and HP 45 (1973).  I am also going to include calculators that have been sitting in the garage that I didn't get a chance to do a review on, such as the Radio Shack EC-4026 (Casio fx-4500P equivalent) and TI-65.  

Source:


Bollman, Mark.  "NautiCalc Plus" April 21, 2013.   Last Accessed March 24, 2022.  http://mathcs.albion.edu/~mbollman/CI/NCalc+.htm  


Jones, Louise.  "What Are Statute Miles?"   Sciencing.  April 25, 2017.  Last Accessed March 27, 2022.  https://sciencing.com/statute-miles-8358166.html  



Until next time,


Eddie


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Saturday, December 12, 2020

DM41 and DM42: Self Timing Programs

 DM41 and DM42: Self Timing Programs


Timing a Program's Performance


The Swiss Micros calculators DM41 (including the DM41L, DM41X, Hewlett Packard HP 41CX, HP41C with a Time Module installed) and DM42 have an internal clock which allows us to set the date and time on the calculator.  With the use of the TIME function we can determine the how long a program takes to execute.


One structure that can be used:


[ preliminary storage]

TIME

HR (DM 41), →HR (DM 42)

STO Rxx  (register xx)

[ loop/main program starts here ]

TIME

HR (DM 41), →HR (DM 42)

RCL Rxx

-

ABS 

3600

*


The routine TIME, HR, RCL xx, -, ABS, 3600, * determines the amount of time in term of seconds.  


DM42S:  Accessing the TIME function:  [SHIFT], [ + ] (CATALOG), [down arrow], ( TIME )  ("F1")


Let's demonstrate this technique on three examples.  The time record is the calculator ran on batteries.  


Example 1:  40th Fibonacci Numbers 


Registers:  

R01:  counter

R02:  sum

R03:  time

(counter of 39 is set because the first Fibonacci number is loaded at the beginning)


DM41 Program TFIB


01  LBL ^T TFIB

02  39

03  STO 01

04  0

05  STO 02

06  TIME

07  HR

08  STO 03

09  1

10  0

11  +

12  LBL 00

13  LASTX

14  X<>Y

15  +

16  DSE 01

17  GTO 00

18  TIME

19  HR

20  RCL 03

21  -

22  ABS

23  3600

24  *

25  STO 03

26  END


Y:  Results:  102334155.0

X: Seconds:  0.5100


DM42 Program TFIB


00  {45-Byte Prgm}

01  LBL "TFIB"

02  39

03  STO 01

04  0

05  STO 02

06  TIME

07  →HR

08  STO 03

09  1

10  0

11  +

12  LBL 00

13  LASTX

14  X<>Y

15  +

16  DSE 01

17  GTO 00

18  TIME

19  →HR

20  RCL 03

21  -

22  ABS

23  3600

24  ×

25  STO 03

26  END


Y:  Results:  102334155.0

X: Seconds:  0.0200


Example 2:  The Sum of Cubes Using a Loop from 1 to 250


Registers:  

R01:  counter

R02:  sum

R03:  time


DM41 Program TSUM


01  LBL ^T TSUM

02  250

03  STO 01

04  0

05  STO 02

06  TIME

07  HR

08  STO 03

09  LBL 00

10  RCL 01

11  3

12  Y↑X

13  ST+ 02

14  DSE 01

15  GTO 00

16  RCL 02

17  TIME

18  HR

19  RCL 03

20  -

21  ABS

22  3600

23  *

24  STO 03

25  END


Y:  Results:  984390625.0

X: Seconds:  12.07


DM42 Program TSUM


00  {45-Byte Prgm}

01  LBL "TSUM"

02  250

03  STO 01

04  0

05  STO 02

06  TIME

07  →HR

08  STO 03

09  LBL 00

10  RCL 01

11  3

12  Y↑X

13  STO+ 02

14  DSE 01

15  GTO 00

16  RCL 02

17  TIME

18  →HR

19  RCL 03

20  -

21  ABS

22  3600

23  ×

24  STO 03

25  END


Y:  Results:  984390625.0

X: Seconds:  0.24


Example 3:  Savage Test


Let A = 1, then for 2499 loops:

A = tan(atan(exp(ln(sqrt(A^2))))) + 1   (radians mode is used)


Registers:  

R01:  counter

R02:  sum

R03:  time


DM41 Program SVGE


01  LBL ^T SVGE

02  2499

03  STO 01

04  1

05  STO 02

06  TIME

07  HR

08  STO 03

09  LBL 00

10  RCL 02

11  X↑2

12  SQRT

13  LN

14  E↑X

15  ATAN

16  TAN

17  1

18  +

19  STO 02

20  DSE 01

21  GTO 00

22  RCL 02

23  TIME

24  HR

25  RCL 03

26  -

27  ABS

28  3600

29  *

30  STO 03

31  END


Y:  Results:  2499.970322

X: Seconds:  246.4500240  (about 4 minutes, 6.45 seconds)


DM42 Program SVGE


00  {51-Byte Prgm}

01  LBL "SVGE"

02  2499

03  STO 01

04  1

05  STO 02

06  TIME

07  →HR

08  STO 03

09  LBL 00

10  RCL 02

11  X↑2

12  SQRT

13  LN

14  E↑X

15  ATAN

16  TAN

17  1

18  +

19  STO 02

20  DSE 01

21  GTO 00

22  RCL 02

23  TIME

24  →HR

25  RCL 03

26  -

27  ABS

28  3600

29  ×

30  STO 03

31  END


Y:  Results:  2500  (just over 2500)

X: Seconds:  13.24


Source:


Burkett, John.  "The Savage Benchmark"  TI-89 / TI-92 Plus Tip List 10.0   July 20, 2002.  http://www.technicalc.org/tiplist/en/files/pdf/tips/tip6_50.pdf   Retrieved November 28, 2020 


Eddie 


Wednesday, March 13, 2019

TI-84 Plus: Greenwich Mean Sidereal Time Estimate

TI-84 Plus:  Greenwich Mean Sidereal Time Estimate

Introduction

The program GMST calculates and estimates the Greenwich Mean Sidereal Time for any dates between January 1, 1900 and December 31, 2099.

For any date between 1900 and 2099, the date number is calculated as:

number of days since January 1 + (year - 1900) * 365 + int((1900 - year)/4) + 0.5 + hour/24

Please keep in mind, the formula in this program is from 1978 (see source).

For the hour, a 2400 hour clock format is used.  For example, 1 AM = 1, 1 PM = 13. 

This program does not take the location of the observer into account.

TI-84 Plus Program: GMST

"2019-03-08 EWS"
Disp "1900-2099"
Input "MONTH: ",M
Input "DAY: ",D
Input "YEAR: ",Y
Input "HOUR: ",H
If fPart(Y/4)=0 and Y≠1900
Then
1→L
Else
0→L
End

If M≥3
Then
int(30.6*M+1.6)+D-35+L→T
Else
int(30.6*M+368.8)+D-400→T
End

T+(Y-1900)*365+iPart((Y-1900)/4)+.5+H/4Z
Z/36525→Z
6°38'45.836"+2400.051262*Z+0°0'0.0929"*Z²→E
24*fPart(E/24)→E
Disp "GMST: ",E>DMS


Example:

Example 1: 

January 1, 1978, Midnight (Hour = 0):  6°41'9.836"

Example 2:

March 13, 2011, 7:00 PM (H = 19): 11°23'54.646"

Source:

Jones, Aubrey  Mathematical Astronomy With a Pocket Calculator  Halsted Press:  John Wiley & Sons, New York.  1978.  ISBN 0 470 26552 3

Eddie


All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

HP 48G Collection

 HP 48G Collection  Contents:  Intensity of Spherical Light Source  Speed of Light in Dry Air  Pressure of Air  Earth's Gravity a...