# Chapter 6 – The Planets (Globe Projection)

## Globe Projection

This program DRAWs a globe divided into lines of latitude and longitude at 10° intervals rather than as a single pixel to mark each division as via the Globe-pixel program.

This program is not as accurate as the previous routine because it uses the Spectrum’s DRAW command which, although executed rapidly, cannot produce the required elliptical lines but only simple arcs. The largest errors, such as they are, occur adjacent to the edge of the disc and in the polar regions. Nevertheless, the simulation is quite effective and the user has the option to show either a polar or an equatorial view. The latter may be tilted up to 12° in a north or south direction. Figures 6.13 and 6.14 are typical COPYs from the Spectrum screen. The REM statements show the general structure of the program.

Figure 6.13
The globe can be drawn for a polar or equatorial viewpoint. The latter can be tilted up to ±12°.

Figure 6.14
Polar viewpoint.

10 REM Globe Projection
30 BORDER 5: PAPER 5: CLS : PRINT PAPER 4;”Globe projection [10″; CHR\$ 130;” int] ”
40 LET a=148: LET b=80: CIRCLE a,b,b
60 DIM x(9): DIM y(9)
70 FOR n=1 TO 9: READ y(n)
80 LET x(n)=63*(1.24*ATN (PI/180*n*10.5)): NEXT n
90 DATA 79,75,70,64,56,47,36,27,0: RESTORE
110 INPUT “Polar or Equitorial (p or e)? “; LINE a\$: GO TO (a\$=”e”)*120+(a\$=”p”)*270
130 PRINT “[max tilt=12 HR\$ 130;”‘”Equatorial “;
135 INPUT “Tilt (-s): “;k: IF ABS k>12 THEN GO TO 135
140 PRINT k;CHR\$ 130: LET k=k/14
150 FOR n=0 TO 36 STEP 2
160 LET f=n-18: LET g=2.71
170 LET h=g*ATN (PI/180*-f*7.3)
180 PLOT a,0: DRAW 0,b*2,h
190 NEXT n
210 PLOT a-b,b: DRAW b*2,0,k
220 FOR n=1 TO 9: LET c=y(n)
230 PLOT a+1-x(10-n),b+x(n)
240 DRAW c*2,0,k
250 PLOT a+1-x(10-n),-b+x(n)
260 DRAW c*2,0,k: NEXT n: STOP
280 PRINT “Polar”
290 FOR n=0 TO 72 STEP 2
300 LET d=n/36*PI: LET z=b*SIN d: LET yy=b*COS d
310 PLOT a,b: DRAW z,yy: NEXT n
330 FOR n=1 TO 9
340 CIRCLE a,b,x(n): NEXT n
350 STOP

# Chapter 6 – The Planets (Globe-pixel)

## Globe-pixel

Since the invention of the telescope and the discovery that the planets are worlds similar in shape to our Earth, astronomers have sliced up each globe into the homely lines of latitude and longitude with a north and south pole and an equator. Of the giant gas planets Jupiter, Saturn, Uranus and Neptune, only Jupiter and, to a lesser extent, Saturn have such systems of any practical interest. No positive markings (other than banding of polar and equatorial regions) have been detected on Uranus and Neptune due to their extreme remoteness. Only rarely does Saturn reveal any identifiable markings that are carried across the disc by the planet’s rotation. This leaves the relatively close (typically four to six times the distance of the Sun) planet Jupiter. A wealth of detail is visible on the disc in amateur telescopes but there is a snag.

Jupiter, being a rapidly spinning gas world, has no fixed reference point — only the constantly shifting cloud top is revealed. Also the rotation of the equatorial cloud zone is faster than at higher latitudes, and the planet is distorted from a neat sphere to an oblate spheriod shape. Thus, although a grid system of latitude and longitude is possible via the Spectrum graphics which even accounts for the oblate shapes of Jupiter and Saturn, it was not quite what we had in mind. A journey closer to Earth is called for.

Mars, Mercury and the Moon
The four inner planets from Mercury to Mars (including Earth) all have rocky surfaces. Only Venus with her permanent cloak of dense cloud is unwilling to reveal all. To this foursome, the Moon should be added as Earth’s twin planet. All are ripe for dissection into neat parcels of latitude and longitude as a globe projection. The two that are of practical interest to amateur astronomers are the Moon, somewhat obviously, and Mars. Mars is the only planet apart from Earth where the changing seasons and rotation-carrying surface markings across the disc can be seen using a back-yard telescope. The two programs that follow are particularly useful in converting the normal flat Mercator-type projection of, say, Mars’s maps to that of a globe — making for easier recognition of features, especially when displayed in the limb regions, ie adjacent to the disc edge.

The program
The short Globe-pixel routine can be used to PLOT a globe divided at 10° intervals of latitude and longitude. Figure 6.11 is a COPY from the screen. The scale of the COPY to the ZX printer gives a 5 cm diameter disc — the diameter recognised by amateur specialist observers of Mars and Venus for sketching these planets as basic outlines.

Figure 6.11
Globe accurately plotted at 10° intervals of latitude and longitude.

The program uses two FOR/NEXT loops to PLOT each pixel — the z loop for the lines of longitude (vertical lines) and the n loop for the lines of latitude (horizontal lines). The results are precise and accurate as presented to the screen and to the ZX printer. The separation of each pixel is controlled by the STEPs in the FOR/NEXT loops as follows:

FOR z= .001 TO 91 STEP 10

where STEP 10 is for each 10° of longitude. Note that although these STEPs are at precisely 10° intervals, the actual value returned has the sequential value of:

.001, 10.001, 20.001, 30.001, 40.001, etc.

Adding .001° (1/1000 degree or 3.6″ (seconds) arc) has no visible effect on the PLOTted positions but does ensure that the program will not crash trying to evaluate the SIN of 0° – an infinite number. The n loop takes the form:

FOR n = 0 TO PI*2 STEP 1 /r* 10 (latitude lines)

where PI*2 gives a full circle and STEP 1/r*10 equals a STEP interval of 0.175 from (1/(180/PI))*10 producing the required 10° spacing in latitude.

The lines of latitude are parallel to the equator whilst the curved lines of longitude originate from the poles. The latter PLOTting is controlled by the variable c in Line 60 to produce the curvature in Line 90.

Jupiter simulation
With a very minor amendment to the program it is possible to simulate Jupiter’s oblate globe — in this case, expanding the equatorial regions and leaving the polar or vertical dimensions unchanged. Amend the following line:

90 LET b = COS n*80/c* 1.08

It is the last value in the expression, ie * 1.08, that does the necessary expansion. Figure 6.12 shows Jupiter’s shape.

Figure 6.12
The oblate figure of planet Jupiter shown by reducing the STEP value to 1 in the z FOR/NEXT loop.

3 REM Globe-pixel
10 BORDER 0: PAPER 0: INK 5: CLS
20 PRINT PAPER 1;”Globe-pixel at 10″; CHR\$ 130;” intervals ”
30 LET r=180/PI
40 FOR z=.001 TO 91 STEP 10
50 PRINT INT z;CHR\$ 130
60 LET c=1/SIN (z/r)
70 FOR n=0 TO PI*2 STEP 1/r*10
80 LET a=SIN n*80
90 LET b=COS n*80/c
100 PLOT INK 6;INT (137+b),INT (85+a)
110 NEXT n: NEXT z

# Chapter 6 – The Planets (Planets through a Telescope)

## Planets through a Telescope

• How large does Jupiter appear in binoculars magnifying x 10?
• Are Mercury and Mars sometimes as small as Uranus in the telescope?
• What range of sizes does Venus appear to be when closest and at its most distant?

This program answers these questions and gives an impression of the relative size of all the planets as seen through a telescope for any magnification up to x 300. Included in the printout to the screen is the maximum and minimum size of each planet in seconds of arc and a scaled disc according to the magnification INPUT. Figure 6.10 is a typical screen copy.

Figure 6.10
Relative size of all the planets in a telescope magnifying x 123.

The display uses a black screen (BORDER 0: PAPER 0: INK 9) and the outline for each planet is coloured via the conditional INK command in Line 110. This command is matched reasonably well to the actual colours of the respective planets — Mars is red, Jupiter and Saturn are yellow, and so on. In the case of Jupiter, two equatorial belts are added and Saturn has an edge-on ring system.

The program
The layout of the program is both economical and straightforward, with the DATA on the planetary diameters, both maximum and minimum, stored in Line 90. These are READ in Line 110 with variable a for the minimum diameter and variable b for the maximum diameter of each planet, using the FOR/NEXT n loop for the seven planets.

The CIRCLE commands in Lines 130 and 140 produce an outline of each planet immediately the DATA is READ but modified according to the magnification as INPUT via the variable c. Lines 160 to 250 PLOT and DRAW the belts and rings of Jupiter and Saturn respectively, and correctly scaled. The planet names are PRINTed to the screen via Line 40. It is often more economical to use this simple arrangement than DATA/READ. Note the three apostrophes (”’) between each planet name — these are to give two blank PRINT lines below each name.

Interpreting the results
The results need to be interpreted if the information is to be meaningful. The program indicates the minimum and maximum size the planets can appear as seen from Earth through a telescope.

The minimum diameter applies when a planet is at its most remote from Earth in what is called the far side of the Sun or ‘superior conjunction’ — ie the Sun is between us and the planet. On these occasions the planet is unobservable due to its apparent proximity to the Sun. (This restriction does not necessarily apply to radio astronomers who could communicate with and receive data from the Viking spacecraft on the Martian surface during these periods, the radio signals being beamed within a degree or so of the Sun’s position.)

Best viewing
When the planets from Mars through to Neptune appear at their largest, they are normally due south at midnight and are seen at their best. Mars’s orbit is eccentric to the extent that the full diameter is not experienced at each ‘opposition’ as it is called, ie opposite to the Sun. In the case of Mercury and Venus, these planets are permanently nearer to the Sun than the Earth and so at times either can appear to pass in front of the Sun’s general position at what is called inferior conjunction. Again, these two planets are unobservable due to their proximity to the Sun even when they are at their closest to Earth and at their largest apparent diameter. On extremely rare occasions, the silhouette of Mercury or Venus can be seen (with special equipment only) in transit across the Sun’s disc.

In general, then, for normal viewing the planets tend to fall into an intermediate size between maximum and minimum. The greatest range of apparent sizes is for Venus, the nearest planet to Earth. The least range for Neptune — the remotest planet.

10 REM Planets through ‘scope
20 LET d=120: LET e=180: BORDER 0: PAPER 0: INK 9: CLS
30 PRINT PAPER 5;”Planet when remote/nearest”
40 PRINT PAPER 1””Mercury””'”Venus””'”Mars””'”Jupiter””'”Saturn””'”Uranus””'”Neptune”
50 INPUT “Magnification x”;c
60 IF c>300 THEN GO TO 50
70 PRINT PAPER 3;AT 0,26;”x”;c
90 DATA 4.7, 13, 11, 63, 3.5, 26, 30, 48, 14, 20, 3, 4, 2.3, 2.3
100 FOR n = 1 TO 7
110 READ a,b: INK 5+ (1 AND n>3 AND N <6) – (3 AND N=3)
120 PRINT AT n*3,8; a; CHR\$ 34; TAB 28;b; CHR\$ 34
130 CIRCLE d, INT (170-n*24), INT (a*c/500)
140 CICRLE e, INT (170-n*24), INT (b*c/500)
150 NEXT n
155 INK 6
160 LET r=c/18: x=c/9
170 LET r1=C/11: LET x1=c/5.5
180 PLOT d,73-c/d
190 DRAW r,0: DRAW -x,0: DRAW 0,c/50: DRAW x,0
200 PLOT d,50
210 DRAW r,0: DRAW -x,0
220 PLOT e,50
230 DRAW r1,0: DRAW -x1,0
240 PLOT e,73-c/d
250 DRAW r1,0: DRAW -x1,0: DRAW 0,c/50: DRAW x1,0
260 PRINT #0; FLASH 1; “Press C to continue”: PAUSE 0: RUN

# Chapter 6 – The Planets (Saturn Draw)

## Saturn Draw

For the dedicated Saturn observer it is usual to prepare an outline of the planet and ring system for use at the telescope. The most difficult aspect in sketching the planet is getting the ring geometry correct. Much precious telescope time can be wasted in attempting to draw these subtle ellipses — a test for the most skilled draughtsman. In case those unfamiliar with planetary observation suspect that the following program will obviate the need to go to the telescope at all, this is not so. There are many subtle shadows and shadings and divisions in the rings to be recorded — the program is merely an aid, and great fun even if you are not a telescope enthusiast.

This short program, based on the Saturn Rings routine, is designed for use with the ZX printer by drawing standard outlines measuring 100 mm across the ring system major axis for subsequent tracing. Because the ZX printer cannot cope with this full width, the left hand edge of the ring system has been folded.

The planet can be tilted up to 27.22° and the program accepts 0° to 28° for INPUT. Negative values cannot be entered and in any case are unnecessary as the globe is transparent. Correction for globe oblateness according to the tilt has been carefully applied and the ring systems represent the outer edge of ring A (largest ellipse) and inner edge of ring B (smallest ellipse) respectively. Figure 6.9 is a typical COPY from the program.

Figure 6.9
Copy from the ZX printer as a standard outline for sketching Saturn through a telescope.

Computer Aided Design
If you wish to have a permanent record of the appearance of Saturn through every possible phase over a 29½-year orbital period, covering the axial tilt from 0° to 28°, make the following minor modifications to the program so that the Spectrum with printer does it automatically. You will need about 2 m (6½ ft) of ZX printer paper for the 29½ COPYs. Amend Line 170 to read:

170 NEXT f: NEXT n: COPY: CLS: LET z = z+ 1: GOTO 40

Now press

RUN ENTER 0 ENTER

and your Spectrum will make a fine and effortless job of Computer Aided Design (CAD). The computer is best left to its own devices as it takes about 5 minutes to PLOT each image before it is COPYed. The PLOT time can be reduced to about 90 seconds per image if only the outer and inner rings are drawn, with wider spacing between the PLOT positions. For this, the STEPs in the two FOR/NEXT loops in Lines 120 and 130 need modification as follows:

120… STEP .5 130… STEP .04

If you are unhappy with the left portion of the ring system being folded, then the whole image can be rescaled so that it is contained on the screen, by changing the variables in lines 80 and 90:

x = 255/2
r = 60*.9
h = 140*.9

10 PRINT “Saturn Draw “;
30 INPUT “Tilt (0” CHR\$ 130; “to 28″; CHR\$ 130;”)”,z
40 IF z>28 THEN GO TO 30
50 LET ob=1.1*z/100
60 PRINT “Tilt=”;z;CHR\$ 130
70 LET e=1/SIN ((.1+z)/180*PI)
80 LET x=115: LET y=88
90 LET r=60: LET h=140
100 GO SUB 190
120 FOR n=1 TO 1.6 STEP .1
130 FOR f=0 TO PI*2 STEP .02
140 LET sx=INT (SIN f*h)
150 LET cy=INT (COS f*h/e)
160 PLOT x+sx/n,y+cy/n
170 NEXT f: NEXT n: STOP
190 PLOT 0,y: DRAW 255,0
200 PLOT x,10: DRAW 0,155
210 FOR f=0 TO PI*2 STEP .02
220 PLOT INT (x+SIN f*r),INT (y+COS f*r*(.89+.11*ob)): NEXT f
240 FOR f=PI*.5 TO PI*1.5 STEP .1: PLOT x+SIN f*r,y+COS f*r/e
250 NEXT f: RETURN

# Chapter 6 – The Planets (Saturn’s Rings)

## Saturn’s Rings

This program is similar to the previous one but stripped to the minimum to produce an outline of the planet and its ring system. It indicates how a program can be brief and still prove satisfactory. Figures 6.7 and 6.8 are COPYs of the screen.

Figure 6.7
Saturn with rings wide open.

Figure 6.8
Saturn with rings edge on.

The program
With this program you can simulate the appearance of Saturn and its ring system tilted at any chosen angle from 0 to 90 degrees. If 0 is ENTERed, the planet is drawn as viewed directly over its equator with the rings shown edge-on. If 90 is ENTERed, a polar view is presented with the ring system completely encircling the planet. Any intermediate angle will tilt the planet. As seen from Earth the appearance is limited from 0 to 26.73 degrees of tilt in both north and south directions plus or minus 0.49° depending on the relative positions of Earth and Saturn in their orbits at the time.

For simplicity, no attempt has been made to delete the ring system as it passes behind the planet and it is left to you to decide which portion of the rings is nearest to you. The Spectrum will influence your initial decision by drawing across the lower section of the globe first.

The Spectrum draws the globe and ring system with the PLOT command, using a modified Ellipse program (see Chapter 9). In the case of the globe the reduction in oblateness from 10% to zero (full circle) is applied progressively through the change of tilt from 0 to 90 degrees.

10 PRINT “Saturn’s Rings “;
30 INPUT “Tilt (0″; CHR\$ 130;”-90″; CHR\$ 130;”)”,z
40 PRINT “Tilt=”;z;CHR\$ 130
50 LET ob=1.1*z/100
60 LET z=1/SIN ((.1+z)/180*PI)
70 LET x=128: LET y=88
80 LET r=30: LET h=70
90 GO SUB 180
110 FOR n=1 TO 1.6 STEP .1
120 FOR f=0 TO PI*2 STEP .05
130 LET sx=INT (SIN f*h)
140 LET cy=INT (COS f*h/z)
150 PLOT x+sx/n,y+cy/n
160 NEXT f: NEXT n: STOP
180 FOR f=0 TO PI*2 STEP PI/100
190 PLOT INT (x+SIN f*r),INT (y+COS f*r*(.89+.11*ob))
200 NEXT f: RETURN

# Chapter 6 – The Planets (The Rings of Saturn)

## The Rings of Saturn

Saturn is the most splendid of planets: it marked the boundary of the known solar system until 1781. It is a cold world — the Sun is no more than a brilliant star in its skies. But its remoteness has not stopped man from seeking a closer view, with the highly successful Voyager spacecraft of August 1981 returning images clearer than were ever possible from Earth-based telescopes (from a distance of about 900 million miles).

The beautiful ring planet has always impressed people, be they beginners or experts at the telescope. This program, and the two that follow are designed to satisfy different interests and demonstrate the graphic potential of the Spectrum.

The Rings of Saturn probably represents the most accurate computer simulation of Saturn ever attempted on a home micro. It is possibly even superior to many mainframe efforts, with the exception of NASA’s Planetary Laboratories.

It features a full-screen solid image with all hidden lines deleted and the globe and ring system drawn accurately to scale. The user may tilt the planet and ring system at any angle up to 90°. If 0° is INPUT the planet is drawn as viewed directly over its equator with the rings shown edge-on. If 90° is INPUT a polar view is presented with the ring system completely encircling the planet. You may select a northern or southern aspect for the tilt. An INPUT of’s’ will show the underside of the rings and equator and visible pole for this aspect.

The sequence for drawing the planet is as follows:

1. Check image size; rescale if tilt >43°.
2. Draw globe correcting apparent oblateness for tilt.
3. Draw equator, correcting for tilt.
4. Draw semi-transparent ring system.
5. ‘Trace’ nearest edge of rings across globe according to N/S aspect.
6. Draw Cassini Division through ring system: clockwise for N aspect.
7. Delete Cassini Division if ‘behind’ planet.
8. Plot visible pole position correcting apparent oblateness for tilt.

Using the SCREEN\$ command
The program contains an option to COPY the completed picture to the ZX printer or to SAVE the image on to tape with the SCREEN\$ command. The latter is simplicity itself — it is only necessary to press ‘p’ (for picture) and start the recorder to SAVE the picture you have created. The angle of tilt is automatically SAVEd in the file name, eg sat -23.4. To recreate the picture, enter LOAD “sat – 23.4″SCREEN\$ and the Spectrum will search and display the appropriate image off the tape.

Saturn and computer simulations
Unlike some uninformed computer presentations of Saturn, the globe is not circular (except for the polar view) and so the CIRCLE command cannot be used to draw the planet. This oval (or correctly termed oblate spheroid) shape is due to Saturn’s rapid axial rotation in lOh 14m (Saturn’s day) causing the equatorial ‘bulge’ and polar ‘flattening’.

The Spectrum DRAWs the globe and ring system via the PLOT command using a rapid ellipse routine. In the case of the globe the reduction in oblateness from 10% to zero (full circle) is applied progressively through the change of tilt from 0° to 90°. Similarly the position of the equator and visible pole are correctly located according to the tilt of the planet and the oblateness as presented.

As seen from Earth, the appearance of the planet is limited to a maximum tilt of 26.73° (Saturn’s axial tilt to its orbit about the Sun) in both north or south directions plus or minus 0.49°, depending on the relative positions of Earth and Saturn in their orbits at the time. Thus any tilt in excess of 28° will represent a viewpoint other than from Earth.

The program
The REM statements show the general structure of the program. In the case of DRAWing the globe and rings, it is only necessary to calculate the outline of one quadrant of the ellipse and to mirror this in the remaining three quadrants by DRAWing each quadrant sequentially. Such a routine ensures that the DRAWing is executed rapidly with the minimum of calculation to slow the program down. In the case of the routine to DRAW the Cassini Division in the ring system, the program PLOTs one complete ellipse and you will note how relatively slow, though satisfying, this proves to be.

10 REM Rings of Saturn
20 LET sc=1: BORDER 0: PAPER 0: INK 6: CLS
30 PRINT “Saturn “;CHR\$ 127;
40 INPUT “Tilt (0\’ to 90\’ )”,z
50 IF z>43 THEN LET sc=.66
60 INPUT “N or S tilt (n/s): “; LINE a\$
70 LET ob=1.1*z/100
80 LET oe=.89+.11*ob
90 IF a\$=”s” THEN LET z=-z
100 PRINT TAB 21;”Tilt=”;z;CHR\$ 130
110 LET e=1/SIN ((.1+z)/180*PI)
115 LET p=COS ((.1+z)/180*PI): IF a\$=”s” THEN LET p=-p
120 LET x=255/2: LET y=88
130 LET r=54*sc: LET h=126*sc
140 GO SUB 360
160 FOR f=0 TO 1.58 STEP .01
170 LET c=INT (SIN f*h)
180 LET d=INT (COS f*h/e)
190 PLOT x+c,y+d
200 DRAW -c/3,-d/3
210 PLOT x-c,y+d
220 DRAW c/3,-d/3
230 PLOT OVER 1;x-c,y-d
240 DRAW c/3,d/3
250 DRAW OVER 1;0,1
260 PLOT OVER 1;x+c,y-d
270 DRAW -c/3,d/3
280 DRAW OVER 1;0,1
290 NEXT f: GO SUB 460
310 PRINT #0;”Press x to COPY, c to CONTINUE”
320 PRINT #1;TAB 6;”s to SAVE “”sat “;STR\$ z;””””: PAUSE 0
330 IF INKEY\$=”x” THEN COPY : INPUT “”: GO TO 310
340 IF INKEY\$=”s” THEN INPUT “”: SAVE “sat “+STR\$ zSCREEN\$ : INPUT “”: GO TO 310
350 RUN
370 FOR f=0 TO 1.420 STEP .019
380 LET a=INT (SIN f*r)
390 LET b=INT (COS f*r*oe)
400 PLOT x+a,y+b: DRAW 0,-b*2
410 PLOT x-a,y+b: DRAW 0,-b*2
420 NEXT f
440 FOR f=PI*.5 TO PI*1.5 STEP .1: PLOT OVER 1;x+SIN f*r,y+COS f*r/e: NEXT f: RETURN
460 LET cd=2.1
470 FOR f=0 TO PI*2 STEP .03: PLOT OVER 1;x+SIN f*r*cd,y+COS f*r*cd/e: DRAW OVER 1;2,0: NEXT f
485 IF ABS z>26 THEN GO TO 570
490 FOR f=0 TO 1.42 STEP .01
500 LET a=INT (SIN f*r)
510 LET b=INT (COS f*r*oe)
520 IF a\$=”s” THEN LET b=-b
530 PLOT x+a,y: DRAW 0,b
540 PLOT x-a,y: DRAW 0,b
550 NEXT f
570 PLOT OVER 1;x,y+r*p*oe
580 RETURN

# Chapter 6 – The Planets (The Moons of Mars)

## The Moons of Mars

In Gulliver’s Travels, published in 1735, satirical writer Jonathan Swift poked fun at contemporary astronomers by attributing superior instrumentation and discoveries to the mythical people of Laputa. At the same time Swift proved that he was no mean mathematician.

The Laputans discovered (amongst other things) ‘two lesser stars or satellites… revolving about Mars… at a distance of three times and five times the planet’s diameter.. .from the primary’s centre.. .in periods of 10 and 21 hours respectively….’

As the length of the Martian ‘day’ (24hr 37m) was first deduced by Cassini in 1666, Swift was probably fully aware that his fictional nearer moon to Mars would, as seen from the Martian surface, rise in the west and set in the east a few hours later. The second fictional moon would remain virtually fixed in the Martian skies, because the orbital period nearly matched the planet’s rotation period.

142 years later, in 1877, Professor Asaph Hall, using the 26-inch Naval Observatory refractor in Washington DC, turned Swift’s fiction into fact.

He discovered two moons of Mars, the inner moon indeed orbiting the planet faster than the planet’s axial rotation and the outer moon remaining above a given landscape for nearly three Martian days — passing through all its phases from new moon through full moon twice over. The currently recognised synodic orbital period (new moon to new moon) is 7hr 39m for Phobos and 30hr 21m for Deimos.

The screen display
The following program shows most of these factual features in an animated presentation, correct in both scale and relative motion of the three bodies. Incorporated into the display is a unique projection showing the skies as seen from the Red Planet’s surface, together with the changing phases of each moon as they orbit the planet. See Figure 6.4 for a typical display.

Figure 6.4
The positions of Phobos and Deimos are revealed by their shadows as they orbit Mars. Inset is the view from the Martian surface at local noon with the sun due south. Deimos is in the western sky. As in many of the programs in this book, they can only be fully appreciated in animation and colour.

The viewpoint is from space looking down on the north polar ice cap of Mars. Sunlight shines from the bottom of the screen with the shadow of the globe cast upwards into space. The planet is slowly rotating on its axis as indicated by a flickering line of longitude — the location of our observation post on the surface. Phobos and Deimos orbit the planet and their shadows in turn are cast up the screen into space.

At the bottom right of the screen is the mini-sky projection of the scene from the planet’s surface. The view covers the southern horizon from east to west and the Sun and moons as they pass across the sky, all synchronised to the main display. Inset into the mini-sky projection is the current phase of each moon, marked ‘p’ for Phobos and’d’ for Deimos. Immediately above is indicated the elapse time since the animation started, marked in days and hours.

Phobos and Deimos
The animation starts at a colourful sunset on the first day — Phobos and Deimos are due south and therefore centred in the mini-sky projection. Phobos moves rapidly to the left in overhauling the planet’s rotation and soon sets on the eastern horizon. In contrast, Deimos moves very slowly westwards, remaining in the sky for over 30 Martian hours before setting, being overtaken by the Sun in the process. Phobos will arc across the skies from west to east many times in the days that follow — Deimos only putting in an appearance again at the end of the program RUN.

It is advisable to reRUN the program several times, preferably in colour, to glean the most from the various interacting displays. The following pointers may be of interest.

When an orbiting moon is at the top of the screen, it appears as a fully illuminated disc or full moon. When at the bottom of the screen, between the Sun and Mars, it is said to be a new moon and, because it is effectively unilluminated as seen from Mars, it disappears briefly. If new moon occurs during the Martian daytime then the moon in question will pass briefly near the Sun, as shown on the mini-sky projection. The UDG CHR\$ set from CHR\$ 144 to CHR\$ 159 is defined in the program to show the moons’ phases in 16 steps.

The program RUN time is controlled by the FOR/NEXT n loop in Line 280 and RUNs for 5 days where PI* 10 equals 10 semicircular arcs of planetary rotation STEPped at half hour intervals by STEP PI/24. Test the program with different values instead of 10 and 24 in this line. A RUN longer than 5 days lacks synchronisation for Phobos.

It is also possible to change the size of Mars and the two orbits with the variable scale in Line 110. Currently it is set so as to contain Deimos’s orbit on the Spectrum screen. The variables ‘mars’, ‘ph’ and ‘de’ are the diameter of Mars and the orbital radii of Phobos and Deimos respectively in kilometres, and should not be changed.

10 REM Moons of Mars
20 RESTORE : GO SUB 2000
40 DIM a\$(3): DIM d\$(13)
50 LET m\$=” martian ”
60 LET n\$=”Mars Phobos Deimos”
70 LET x=83: LET y=92: LET d=0: LET p=0: LET sky=0: LET sk=1
80 LET h=0
90 LET dd=4.7: LET pp=4.7
100 LET m1=4: LET m2=4
110 LET q=203: LET scale=290
120 LET mars=6790/2/scale
130 LET m=mars-1
140 LET ph=9350/scale
150 LET de=23487/scale
170 BORDER 0: PAPER 0: CLS
180 PRINT AT 12,9;n\$;AT 15,22; INK 4;”hour=”;AT 14,22; INK 6;”day =”
190 PRINT PAPER 6; INK 9;AT 16,19;m\$+”day “””'”sunlight ^ ^ ^ ^ ^ “; PAPER 2; INK 5;”e–+–s–+–w”
200 LET pa=5: GO SUB 740
220 FOR n=0 TO 9: PRINT PAPER 1;AT n,9;a\$: NEXT n
230 OVER 0: CIRCLE x,y,mars
240 FOR n=0 TO PI*2 STEP PI/24
250 PLOT x,y: DRAW INK 2;COS n*m,SIN n*m: NEXT n: PRINT AT 12,5;d\$+d\$; BRIGHT 1; PAPER 7;AT 10,10;” ”
260 PRINT AT 0,13;n\$;CHR\$ 127
280 FOR n=0 TO PI*10 STEP PI/24
290 IF h>24 THEN LET h=h-24
300 PRINT AT 15,28;h;” ”
310 BEEP .01,40: LET h=h+.5
320 PRINT AT 14,28;sk-.5;” ”
340 LET cn=COS n: LET cm=cn*m
350 LET sn=SIN n: LET sm=sn*m
360 IF sky/24=INT (sky/24) THEN LET pa=3: GO SUB 740: GO SUB 690
370 GO SUB 850
390 LET dc=COS d: LET ds=SIN d
400 LET pc=COS p: LET ps=SIN p
420 OVER 1: LET ddc=COS dd: LET dds=SIN dd: LET ppc=COS pp: LET pps=SIN pp: LET sky=sky+1
440 LET dx=x+dc*de
450 LET dy=y+ds*de
460 LET px=x+pc*ph
470 LET py=y+ps*ph
490 FOR f=0 TO 1: PLOT x,y: DRAW INK 2;cm,sm: GO SUB 780
500 INK 9
520 PLOT dx,dy
530 DRAW 0,175-dy-(96 AND dyx-13 AND dx<x+13)
540 PLOT px,py
550 DRAW 0,175-py-(96 AND pyx-13 AND px15 THEN LET m1=m1-16
640 IF m2>15 THEN LET m2=0
650 OVER 0: NEXT n
660 PRINT #0; FLASH 1;” Press any key to run again “: PAUSE 0: GO TO 30
690 PRINT AT 16,19;
700 IF skINT sk THEN PRINT PAPER 6; INK 9;m\$+”day “: LET pa=5
710 IF sk=INT sk THEN PRINT PAPER 5; INK 9;m\$+”nght”: LET pa=1
720 LET sk=sk+.5
740 FOR k=17 TO 20: PRINT PAPER pa;AT k,19;d\$: NEXT k
750 INK 9: PLOT 154,9: DRAW 100,0: DRAW 0,30: DRAW -100,0: DRAW 0,-30
760 PRINT BRIGHT 1; PAPER 0; INK 7;AT 20,23;”p d”
770 RETURN
790 INK 9: IF sm<0 THEN PLOT q+cm*4.2,10+ABS sm*2.4: DRAW 0,1
810 IF dds<0 THEN PLOT q+ddc*50,12+ABS dds*20: DRAW 0,1
820 IF pps<0 THEN PLOT q+ppc*50,10+ABS pps*20: DRAW 0,1
830 INK 0: RETURN
850 PRINT PAPER 0; INK 7; BRIGHT 1;AT 20,24;CHR\$ (144+ABS m1)+” “+CHR\$ (144+m2): RETURN
2010 DATA 0,0,0,12,2,1,12,6,3,12,6,7,12,14,15,12,30,31,28,62,63
2020 DATA 60,126,127,60,126,255,60,126,254,56,124,252,48,120,248
2030 DATA 48,112,240,48,96,224,48,96,192,48,64,128
2050 FOR n=0 TO 15: FOR f=0 TO 1