home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 91 / af091a.adf / af91a3.lzx / prgs / Astronomy / Kepler.b < prev    next >
Encoding:
Text File  |  1996-09-15  |  2.2 KB  |  67 lines

  1. 10 REM  This program 'KEP3LAW' written August 1994 
  2. 20 REM  by Leland Dolan of Houston Texas (USA) 
  3. 25 WINDOW 1,"Kepler's 3 Laws of Planetary Motion",(0,0)-(640,200)
  4. 30 CLS 
  5. 40 AY = 365.2596: REM  Anomalistic Year 
  6. 60 PRINT "This program calculates Planet's Orbital Period, or" 
  7. 70 PRINT "Mean Solar Distance, whichever value is unknown." 
  8. 90 PRINT 
  9. 100 INPUT "Quantity known: Distance (D), or Period (P)"; AN$ 
  10. 110 IF AN$ = "D" OR AN$ = "d" THEN GOSUB 1200 
  11. 120 IF AN$ = "P" OR AN$ = "p" THEN GOSUB 1400 
  12. 140 PRINT 
  13. 150 IF PA < 2 THEN GOSUB 1500 
  14. 160 IF PA >= 2 THEN GOSUB 1600 
  15. 200 GOSUB 1700 
  16. 210 PRINT 
  17. 300 INPUT "Is Orbital Eccentricity known"; QS$ 
  18. 320 IF QS$ = "Y" OR QS$ = "y" THEN GOSUB 2000 
  19. 330 IF QS$ = "N" OR QS$ = "n" THEN GOTO 900 
  20. 900 WINDOW CLOSE 1 : END 
  21. 1200 REM  Calculating orbital period 
  22. 1210 INPUT "Planet's Mean Solar Distance in A.U."; DS 
  23. 1220 PA = SQR(DS ^ 3) 
  24. 1230 RETURN 
  25. 1400 REM  Calculating Mean Solar Distance 
  26. 1410 INPUT "Planet's Orbital Period (years)"; PA 
  27. 1420 DS = (PA ^ 2) ^ (1 / 3) 
  28. 1430 RETURN 
  29. 1500 PG = PA * AY: REM  Converting years to days 
  30. 1510 PRINT "Orbital Period = "; 
  31. 1520 PRINT {USING "###.#";} PG; 
  32. 1530 PRINT " days" 
  33. 1540 RETURN 
  34. 1600 PRINT "Orbital Period ="; 
  35. 1610 PRINT {USING "###.##";} PA; 
  36. 1620 PRINT " years" 
  37. 1630 RETURN 
  38. 1700 PRINT "Mean Solar Distance ="; 
  39. 1710 PRINT {USING "###.##";} DS; 
  40. 1720 PRINT " A.U." 
  41. 1730 RETURN 
  42. 2000 REM  Calculating Perihelion & Aphelion Dist. 
  43. 2010 INPUT "What is Eccentricity of Orbit"; E 
  44. 2020 C = E * DS: REM  C is distance of foci from center 
  45. 2030 Q = DS - C: REM  Perihelion dist. 
  46. 2040 QA = DS + C: REM  Aphelion dist. 
  47. 2045 PRINT : CLS ': SCREEN 9 
  48. 2050 COLOR 5, 0: PRINT "Eccentricity ="; E 
  49. 2060 COLOR 12, 0: PRINT "Perihelion ="; 
  50. 2065 PRINT {USING "##.##";} Q 
  51. 2070 COLOR 3, 0: PRINT "Aphelion ="; 
  52. 2075 PRINT {USING "###.##";} QA 
  53. 2080 COLOR 7, 0: PRINT 
  54. 2100 REM  Drawing orbital ellipse 
  55. 2160 A = 195: B = A * (1 - E) ^ (1 / 2) 
  56. 2170 B1 = INT(B + .5): C1 = E * A 
  57. 2180 Q1 = A - C1: REM periehlion length 
  58. 2190 Q2 = Q1 + 115 
  59. 2200 LINE (115, 160)-(Q2, 160), 12 
  60. 2210 LINE (Q2, 160)-(505, 160), 3 
  61. 2230 PSET (310, 160) 
  62. 2250 PSET (Q2, 160) 
  63. 2260 ASP = 265: REM  Aspect Ratio number 
  64. 2270 CIRCLE (310, 160), 195, , , , 1 / ASP * B1 
  65. 2280 WHILE INKEY$="":SLEEP:WEND
  66. 2290 WINDOW CLOSE 1 
  67.