home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug012.arc
/
HALLEY.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
5KB
|
202 lines
5 REM ** HALLEY.BAS **
10 REM -------- COMET EPHEMERIS --------
20 PI=3.14159
30 C0$="COMET HALLEY"
40 PH=1986.11
50 PL=170.011
60 AN=58.1453
70 PY=76.0081
80 SM=17.9435
90 EO=.967267
100 IO=162.239
110 REM ---------------------------------
120 PRINT" "C0$
130 PRINT"- - - - - - - - - - - - - - -"
140 PRINT" EPHERMIS FOR DATES"
150 PRINT" BETWEEN 1946 AND 2026"
160 PRINT" by Roger Browne"
170 REM ---------------------------------
180 REM Input the Date
190 REM ---------------------------------
200 PRINT"INPUT YEAR"
210 INPUT Y
220 IF Y<1946 OR Y>2026 THEN 200
230 PRINT"INPUT MONTH"
240 INPUT M
250 IF M<1 OR M>12 THEN 230
260 PRINT"INPUT DAY"
270 INPUT D
280 PRINT
290 REM ---------------------------------
300 REM Calculations for the comet
310 REM ---------------------------------
320 X=PH
330 IF Y>=1986 THEN LET Z=1984:S=1
340 IF Y<1986 THEN LET Z=1988:S=0
370 GOSUB 1780
380 DS=N
390 B=(360/PY)*(N/365.25)
400 K=B
410 GOSUB 1930
420 B=K*PI/180
430 E=B
440 Y1=EO
450 Q=E-Y1*SIN(E)-B
460 IF ABS(Q)<=.000017 THEN 500
470 U=Q/(1-Y1*COS(E))
480 E=E-U
490 GOTO 450
500 V=(SQR((1+Y1)/(1-Y1))*TAN(E/2))
510 V=2*ATN(V)
520 V1=V*180/PI
530 L=V1+PL
540 R=SM*(1-Y1*Y1)/(1+Y1*COS(V))
550 F=L-AN
560 F2=IO
570 F1=F*PI/180
580 F2=F2*PI/180
590 I=SIN(F1)*SIN(F2)
600 I=ATN(I/SQR(-I*I+1))
610 P=ATN(TAN(F1)*COS(F2))
620 P1=P*180/PI+AN
630 IF F>=90 AND F<=270 THEN LET P1=P1+180
640 IF P1<0 THEN LET P1=P1+360
650 P=P1*PI/180
660 R2=R*COS(I)
670 REM ---------------------------------
680 REM Calculations for the Earth
690 REM ---------------------------------
700 X=1975
710 IF Y>=X THEN LET Z=1972:S=0
720 IF Y<X THEN LET Z=1976:S=1
750 GOSUB 1780
760 T=(360/365.25)*(N/1.00004)
770 K=T
780 GOSUB 1930
790 T=K
800 T1=T*PI/180
810 C=.01672
820 J=T+360/PI*C*SIN(T1-.051943)
830 J=J+99.5343
840 IF J>360 THEN LET J=J-360
850 IF J<0 THEN LET J=J+360
860 H=((J-102.51044#)*PI)/180
870 R1=(1-C*C)/(1+C*COS(H))
880 REM ---------------------------------
890 REM Compute Ecliptic Coordinates
900 REM ---------------------------------
910 U1=(P1-J)*PI/180
920 U2=(J-P1)*PI/180
930 IF R2<R1 THEN 990
940 Q1=R1*SIN(U1)
950 Q1=Q1/(R2-R1*COS(U1))
960 Q1=ATN(Q1)
970 Q2=Q1*180/PI+P1
980 GOTO 1030
990 Q3=R2*SIN(U2)
1000 Q3=Q3/(R1-R2*COS(U2))
1010 Q3=ATN(Q3)
1020 Q2=Q3*180/PI+J+180
1030 IF Q2>360 THEN LET Q2=Q2-360
1040 IF Q2<0 THEN LET Q2=Q2+360
1050 Q4=Q2*PI/180
1060 Q5=R2*TAN(I)*SIN(Q4-P)
1070 Q5=Q5/(R1*SIN(U1))
1080 Q5=ATN(Q5)
1090 REM ---------------------------------
1100 REM Convert to Equatorial coords
1110 REM ---------------------------------
1120 E1=.40893064#
1130 L1=SIN(Q5)*COS(E1)
1140 L1=L1+COS(Q5)*SIN(E1)*SIN(Q4)
1150 M1=ATN(L1/SQR(-L1*L1+1))
1160 Y2=M1*180/PI
1170 B1=TAN(Q4)/COS(E1)
1180 B1=B1-TAN(Q5)*SIN(E1)/COS(Q4)
1190 G=ATN(B1)
1200 H1=G*180/PI
1210 I1=INT(Q2/90)
1220 J1=INT(H1/90)
1230 IF I1-J1=4 OR I1-J1=1 THEN LET H1=H1+360
1240 IF I1-J1=2 OR I1-J1=3 THEN LET H1=H1+180
1250 IF I1-I1=-4 THEN LET H1=H1+360
1260 IF I1-J1=-2 THEN LET H1=H1-180
1270 N1=H1/15
1280 W=INT((K1-INT(K1))*60+5)
1290 IF W=60 THEN LET N1=N1+1:W=0
1310 K1=ABS(Y2)
1320 W1=INT((K1-INT(K1))*60+.5)
1330 IF W1=60 THEN LET G1=G1+1
1340 IF W1=60 THEN LET W1=0
1350 G1=INT(K1)
1360 IF Y2<0 OR G1<1 THEN LET W1=-W1
1370 D1=R1*R1+R2*R2
1380 D1=D1-2*R1*R2*COS(U1)
1390 D2=SQR(D1) 1400 R3=D2/COS(I)
1410 K9=R
1420 GOSUB 2040
1430 R=K9
1440 K9=R2/10
1450 GOSUB 2040
1460 R2=K9*10
1470 M0=4.1:N=3.1
1480 IF DS<0 THEN LET M0=5:N=4.44
1490 MA=MO+5*.4343*LOG(R3)
1500 MA=MA+N*2.5*.4343*LOG(R)
1510 M1=INT(10*MA)/10
1520 IF Y2<0 THEN LET G1=-G1
1530 REM ---------------------------------
1540 REM Print Ephermis For Date
1550 REM ---------------------------------
1560 PRINT"-----------------------------"
1570 PRINT"DATA FOR "C0$
1580 PRINT"DATE: D/M/Y="D"/"M"/"Y
1590 PRINT"DAYS TO PERIHELION "INT(DS)
1600 PRINT
1610 PRINT"COORDINATES:"
1620 PRINT" RA:";INT(N1);"HRS";W;"MIN"
1630 PRINT"DEC:";G1;"DEG";W1;"MIN"
1640 PRINT
1650 PRINT"DISTANCES:"
1660 PRINT" COMET TO SUN";R;"AU"
1670 PRINT"COMET TO EARTH";R3;"AU"
1680 PRINT
1690 PRINT"PREDICTED MAG";MA
1700 PRINT"---------------------------"
1710 PRINT"PRESS 0 FOR ANOTHER DATE"
1720 IF INKEY$="0" THEN 1740
1730 GOTO 1720
1740 PRINT
1750 GOTO 200
1760 REM -------------------------------
1770 REM Subroutine: DAYS TO PERIHELION
1780 A=(Y-Z)/4
1790 A1=INT(A+S)
1800 N=365*(Y-X+S)+A1
1810 IF INT(A)<>A THEN 1830
1820 IF (M=2 AND D<29) OR M=1 THEN LET N=N-1
1830 IF M>2 THEN 1870
1840 M2=M-1
1850 M2=31*M2
1860 GOTO 1890
1870 M2=M+1
1880 M2=INT(30.6*M2)-63
1890 N=N+M2+D-365*S
1900 RETURN
1910 REM -------------------------------
1920 REM: PLACE BETWEEN 0 AND 360 DEG
1930 IF K<0 THEN 1950
1940 IF K>360 THEN 1980
1950 K=K+360
1960 IF K>=0 THEN 2010
1970 GOTO 1950
1980 K=K-360
1990 IF K<=360 THEN 2010
2000 GOTO 1980
2010 RETURN
2020 REM -------------------------------
2030 REM: ROUND OFF ROUTINE
2040 K9=INT(K9*1000+.5)/1000
2050 RETURN