DEFDBL a-z CONST pi = 3.1415926536# PRINT "P. Hellings: Astrophysics with a PC: COMET TAILS" ' Adapted by Kiyoshi Kawabata from the minimal solution program of Chapter 2 ' on May 8, 2008 PRINT " " PRINT "Key in 1 for Fig.2.3, 2 for Fig. 2.4, and 3 otherwise" INPUT Nkey% IF Nkey%=1 THEN ap=0.5 : ecc=0.95 : mu=1.00 : g=0.03 ELSEIF Nkey%=2 THEN ap=0.5 : ecc=0.97 : mu=18 : g=0.20 ELSE PRINT "Input parameters and orbital elements : " INPUT "Perihelium distance (A.U.) : ", ap INPUT "Eccentricity of the comet orbit : ", ecc INPUT "Parameter 1 - mu : ", mu INPUT "Outflow velocity : ", g ENDIF CALL GRAPHSET p = ap * (1 + ecc) 'Draw the orbit of the comet nu=-45*0.05 r = p / (1 + ecc * COS(nu)) x = r * COS(nu) y = r * SIN(nu) ' PSET(x,y) PSET(-x,y) FOR i%=-44 To 45 nu=0.05*i% r = p / (1 + ecc * COS(nu)) x = r * COS(nu) y = r * SIN(nu) ' LINE -(x,y), 8 LINE -(-x,y), 8 NEXT i% FOR i% = -4 TO 4 ' ' this FOR-cycle considers 9 positions of the comet ' in its orbit ' ' next block computes position of the nucleus and parameters ' A1, A2 and A3 and shows these results on screen IF i%=-4 THEN LOCATE(2,14): COLOR 14: PRINT " Press any key to continue": COLOR 6 COLOR 15 END IF nu = .5 * i% r = p / (1 + ecc * COS(nu)) x = r * COS(nu) y = r * SIN(nu) a1 = SQR(2 / mu) * r a2 = 4 * ecc * r * SIN(nu) / 3 / mu / SQR(p) a3 = SQR(8 * p / mu) / 3 / r LOCATE (6+i%,5) PRINT "Tail ";5+i% FOR j% = -1 TO 1 ' PSET (x,y) PSET (-x,y) ' ' This FOR-cycle considers 3 syndynames for each of ' the 9 positions ' gg = j% * pi / 2 ggdegree = j% * 90 ' PRINT USING "Syndyname for G = ###.#"; ggdegree FOR k% = 1 TO 9 ' ' this FOR-cycle computes 9 points (s,t) and their ' (x',y') transformation s = .05 * k% t = g * SIN(gg) * (a1 * SQR(s) - a2 * s) + a3 * s _ * SQR(s) xx = (s * x + t * y + r * x) / r yy = (s * y - t * x + r * y) / r ' LINE -(xx,yy) LINE -(-xx,yy) NEXT k% NEXT j% IF i%=4 THEN COLOR 14: PRINT " Press any key to exit" ENDIF DO LOOP WHILE INKEY$ = "" NEXT i% END SUB GRAPHSET SCREEN 18,2 __SCREENSET 1,0 WINDOW SCREEN (-3.2,2)-(3.2,-2) VIEW (50,50)-(690,415) ' Draw X and Y axes LINE (-2.5,0)-(2.5,0),5 LINE (0,-2)-(0,2),5 ' Draw the orbit of Earth PSET(1.0,0.0) dtheta=pi/36 FOR i% =2 To 73 theta=dtheta*(i%-1) x = COS(theta) y = SIN(theta) LINE -(x,y), 6 NEXT i% IY%=PMAP(0,1)/16+5 IX%=PMAP(0,0)/8+3 LOCATE (IY%,IX%+5): COLOR 4: PRINT "Sun" : COLOR 15 IX%=PMAP(1,0)/8+9 LOCATE (IY%,IX%): COLOR 1: PRINT "Earth's orbit": COLOR 15 END SUB END