ebook img

Computer Algebra. Systems and Algorithms for Algebraic Computation PDF

308 Pages·1993·0.955 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Computer Algebra. Systems and Algorithms for Algebraic Computation

Preface An example The example which follows is a work session on the computer, using the software MACSYMA. The user’s commands are entered in the lines be- ginning with (ci). Here we are dealing with a limited (or Taylor series) expansion, calculating an integral and checking that the derivative in the result is indeed the initial function. (c2) taylor( sinh(sin(x))-sin(sinh(x)) ,x ,0 , 15); 7 11 15 x x 5699 x (d2)/T/ -- - ---- - ---------- + . . . 45 1575 1277025750 (c3) primitive:integrate( 1/(x**2 + 1) ** 4 ,x); 5 3 5 atan(x) 15 x + 40 x + 33 x (d3) --------- + ---------------------------- 16 6 4 2 48 x + 144 x + 144 x + 48 (c4) derivative:diff(primitive, x); 4 2 75 x + 120 x + 33 (d4) ---------------------------- 6 4 2 48 x + 144 x + 144 x + 48 5 3 5 3 (15 x + 40 x + 33 x) (288 x + 576 x + 288 x) 5 - ----------------------------------------------- + ----------- 6 4 2 2 2 (48 x + 144 x + 144 x + 48) 16 (x + 1) vi Preface (c5) factor(ratsimp(derivative)); 1 (d5) --------- 2 4 (x + 1) All these calculations can, in theory, be done by a (cid:12)rst year student, but they are quite laborious and it is diÆcult to do them with pencil and paper without making a mistake. ItisnotsuÆcientlywell-knownthatthistypeofcalculationisasmuch within the range of computers as is numerical calculation. The purpose of this book is to demonstrate the existing possibilities, to show how to use them, and to indicate the principles on which systems of non numerical calculation are based, to show the diÆculties which the designers of these systems had to solve | diÆculties with which the user is soon faced. But before we try to describe how the authors hope to carry out this ambitious design, we should (cid:12)rst try to de(cid:12)ne the subject better. Scienti(cid:12)c calculation and algebraic calculation From the start of electronic calculation, one of the main uses of computers has been for numerical calculation. Very soon, applications to manage- ment began to dominate the scene, as far as the volume of calculation assignedtothem isconcerned. Nevertheless,scienti(cid:12)capplicationsarestill themostprestigious,especiallyifwelookattheperformancerequiredofthe computer: the most powerful computers are usually reserved for scienti(cid:12)c calculation. Thisconceptof\scienti(cid:12)ccalculation"concealsanambiguity,whichit isimportanttonote: beforecomputersappearedonthescene,acalculation usually consisted of a mixture of numerical calculation and what we shall call \algebraic calculation", that is calculation by mathematical formulae. The only example of purely numerical calculation seems to have been the featsofcalculatingprodigiessuchasInaudi: theauthorsoftables,especially of logarithms, did indeed carry out enormous numerical calculations, but thesewereprecededbyarestatementofthealgebraicformulaeandmethods which were essential if the work was to be within the bounds of what is humanly possible. For example, the famous large calculations of the 19thcenturyinclude alargeproportionofformulamanipulation. Thebest known is certainly Le Verrier’s calculation of the orbit of Neptune, which started from the disturbances of the orbit of Uranus, and which led to the discovery of Neptune. The most impressive calculation with pencil and paperisalsointhe(cid:12)eldofastronomy: Delaunaytook10yearstocalculate the orbit of the moon, and another 10 years to check it. The result is not numerical,becauseitconsistsforthemostpartofaformulawhichbyitself occupies all the 128 pages of Chapter 4 of his book. Computer Algebra vii Theambiguitymentionedaboveisthefollowing: whencomputerscame on the scene, numerical calculation was made very much easier and it be- camecommonplacetodoenormouscalculations,whichinsomecasesmade itpossibletoavoidlaboriousalgebraicmanipulations. Theresultwasthat, for the public at large and even for most scientists, numerical calculation and scienti(cid:12)c calculation have become synonymous. When the title or list ofsubjectsofacongressorconferenceincludesthewords\scienti(cid:12)ccalcula- tion",wecangenerallybesurethatitisaquestionofnumericalcalculation only, even if computer algebra is also in the list of subjects. However,numericalcalculationdoesnotruleoutalgebraiccalculation: writing the most trivial numerical program requires a restatement of the formulae on which the algorithm is based. And, the power of computers does not solve everything: calculating the development of the atmosphere with the precision needed by meteorologists for a forecast 48 hours ahead would requiremuchmorethan 48hours on the mostpowerfulcomputer at present available (CRAY). Multiplying their power by 10 would make the situation only marginally better for, at the same time, the theory would be being improved and the mesh-size would have to be divided by 2 (to distinguishforexample betweentheweatherin Parisandthat in Orl(cid:19)eans), andthis wouldmultiply by8thenumber ofnumericalcalculationsneeded. Computer Algebra Thusalgebraiccalculationhasnotlostitsrelevance. However,itismostfre- quentlydonewithpencilandpaper,eventhoughthe(cid:12)rstsoftwareintended to automate it is already quite old [Kahrimanian, 1953; Nolan, 1953]. It was very quickly seen that such software for helping algebraic calculation would haveto be a complete system, which included a method with a very specialstructureforrepresentingnonnumericaldata,alanguagemakingit possibletomanipulatethem,andalibraryofe(cid:11)ectivefunctionsforcarrying out the necessary basic algebraic operations. And so there appeared systems which run very well, and the most widely used of these are described or referred to in this book. Writing, developing and even using these systems gradually merged into an autonomous scienti(cid:12)c discipline, obviously based on computer sci- ence. But the objectivesarein the (cid:12)eld of arti(cid:12)cialintelligence, evenif the methods are moving further and further away from it. Moreover, the al- gorithms used bring into play less and less elementary mathematical tools. And so this discipline seems to form a frontier between several (cid:12)elds, and thisaddsbothtoitsrichnessand,fromtheresearchaspect,toitsdiÆculty. The name of this discipline has long hesitated between \symbolic and algebraiccalculation",\symbolicandalgebraicmanipulations",and(cid:12)nally settled down as \ComputerAlgebra"in English, and \CalculFormel", ab- viii Preface breviated to CALSYF, in French. At the same time societies were formed to bring together the research workers and the users of this discipline: the (1) (2) world-wide organisation is SIGSAM group of the ACM which organ- ises the congresses SYMSAC and EUROSAM and publishes the bulletin (3) SIGSAM. TheEuropeangroupis calledSAME andorganisescongresses called EUROCAM, EUROSAM,... the proceedings of which are referred to in the bibliography. For French research workers there is the body of (4) the CNRS (Centre national de la recherche scienti(cid:12)que), the GRECO of Computer Algebra. And since 1985 a specialist review, the Journal of Symbolic Computation, has been published. Computer Algebra systems There are very many computer algebra systems; but scarcely more than ten are up-to-date, general and fairly widely available. In this book the authors have chosen four as being especially representative: - MACSYMA, the most developed. - REDUCE, the most widely available of all the large systems. - DERIVE, the system most easily availableto micro-computers,which means that it is very widely used but at the same time means that it is mainly used by beginners. - AXIOM, a very new system, with (currently) restricted availability, but which, because of its completely di(cid:11)erent structure, can overcome somelimitationstheothersystemsshare,andcanbetheprototypefor the next generation of Computer Algebra systems. The systemsmeioned here, and most of thosenot mentioned, arevery user friendly; admittedly, the super(cid:12)cial syntax of the language is not the same;admittedly,thelibraryofavailablefunctionsvariesfromsomedozens to more than a thousand; admittedly, the internal structure of the system varies considerably; but they all share the following properties: - The programming is mainly interactive: the user does not, in theory, know either the form or the size of his results and must therefore be able to intervene at any time. - Mostof the dataworkedonare mathematicalexpressions,ofwhich at least the external representationis the one everyoneis accustomed to. - The language used is \ALGOL-like". - The implementation language is often LISP; in any case, the data are list structures and tree structures, and memory management is (1) Special Interest Group in Symbolic and Algebraic Manipulations. (2) Association for Computing Machinery. (3) Symbolic and Algebraic Manipulations in Europe. (4) Groupe de REcherches COordonn(cid:19)ees. Computer Algebra ix dynamic with automatic recovery of the available space. Thus, once one of the Computer Algebra systems has been mastered, changing to a di(cid:11)erent one does not usually present the programmer with many problems, with far fewer in any case than does changing the system used at the same time as changing computer. That is why the authorsthought it better to write ageneralintroduc- tion to Computer Algebra than a manual for a particular system. And so, the introductory chapter \How to use a Computer Algebra system" is written in MACSYMA, the commands and the results are ex- tremely readable and easily understood. But REDUCE has been chosen forthedetaileddescriptionofasystem,becauseitismorewidelyavailable. The other chapters do not usually refer to a particular system. Accessibility of Computer Algebra systems Computer Algebra systems can generally be used only on fairly large ma- chines whose operating system works in virtual memory: to work without too much diÆculty, a mega-byte of main memory seems to be the smallest amount suitable. The most economical system is obviously DERIVE; the mostcostlyinworkmemoryisAXIOMforwhichmorethan10mega-bytes ofworkspacearenecessaryatpresent. Theonewhichneedsmostdiskspace isprobablyMACSYMA whosecompiled codeis gettingonformega-bytes, to which must be added severalmega-bytes of line documentation. At present the availability of the systems is as follows: MACSYMA runsonVAX,andsomepersonalwork-stations(Symbolics, Sun), andeven on 386-based PCs. REDUCE can be used on almost all the main models of large machines or of mini-computers, even though in some cases only the old versions are available (Cyber, IBM series 360, 370,:::, MULTICS, all the UNIX systems,:::). DERIVE can be used on almost every micro- computer. As for AXIOM, it only works on IBM’s VM/CMS or RS/6000 systems. Using Computer Algebra systems Forabeginner,theComputerAlgebralanguagesaresomeofthesimplestto use. Infact,at(cid:12)rst,heonlyneedstoknowsomefunctionswhichallowhim torewritetheprobleminquestioninaformverysimilartoitsmathematical form. Even if the rewriting is clumsy or incorrect, the interactivity means that after some playing around he can quickly (cid:12)nd results unobtainable with pencil and paper. And, for many applications, that is suÆcient. InprogramminglanguagesuchasFORTRANthesyntacticalsubtleties require a long apprenticeship whereas the work principles of the compiler can be totally ignored, but here, the user must very quickly grasp \how that works", especially how the data are represented and managed. x Preface Infact, althoughit isusuallydiÆcult toforetellthetime acalculation willtakeandwhatitssizewillbe,aknowledgeoftheworkingprinciplescan give an idea as to their order of magnitude and, if need be, optimise them. These estimates are in fact essential: for most algebraic calculations, the resultsarequasi-instantaneous,and allgoeswell. But, if this is not so,the increases in the time and memory space required are usually exponential. So the feasibility of a given calculation is not always obvious, and it is stupid to commit large resourceswhen a failure can be predicted. Moreover,anintelligentmodellingoftheproblemandaprogramadap- tedtothestructureofthedatamaymakeanotherwiseimpossibleproblem easy. Thus,inChapter1twoprogramsforcalculatingthelargestcoeÆcient of a polynomial are given; the text of the one which seems most natural for someone used to FORTRAN is considerably more complicated than the other, but above all it needs 10 times more time for a polynomial of degree 30 ; if we move on to a polynomial of degree 1000, about 30 times greater, the running time of the second program is in theory multiplied by 30, whereas that of the (cid:12)rst is multiplied by a factor of the order of 1000, whichgivesarunningtimeratioof300betweenthetwoprograms,andreal times of about one minute and (cid:12)ve hours. Acquiring an eÆcient programming style and an ability to foresee the size of a calculationis thereforemuchmoreimportant herethan in numer- ical calculation where the increase is generally linear. Unfortunately, this is for many a matter of experience, which it is hard to pass on by way of a manual. However, familiarity makes it easier to acquire this experience; and that is why such a large part of the book is devoted to describing the mathematical workingof Computer Algebra systems. Plan of the book The book can be divided into four sections. The (cid:12)rst (Chapter 1) is an introduction to Computer Algebra with the help of annotatedexamples, mostof which arewritten in MACSYMA. They can usually be understood on a (cid:12)rst reading. Nevertheless, it is a very useful exercise to program these examples or similar ones in MAC- SYMA or in some other system. This obviously requires a knowledge of the corresponding users’ manual. The second part, which consists of Chapters 2, 3, and 4, describes the working of Computer Algebra systems. Besides being interesting in itself, thedescriptionoftheproblemswhichhadtobesolvedandoftheprinciples behindthechosensolutionsisessentialforhelpingtheusertogetroundthe problems of \combinatorial explosion" with which he will be confronted. Chapter 5 makes up the third part and gives two Computer Algebra problems, still at the research stage, even though the softwares described Computer Algebra xi are beginning to be widely used. They are very good examples, which require all thepowerandall thepossibilities of ComputerAlgebrasystems to solve diÆcult natural problems; they are good illustrations both of the possibilities and of the diÆculties inherent in this discipline. Finally, a detailed presentation of REDUCE, as an appendix, enables this book to serve as a manual, at least for the most widely used of these systems. There is also a detailed bibliography, which includes many more ref- erences than appear explicitly in the text, so that the reader has access to the methods, results and algorithms for which there was no room in the book. Inconclusion,letushopethatthisbook,whichtillnowhasnoparallel anywhereintheworld,willhelptoincreasetheuseofthistool,sopowerful and so little known: Computer Algebra. Daniel Lazard Professorat the P. and M. Curie University (Paris VI) ACKNOWLEDGEMENTS The authors would like to thank all those who read the various drafts of this book, in particular Mrs. H. Davenport, J. Della Dora, D. Duval, M. Giusti, D. Lazard and J.C. Smith. This book was typeset with the TEX system. The author of TEX, D.E. Knuth, is responsible for the typographical excellence of the book, but obviously not for the errors. The presentation owes much to the TEX experts: C. Goutorbe at the C.I.C.G.* and C.E. Thompson of the Univer- sity of Cambridge. For the second edition, the authors would like to thank everyone who commented on the (cid:12)rst edition. * The French original was prepared on the hardware of the C.I.C.G. (Inter-University Computer Centre of Grenoble). Foreword It is now over thirty years since the computer was (cid:12)rst used to per- formalgebraiccalculations. Theresultingprogramscoulddi(cid:11)erentiatevery simple expressions, a far cry from the impressive array of sophisticated calculations possible with today’s algebraic computation programs. Until recently, however, such programs have only been accessible to those with access to large main-frame computers. This has limited both the use and the appreciation of algebraic computation techniques by the majority of potential users. Fortunately, the personal computer revolution is changing this; readily available machines are now appearing that can run existing algebra programs with impressive ease. As a result, interest in computer algebra is growingat a rapid pace. Although programs exist for performing the esoteric algebraic com- putations of interest to professional mathematicians, in this book we are mainly concerned with the constructive methods used by physical scien- tists andengineers. Theseinclude suchmundane thingsaspolynomialand series manipulation, as well as more sophisticated techniques like analytic integration, polynomial factorization and the analytic solution of di(cid:11)er- ential equations. In addition, a growing number of scientists are (cid:12)nding that these programsarealsouseful forgeneratingnumerical codefrom the resulting expressions. Algebraic computation programshave already been applied to a large number of di(cid:11)erent areas in science and engineering. The most extensive usehasoccurredinthe(cid:12)eldswherethealgebraiccalculationsnecessaryare extremely tedious and time consuming, such as general relativity, celestial mechanics and quantum chromodynamics. Before the advent of computer algebra,suchhandcalculationstookmanymonthstocompleteandwereer- rorprone. Personalworkstationscannowperformmuchlargercalculations xiv Foreword without error in a matter of minutes. Given the potential of computer algebra in scienti(cid:12)c problem solving, it is clear that a text book is needed to acquaint users with the available techniques. There are books concerned with the use of speci(cid:12)c algebraic computation programs, as well as those oriented towards computer scien- tists who study the (cid:12)eld. However, this is the (cid:12)rst general text to appear that providesthe practising scientist with the information needed to make optimal use of the available programs. The appearance of an English ver- sion of the original French text also makes it accessible to a wider class of readers than was previously possible. In addition to being a general text on the subject, this book also in- cludesanannexdescribingtheuseofoneparticularalgebrasystem,namely REDUCE,asystemI(cid:12)rstdesignedinthelate1960s. Theversiondescribed here has undergone many changes and extensions since those days, and is now in use by thousands of scientists and engineers throughout the world on machines ranging in power from the IBM PC to the Cray X-MP. I am sure that they will welcome this useful exposition of the system. Anthony C. Hearn The RAND Corporation December 1987 ACKNOWLEDGEMENTS The translators would like to thank J.P. Fitch and J.C. Smith for their helpful comments on this translation, as well as the reader R. Cut- ler at Academic Press. This translation was also prepared with TEX, and C.E. Thompson again provided much useful advice. The data transfers involved in preparing this translation would have been impossible without the helpful advice and support of the University of Cambridge Computing Service. For the re-printing, R.J. Bradford and M.A.H. MacCallum sig- nalled a few mis-prints, which have been corrected. The second edition owes much to the helpful comments of many, notably A.H.M. Levelt. Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . v Foreword to English translation . . . . . . . . . . . . . . . xiii 1 How to use a Computer Algebra system . . . . . . . . . . . . 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Features of Computer Algebra systems . . . . . . . . . . . . 2 1.3 Syntax of the associated languages . . . . . . . . . . . . . 3 1.4 Areas coveredby existing systems . . . . . . . . . . . . . . 3 1.5 Computer Algebra by example . . . . . . . . . . . . . . . 4 1.5.1 Simple operations on numbers . . . . . . . . . . . . . 4 1.5.2 Polynomialsand rational fractions . . . . . . . . . . 10 1.5.3 Matrix calculation . . . . . . . . . . . . . . . . . 18 1.5.4 Di(cid:11)erentiation { Taylor series . . . . . . . . . . . . 28 1.5.5 Simpli(cid:12)cation of formulae . . . . . . . . . . . . . . 34 1.5.6 Integration . . . . . . . . . . . . . . . . . . . . 42 1.5.7 Ordinary di(cid:11)erential equations . . . . . . . . . . . 48 1.6 MACSYMA’s possibilities in Algebra . . . . . . . . . . . 56 1.6.1 General Possibilities . . . . . . . . . . . . . . . . 56 1.6.2 The division of the circle into 17 equal parts . . . . . 60 1.7 Availability of MACSYMA . . . . . . . . . . . . . . . . 70 1.8 Other systems . . . . . . . . . . . . . . . . . . . . . 70 1.9 AXIOM . . . . . . . . . . . . . . . . . . . . . . . . 71 2 The problem of data representation . . . . . . . . . . . . . . 75 2.1 Representations of integers . . . . . . . . . . . . . . . . 75 2.2 Representations of fractions . . . . . . . . . . . . . . . 77 2.3 Representations of polynomials . . . . . . . . . . . . . . 78 2.3.1 Canonical and normal representations . . . . . . . . 79

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.