Montenbruck . Pfleger Astronomy on the Personal Computer Oliver Montenbruck Thomas Pfleger Astronomy on the Personal Computer Translated by Stürm Dunlüp Second, Corrected and Enlarged Edition With 45 Figures and a Floppy Disk Springer-Verlag Berlin Heidelberg GmbH Dr. rer. nato Oliver Montenbruck DLR-GSOC, D-82230 Weßling, Germany Dipl.-Ing. Thomas Pfleger Schloßstraße 56, D-53773 Hennef, Germany Translator: Dr. Storm Dunlop 140 Stocks Lane, East Wittering, Chichester West Sussex P020 8NT, United Kingdom Title of the original German edition: O. Montenbruck, T. Pfleger: Astronomie mit dem Personal Computer Zweite, überarbeitete und stark erweiterte Auflage © Springer-Verlag Berlin Heidelberg 1989, 1994 2. Auflage Springer-Verlag Berlin Heidelberg ISBN 978-3-662-02984-8 ISBN 978-3-662-02982-4 (eBook) DOI 10.1007/978-3-662-02982-4 Library ofCongress Cataloging-in-Publication Data. Montenbruck, Oliver, 1961- . [Astronomie mit dem Personal Computer. Englishl Astronomy on the personal computer / O. Montenbruck, T. Pfleger; translated by S. Dunlop. - 2nd corr. and enl. ed. p. cm. Includes bibliographical references and index. 1. Astronomy-Data processing. 2. Microcomputers. I. Pfleger, T. (Thomas), 1964- . 11. Title. QB51.3.E43M6613 1994 522'.85'536--dc20 94-28233 This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifica11y the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilm or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law ofSeptember 9, 1965, in its current version, and permission for use must always be obtained from Springer-Verlag. Violations are liable for prosecution under the German Copyright La w. © Springer-Verlag Berlin Heidelberg 1991, 1994 Origina11y published by Springer-Verlag Berlin Heidelberg New York in 1994. Softcover reprint of the hardcover 2nd edition 1994 The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Please note: Before using the programs in this book, pie ase consult the technical manuals provided by the manufacturer of the computer - and of any additional plug-in boards - to be used. The authors and the publisher accept no legal responsibility for any damage by improper use ofthe instructions and programs contained herein. Although these programs ha ve been tested with extreme care, we can offe r no formal guarantee that they will function correctly. The programs on the enclosed diskette are under copyright-protection and may not be reproduced without written permission by Springer-Verlag. One copy ofthe programs may be made as a back-up, but a11 further copies offend copyright law. Typesetting: Camera-ready copy from the authors Cover design: Erich Kirchner, Heidelberg, Germany SPIN: 10131861 55/3140 - 543 2 1 0 - Printed on acid-free paper Foreword It is said that a typical astronomer of the 19th century spent seven hours working at a desk for every hour spent at the telescope. That 's how long the routine analysis of data took with pencil, paper, and logarithmic tables. Thus when Wilhelm Olbers discovered the minor planet Vesta in 1807 and gathered the necessary observations, his friend Gauss needed almost 10 hours to hand- calculate its orbit. That achievement astonished many less gifted astronomers of the time, who might have labored days to work out the orbit of a newfound comet. How different things are today! Gauss's method of orbit determination, presented in Chap. 11 of this book, runs to completion on a horne computer in a few seconds at most. The machine will issue its accurate results in less time than it takes to key in the observations. In this book, alandmark in the youthfulliterature of astronomical com- puter algorithms, Oliver Montenbruck and Thomas Pfleger cover many topics of keen interest to the practical ob server. For me its most remarkable feature is the library of interrelated program modules, aIl elegantly written in PAS- CAL. Anyone who has tried to create such modules in interpreted BASIC soon runs into trouble: too few letters for variable names, not enough signifi- cant digits, and so on. These PASCAL routines are invoked one after another in coordinate transformations and calendar conversions. As "building blocks" for writing programs they find application in all corners of astronomy, not just the specific topics treated. That is reason enough, in my view, for anyone not so equipped to go out and buy a PASCAL compiler at once. Any active ob server will welcome the power and generality of these pro- grams. Chapter 10, for example, teIls how to make personal predictions of all stars to be occulted by the Moon for a given spot on Earth. It 's exciting to see a star wink out of sight or pop into view from behind the Moon's limb, but one has to know when and where to look. For many years, serious amateurs around the world have carefuIly timed such events, thereby gathering the raw data for detailed study of the Moon's limb profile and orbital motion. Astron- omy magazines can alert their readers to just a few of the most spectacular occultations each year - yet they happen all the time. Comets and minor planets offer many opportunities for amateur-professio- nal cooperation as weIl. A large observatory can't easily shuffie its schedule to cope with the sud den appearance of a bright comet. Yet countless ama- VI Foreword teurs already possess the telescopes, photographic skills, and enthusiasm to swing into action at a moment's notice. This book's chapters on measuring photographs, determining orbits, and calculating an ephemeris are just what is needed to participate in discovering and publicizing a new comet. Personal computers, especially when equipped with hard disks and math coprocessors, are also weil suited for the specialized work of identifying and improving the orbits of minor planets - something that just a few years ago was the exclusive province of large mainframes. Total solar eclipses hold a special fascination for astronomers, but accu- rate prediction has not always been easy. In October of 1780, an expedition from Harvard Coilege sailed to Penobscot Bay on the coast of Maine and somehow managed to set up its telescopes 30 km outside the path of total- ity! Such a blunder is far less likely today, even if official predictions are not issued until a few months before an eclipse takes place. However, owners of this book are spared even that frustration; the eclipse program of Chap. 9 will serve quite weil for detailed travel plans. Indeed, the carefuily crafted computer programs presented here go a long way toward freeing us from the need for an almanac or yearbook, the tradi- tional "astronomer's bible". While I still cherish such works on my bookshelf for their accurate planet positions, occultations, and eclipse calculations, I'm starting to look on them differently. Once they seemed great repositories of as- tronomical knowledge, fuil of data not abtainable elsewhere. More and more, they now serve as checks on the wonderfully accurate predictions I'm learning to make with my horne computer. Cambridge, MA Roger W. Sinnott October 1990 Preface to the Second Edition Since the publication of the first edition of Astronomy on the Personal Com- puter, we have received numerous comments and suggestions. Together with the publishers' interest in a new edition, this prompted us to revise the book and to incorporate a wide range of improvements to the text. The first important addition is a chapter on the calculation of perturba- tions. This shows how gravitational perturbations by the major planets may be incorporated into the calculation of ephemerides for minor planets and comets. The NUMINT program described here enables more accurate positions to be calculated. This will be of considerable assistance in searching for what are often extremely faint objects. This tool for calculating perturbations com- plements the chapters on the calculation of ephemerides, the determination of orbits, and astrometry. The second additional chapter discusses the calculation of physical ephe- merides for the major planets and the Sun, and thus fills a gap in the earlier edition's coverage. Amateurs now have at their disposal the means of both predicting and subsequently reducing interesting planetary observations. Other changes mainly concern the calculation of rising and setting times for the planets, and of the local circumstances that apply to solar eclipses. Finally, there is now a single version of the program diskette that is sup- plied with the book. Since the firm of Application Systems Heidelberg have introduced their Pure Pascal compiler for Atari ST /TT computers that is compatible with Borland's Turbo Pascal, there is no need for a special Atari version of the program diskette. The enclosed diskette may, therefore, be used without modifications with Turbo Pascal on IBM-compatible machines or with Pure Pascal on Atari computers. Details about the appropriate in- stallation procedures may be found in the AAREADME. DOC file on the diskette. We should like to thank Springer-Verlag for their helpful co-operation, and also Application Systems Heidelberg for their technical support. Munich, July 1994 o. Montenbruck and T. Pfleger Preface to the First Edition Nowadays anyone who deals with astronomical computations, either as a hobby or as part of their job, inevitably turns to using a computer. This is particularly true now that personal computers have become firmly established as ubiquitous aids to living. Calculations that could not even be contemplated a short time ago are now available to a whole range of users, and at no farther remove than their desks. Not only has the technical capacity of computers grown, but so has the need for powerful - i.e., fast and accurate - programs. So the wish to avoid conventional, astronomical yearbooks as much as possible is quite understand- able. We were therefore delighted to take up our publisher's suggestion that we explain the fundamental principles of spherical astronomy, ephemeris calcu- lations, and celestial mechanics in the form of this book. Astronomy on the Personal Computer offers readers who develop their own programs a comprehensive library of Pascal procedures for solving a whole range of individual steps that frequently occur in problems. This in- cludes routines for common coordinate transformations, for time and calen- dar calculations, and for handling the two-body problem. Specific procedures allow the exact positions of the Sun, the Moon, and the planets to be calcu- lated, taking mutual perturbations into account. Thanks to the widespread use of Pascal as a computing language, and by avoiding computer-specific commands, tlie programs may be employed on a wide range of modern com- puters from the PC to the largest mainframes. The large number of routines discussed should at least mean that few readers will have to 're-invent the wheel', and that they will therefore be free to concentrate on their own par- ticular interests. Each chapter of this book deals with a fairly restricted theme and ends with a complete main program. From simple questions, such as the deter- mination of rising and setting times or the calculation of the positions of the planets, more complex themes are developed, such as the calculation of solar eclipses and stellar occultations. The programs for the astrometric re- duction of photographs of star fields and for orbit determination enable users to derive orbital elements of comets or minor planets for themselves. Even readers without programming experience will be able to use the appropriate applications. X Preface to the First Edition Sufficient details are given of the astronomical and mathematical grounds on which solutions of specific problems are based for readers to understand the programs presented. This knowledge will enable them to adapt any of the programs to their individual needs. This elose link between theory and practice also enables us to explain what are sometimes quite complex aspects in a much easier fashion than the descriptions found in elassical textbooks. To sum up, we hope that we have given readers a fundamental grounding in using computers for astronomy. We should like to thank S. Dunlop for producing such an excellent trans- lation and Dr. G. Wolschin and C.-D. Bachem of Springer-Verlag for their cordial cooperation and interest during the process of publishing this book. Our thanks are also due to all our friends and colleagues, who, with their ideas and advice, and their help in correcting the manuscript and in testing the programs, have played an important part in the success of this book. Munich, August 1990 o. Montenbruck and T. Pfleger Contents 1 Introduction .......... 1 1.1 Some Examples ....... 1 1.2 Astronomy and Computing 2 1.3 Programming Languages and Techniques 4 2 Co ordinate Systems 7 2.1 Making aStart 7 2.2 Calendar and Julian Dates 11 2.3 Ecliptic and Equatorial Coordinates . 13 2.4 Precession ............... 17 2.5 Geocentric Coordinates and the Orbit of the Sun 23 2.6 The CO CO Program ........... . . . . . 27 3 Calculation of Rising and Setting Times 35 3.1 The Observer's Horizon System 35 3.2 Sun and Moon. . . . . . . . . . . . . 38 3.3 Sidereal Time and Hour Angle . . . . 40 3.4 Universal Time and Ephemeris Time 41 3.5 Parallax and Refraction 45 3.6 Rising and Setting Times. 47 3.7 Quadratic Interpolation 49 3.8 The SUNSET Program . . 50 3.9 The PLANRISE Program 57 4 Cometary Orbits ........... 59 4.1 Form and Orientation of the Orbit 59 4.2 Position in the Orbit ........ 61 4.3 Mathematical Treatment of Kepler's Equation 65 4.4 Near-Parabolic Orbits 68 4.5 Gaussian Vectors ... 71 4.6 Light-Time ...... 76 4.7 The COMET Program 77