Kepler carried out this work while he was teaching in Graz, but the book was seen through the press in Tьbingen by Maestlin. The agreement with values deduced from observation was not exact, and Kepler hoped that better observations would improve the agreement, so he sent a copy of the Mysterium cosmographicum to one of the foremost observational astronomers of the time, Tycho Brahe (1546 - 1601). Tycho, then working in Prague, had in fact already written to Maestlin in search of a mathematical assistant. Kepler got the job.

**The 'War with Mars' **

Naturally enough, Tycho's priorities were not the same as Kepler's, and Kepler soon found himself working on the intractable problem of the orbit of Mars [[(See Appendix below)]]. He continued to work on this after Tycho died (in 1601) and Kepler succeeded him as Imperial Mathematician. Conventionally, orbits were compounded of circles, and rather few observational values were required to fix the relative radii and positions of the circles. Tycho had made a huge number of observations and Kepler determined to make the best possible use of them. Essentially, he had so many observations available that once he had constructed a possible orbit he was able to check it against further observations until satisfactory agreement was reached. Kepler concluded that the orbit of Mars was an ellipse with the Sun in one of its foci (a result which when extended to all the planets is now called "Kepler's First Law"), and that a line joining the planet to the Sun swept out equal areas in equal times as the planet described its orbit ("Kepler's Second Law"), that is the area is used as a measure of time. After this work was published in New Astronomy ... (Astronomia nova, ..., Heidelberg, 1609), Kepler found orbits for the other planets, thus establishing that the two laws held for them too. Both laws relate the motion of the planet to the Sun; Kepler's Copernicanism was crucial to his reasoning and to his deductions.

The actual process of calculation for Mars was immensely laborious - there are nearly a thousand surviving folio sheets of arithmetic - and Kepler himself refers to this work as 'my war with Mars', but the result was an orbit which agrees with modern results so exactly that the comparison has to make allowance for secular changes in the orbit since Kepler's time.

**Observational error **

It was crucial to Kepler's method of checking possible orbits against observations that he have an idea of what should be accepted as adequate agreement. From this arises the first explicit use of the concept of observational error. Kepler may have owed this notion at least partly to Tycho, who made detailed checks on the performance of his instruments (see the biography of Brahe).

Optics, and the New Star of 1604

The work on Mars was essentially completed by 1605, but there were delays in getting the book published. Meanwhile, in response to concerns about the different apparent diameter of the Moon when observed directly and when observed using a camera obscura, Kepler did some work on optics, and came up with the first correct mathematical theory of the camera obscura and the first correct explanation of the working of the human eye, with an upside-down picture formed on the retina. These results were published in Supplements to Witelo, on the optical part of astronomy (Ad Vitellionem paralipomena, quibus astronomiae pars optica traditur, Frankfurt, 1604). He also wrote about the New Star of 1604, now usually called 'Kepler's supernova', rejecting numerous explanations, and remarking at one point that of course this star could just be a special creation 'but before we come to [that] I think we should try everything else' (On the New Star, De stella nova, Prague, 1606, Chapter 22, KGW 1, p. 257, line 23).

Following Galileo's use of the telescope in discovering the moons of Jupiter, published in his Sidereal Messenger (Venice, 1610), to which Kepler had written an enthusiastic reply (1610), Kepler wrote a study of the properties of lenses (the first such work on optics) in which he presented a new design of telescope, using two convex lenses (Dioptrice, Prague, 1611). This design, in which the final image is inverted, was so successful that it is now usually known not as a Keplerian telescope but simply as the astronomical telescope.

**Leaving Prague for Linz **

Kepler's years in Prague were relatively peaceful, and scientifically extremely productive. In fact, even when things went badly, he seems never to have allowed external circumstances to prevent him from getting on with his work. Things began to go very badly in late 1611. First, his seven year old son died. Kepler wrote to a friend that this death was particularly hard to bear because the child reminded him so much of himself at that age. Then Kepler's wife died. Then the Emperor Rudolf, whose health was failing, was forced to abdicate in favour of his brother Matthias, who, like Rudolf, was a Catholic but (unlike Rudolf) did not believe in tolerance of Protestants. Kepler had to leave Prague. Before he departed he had his wife's body moved into the son's grave, and wrote a Latin epitaph for them. He and his remaining children moved to Linz (now in Austria).

**Marriage and wine barrels **

Kepler seems to have married his first wife, Barbara, for love (though the marriage was arranged through a broker). The second marriage, in 1613, was a matter of practical necessity; he needed someone to look after the children. Kepler's new wife, Susanna, had a crash course in Kepler's character: the dedicatory letter to the resultant book explains that at the wedding celebrations he noticed that the volumes of wine barrels were estimated by means of a rod slipped in diagonally through the bung-hole, and he began to wonder how that could work. The result was a study of the volumes of solids of revolution (New Stereometry of wine barrels ..., Nova stereometria doliorum ..., Linz, 1615) in which Kepler, basing himself on the work of Archimedes, used a resolution into 'indivisibles'. This method was later developed by Bonaventura Cavalieri (c. 1598 - 1547) and is part of the ancestry of the infinitesimal calculus.

**The Harmony of the World **

Kepler's main task as Imperial Mathematician was to write astronomical tables, based on Tycho's observations, but what he really wanted to do was write The Harmony of the World, planned since 1599 as a development of his Mystery of the Cosmos. This second work on cosmology (Harmonices mundi libri V, Linz, 1619) presents a more elaborate mathematical model than the earlier one, though the polyhedra are still there. The mathematics in this work includes the first systematic treatment of tessellations, a proof that there are only thirteen convex uniform polyhedra (the Archimedean solids) and the first account of two non-convex regular polyhedra (all in Book 2). The Harmony of the World also contains what is now known as 'Kepler's Third Law', that for any two planets the ratio of the squares of their periods will be the same as the ratio of the cubes of the mean radii of their orbits. From the first, Kepler had sought a rule relating the sizes of the orbits to the periods, but there was no slow series of steps towards this law as there had been towards the other two. In fact, although the Third Law plays an important part in some of the final sections of the printed version of the Harmony of the World, it was not actually discovered until the work was in press. Kepler made last-minute revisions. He himself tells the story of the eventual success:

...and if you want the exact moment in time, it was conceived mentally on 8th March in this year one thousand six hundred and eighteen, but submitted to calculation in an unlucky way, and therefore rejected as false, and finally returning on the 15th of May and adopting a new line of attack, stormed the darkness of my mind. So strong was the support from the combination of my labour of seventeen years on the observations of Brahe and the present study, which conspired together, that at first I believed I was dreaming, and assuming my conclusion among my basic premises. But it is absolutely certain and exact that "the proportion between the periodic times of any two planets is precisely the sesquialterate proportion of their mean distances ..."

(Harmonice mundi Book 5, Chapter 3, trans. Aiton, Duncan and Field, p. 411).

**Witchcraft trial **

While Kepler was working on his Harmony of the World, his mother was charged with witchcraft. He enlisted the help of the legal faculty at Tьbingen. Katharina Kepler was eventually released, at least partly as a result of technical objections arising from the authorities' failure to follow the correct legal procedures in the use of torture. The surviving documents are chilling. However, Kepler continued to work. In the coach, on his journey to Wьrttemberg to defend his mother, he read a work on music theory by Vincenzo Galilei (c.1520 - 1591, Galileo's father), to which there are numerous references in The Harmony of the World.

**Astronomical Tables **

Calculating tables, the normal business for an astronomer, always i