The Mathematica GuideBook for Symbolics 0387950206, 9780387950204


99 24 173MB

English Pages [1490]

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

The Mathematica GuideBook for Symbolics
 0387950206, 9780387950204

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

The Mathematica GuideBook for Symbolics

Michael Trott

The Mathematica GuideBook for Symbolics

With 848 Illustrations

Michael Trott Wolfram Research Champaign, Illinois

Mathematica is a registered trademark of Wolfram Research, Inc. Library of Congress Control Number: 2005928496 ISBN-10: 0-387-95020-6 ISBN-13: 978-0387-95020-4 e-ISBN: 0-387-28815-5

Printed on acid-free paper.

 2006 Springer Science+Business Media, Inc. All rights reserved. This work may not be translated or copied in whole or in part without the written permission of the publisher (Springer Science+Business Media, Inc., 233 Spring St., New York, NY 10013, USA), except for brief excerpts in connection with reviews or scholarly analysis. Use in connection with any form of information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed is forbidden. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. Printed in the United States of America. 9 8 7 6 5 4 3 2 1 springeronline.com

(HAM)

Preface Bei mathematischen Operationen kann sogar eine gänzliche Entlastung des Kopfes eintreten, indem man einmal ausgeführte Zähloperationen mit Zeichen symbolisiert und, statt die Hirnfunktion auf Wiederholung schon ausgeführter Operationen zu verschwenden, sie für wichtigere Fälle aufspart. When doing mathematics, instead of burdening the brain with the repetitive job of redoing numerical operations which have already been done before, it’s possible to save that brainpower for more important situations by using symbols, instead, to represent those numerical calculations. — Ernst Mach (1883) [45]

Computer Mathematics and Mathematica Computers were initially developed to expedite numerical calculations. A newer, and in the long run, very fruitful field is the manipulation of symbolic expressions. When these symbolic expressions represent mathematical entities, this field is generally called computer algebra [8]. Computer algebra begins with relatively elementary operations, such as addition and multiplication of symbolic expressions, and includes such things as factorization of integers and polynomials, exact linear algebra, solution of systems of equations, and logical operations. It also includes analysis operations, such as definite and indefinite integration, the solution of linear and nonlinear ordinary and partial differential equations, series expansions, and residue calculations. Today, with computer algebra systems, it is possible to calculate in minutes or hours the results that would (and did) take years to accomplish by paper and pencil. One classic example is the calculation of the orbit of the moon, which took the French astronomer Delaunay 20 years [12], [13], [14], [15], [11], [26], [27], [53], [16], [17], [25]. (The Mathematica GuideBooks cover the two other historic examples of calculations that, at the end of the 19th century, took researchers many years of hand calculations [1], [4], [38] and literally thousands of pages of paper.) Along with the ability to do symbolic calculations, four other ingredients of modern general-purpose computer algebra systems prove to be of critical importance for solving scientific problems: † a powerful high-level programming language to formulate complicated problems † programmable two- and three-dimensional graphics † robust, adaptive numerical methods, including arbitrary precision and interval arithmetic † the ability to numerically evaluate and symbolically deal with the classical orthogonal polynomials and special functions of mathematical physics. The most widely used, complete, and advanced general-purpose computer algebra system is Mathematica. Mathematica provides a variety of capabilities such as graphics, numerics, symbolics, standardized interfaces to other programs, a complete electronic document-creation environment (including a full-fledged mathematical typesetting system), and a variety of import and export capabilities. Most of these ingredients are necessary to coherently and exhaustively solve problems and model processes occurring in the natural sciences [41], [58], [21], [39] and other fields using constructive mathematics, as well as to properly represent the results. Conse-

Preface

vi

quently, Mathematica’s main areas of application are presently in the natural sciences, engineering, pure and applied mathematics, economics, finance, computer graphics, and computer science. Mathematica is an ideal environment for doing general scientific and engineering calculations, for investigating and solving many different mathematically expressable problems, for visualizing them, and for writing notes, reports, and papers about them. Thus, Mathematica is an integrated computing environment, meaning it is what is also called a “problem-solving environment” [40], [23], [6], [48], [43], [50], [52].

Scope and Goals The Mathematica GuideBooks are four independent books whose main focus is to show how to solve scientific problems with Mathematica. Each book addresses one of the four ingredients to solve nontrivial and real-life mathematically formulated problems: programming, graphics, numerics, and symbolics. The Programming and the Graphics volume were published in autumn 2004. The four Mathematica GuideBooks discuss programming, two-dimensional, and three-dimensional graphics, numerics, and symbolics (including special functions). While the four books build on each other, each one is self-contained. Each book discusses the definition, use, and unique features of the corresponding Mathematica functions, gives small and large application examples with detailed references, and includes an extensive set of relevant exercises and solutions. The GuideBooks have three primary goals: † to give the reader a solid working knowledge of Mathematica † to give the reader a detailed knowledge of key aspects of Mathematica needed to create the “best”, fastest, shortest, and most elegant solutions to problems from the natural sciences † to convince the reader that working with Mathematica can be a quite fruitful, enlightening, and joyful way of cooperation between a computer and a human. Realizing these goals is achieved by understanding the unifying design and philosophy behind the Mathematica system through discussing and solving numerous example-type problems. While a variety of mathematics and physics problems are discussed, the GuideBooks are not mathematics or physics books (from the point of view of content and rigor; no proofs are typically involved), but rather the author builds on Mathematica’s mathematical and scientific knowledge to explore, solve, and visualize a variety of applied problems. The focus on solving problems implies a focus on the computational engine of Mathematica, the kernel—rather than on the user interface of Mathematica, the front end. (Nevertheless, for a nicer presentation inside the electronic version, various front end features are used, but are not discussed in depth.) The Mathematica GuideBooks go far beyond the scope of a pure introduction into Mathematica. The books also present instructive implementations, explanations, and examples that are, for the most part, original. The books also discuss some “classical” Mathematica implementations, explanations, and examples, partially available only in the original literature referenced or from newsgroups threads. In addition to introducing Mathematica, the GuideBooks serve as a guide for generating fairly complicated graphics and for solving more advanced problems using graphical, numerical, and symbolical techniques in cooperative ways. The emphasis is on the Mathematica part of the solution, but the author employs examples that are not uninteresting from a content point of view. After studying the GuideBooks, the reader will be able to solve new and old scientific, engineering, and recreational mathematics problems faster and more completely with the help of Mathematica—at least, this is the author’s goal. The author also hopes that the reader will enjoy

Preface

vii

using Mathematica for visualization of the results as much as the author does, as well as just studying Mathematica as a language on its own. In the same way that computer algebra systems are not “proof machines” [46], [9], [37], [10], [54], [55], [56] such as might be used to establish the four-color theorem ([2], [22]), the Kepler [28], [19], [29], [30], [31], [32], [33], [34], [35], [36] or the Robbins ([44], [20]) conjectures, proving theorems is not the central theme of the GuideBooks. However, powerful and general proof machines [9], [42], [49], [24], [3], founded on Mathematica’ s general programming paradigms and its mathematical capabilities, have been built (one such system is Theorema [7]). And, in the GuideBooks, we occasionally prove one theorem or another theorem. In general, the author’s aim is to present a realistic portrait of Mathematica: its use, its usefulness, and its strengths, including some current weak points and sometimes unexpected, but often nevertheless quite “thought through”, behavior. Mathematica is not a universal tool to solve arbitrary problems which can be formulated mathematically—only a fraction of all mathematical problems can even be formulated in such a way to be efficiently expressed today in a way understandable to a computer. Rather, it is often necessary to do a certain amount of programming and occasionally give Mathematica some “help” instead of simply calling a single function like Solve to solve a system of equations. Because this will almost always be the case for “real-life” problems, we do not restrict ourselves only to “textbook” examples, where all goes smoothly without unexpected problems and obstacles. The reader will see that by employing Mathematica’s programming, numeric, symbolic, and graphic power, Mathematica can offer more effective, complete, straightforward, reusable, and less likely erroneous solution methods for calculations than paper and pencil, or numerical programming languages. Although the Guidebooks are large books, it is nevertheless impossible to discuss all of the 2,000+ built-in Mathematica commands. So, some simple as well as some more complicated commands have been omitted. For a full overview about Mathematica’s capabilities, it is necessary to study The Mathematica Book [60] in detail. The commands discussed in the Guidebooks are those that an scientist or research engineer needs for solving typical problems, if such a thing exists [18]. These subjects include a quite detailed discussion of the structure of Mathematica expressions, Mathematica input and output (important for the human–Mathematica interaction), graphics, numerical calculations, and calculations from classical analysis. Also, emphasis is given to the powerful algebraic manipulation functions. Interestingly, they frequently allow one to solve analysis problems in an algorithmic way [5]. These functions are typically not so well known because they are not taught in classical engineering or physics-mathematics courses, but with the advance of computers doing symbolic mathematics, their importance increases [47]. A thorough knowledge of: † structural operations on polynomials, rational functions, and trigonometric functions † algebraic operations on polynomial equations and inequalities † process of compilation, its advantages and limits † main operations of calculus—univariate and multivariate differentiation and integration † solution of ordinary and partial differential equations is needed to put the heart of Mathematica—its symbolic capabilities—efficiently and successfully to work in the solution of model and real-life problems. The Mathematica GuideBooks to Symbolics discusses these subjects. The current version of the Mathematica GuideBooks is tailored for Mathematica Version 5.1.

viii

Preface

Content Overview The Mathematica GuideBook for Symbolics has three chapters. Each chapter is subdivided into sections (which occasionally have subsections), exercises, solutions to the exercises, and references. This fourth and last volume of the GuideBooks deals with Mathematica’s symbolic mathematical capabilities—the real heart of Mathematica and the ingredient of the Mathematica software system that makes it so unique and powerful. In addition, this volume discusses and employs the classical orthogonal polynomials and special functions of mathematical physics. To demonstrate the symbolic mathematics power, a variety of problems from mathematics and physics are discussed. Chapter 1 starts with a discussion of the algebraic functions needed to carry out analysis problems effectively. Contrary to classical science/engineering mathematics education, using a computer algebra system makes it often a good idea to rephrase a problem—including when it is from analysis—in a polynomial way to allow for powerful algorithmic treatments. Gröbner bases play a central role in accomplishing this task. This volume discusses in detail the main functions to deal with structural operations on polynomials, polynomial equations and inequalities, and expressions containing quantified variables. Rational functions and expressions containing trigonometric functions are dealt with next. Then the central problems of classical analysis—differentiation, integration, summation, series expansion, and limits—are discussed in detail. The symbolic solving of ordinary and partial differential equations is demonstrated in many examples. As always, a variety of examples show how to employ the discussed functions in various mathematics or physics problems. The Symbolics volume emphasizes their main uses and discusses the specialities of these operations inside a computer algebra system, as compared to a “manual” calculation. Then, generalized functions and Fourier and Laplace transforms are discussed. The main part of the chapter culminates with three examples of larger symbolic calculations, two of them being classic problems. This chapter has more than 150 exercises and solutions treating a variety of symbolic computation examples from the sciences. Chapters 2 and 3 discuss classical orthogonal polynomials and the special functions of mathematical physics. Because this volume is not a treatise on special functions, it is restricted to selected function groups and presents only their basic properties, associated differential equations, normalizations, series expansions, verification of various special cases, etc. The availability of nearly all of the special functions of mathematical physics for all possible arbitrary complex parameters opens new possibilities for the user, e.g., the use of closed formulas for the Green’s functions of commonly occurring partial differential equations or for “experimental mathematics”. These chapters focus on the use of the special functions in a number of physics-related applications in the text as well as in the exercises. The larger examples deal with are the quartic oscillator in the harmonic oscillator basis and the implementation of Felix Klein’s method to solve quintic polynomials in Gauss hypergeometric functions 2F1 . The Symbolics volume employs the built-in symbolic mathematics in a variety of examples. However, the underlying algorithms themselves are not discussed. Many of them are mathematically advanced and outside of the scope of the GuideBooks. Throughout the Symbolics volume, the programming and graphics experience acquired in the first two volumes is used to visualize various mathematics and physics topics.

Preface

ix

The Books and the Accompanying DVDs Each of the GuideBooks comes with a multiplatform DVD. Each DVD contains the fourteen main notebooks, the hyperlinked table of contents and index, a navigation palette, and some utility notebooks and files. All notebooks are tailored for Mathematica 5.1. Each of the main notebooks corresponds to a chapter from the printed books. The notebooks have the look and feel of a printed book, containing structured units, typeset formulas, Mathematica code, and complete solutions to all exercises. The DVDs contain the fully evaluated notebooks corresponding to the chapters of the corresponding printed book (meaning these notebooks have text, inputs, outputs and graphics). The DVDs also include the unevaluated versions of the notebooks of the other three GuideBooks (meaning they contain all text and Mathematica code, but no outputs and graphics). Although the Mathematica GuideBooks are printed, Mathematica is “a system for doing mathematics by computer” [59]. This was the lovely tagline of earlier versions of Mathematica, but because of its growing breadth (like data import, export and handling, operating system-independent file system operations, electronic publishing capabilities, web connectivity), nowadays Mathematica is called a “system for technical computing”. The original tagline (that is more than ever valid today!) emphasized two points: doing mathematics and doing it on a computer. The approach and content of the GuideBooks are fully in the spirit of the original tagline: They are centered around doing mathematics. The second point of the tagline expresses that an electronic version of the GuideBooks is the more natural medium for Mathematica-related material. Long outputs returned by Mathematica, sequences of animations, thousands of web-retrievable references, a 10,000-entry hyperlinked index (that points more precisely than a printed index does) are space-consuming, and therefore not well suited for the printed book. As an interactive program, Mathematica is best learned, used, challenged, and enjoyed while sitting in front of a powerful computer (or by having a remote kernel connection to a powerful computer). In addition to simply showing the printed book’s text, the notebooks allow the reader to: † experiment with, reuse, adapt, and extend functions and code † investigate parameter dependencies † annotate text, code, and formulas † view graphics in color † run animations.

The Accompanying Web Site Why does a printed book need a home page? There are (in addition to being just trendy) two reasons for a printed book to have its fingerprints on the web. The first is for (Mathematica) users who have not seen the book so far. Having an outline and content sample on the web is easily accomplished, and shows the look and feel of the notebooks (including some animations). This is something that a printed book actually cannot do. The second reason is for readers of the book: Mathematica is a large modern software system. As such, it ages quickly in the sense that in the timescale of 101. smallIntegermonths, a new version will likely be available. The overwhelmingly large majority of Mathematica functions and programs will run unchanged in a new version. But occasionally, changes and adaptations might be needed. To accommodate this, the web site of this book—http://www.MathematicaGuideBooks.org—contains a list of changes relevant to the GuideBooks. In addition, like any larger software project, unavoidably, the GuideBooks will contain suboptimal implementations, mistakes, omissions, imperfections, and errors. As they come to his attention, the author will list them at

Preface

x

the book’s web site. Updates to references, corrections [51], hundreds of pages of additional exercises and solutions, improved code segments, and other relevant information will be on the web site as well. Also, information about OS-dependent and Mathematica version-related changes of the given Mathematica code will be available there.

Evolution of the Mathematica GuideBooks A few words about the history and the original purpose of the GuideBooks: They started from lecture notes of an Introductory Course in Mathematica 2 and an advanced course on the Efficient Use of the Mathematica Programming System, given in 1991/1992 at the Technical University of Ilmenau, Germany. Since then, after each release of a new version of Mathematica, the material has been updated to incorporate additional functionality. This electronic/printed publication contains text, unique graphics, editable formulas, runable, and modifiable programs, all made possible by the electronic publishing capabilities of Mathematica. However, because the structure, functions and examples of the original lecture notes have been kept, an abbreviated form of the GuideBooks is still suitable for courses. Since 1992 the manuscript has grown in size from 1,600 pages to more than three times its original length, finally “weighing in” at nearly 5,000 printed book pages with more than: † 18 gigabytes of accompanying Mathematica notebooks † 22,000 Mathematica inputs with more than 13,000 code comments † 11,000 references † 4,000 graphics † 1,000 fully solved exercises † 150 animations. This first edition of this book is the result of more than eleven years of writing and daily work with Mathematica. In these years, Mathematica gained hundreds of functions with increased functionality and power. A modern year-2005 computer equipped with Mathematica represents a computational power available only a few years ago to a select number of people [57] and allows one to carry out recreational or new computations and visualizations—unlimited in nature, scope, and complexity— quickly and easily. Over the years, the author has learned a lot of Mathematica and its current and potential applications, and has had a lot of fun, enlightening moments and satisfaction applying Mathematica to a variety of research and recreational areas, especially graphics. The author hopes the reader will have a similar experience.

Disclaimer In addition to the usual disclaimer that neither the author nor the publisher guarantees the correctness of any formula, fitness, or reliability of any of the code pieces given in this book, another remark should be made. No guarantee is given that running the Mathematica code shown in the GuideBooks will give identical results to the printed ones. On the contrary, taking into account that Mathematica is a large and complicated software system which evolves with each released version, running the code with another version of Mathematica (or sometimes even on another operating system) will very likely result in different outputs for some inputs. And, as a consequence, if different outputs are generated early in a longer calculation, some functions might hang or return useless results.

Preface

xi

The interpretations of Mathematica commands, their descriptions, and uses belong solely to the author. They are not claimed, supported, validated, or enforced by Wolfram Research. The reader will find that the author’s view on Mathematica deviates sometimes considerably from those found in other books. The author’s view is more on the formal than on the pragmatic side. The author does not hold the opinion that any Mathematica input has to have an immediate semantic meaning. Mathematica is an extremely rich system, especially from the language point of view. It is instructive, interesting, and fun to study the behavior of built-in Mathematica functions when called with a variety of arguments (like unevaluated, hold, including undercover zeros, etc.). It is the author’s strong belief that doing this and being able to explain the observed behavior will be, in the long term, very fruitful for the reader because it develops the ability to recognize the uniformity of the principles underlying Mathematica and to make constructive, imaginative, and effective use of this uniformity. Also, some exercises ask the reader to investigate certain “unusual” inputs. From time to time, the author makes use of undocumented features and/or functions from the Developer` and Experimental` contexts (in later versions of Mathematica these functions could exist in the System` context or could have different names). However, some such functions might no longer be supported or even exist in later versions of Mathematica.

Acknowledgements Over the decade, the GuideBooks were in development, many people have seen parts of them and suggested useful changes, additions, and edits. I would like to thank Horst Finsterbusch, Gottfried Teichmann, Klaus Voss, Udo Krause, Jerry Keiper, David Withoff, and Yu He for their critical examination of early versions of the manuscript and their useful suggestions, and Sabine Trott for the first proofreading of the German manuscript. I also want to thank the participants of the original lectures for many useful discussions. My thanks go to the reviewers of this book: John Novak, Alec Schramm, Paul Abbott, Jim Feagin, Richard Palmer, Ward Hanson, Stan Wagon, and Markus van Almsick, for their suggestions and ideas for improvement. I thank Richard Crandall, Allan Hayes, Andrzej Kozlowski, Hartmut Wolf, Stephan Leibbrandt, George Kambouroglou, Domenico Minunni, Eric Weisstein, Andy Shiekh, Arthur G. Hubbard, Jay Warrendorff, Allan Cortzen, Ed Pegg, and Udo Krause for comments on the prepublication version of the GuideBooks. I thank Bobby R. Treat, Arthur G. Hubbard, Murray Eisenberg, Marvin Schaefer, Marek Duszynski, Daniel Lichtblau, Devendra Kapadia, Adam Strzebonski, Anton Antonov, and Brett Champion for useful comments on the Mathematica Version 5.1 tailored version of the GuideBooks. My thanks are due to Gerhard Gobsch of the Institute for Physics of the Technical University in Ilmenau for the opportunity to develop and give these original lectures at the Institute, and to Stephen Wolfram who encouraged and supported me on this project. Concerning the process of making the Mathematica GuideBooks from a set of lecture notes, I thank Glenn Scholebo for transforming notebooks to T E X files, and Joe Kaiping for T E X work related to the printed book. I thank John Novak and Jan Progen for putting all the material into good English style and grammar, John Bonadies for the chapter-opener graphics of the book, and Jean Buck for library work. I especially thank John Novak for the creation of Mathematica 3 notebooks from the T E X files, and Andre Kuzniarek for his work on the stylesheet to give the notebooks a pleasing appearance. My thanks go to Andy Hunt who created a specialized stylesheet for the actual book printout and printed and formatted the 4×1000+ pages of the Mathematica GuideBooks. I thank Andy Hunt for making a first version of the homepage of the GuideBooks and Amy Young for creating the current version of the homepage of the GuideBooks. I thank Sophie Young for a final check of the English. My largest thanks go to Amy Young, who encouraged me to update the whole book over the years and who had a close look at all of my English writing and often improved it considerably. Despite reviews by

xii

Preface

many individuals any remaining mistakes or omissions, in the Mathematica code, in the mathematics, in the description of the Mathematica functions, in the English, or in the references, etc. are, of course, solely mine. Let me take the opportunity to thank members of the Research and Development team of Wolfram Research whom I have met throughout the years, especially Victor Adamchik, Anton Antonov, Alexei Bocharov, Arnoud Buzing, Brett Champion, Matthew Cook, Todd Gayley, Darren Glosemeyer, Roger Germundsson, Unal Goktas, Yifan Hu, Devendra Kapadia, Zbigniew Leyk, David Librik, Daniel Lichtblau, Jerry Keiper, Robert Knapp, Roman Mäder, Oleg Marichev, John Novak, Peter Overmann, Oleksandr Pavlyk, Ulises Cervantes–Pimentel, Mark Sofroniou, Adam Strzebonski, Oyvind Tafjord, Robby Villegas, Tom Wickham–Jones, David Withoff, and Stephen Wolfram for numerous discussions about design principles, various small details, underlying algorithms, efficient implementation of various procedures, and tricks concerning Mathematica. The appearance of the notebooks profited from discussions with John Fultz, Paul Hinton, John Novak, Lou D’Andria, Theodore Gray, Andre Kuzniarek, Jason Harris, Andy Hunt, Christopher Carlson, Robert Raguet–Schofield, George Beck, Kai Xin, Chris Hill, and Neil Soiffer about front end, button, and typesetting issues. It was an interesting and unique experience to work over the last 12 years with five editors: Allan Wylde, Paul Wellin, Maria Taylor, Wayne Yuhasz, and Ann Kostant, with whom the GuideBooks were finally published. Many book-related discussions that ultimately improved the GuideBooks, have been carried out with Jan Benes from TELOS and associates, Steven Pisano, Jenny Wolkowicki, Henry Krell, Fred Bartlett, Vaishali Damle, Ken Quinn, Jerry Lyons, and Rüdiger Gebauer from Springer New York. The author hopes the Mathematica GuideBooks help the reader to discover, investigate, urbanize, and enjoy the computational paradise offered by Mathematica.

Wolfram Research, Inc. April 2005

Michael Trott

Preface

xiii

References 1

A. Amthor. Z. Math. Phys. 25, 153 (1880).

2

K. Appel, W. Haken. J. Math. 21, 429 (1977).

3

A. Bauer, E. Clarke, X. Zhao. J. Automat. Reasoning 21, 295 (1998).

4

A. H. Bell. Am. Math. Monthly 2, 140 (1895).

5

M. Berz. Adv. Imaging Electron Phys. 108, 1 (2000).

6

R. F. Boisvert. arXiv:cs.MS/0004004 (2000).

7

B. Buchberger. Theorema Project (1997). ftp://ftp.risc.uni-linz.ac.at/pub/techreports/1997/97-34/ed-media.nb

8

B. Buchberger. SIGSAM Bull. 36, 3 (2002).

9

S.-C. Chou, X.-S. Gao, J.-Z. Zhang. Machine Proofs in Geometry, World Scientific, Singapore, 1994.

10

A. M. Cohen. Nieuw Archief Wiskunde 14, 45 (1996).

11

A. Cook. The Motion of the Moon, Adam-Hilger, Bristol, 1988.

12

C. Delaunay. Théorie du Mouvement de la Lune, Gauthier-Villars, Paris, 1860.

13

C. Delaunay. Mem. de l’ Acad. des Sc. Paris 28 (1860).

14

C. Delaunay. Mem. de l’ Acad. des Sc. Paris 29 (1867).

15

A. Deprit, J. Henrard, A. Rom. Astron. J. 75, 747 (1970).

16

A. Deprit. Science 168, 1569 (1970).

17

A. Deprit, J. Henrard, A. Rom. Astron. J. 76, 273 (1971).

18

P. J. Dolan, Jr., D. S. Melichian. Am. J. Phys. 66, 11 (1998).

19

S. P. Ferguson, T. C. Hales. arXiv:math.MG/ 9811072 (1998).

20

B. Fitelson. Mathematica Educ. Res. 7, n1, 17 (1998).

21

A. C. Fowler. Mathematical Models in the Applied Sciences, Cambridge University Press, Cambridge, 1997.

22

H. Fritsch, G. Fritsch. The Four-Color Theorem, Springer-Verlag, New York, 1998.

23

E. Gallopoulus, E. Houstis, J. R. Rice (eds.). Future Research Directions in Problem Solving Environments for Computational Science: Report of a Workshop on Research Directions in Integrating Numerical Analysis, Symbolic Computing, Computational Geometry, and Artificial Intelligence for Computational Science, 1991. http://www.cs.purdue.edu/research/cse/publications/tr/92/92-032.ps.gz

24

V. Gerdt, S. A. Gogilidze in V. G. Ganzha, E. W. Mayr, E. V. Vorozhtsov (eds.). Computer Algebra in Scientific Computing, Springer-Verlag, Berlin, 1999.

25

M. C. Gutzwiller, D. S. Schmidt. Astronomical Papers: The Motion of the Moon as Computed by the Method of Hill, Brown, and Eckert, U.S. Government Printing Office, Washington, 1986.

26

M. C. Gutzwiller. Rev. Mod. Phys. 70, 589 (1998).

27

Y. Hagihara. Celestial Mechanics vII/1, MIT Press, Cambridge, 1972.

28

T. C. Hales. arXiv:math.MG/ 9811071 (1998).

29

T. C. Hales. arXiv:math.MG/ 9811073 (1998).

30

T. C. Hales. arXiv:math.MG/ 9811074 (1998).

31

T. C. Hales. arXiv:math.MG/ 9811075 (1998).

32

T. C. Hales. arXiv:math.MG/ 9811076 (1998).

33

T. C. Hales. arXiv:math.MG/ 9811077 (1998).

Preface

xiv 34

T. C. Hales. arXiv:math.MG/ 9811078 (1998).

35

T. C. Hales. arXiv:math.MG/0205208 (2002).

36

T. C. Hales in L. Tatsien (ed.). Proceedings of the International Congress of Mathematicians v. 3, Higher Education Press, Beijing, 2002.

37

J. Harrison. Theorem Proving with the Real Numbers, Springer-Verlag, London, 1998.

38

J. Hermes. Nachrichten Königl. Gesell. Wiss. Göttingen 170 (1894).

39 40

E. N. Houstis, J. R. Rice, E. Gallopoulos, R. Bramley (eds.). Enabling Technologies for Computational Science, Kluwer, Boston, 2000. E. N. Houstis, J. R. Rice. Math. Comput. Simul. 54, 243 (2000).

41

M. S. Klamkin (eds.). Mathematical Modelling, SIAM, Philadelphia, 1996.

42

H. Koch, A. Schenkel, P. Wittwer. SIAM Rev. 38, 565 (1996).

43

Y. N. Lakshman, B. Char, J. Johnson in O. Gloor (ed.). ISSAC 1998, ACM Press, New York, 1998.

44

W. McCune. Robbins Algebras Are Boolean, 1997. http://www.mcs.anl.gov/home/mccune/ar/robbins/

45

E. Mach (R. Wahsner, H.-H. von Borszeskowski eds.). Die Mechanik in ihrer Entwicklung, Akademie-Verlag, Berlin, 1988. D. A. MacKenzie. Mechanizing Proof: Computing, Risk, and Trust, MIT Press, Cambridge, 2001.

46 47

B. M. McCoy. arXiv:cond-mat/0012193 (2000).

48

K. J. M. Moriarty, G. Murdeshwar, S. Sanielevici. Comput. Phys. Commun. 77, 325 (1993).

49

I. Nemes, M. Petkovšek, H. S. Wilf, D. Zeilberger. Am. Math. Monthly 104, 505 (1997).

50

W. H. Press, S. A. Teukolsky. Comput. Phys. 11, 417 (1997).

51

D. Rawlings. Am. Math. Monthly 108, 713 (2001).

52

Problem Solving Environments Home Page. http://www.cs.purdue.edu/research/cse/pses

53 54

D. S. Schmidt in H. S. Dumas, K. R. Meyer, D. S. Schmidt (eds.). Hamiltonian Dynamical Systems, Springer-Verlag, New York, 1995. S. Seiden. SIGACT News 32, 111 (2001).

55

S. Seiden. Theor. Comput. Sc. 282, 381 (2002).

56

C. Simpson. arXiv:math.HO/0311260 (2003).

57

A. M. Stoneham. Phil. Trans. R. Soc. Lond. A 360, 1107 (2002).

58

M. Tegmark. Ann. Phys. 270, 1 (1999).

59

S. Wolfram. Mathematica: A System for Doing Mathematics by Computer, Addison-Wesley, Redwood City, 1992.

60

S. Wolfram. The Mathematica Book, Wolfram Media, Champaign, 2003.

Contents 0.

Introduction and Orientation

xix

CHAmR I

SymbolicComputations 1.0

Remarks

1

1.1

Introduction 1

1.2

Operations on Polynomials 13 1.2.0

Remarks 13

1.2.1

Structural Manipulations on Polynomials 13

1.2.2

Polynomials in Equations 25

1.2.3

Polynomials in Inequalities 50

1.3

Operations on Rational Functions 78

1.4

Operations on Trigonometric Expressions

1.5

Solution of Equations 94

1.6

Classical Analysis 129

1.7

1.6.1

Differentiation 129

1.6.2

Integration 156

1.6.3

Limits 184

1.6.4

Series Expansions 189

1.6.5

Residues 220

1.6.6

Sums 221

88

Differential and Difference Equations 233 1.7.0

Remarks 233

1.7.1

Ordinary Differential Equations 234

1.7.2

Partial Differential Equations 257

1.7.3

Difference Equations 260

1.8

Integral Transforms and Generalized Functions 266

1.9

Additional Symbolics Functions 294

xvi 1.10

Three Applications 298 1.10.0 Remarks 298 1.10.1

Area of a Random Triangle in a Square 298

1.10.2

2 cosH 257 L à la Gauss 312

1.10.3

Implicitization of a Trefoil Knot 321

p

ÅÅÅÅÅÅÅÅÅÅ

Exercises 330 Solutions 371 References 749

CHAPTER 2

Classical Orthogonal Polynomials 2.0

Remarks 803

2.1

General Properties of Orthogonal Polynomials 803

2.2

Hermite Polynomials 806

2.3

Jacobi Polynomials 816

2.4

Gegenbauer Polynomials 823

2.5

Laguerre Polynomials 832

2.6

Legendre Polynomials 842

2.7

Chebyshev Polynomials of the First Kind 849

2.8

Chebyshev Polynomials of the Second Kind 853

2.9

Relationships Among the Orthogonal Polynomials 860

2.10 Ground-State of the Quartic Oscillator 868 Exercises 885 Solutions 897 References 961

xvii

CHAPTER 3

Classical Special Functions 3.0

Remarks 979

3.1

Introduction 989

3.2

Gamma, Beta, and Polygamma Functions 1001

3.3

Error Functions and Fresnel Integrals 1008

3.4

Exponential Integral and Related Functions 1016

3.5

Bessel and Airy Functions 1019

3.6

Legendre Functions 1044

3.7

Hypergeometric Functions 1049

3.8

Elliptic Integrals 1062

3.9

Elliptic Functions 1071

3.10 Product Log Function 1081 3.11

Mathieu Functions 1086

3.12 Additional Special Functions 1109 3.13 Solution of Quintic Polynomials 1110 Exercises 1125 Solutions 1155 References 1393 Index 1431

Introduction and Orientation to The Mathematica GuideBooks 0.1 Overview 0.1.1 Content Summaries The Mathematica GuideBooks are published as four independent books: The Mathematica GuideBook to Programming, The Mathematica GuideBook to Graphics, The Mathematica GuideBook to Numerics, and The Mathematica GuideBook to Symbolics. † The Programming volume deals with the structure of Mathematica expressions and with Mathematica as a programming language. This volume includes the discussion of the hierarchical construction of all Mathematica objects out of symbolic expressions (all of the form head[argument]), the ultimate building blocks of expressions (numbers, symbols, and strings), the definition of functions, the application of rules, the recognition of patterns and their efficient application, the order of evaluation, program flows and program structure, the manipulation of lists (the universal container for Mathematica expressions of all kinds), as well as a number of topics specific to the Mathematica programming language. Various programming styles, especially Mathematica’ s powerful functional programming constructs, are covered in detail. † The Graphics volume deals with Mathematica’s two-dimensional (2D) and three-dimensional (3D) graphics. The chapters of this volume give a detailed treatment on how to create images from graphics primitives, such as points, lines, and polygons. This volume also covers graphically displaying functions given either analytically or in discrete form. A number of images from the Mathematica Graphics Gallery are also reconstructed. Also discussed is the generation of pleasing scientific visualizations of functions, formulas, and algorithms. A variety of such examples are given. † The Numerics volume deals with Mathematica’s numerical mathematics capabilities—the indispensable sledgehammer tools for dealing with virtually any “real life” problem. The arithmetic types (fast machine, exact integer and rational, verified high-precision, and interval arithmetic) are carefully analyzed. Fundamental numerical operations, such as compilation of programs, numerical Fourier transforms, minimization, numerical solution of equations, and ordinary/partial differential equations are analyzed in detail and are applied to a large number of examples in the main text and in the solutions to the exercises. † The Symbolics volume deals with Mathematica’s symbolic mathematical capabilities—the real heart of Mathematica and the ingredient of the Mathematica software system that makes it so unique and powerful. Structural and mathematical operations on systems of polynomials are fundamental to many symbolic calculations and are covered in detail. The solution of equations and differential equations, as well as the classical calculus operations, are exhaustively treated. In addition, this volume discusses and employs the classical

xx

Introduction

orthogonal polynomials and special functions of mathematical physics. To demonstrate the symbolic mathematics power, a variety of problems from mathematics and physics are discussed. The four GuideBooks contain about 25,000 Mathematica inputs, representing more than 75,000 lines of commented Mathematica code. (For the reader already familiar with Mathematica, here is a more precise measure: The LeafCount of all inputs would be about 900,000 when collected in a list.) The GuideBooks also have more than 4,000 graphics, 150 animations, 11,000 references, and 1,000 exercises. More than 10,000 hyperlinked index entries and hundreds of hyperlinks from the overview sections connect all parts in a convenient way. The evaluated notebooks of all four volumes have a cumulative file size of about 20 GB. Although these numbers may sound large, the Mathematica GuideBooks actually cover only a portion of Mathematica’s functionality and features and give only a glimpse into the possibilities Mathematica offers to generate graphics, solve problems, model systems, and discover new identities, relations, and algorithms. The Mathematica code is explained in detail throughout all chapters. More than 13,000 comments are scattered throughout all inputs and code fragments.

0.1.2 Relation of the Four Volumes The four volumes of the GuideBooks are basically independent, in the sense that readers familiar with Mathematica programming can read any of the other three volumes. But a solid working knowledge of the main topics discussed in The Mathematica GuideBook to Programming—symbolic expressions, pure functions, rules and replacements, and list manipulations—is required for the Graphics, Numerics, and Symbolics volumes. Compared to these three volumes, the Programming volume might appear to be a bit “dry”. But similar to learning a foreign language, before being rewarded with the beauty of novels or a poem, one has to sweat and study. The whole suite of graphical capabilities and all of the mathematical knowledge in Mathematica are accessed and applied through lists, patterns, rules, and pure functions, the material discussed in the Programming volume. Naturally, graphics are the center of attention of the The Mathematica GuideBook to Graphics. While in the Programming volume some plotting and graphics for visualization are used, graphics are not crucial for the Programming volume. The reader can safely skip the corresponding inputs to follow the main programming threads. The Numerics and Symbolics volumes, on the other hand, make heavy use of the graphics knowledge acquired in the Graphics volume. Hence, the prerequisites for the Numerics and Symbolics volumes are a good knowledge of Mathematica’s programming language and of its graphics system. The Programming volume contains only a few percent of all graphics, the Graphics volume contains about two-thirds, and the Numerics and Symbolics volume, about one-third of the overall 4,000+ graphics. The Programming and Graphics volumes use some mathematical commands, but they restrict the use to a relatively small number (especially Expand, Factor, Integrate, Solve). And the use of the function N for numerical ization is unavoidable for virtually any “real life” application of Mathematica. The last functions allow us to treat some mathematically not uninteresting examples in the Programming and Graphics volumes. In addition to putting these functions to work for nontrivial problems, a detailed discussion of the mathematics functions of Mathematica takes place exclusively in the Numerics and Symbolics volumes. The Programming and Graphics volumes contain a moderate amount of mathematics in the examples and exercises, and focus on programming and graphics issues. The Numerics and Symbolics volumes contain a substantially larger amount of mathematics. Although printed as four books, the fourteen individual chapters (six in the Programming volume, three in the Graphics volume, two in the Numerics volume, and three in the Symbolics volume) of the Mathematica GuideBooks form one organic whole, and the author recommends a strictly sequential reading, starting from Chapter 1 of the Programming volume and ending with Chapter 3 of the Symbolics volume for gaining the maximum

Introduction

xxi

benefit. The electronic component of each book contains the text and inputs from all the four GuideBooks, together with a comprehensive hyperlinked index. The four volumes refer frequently to one another.

0.1.3 Chapter Structure A rough outline of the content of a chapter is the following: † The main body discusses the Mathematica functions belonging to the chapter subject, as well their options and attributes. Generically, the author has attempted to introduce the functions in a “natural order”. But surely, one cannot be axiomatic with respect to the order. (Such an order of the functions is not unique, and the author intentionally has “spread out” the introduction of various Mathematica functions across the four volumes.) With the introduction of a function, some small examples of how to use the functions and comparisons of this function with related ones are given. These examples typically (with the exception of some visualizations in the Programming volume) incorporate functions already discussed. The last section of a chapter often gives a larger example that makes heavy use of the functions discussed in the chapter. † A programmatically constructed overview of each chapter functions follows. The functions listed in this section are hyperlinked to their attributes and options, as well as to the corresponding reference guide entries of The Mathematica Book. † A set of exercises and potential solutions follow. Because learning Mathematica through examples is very efficient, the proposed solutions are quite detailed and form up to 50% of the material of a chapter. † References end the chapter. Note that the first few chapters of the Programming volume deviate slightly from this structure. Chapter 1 of the Programming volume gives a general overview of the kind of problems dealt with in the four GuideBooks. The second, third, and fourth chapters of the Programming volume introduce the basics of programming in Mathematica. Starting with Chapters 5 of the Programming volume and throughout the Graphics, Numerics, and Symbolics volumes, the above-described structure applies. In the 14 chapters of the GuideBooks the author has chosen a “we” style for the discussions of how to proceed in constructing programs and carrying out calculations to include the reader intimately.

0.1.4 Code Presentation Style The typical style of a unit of the main part of a chapter is: Define a new function, discuss its arguments, options, and attributes, and then give examples of its usage. The examples are virtually always Mathematica inputs and outputs. The majority of inputs is in InputForm are the notebooks. On occasion StandardForm is also used. Although StandardForm mimics classical mathematics notation and makes short inputs more readable, for “program-like” inputs, InputForm is typically more readable and easier and more natural to align. For the outputs, StandardForm is used by default and occasionally the author has resorted to InputForm or FullForm to expose digits of numbers and to TraditionalForm for some formulas. Outputs are mostly not programs, but nearly always “results” (often mathematical expressions, formulas, identities, or lists of numbers rather than program constructs). The world of Mathematica users is divided into three groups, and each of them has a nearly religious opinion on how to format Mathematica code [1], [2]. The author follows the InputForm

xxii

Introduction

cult(ure) and hopes that the Mathematica users who do everything in either StandardForm or Traditional Form will bear with him. If the reader really wants to see all code in either StandardForm or Traditional Form, this can easily be done with the Convert To item from the Cell menu. (Note that the relation between InputForm and StandardForm is not symmetric. The InputForm cells of this book have been line-broken and aligned by hand. Transforming them into StandardForm or TraditionalForm cells works well because one typically does not line-break manually and align Mathematica code in these cell types. But converting StandardForm or TraditionalForm cells into InputForm cells results in much less pleasing results.) In the inputs, special typeset symbols for Mathematica functions are typically avoided because they are not monospaced. But the author does occasionally compromise and use Greek, script, Gothic, and doublestruck characters. In a book about a programming language, two other issues come always up: indentation and placement of the code. † The code of the GuideBooks is largely consistently formatted and indented. There are no strict guidelines or even rules on how to format and indent Mathematica code. The author hopes the reader will find the book’s formatting style readable. It is a compromise between readability (mental parsabililty) and space conservation, so that the printed version of the Mathematica GuideBook matches closely the electronic version. † Because of the large number of examples, a rather imposing amount of Mathematica code is presented. Should this code be present only on the disk, or also in the printed book? If it is in the printed book, should it be at the position where the code is used or at the end of the book in an appendix? Many authors of Mathematica articles and books have strong opinions on this subject. Because the main emphasis of the Mathematica GuideBooks is on solving problems with Mathematica and not on the actual problems, the GuideBooks give all of the code at the point where it is needed in the printed book, rather than “hiding” it in packages and appendices. In addition to being more straightforward to read and conveniently allowing us to refer to elements of the code pieces, this placement makes the correspondence between the printed book and the notebooks close to 1:1, and so working back and forth between the printed book and the notebooks is as straightforward as possible.

0.2 Requirements 0.2.1 Hardware and Software Throughout the GuideBooks, it is assumed that the reader has access to a computer running a current version of Mathematica (version 5.0/5.1 or newer). For readers without access to a licensed copy of Mathematica, it is possible to view all of the material on the disk using a trial version of Mathematica. (A trial version is downloadable from http://www.wolfram.com/products/mathematica/trial.cgi.) The files of the GuideBooks are relatively large, altogether more than 20 GB. This is also the amount of hard disk space needed to store uncompressed versions of the notebooks. To view the notebooks comfortably, the reader’s computer needs 128 MB RAM; to evaluate the evaluation units of the notebooks 1 GB RAM or more is recommended. In the GuideBooks, a large number of animations are generated. Although they need more memory than single pictures, they are easy to create, to animate, and to store on typical year-2005 hardware, and they provide a lot of joy.

Introduction

xxiii

0.2.2 Reader Prerequisites Although prior Mathematica knowledge is not needed to read The Mathematica GuideBook to Programming, it is assumed that the reader is familiar with basic actions in the Mathematica front end, including entering Greek characters using the keyboard, copying and pasting cells, and so on. Freely available tutorials on these (and other) subjects can be found at http://library.wolfram.com. For a complete understanding of most of the GuideBooks examples, it is desirable to have a background in mathematics, science, or engineering at about the bachelor’s level or above. Familiarity with mechanics and electrodynamics is assumed. Some examples and exercises are more specialized, for instance, from quantum mechanics, finite element analysis, statistical mechanics, solid state physics, number theory, and other areas. But the GuideBooks avoid very advanced (but tempting) topics such as renormalization groups [6], parquet approximations [27], and modular moonshines [14]. (Although Mathematica can deal with such topics, they do not fit the character of the Mathematica GuideBooks but rather the one of a Mathematica Topographical Atlas [a monumental work to be carried out by the Mathematica–Bourbakians of the 21st century]). Each scientific application discussed has a set of references. The references should easily give the reader both an overview of the subject and pointers to further references.

0.3 What the GuideBooks Are and What They Are Not 0.3.1 Doing Computer Mathematics As discussed in the Preface, the main goal of the GuideBooks is to demonstrate, showcase, teach, and exemplify scientific problem solving with Mathematica. An important step in achieving this goal is the discussion of Mathematica functions that allow readers to become fluent in programming when creating complicated graphics or solving scientific problems. This again means that the reader must become familiar with the most important programming, graphics, numerics, and symbolics functions, their arguments, options, attributes, and a few of their time and space complexities. And the reader must know which functions to use in each situation. The GuideBooks treat only aspects of Mathematica that are ultimately related to “doing mathematics”. This means that the GuideBooks focus on the functionalities of the kernel rather than on those of the front end. The knowledge required to use the front end to work with the notebooks can easily be gained by reading the corresponding chapters of the online documentation of Mathematica. Some of the subjects that are treated either lightly or not at all in the GuideBooks include the basic use of Mathematica (starting the program, features, and special properties of the notebook front end [16]), typesetting, the preparation of packages, external file operations, the communication of Mathematica with other programs via MathLink, special formatting and string manipulations, computer- and operating system-specific operations, audio generation, and commands available in various packages. “Packages” includes both, those distributed with Mathematica as well as those available from the Mathematica Information Center (http://library.wolfram.com/infocenter) and commercial sources, such as MathTensor for doing general relativity calculations (http://smc.vnet.net/MathTensor.html) or FeynCalc for doing high-energy physics calculations (http://www.feyncalc.org). This means, in particular, that probability and statistical calculations are barely touched on because most of the relevant commands are contained in the packages. The GuideBooks make little or no mention of the machine-dependent possibilities offered by the various Mathematica implementations. For this information, see the Mathematica documentation.

xxiv

Introduction

Mathematical and physical remarks introduce certain subjects and formulas to make the associated Mathematica implementations easier to understand. These remarks are not meant to provide a deep understanding of the (sometimes complicated) physical model or underlying mathematics; some of these remarks intentionally oversimplify matters. The reader should examine all Mathematica inputs and outputs carefully. Sometimes, the inputs and outputs illustrate little-known or seldom-used aspects of Mathematica commands. Moreover, for the efficient use of Mathematica, it is very important to understand the possibilities and limits of the built-in commands. Many commands in Mathematica allow different numbers of arguments. When a given command is called with fewer than the maximum number of arguments, an internal (or user-defined) default value is used for the missing arguments. For most of the commands, the maximum number of arguments and default values are discussed. When solving problems, the GuideBooks generically use a “straightforward” approach. This means they are not using particularly clever tricks to solve problems, but rather direct, possibly computationally more expensive, approaches. (From time to time, the GuideBooks even make use of a “brute force” approach.) The motivation is that when solving new “real life” problems a reader encounters in daily work, the “right mathematical trick” is seldom at hand. Nevertheless, the reader can more often than not rely on Mathematica being powerful enough to often succeed in using a straightforward approach. But attention is paid to Mathematica-specific issues to find time- and memory-efficient implementations—something that should be taken into account for any larger program. As already mentioned, all larger pieces of code in this book have comments explaining the individual steps carried out in the calculations. Many smaller pieces of code have comments when needed to expedite the understanding of how they work. This enables the reader to easily change and adapt the code pieces. Sometimes, when the translation from traditional mathematics into Mathematica is trivial, or when the author wants to emphasize certain aspects of the code, we let the code “speak for itself”. While paying attention to efficiency, the GuideBooks only occasionally go into the computational complexity ([8], [40], and [7]) of the given implementations. The implementation of very large, complicated suites of algorithms is not the purpose of the GuideBooks. The Mathematica packages included with Mathematica and the ones at MathSource (http://library.wolfram.com/database/MathSource ) offer a rich variety of self-study material on building large programs. Most general guidelines for writing code for scientific calculations (like descriptive variable names and modularity of code; see, e.g., [19] for a review) apply also to Mathematica programs. The programs given in a chapter typically make use of Mathematica functions discussed in earlier chapters. Using commands from later chapters would sometimes allow for more efficient techniques. Also, these programs emphasize the use of commands from the current chapter. So, for example, instead of list operation, from a complexity point of view, hashing techniques or tailored data structures might be preferable. All subsections and sections are “self-contained” (meaning that no other code than the one presented is needed to evaluate the subsections and sections). The price for this “self-containedness” is that from time to time some code has to be repeated (such as manipulating polygons or forming random permutations of lists) instead of delegating such programming constructs to a package. Because this repetition could be construed as boring, the author typically uses a slightly different implementation to achieve the same goal.

Introduction

xxv

0.3.2 Programming Paradigms In the GuideBooks, the author wants to show the reader that Mathematica supports various programming paradigms and also show that, depending on the problem under consideration and the goal (e.g., solution of a problem, test of an algorithm, development of a program), each style has its advantages and disadvantages. (For a general discussion concerning programming styles, see [3], [41], [23], [32], [15], and [9].) Mathematica supports a functional programming style. Thus, in addition to classical procedural programs (which are often less efficient and less elegant), programs using the functional style are also presented. In the first volume of the Mathematica GuideBooks, the programming style is usually dictated by the types of commands that have been discussed up to that point. A certain portion of the programs involve recursive, rule-based programming. The choice of programming style is, of course, partially (ultimately) a matter of personal preference. The GuideBooks’ main aim is to explain the operation, limits, and efficient application of the various Mathematica commands. For certain commands, this dictates a certain style of programming. However, the various programming styles, with their advantages and disadvantages, are not the main concern of the GuideBooks. In working with Mathematica, the reader is likely to use different programming styles depending if one wants a quick one-time calculation or a routine that will be used repeatedly. So, for a given implementation, the program structure may not always be the most elegant, fastest, or “prettiest”. The GuideBooks are not a substitute for the study of The Mathematica Book [45] http://documents. wolfram.com/mathematica). It is impossible to acquire a deeper (full) understanding of Mathematica without a thorough study of this book (reading it twice from the first to the last page is highly recommended). It defines the language and the spirit of Mathematica. The reader will probably from time to time need to refer to parts of it, because not all commands are discussed in the GuideBooks. However, the story of what can be done with Mathematica does not end with the examples shown in The Mathematica Book. The Mathematica GuideBooks go beyond The Mathematica Book. They present larger programs for solving various problems and creating complicated graphics. In addition, the GuideBooks discuss a number of commands that are not or are only fleetingly mentioned in the manual (e.g., some specialized methods of mathematical functions and functions from the Developer` and Experimental` contexts), but which the author deems important. In the notebooks, the author gives special emphasis to discussions, remarks, and applications relating to several commands that are typical for Mathematica but not for most other programming languages, e.g., Map, MapAt, MapIndexed, Distribute, Apply, Replace, ReplaceAll, Inner, Outer, Fold, Nest, Nest List, FixedPoint, FixedPointList, and Function. These commands allow to write exceptionally elegant, fast, and powerful programs. All of these commands are discussed in The Mathematica Book and others that deal with programming in Mathematica (e.g., [33], [34], and [42]). However, the author’s experience suggests that a deeper understanding of these commands and their optimal applications comes only after working with Mathematica in the solution of more complicated problems. Both the printed book and the electronic component contain material that is meant to teach in detail how to use Mathematica to solve problems, rather than to present the underlying details of the various scientific examples. It cannot be overemphasized that to master the use of Mathematica, its programming paradigms and individual functions, the reader must experiment; this is especially important, insightful, easily verifiable, and satisfying with graphics, which involve manipulating expressions, making small changes, and finding different approaches. Because the results can easily be visually checked, generating and modifying graphics is an ideal method to learn programming in Mathematica.

xxvi

Introduction

0.4 Exercises and Solutions 0.4.1 Exercises Each chapter includes a set of exercises and a detailed solution proposal for each exercise. When possible, all of the purely Mathematica-programming related exercises (these are most of the exercises of the Programming volume) should be solved by every reader. The exercises coming from mathematics, physics, and engineering should be solved according to the reader’s interest. The most important Mathematica functions needed to solve a given problem are generally those of the associated chapter. For a rough orientation about the content of an exercise, the subject is included in its title. The relative degree of difficulty is indicated by level superscript of the exercise number ( L1 indicates easy, L2 indicates medium, and L3 indicates difficult). The author’s aim was to present understandable interesting examples that illustrate the Mathematica material discussed in the corresponding chapter. Some exercises were inspired by recent research problems; the references given allow the interested reader to dig deeper into the subject. The exercises are intentionally not hyperlinked to the corresponding solution. The independent solving of the exercises is an important part of learning Mathematica.

0.4.2 Solutions The GuideBooks contain solutions to each of the more than 1,000 exercises. Many of the techniques used in the solutions are not just one-line calls to built-in functions. It might well be that with further enhancements, a future version of Mathematica might be able to solve the problem more directly. (But due to different forms of some results returned by Mathematica, some problems might also become more challenging.) The author encourages the reader to try to find shorter, more clever, faster (in terms of runtime as well complexity), more general, and more elegant solutions. Doing various calculations is the most effective way to learn Mathematica. A proper Mathematica implementation of a function that solves a given problem often contains many different elements. The function(s) should have sensibly named and sensibly behaving options; for various (machine numeric, high-precision numeric, symbolic) inputs different steps might be required; shielding against inappropriate input might be needed; different parameter values might require different solution strategies and algorithms, helpful error and warning messages should be available. The returned data structure should be intuitive and easy to reuse; to achieve a good computational complexity, nontrivial data structures might be needed, etc. Most of the solutions do not deal with all of these issues, but only with selected ones and thereby leave plenty of room for more detailed treatments; as far as limit, boundary, and degenerate cases are concerned, they represent an outline of how to tackle the problem. Although the solutions do their job in general, they often allow considerable refinement and extension by the reader. The reader should consider the given solution to a given exercise as a proposal; quite different approaches are often possible and sometimes even more efficient. The routines presented in the solutions are not the most general possible, because to make them foolproof for every possible input (sensible and nonsensical, evaluated and unevaluated, numerical and symbolical), the books would have had to go considerably beyond the mathematical and physical framework of the GuideBooks. In addition, few warnings are implemented for improper or improperly used arguments. The graphics provided in the solutions are mostly subject to a long list of refinements. Although the solutions do work, they are often sketchy and can be considerably refined and extended by the reader. This also means that the provided solutions to the exercises programs are not always very suitable for

Introduction

xxvii

solving larger classes of problems. To increase their applicability would require considerably more code. Thus, it is not guaranteed that given routines will work correctly on related problems. To guarantee this generality and scalability, one would have to protect the variables better, implement formulas for more general or specialized cases, write functions to accept different numbers of variables, add type-checking and error-checking functions, and include corresponding error messages and warnings. To simplify working through the solutions, the various steps of the solution are commented and are not always packed in a Module or Block. In general, only functions that are used later are packed. For longer calculations, such as those in some of the exercises, this was not feasible and intended. The arguments of the functions are not always checked for their appropriateness as is desirable for robust code. But, this makes it easier for the user to test and modify the code.

0.5 The Books Versus the Electronic Components 0.5.1 Working with the Notebooks Each volume of the GuideBooks comes with a multiplatform DVD, containing fourteen main notebooks tailored for Mathematica 4 and compatible with Mathematica 5. Each notebook corresponds to a chapter from the printed books. (To avoid large file sizes of the notebooks, all animations are located in the Animations directory and not directly in the chapter notebooks.) The chapters (and so the corresponding notebooks) contain a detailed description and explanation of the Mathematica commands needed and used in applications of Mathematica to the sciences. Discussions on Mathematica functions are supplemented by a variety of mathematics, physics, and graphics examples. The notebooks also contain complete solutions to all exercises. Forming an electronic book, the notebooks also contain all text, as well as fully typeset formulas, and reader-editable and reader-changeable input. (Readers can copy, paste, and use the inputs in their notebooks.) In addition to the chapter notebooks, the DVD also includes a navigation palette and fully hyperlinked table of contents and index notebooks. The Mathematica notebooks corresponding to the printed book are fully evaluated. The evaluated chapter notebooks also come with hyperlinked overviews; these overviews are not in the printed book. When reading the printed books, it might seem that some parts are longer than needed. The reader should keep in mind that the primary tool for working with the Mathematica kernel are Mathematica notebooks and that on a computer screen and there “length does not matter much”. The GuideBooks are basically a printout of the notebooks, which makes going back and forth between the printed books and the notebooks very easy. The GuideBooks give large examples to encourage the reader to investigate various Mathematica functions and to become familiar with Mathematica as a system for doing mathematics, as well as a programming language. Investigating Mathematica in the accompanying notebooks is the best way to learn its details. To start viewing the notebooks, open the table of contents notebook TableOfContents.nb. Mathematica notebooks can contain hyperlinks, and all entries of the table of contents are hyperlinked. Navigating through one of the chapters is convenient when done using the navigator palette GuideBooksNavigator.nb. When opening a notebook, the front end minimizes the amount of memory needed to display the notebook by loading it incrementally. Depending on the reader’s hardware, this might result in a slow scrolling speed. Clicking the “Load notebook cache” button of the GuideBooksNavigator palette speeds this up by loading the complete notebook into the front end. For the vast majority of sections, subsections, and solutions of the exercises, the reader can just select such a structural unit and evaluate it (at once) on a year-2005 computer (¥512 MB RAM) typically in a matter of

xxviii

Introduction

minutes. Some sections and solutions containing many graphics may need hours of computation time. Also, more than 50 pieces of code run hours, even days. The inputs that are very memory intensive or produce large outputs and graphics are in inactive cells which can be activated by clicking the adjacent button. Because of potentially overlapping variable names between various sections and subsections, the author advises the reader not to evaluate an entire chapter at once. Each smallest self-contained structural unit (a subsection, a section without subsections, or an exercise) should be evaluated within one Mathematica session starting with a freshly started kernel. At the end of each unit is an input cell. After evaluating all input cells of a unit in consecutive order, the input of this cell generates a short summary about the entire Mathematica session. It lists the number of evaluated inputs, the kernel CPU time, the wall clock time, and the maximal memory used to evaluate the inputs (excluding the resources needed to evaluate the Program cells). These numbers serve as a guide for the reader about the to-be-expected running times and memory needs. These numbers can deviate from run to run. The wall clock time can be substantially larger than the CPU time due to other processes running on the same computer and due to time needed to render graphics. The data shown in the evaluated notebooks came from a 2.5 GHz Linux computer. The CPU times are generically proportional to the computer clock speed, but can deviate within a small factor from operating system to operating system. In rare, randomly occurring cases slower computers can achieve smaller CPU and wall clock times than faster computers, due to internal time-constrained simplification processes in various symbolic mathematics functions (such as Integrate, Sum, DSolve, …). The Overview Section of the chapters is set up for a front end and kernel running on the same computer and having access to the same file system. When using a remote kernel, the directory specification for the package Overview.m must be changed accordingly. References can be conveniently extracted from the main text by selecting the cell(s) that refer to them (or parts of a cell) and then clicking the “Extract References” button. A new notebook with the extracted references will then appear. The notebooks contain color graphics. (To rerender the pictures with a greater color depth or at a larger size, choose Rerender Graphics from the Cell menu.) With some of the colors used, black-and-white printouts occasionally give low-contrast results. For better black-and-white printouts of these graphics, the author recommends setting the ColorOutput option of the relevant graphics function to GrayLevel. The notebooks with animations (in the printed book, animations are typically printed as an array of about 10 to 20 individual graphics) typically contain between 60 and 120 frames. Rerunning the corresponding code with a large number of frames will allow the reader to generate smoother and longer-running animations. Because many cell styles used in the notebooks are unique to the GuideBooks, when copying expressions and cells from the GuideBooks notebooks to other notebooks, one should first attach the style sheet notebook GuideBooksStylesheet.nb to the destination notebook, or define the needed styles in the style sheet of the destination notebook.

Introduction

xxix

0.5.2 Reproducibility of the Results The 14 chapter notebooks contained in the electronic version of the GuideBooks were run mostly with Mathematica 5.1 on a 2 GHz Intel Linux computer with 2 GB RAM. They need more than 100 hours of evaluation time. (This does not include the evaluation of the currently unevaluatable parts of code after the Make Input buttons.) For most subsections and sections, 512 MB RAM are recommended for a fast and smooth evaluation “at once” (meaning the reader can select the section or subsection, and evaluate all inputs without running out of memory or clearing variables) and the rendering of the generated graphic in the front end. Some subsections and sections need more memory when run. To reduce these memory requirements, the author recommends restarting the Mathematica kernel inside these subsections and sections, evaluating the necessary definitions, and then continuing. This will allow the reader to evaluate all inputs. In general, regardless of the computer, with the same version of Mathematica, the reader should get the same results as shown in the notebooks. (The author has tested the code on Sun and Intel-based Linux computers, but this does not mean that some code might not run as displayed (because of different configurations, stack size settings, etc., but the disclaimer from the Preface applies everywhere). If an input does not work on a particular machine, please inform the author. Some deviations from the results given may appear because of the following: † Inputs involving the function Random[…] in some form. (Often SeedRandom to allow for some kind of reproducibility and randomness at the same time is employed.) † Mathematica commands operating on the file system of the computer, or make use of the type of computer (such inputs need to be edited using the appropriate directory specifications). † Calculations showing some of the differences of floating-point numbers and the machine-dependent representation of these on various computers. † Pictures using various fonts and sizes because of their availability (or lack thereof) and shape on different computers. † Calculations involving Timing because of different clock speeds, architectures, operating systems, and libraries. † Formats of results depending on the actual window width and default font size. (Often, the corresponding inputs will contain Short.) Using anything other than Mathematica Version 5.1 might also result in different outputs. Examples of results that change form, but are all mathematically correct and equivalent, are the parameter variables used in underdetermined systems of linear equations, the form of the results of an integral, and the internal form of functions like InterpolatingFunction and CompiledFunction. Some inputs might no longer evaluate the same way because functions from a package were used and these functions are potentially built-in functions in a later Mathematica version. Mathematica is a very large and complicated program that is constantly updated and improved. Some of these changes might be design changes, superseded functionality, or potentially regressions, and as a result, some of the inputs might not work at all or give unexpected results in future versions of Mathematica.

xxx

Introduction

0.5.3 Earlier Versions of the Notebooks The first printing of the Programming volume and the Graphics volumes of the Mathematica GuideBooks were published in October 2004. The electronic components of these two books contained the corresponding evaluated chapter notebooks as well as unevaluated versions of preversions of the notebooks belonging to the Numerics and Symbolics volumes. Similarly, the electronic components of the Numerics and Symbolics volume contain the corresponding evaluated chapter notebooks and unevaluated copies of the notebooks of the Programming and Graphics volumes. This allows the reader to follow cross-references and look up relevant concepts discussed in the other volumes. The author has tried to keep the notebooks of the GuideBooks as up-to-date as possible. (Meaning with respect to the efficient and appropriate use of the latest version of Mathematica, with respect to maintaining a list of references that contains new publications, and examples, and with respect to incorporating corrections to known problems, errors, and mistakes). As a result, the notebooks of all four volumes that come with later printings of the Programming and Graphics volumes, as well with the Numerics and Symbolics volumes will be different and supersede the earlier notebooks originally distributed with the Programming and Graphics volumes. The notebooks that come with the Numerics and Symbolics volumes are genuine Mathematica Version 5.1 notebooks. Because most advances in Mathematica Version 5 and 5.1 compared with Mathematica Version 4 occurred in functions carrying out numerical and symbolical calculations, the notebooks associated with Numerics and Symbolics volumes contain a substantial amount of changes and additions compared with their originally distributed version.

0.6 Style and Design Elements 0.6.1 Text and Code Formatting The GuideBooks are divided into chapters. Each chapter consists of several sections, which frequently are further subdivided into subsections. General remarks about a chapter or a section are presented in the sections and subsections numbered 0. (These remarks usually discuss the structure of the following section and give teasers about the usefulness of the functions to be discussed.) Also, sometimes these sections serve to refresh the discussion of some functions already introduced earlier. Following the style of The Mathematica Book [45], the GuideBooks use the following fonts: For the main text, Times; for Mathematica inputs and built-in Mathematica commands, Courier plain (like Plot); and for user-supplied arguments, Times italic (like userArgument1 ). Built-in Mathematica functions are introduced in the following style: MathematicaFunctionToBeIntroduced[typeIndicatingUserSuppliedArgument(s)] is a description of the built-in command MathematicaFunctionToBeIntroduced upon its first appearance. A definition of the command, along with its parameters is given. Here, typeIndicatingUserSuppliedArgument(s) is one (or more) user-supplied expression(s) and may be written in an abbreviated form or in a different way for emphasis.

The actual Mathematica inputs and outputs appear in the following manner (as mentioned above, virtually all inputs are given in InputForm).

Introduction

xxxi

(* A comment. It will be/is ignored as Mathematica input: Return only one of the solutions *) Last[Solve[{x^2 - y == 1, x - y^2 == 1}, {x, y}]]

When referring in text to variables of Mathematica inputs and outputs, the following convention is used: Fixed, nonpattern variables (including local variables) are printed in Courier plain (the equations solved above contained the variables x and y). User supplied arguments to built-in or defined functions with pattern variables are printed in Times italic. The next input defines a function generating a pair of polynomial equations in x and y. equationPair[x_, y_] := {x^2 - y == 1, x - y^2 == 1}

x and y are pattern variables (usimng the same letters, but a different font from the actual code fragments x_ and y_) that can stand for any argument. Here we call the function equationPair with the two arguments u + v and w - z. equationPair[u + v, w - z]

Occasionally, explanation about a mathematics or physics topic is given before the corresponding Mathematica implementation is discussed. These sections are marked as follows:

Mathematical Remark: Special Topic in Mathematics or Physics A short summary or review of mathematical or physical ideas necessary for the following example(s). 1

From time to time, Mathematica is used to analyze expressions, algorithms, etc. In some cases, results in the form of English sentences are produced programmatically. To differentiate such automatically generated text from the main text, in most instances such text is prefaced by “ë” (structurally the corresponding cells are of type "PrintText" versus "Text" for author-written cells). Code pieces that either run for quite long, or need a lot of memory, or are tangent to the current discussion are displayed in the following manner. Make Input

mathematicaCodeWhichEitherRunsVeryLongOrThatIsVeryMemoryIntensive OrThatProducesAVeryLargeGraphicOrThatIsASideTrackToTheSubjectUnder Discussion (* with some comments on how the code works *)

To run a code piece like this, click the Make Input button above it. This will generate the corresponding input cell that can be evaluated if the reader’s computer has the necessary resources. The reader is encouraged to add new inputs and annotations to the electronic notebooks. There are two styles for reader-added material: "ReaderInput" (a Mathematica input style and simultaneously the default style for a new cell) and "ReaderAnnotation" (a text-style cell type). They are primarily intended to be used in the Reading environment. These two styles are indented more than the default input and text cells, have a green left bar and a dingbat. To access the "ReaderInput" and "ReaderAnnotation" styles, press the system-dependent modifier key (such as Control or Command) and 9 and 7, respectively.

xxxii

Introduction

0.6.2 References Because the GuideBooks are concerned with the solution of mathematical and physical problems using Mathematica and are not mathematics or physics monographs, the author did not attempt to give complete references for each of the applications discussed [38], [20]. The references cited in the text pertain mainly to the applications under discussion. Most of the citations are from the more recent literature; references to older publications can be found in the cited ones. Frequently URLs for downloading relevant or interesting information are given. (The URL addresses worked at the time of printing and, hopefully, will be still active when the reader tries them.) References for Mathematica, for algorithms used in computer algebra, and for applications of computer algebra are collected in the Appendix A. The references are listed at the end of each chapter in alphabetical order. In the notebooks, the references are hyperlinked to all their occurrences in the main text. Multiple references for a subject are not cited in numerical order, but rather in the order of their importance, relevance, and suggested reading order for the implementation given. In a few cases (e.g., pure functions in Chapter 3, some matrix operations in Chapter 6), references to the mathematical background for some built-in commands are given—mainly for commands in which the mathematics required extends beyond the familiarity commonly exhibited by non-mathematicians. The GuideBooks do not discuss the algorithms underlying such complicated functions, but sometimes use Mathematica to “monitor” the algorithms. References of the form abbreviationOfAScientificField/yearMonthPreprintNumber (such as quant-ph/0012147) refer to the arXiv preprint server [43], [22], [30] at http://arXiv.org. When a paper appeared as a preprint and (later) in a journal, typically only the more accessible preprint reference is given. For the convenience of the reader, at the end of these references, there is a Get Preprint button. Click the button to display a palette notebook with hyperlinks to the corresponding preprint at the main preprint server and its mirror sites. (Some of the older journal articles can be downloaded free of charge from some of the digital mathematics library servers, such as http://gdz.sub.uni-goettingen.de, http://www.emis.de, http://www.numdam.org, and http://dieper.aib.unilinz.ac.at.) As much as available, recent journal articles are hyperlinked through their digital object identifiers (http://www.doi.org).

0.6.3 Variable Scoping, Input Numbering, and Warning Messages Some of the Mathematica inputs intentionally cause error messages, infinite loops, and so on, to illustrate the operation of a Mathematica command. These messages also arise in the user’s practical use of Mathematica. So, instead of presenting polished and perfected code, the author prefers to illustrate the potential problems and limitations associated with the use of Mathematica applied to “real life” problems. The one exception are the spelling warning messages General::spell and General::spell1 that would appear relatively frequently because “similar” names are used eventually. For easier and less defocused reading, these messages are turned off in the initialization cells. (When working with the notebooks, this means that the pop-up window asking the user “Do you want to automatically evaluate all the initialization cells in the notebook?” should be evaluated should always be answered with a “yes”.) For the vast majority of graphics presented, the picture is the focus, not the returned Mathematica expression representing the picture. That is why the Graphics and Graphics3D output is suppressed in most situations.

Introduction

xxxiii

To improve the code’s readability, no attempt has been made to protect all variables that are used in the various examples. This protection could be done with Clear, Remove, Block, Module, With, and others. Not protecting the variables allows the reader to modify, in a somewhat easier manner, the values and definitions of variables, and to see the effects of these changes. On the other hand, there may be some interference between variable names and values used in the notebooks and those that might be introduced when experimenting with the code. When readers examine some of the code on a computer, reevaluate sections, and sometimes perform subsidiary calculations, they may introduce variables that might interfere with ones from the GuideBooks. To partially avoid this problem, and for the reader’s convenience, sometimes Clear[sequenceOfVariables]and Remove[sequenceOfVariables] are sprinkled throughout the notebooks. This makes experimenting with these functions easier. The numbering of the Mathematica inputs and outputs typically does not contain all consecutive integers. Some pieces of Mathematica code consist of multiple inputs per cell; so, therefore, the line numbering is incremented by more than just 1. As mentioned, Mathematica should be restarted at every section, or subsection or solution of an exercise, to make sure that no variables with values get reused. The author also explicitly asks the reader to restart Mathematica at some special positions inside sections. This removes previously introduced variables, eliminates all existing contexts, and returns Mathematica to the typical initial configuration to ensure reproduction of the results and to avoid using too much memory inside one session.

0.6.4 Graphics In Mathematica 5.1, displayed graphics are side effects, not outputs. The actual output of an input producing a graphic is a single cell with the text Graphics or Graphics3D or GraphicsArray and so on. To save paper, these output cells have been deleted in the printed version of the GuideBooks. Most graphics use an appropriate number of plot points and polygons to show the relevant features and details. Changing the number of plot points and polygons to a higher value to obtain higher resolution graphics can be done by changing the corresponding inputs. The graphics of the printed book and the graphics in the notebooks are largely identical. Some printed book graphics use a different color scheme and different point sizes and line and edge thicknesses to enhance contrast and visibility. In addition, the font size has been reduced for the printed book in tick and axes labels. The graphics shown in the notebooks are PostScript graphics. This means they can be resized and rerendered without loss of quality. To reduce file sizes, the reader can convert them to bitmap graphics using the Cellö Convert ToöBitmap menu. The resulting bitmap graphics can no longer be resized or rerendered in the original resolution. To reduce file sizes of the main content notebooks, the animations of the GuideBooks are not part of the chapter notebooks. They are contained in a separate directory.

xxxiv

Introduction

0.6.5 Notations and Symbols The symbols used in typeset mathematical formulas are not uniform and unique throughout the GuideBooks. Various mathematical and physical quantities (such as normals, rotation matrices, and field strengths) are used repeatedly in this book. Frequently the same notation is used for them, but depending on the context, also different ones are used, e.g. sometimes bold is used for a vector (such as r) and sometimes an arrow (such as ”r). Matrices appear in bold or as doublestruck letters. Depending on the context and emphasis placed, different notations are used in display equations and in the Mathematica input form. For instance, for a time-dependent scalar quantity of one variable yHt; xL, we might use one of many patterns, such as ψ[t][x] (for emphasizing a parametric t-dependence) or ψ[t, x] (to treat t and x on an equal footing) or ψ[t, {x}] (to emphasize the one-dimensionality of the space variable x). Mathematical formulas use standard notation. To avoid confusion with Mathematica notations, the use of square brackets is minimized throughout. Following the conventions of mathematics notation, square brackets are used for three cases: a) Functionals, such as t @ f HtLD HwL for the Fourier transform of a function f HtL. b) Power series coefficients, @xk D H f HxLL denotes the coefficient of xk of the power series expansion of f HxL around x = 0. c) Closed intervals, like @a, bD (open intervals are denoted by Ha, bL). Grouping is exclusively done using parentheses. Upper-case double-struck letters denote domains of numbers,  for integers,  for nonnegative integers,  for rational numbers,  for reals, and  for complex numbers. Points in n (or n ) with explicitly given coordinates are indicated using curly braces 8c1 , …, cn = 0, 1/2 Floor[n](1 + Floor[n]), Sum[k, {k, 1, n}]] which would correspond to the result returned by Sum for an explicit (real) n. Variables that occur in inequalities will be considered as real-valued by many functions. For instance, for most functions a statement like z2 < -1 will not include parts of the imaginary axis of the z-plane. Many matrix operations, such as Cross[, ] and Det[] stay unevaluated for symbols  and . Obviously, here  and  are not assumed to be complex numbers. There are some more exceptions, and we will encounter them in the following discussions. Generically, the assumption that every variable is a complex one of finite size is very sensible. The complex numbers are an algebraically closed field and enable the inversion of polynomials and more complicated functions. Without using complex numbers, it would be, for instance, impossible to express the three real roots è!!!!!!!! of 5 x3 - 9 x2 + x + 1 = 0 in radicals without using -1 explicitly. (See below for a more detailed discussion of this case.) But in some instances one wants to make certain assumptions about the type of a variable, for example, when 2 ¶ one wants to express that the parameter g in Ÿ-¶ ei g x dx is real so that the integral exists. A few Mathematica functions, notably Simplify, Integrate, Refine, and Assuming have currently the notion of a variable “type”. We will discuss assumptions in Integrate in detail in Subsection 1.6.2. The function Simplify we discussed already in Section 3.5 of the Programming volume [1735], but not in its full generality. Because we will make use of it more frequently later, and because internally Simplify uses functions from all sections of this chapter, we will discuss all of its options now. Simplify[expression, assumptions, options] tries to simplify expression under the assumptions assumptions.

We start with the last arguments of Simplify, its options. In[1]:= Out[1]=

Options[Simplify] 8Assumptions  $Assumptions, ComplexityFunction → Automatic, TimeConstraint → 300, TransformationFunctions → Automatic, Trig → True
= 2][ψ][x_] :> D[[x] ψ[x], {x, n - 2}] // Simplify] 1    H2 ψ @D H3 @D  @D + 2 H3L @DL + ψ@D H4  @D2 + 7 @D  @D + H4L @DLL h6 + O@hD7 240

Series can work with exact and approximate coefficients. Series applies zero testing to the series coefficients and drops terms that are considered to be zero. Here are the first terms of a function with the neat property f H-1L HzL = - f HzL-1 . In[55]:=

Inv[z_] = 1 + Table[z^k, {k, 20}]. (* series coefficient *) { 0.11201933586799460636, 0.04013232971298552835, 0.05017599118780908587, 0.02331170198490686166, 0.04169759366964792265, 0.01434818305566120933, 0.04341898484131755962, 0.00427268422270174173, 0.05316437195644763211, -0.01227684573369744105, 0.07511431972356796605, -0.04373397070311347075, 0.12019355271066564345, -0.10687118497186786129, 0.21222687421724158176, -0.23683787138794410136, 0.40230256474819762393, -0.50866679958475735404, 0.80042942843989834362, 1.73706479076791285289};

Calculating f H-1 ê f HzLL yields z + OHzL20 .

1.6 Classical Analysis In[56]:= Out[56]=

197

Inv[-1/Inv[z]] + O[z]^21 z + 25.186282715164607 z20 + O@zD21

Calculating the same expression to polynomial and rational algebra we see that the coefficients of z j , j = 2, …, 19 are high-precision zeros that have been converted to exact zeros by Series. In[57]:= Out[57]=

In[58]:=

Out[60]=

Take[Expand[Inv[Normal[-1/Inv[z] + O[z]^21]]], 21] 0. × 10−19 + 1.00000000000000000 z + 0. × 10−18 z2 + 0. × 10−18 z3 + 0. × 10−18 z4 + 0. × 10−18 z5 + 0. × 10−17 z6 + 0. × 10−17 z7 + 0. × 10−17 z8 + 0. × 10−17 z9 + 0. × 10−17 z10 + 0. × 10−17 z11 + 0. × 10−17 z12 + 0. × 10−17 z13 + 0. × 10−17 z14 + 0. × 10−17 z15 + 0. × 10−16 z16 + 0. × 10−16 z17 + 0. × 10−16 z18 + 0. × 10−16 z19 + 25.186282715164607 z20 (* for comparison: make coefficients exact *) InvInf[z_] = SetPrecision[Inv[z], Infinity]; SetPrecision[Normal[InvInf[-1/InvInf[z]] + O[z]^21], 2] 6.1 × 10−20 + 1.0 z + 6.3 × 10−20 z2 + 3.7 × 10−21 z3 + 7.1 × 10−21 z4 − 1.1 × 10−20 z5 − 4.5 × 10−20 z6 − 2.4 × 10−21 z7 + 5.5 × 10−20 z8 − 1.1 × 10−19 z9 + 2.6 × 10−19 z10 − 1.7 × 10−19 z11 + 1.3 × 10−19 z12 − 1.3 × 10−19 z13 + 1.7 × 10−19 z14 − 2.0 × 10−19 z15 + 2.4 × 10−19 z16 − 4.1 × 10−19 z17 + 6.8 × 10−19 z18 − 9.5 × 10−19 z19 + 25. z20

Series can often be successfully used to calculate leading terms of very large, unexpanded polynomials. In the following input, we display the number of possibilities cHFL n to represent an integer n as a sum of Fibonacci numbers n = ⁄¶j=0 ¶ j F j where ¶ j is 0 or 1 [308], [1828], [558]. Using the obvious generating function for this problem, we obtain the following self-similar plot for cHFL n . (As we see from the following example, the function CoefficientList works not only for polynomials, but also for SeriesData.) In[61]:=

ListPlot[Rest[CoefficientList[Series[Product[1 + z^Fibonacci[k], {k, 21}] - 1, {z, 0, 10946}], z]]] 140 120 100 80 60 40 20 2000

4000

6000

8000

10000

Using symbolic exponents of another variable in addition to the explicit exponents allows obtaining the explicit form of the sums. Here are the 820 possibilities for representing the first 100 integers as sums of Fibonacci numbers calculated and some of them shown. In[62]:=

fibonacci01Partitions100 = MapIndexed[((* make equations *) Equal @@ Flatten[{#2[[1]], #1}])&, (* separate powers of ζ *) List @@@ Expand[Rest[CoefficientList[ Series[Product[1 + z^Fibonacci[k] ζ^Subscript[F, k], {k, 12}] - 1, {z, 0, 100}], z]]] /. (* powers to exponents *) ζ^e_. :> e];

In[63]:=

Short[fibonacci01Partitions100, 16] // TraditionalForm

Symbolic Computations

198 Out[63]//TraditionalForm=

81  F1  F2 , 2  F1 + F2  F3 , 3  F1 + F3  F2 + F3  F4 , 4  F1 + F2 + F3  F1 + F4  F2 + F4 , 5  F1 + F2 + F4  F3 + F4  F5 , 6  F1 + F3 + F4  F2 + F3 + F4  F1 + F5  F2 + F5 , á89à, 96  F1 + F2 + F3 + F4 + F5 + F6 + F8 + F10  F1 + F2 + F3 + F4 + F7 + F8 + F10  F1 + F2 + F5 + F7 + F8 + F10  F3 + F5 + F7 + F8 + F10  F1 + F2 + F3 + F4 + F9 + F10  F1 + F2 + F5 + F9 + F10  F3 + F5 + F9 + F10  F1 + F2 + F3 + F4 + F11  F1 + F2 + F5 + F11  F3 + F5 + F11 , 97  F1 + F3 + F5 + F7 + F8 + F10  F2 + F3 + F5 + F7 + F8 + F10  F4 + F5 + F7 + F8 + F10  F6 + F7 + F8 + F10  F1 + F3 + F5 + F9 + F10  F2 + F3 + F5 + F9 + F10  F4 + F5 + F9 + F10  F6 + F9 + F10  F1 + F3 + F5 + F11  F2 + F3 + F5 + F11  F4 + F5 + F11  F6 + F11 , 98  F1 + F2 + F3 + F5 + F7 + F8 + F10  F1 + F4 + F5 + F7 + F8 + F10  F2 + F4 + F5 + F7 + F8 + F10  F1 + F6 + F7 + F8 + F10  F2 + F6 + F7 + F8 + F10  F1 + F2 + F3 + F5 + F9 + F10  F1 + F4 + F5 + F9 + F10  F2 + F4 + F5 + F9 + F10  F1 + F6 + F9 + F10  F2 + F6 + F9 + F10  F1 + F2 + F3 + F5 + F11  F1 + F4 + F5 + F11  F2 + F4 + F5 + F11  F1 + F6 + F11  F2 + F6 + F11 , 99  F1 + F2 + F4 + F5 + F7 + F8 + F10  F3 + F4 + F5 + F7 + F8 + F10  F1 + F2 + F6 + F7 + F8 + F10  F3 + F6 + F7 + F8 + F10  F1 + F2 + F4 + F5 + F9 + F10  F3 + F4 + F5 + F9 + F10  F1 + F2 + F6 + F9 + F10  F3 + F6 + F9 + F10  F1 + F2 + F4 + F5 + F11  F3 + F4 + F5 + F11  F1 + F2 + F6 + F11  F3 + F6 + F11 , 100  F1 + F3 + F4 + F5 + F7 + F8 + F10  F2 + F3 + F4 + F5 + F7 + F8 + F10  F1 + F3 + F6 + F7 + F8 + F10  F2 + F3 + F6 + F7 + F8 + F10  F4 + F6 + F7 + F8 + F10  F1 + F3 + F4 + F5 + F9 + F10  F2 + F3 + F4 + F5 + F9 + F10  F1 + F3 + F6 + F9 + F10  F2 + F3 + F6 + F9 + F10  F4 + F6 + F9 + F10  F1 + F3 + F4 + F5 + F11  F2 + F3 + F4 + F5 + F11  F1 + F3 + F6 + F11  F2 + F3 + F6 + F11  F4 + F6 + F11
x EulerGamma 1 −   +  HEulerGamma + Log@4DL + 2 2 1 3 1 op 1  PolyGammaA0,  +  J−1 +  NE −  PolyGammaA0, 2 + 2 2 2 p+q 2

large o) *) large o) *)

1 oq  J−2 +  NE 2 p+q

Series[%, (* take many terms of the sum *) {o, Infinity, 0}] // Simplify[#, p > 0 && q > 0]& 1 4p 1 1  LogA  E + OA  E 2 q o

If a function of several variables is to be expanded around a point in multidimensional space, we can use the standard iterator notation. The computation proceeds from right to left. Series allows expanding with respect to two or more variables. The result is again a SeriesData object with further SeriesData in its third argument. In[67]:=

Series[Exp[x y], {x, 0, 2}, {y, 0, 2}] // InputForm

Out[67]//InputForm=

SeriesData[x, 0, {1, SeriesData[y, 0, {1}, 1, 3, 1], SeriesData[y, 0, {1/2}, 2, 3, 1]}, 0, 3, 1] In[68]:=

{% === Series[Series[Exp[x y], {y, 0, 2}], {x, 0, 2}], % === Series[Series[Exp[x y], {x, 0, 2}], {y, 0, 2}]}

1.6 Classical Analysis Out[68]=

199

8False, True
coeffs.Take[Table[(x - x0)^(e/den), {e, e1, e2, den}], Length[coeffs]]

In[72]:=

normal[sxy] - normal[syx] // Together

Out[72]=

0

Sometimes one wants a multivariate series expansion up to a given total degree. This can be conveniently done by using the univariate built-in Series command by homogenizing the expression. The following function dSeries shows this. In[73]:=

dSeries[f_, {vars_List, points_List, d_}] := Module[{τ}, (Normal[Series[f /. Thread[vars -> τ vars + points], {τ, 0, d}]] /. τ -> 1) + (* for correct form of the result *) O[Times @@ (vars - points)]^d]

Here is an example that shows dSeries in action. Because the argument of O has head Times, we cannot use the result directly for further manipulations. The built-in code for manipulating SeriesData-objects has no rules to deal with such terms. In[74]:= Out[74]=

dSeries[Sin[x] Cos[y] + Tan[z]^2 , {{x, y, z}, {X, Pi/2, 0}, 4}] 2 z4 1 1 Jz2 +  − x y Cos@XD +  x3 y Cos@XD +  x y3 Cos@XD − 3 6 6 4 1 1 π y Sin@XD +  x2 y Sin@XD +  y3 Sin@XDN + OAHx − XL I−  + yM zE 2 6 2

(For recovering the original function from the higher-order series terms, see [846].) One word of caution is in order when working with multivariate SeriesData objects. Because constants with respect to the expansion variable do not form SeriesData objects, some orders might become wrong. So it is recommended to ensure that each of the coefficients of the outer SeriesData object is itself a SeriesData object. Here is an example that demonstrates the difference. The first series does not contain a Series Data-object in the variable x. In[75]:= Out[75]=

{Series[1 + y, {x, 0, 4}, {y, 0, 4}] + x^2 y^2, Series[1 + y + x^2 y^2, {x, 0, 4}, {y, 0, 4}]} 81 + y + x2 y2 + O@yD5 , H1 + y + O@yD5 L + Hy2 + O@yD5 L x2 + O@xD5
Automatic, Frame -> True, PlotRange -> All, FrameLabel -> {"Re[z]", "Im[z]"}]

In[88]:=

seriesZerosGraphics[Exp[z], z, {35, 34}] 15 10

Im@zD

5 0 -5 -10 -15 -10

-5

0

5 10 Re@zD

15

20

The zeros of the scaled partial sums z Ø order z cluster asymptotically at the curve †z expH1 - zL§ = 1. In[89]:=

Module[{o = 60, z}, Show[{(* region Abs[z Exp[1 - z]] < 1 *) ContourPlot[Abs[(x + I y) Exp[1 - x - I y]] - 1, {x, -1, 1}, {y, -3/4, 3/4}, Contours -> {0}, PlotPoints -> 200, DisplayFunction -> Identity], (* zeros of the rescaled partial sums *) Graphics[Table[{Hue[0.8 n/o], Point[{Re[#], Im[#]}]& /@ N[z /. Solve[(Normal[Series[Exp[z], {z, 0, n}]] /. (* rescale *) z -> n z) == 0, z]]}, {n, o}]]}, AspectRatio -> Automatic, DisplayFunction -> $DisplayFunction]]

Symbolic Computations

202

0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -1

-0.5

0

0.5

1

Let us use seriesZerosGraphics to visualize the zeros of some more polynomials that arise from a series. For sinHzL, the zeros of the polynomials have to accumulate near the zeros of sinHzL at k p, k œ  [1765], [1775]. In[90]:=

seriesZerosGraphics[Sin[z], z, {40, 19}]

20

Im@zD

10 0 -10 -20 -15-10-5 0 5 10 15 Re@zD

The Taylor series expansion of H1 + zL1ê2 has the finite convergence radius 1. Now, the zeros accumulate at the boundary of convergence. In[91]:=

seriesZerosGraphics[Sqrt[1 + z], z, {35, 34}] 3 2

Im@zD

1 0 -1 -2 -3 -2

-1

0

1

2 Re@zD

3

4

5

The zeros of the partial sums of an asymptotic series (the series of the Gamma function at infinity) are shown. In[92]:=

Show[Graphics[Reverse[ MapIndexed[{PointSize[0.0006 #2[[1]]], Hue[(#2[[1]] - 1)/60], #1}&, Map[Point[{Re[#], Im[#]}]&, (z /. NSolve[# == 0, z])& /@ Rest[Table[Numerator @ Together @ Expand[Cancel[Normal[ (* the series; divide out Puiseux part *) Series[Gamma[z], {z, Infinity, k}]]/ (z^z Exp[-z] Sqrt[1/z] Sqrt[Pi/2])]], {k, 50}]], {-1}]]]], AspectRatio -> Automatic, Frame -> True, PlotRange -> All, FrameLabel -> {"Re[z]", "Im[z]"}]

1.6 Classical Analysis

203

2

Im@zD

1 0 -1 -2 -2

-1

0 Re@zD

1

2

Here are the zeros of the series of a truncated polynomial [1609]. In[93]:=

seriesZerosGraphics[(1 - z)^-50, z, {40, 19}] 0.2

Im@zD

0.1 0 -0.1 -0.2 -0.2

-0.1

0

0.1 Re@zD

0.2

0.3

Here are some more pictures of this kind. The next example shows the zeros of the partial sums of the divergent n ¶ ¶ series Ÿ0 e-t Ht z + 1L-1 dt ∂ ‚ J-1N n! zn . n=0

In[94]:= Out[94]= In[95]:=

Integrate[Normal[Series[Exp[-t]/(1 + x t), {x, 0, 9}]], {t, 0, Infinity}] 1 − x + 2 x2 − 6 x3 + 24 x4 − 120 x5 + 720 x6 − 5040 x7 + 40320 x8 − 362880 x9 seriesZerosGraphics[Sum[(-1)^n n! z^n, {n, 0, 40}], z, {30, 22}] 0.2

Im@zD

0.1 0 -0.1 -0.2 -0.2

-0.1

0 0.1 Re@zD

0.2

The last picture of this series shows the zeros of the partial sums of the series of the first seven derivatives of H1 - zL-1 . In[96]:=

Show[GraphicsArray[#]]& /@ Partition[ Table[seriesZerosGraphics[D[1/(1 - z), {z, n}], z, {30, 23}, DisplayFunction -> Identity], {n, 0, 7}], 4]

Symbolic Computations

204

Re@zD

Im z Re@zD

Re@zD

Re@zD

D @

Im z

D @

Im z

D @

Im z

D @

Re@zD

Im z

Re@zD

D @

Im z

D @

Im z

D @

Im z

D @

Re@zD

Re@zD

For the behavior of partial sums of other divergent series, see [486]. For mathematical details on the behavior of partial sum approximations of power series, see [1334], [557], [1773], [1774], and [218]. Let us use the Series command to build a more complicated series, a q-Taylor series [914], [587], [1094], [677], [962], [1682], [1453]. For any function f HxL analytic at x0 , the series n

dq f HxL H x, x0 ; qL fn HxL = „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅnÅ Å ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Hk !Lq dq x k =0

converges to f HxL as n Ø ¶ for all †q§ ∫ 1. Here Hk !Lq is the q-differential operator

= ¤nk=1 Hqk - 1L ê Hq - 1L, H x, a; qLn = ¤nk=-10 Hx - a qk L and dq

dq f H xL f H xL - f Hq xL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å . H1 - qL x dq x It is straightforward to implement the last definitions. In[97]:=

(* q-factorial function *) qFactorial[q_][n_] := Product[(q^k - 1)/(q - 1), {k, 1, n}]; qFactorial[q][0] = 1; (* q-differential operator; defined recursively *) qD[q_][f_, x_] := (f - (f /. x -> q x))/((1 - q) x); qD[q_][f_, {x_, 0 }] := f qD[q_][f_, {x_, 1 }] := qD[q][f, x] qD[q_][f_, {x_, n_}] := qD[q][f, {x, n}] = Together[qD[q][qD[q][f, {x, n - 1}], x]] (* q product *) qProduct[q_][n_, x_, a_] := Product[x - a q^k, {k, 0, n - 1}] (* q-Taylor series *) qTaylorSeries[q_][f_, {x_, x0_, n_}] := Sum[Together[qProduct[q][k, x, x0]/qFactorial[q][k]*

1.6 Classical Analysis

205

Here are the first two terms of the q-Taylor series expansion of an abstract function f HxL around x0 . In[110]:= Out[110]=

In[111]:= Out[111]=

qTaylorSeries[q][f[x], {x, x0, 2}] Hx − x0L Hf@x0D − f@q x0DL f@x0D −    − H−1 + qL x0 Hx − x0L H−x + q x0L Hq f@x0D − f@q x0D − q f@q x0D + f@q2 x0DL       H−1 + qL2 Hq + q2 L x02 Series[%, {q, 1, 1}] // Simplify 1 Jf@x0D +  Hx − x0L H2 f @x0D + Hx − x0L f @x0DLN + 2 1  Hx − x0L2 x0 fH3L @x0D Hq − 1L + O@q − 1D2 2

For x0 = 0, the q-Taylor series agrees with the ordinary Taylor series. In[112]:= Out[112]=

qTaylorSeries[q][Cos[x], {x, 0, 6}] x2 x4 x6 1 −  +  −  2 24 720

But for general q, the q-Taylor series is typically far more complicated. In[113]:= Out[113]=

qTaylorSeries[q][Cos[x], {x, 2Pi, 3}] H2 π − xL H−1 + Cos@2 π qDL 1 −    − 2 π H−1 + qL H2 π − xL H2 π q − xL H−q + Cos@2 π qD + q Cos@2 π qD − Cos@2 π q2 DL       − 4 π2 H−1 + qL2 Hq + q2 L HH2 π − xL H2 π q − xL H2 π q2 − xL H−q3 + q Cos@2 π qD + q2 Cos@2 π qD + q3 Cos@2 π qD − Cos@2 π q2 D − q Cos@2 π q2 D − 3

q2 Cos@2 π q2 D + Cos@2 π q3 DLL ë I8 π3 H−q + q2 L H1 + 2 q + 2 q2 + q3 LM

Similarly to the above investigations, we could visualize the behavior of the zeros of fn HxL. This time, we fix n and study the dependence on q. Here this is done for a simple polynomial x50 - 1 with x0 = 1, n = 25 and q varying between -1 and 1. In[114]:=

qft[x_] = qTaylorSeries[q][x^50 - 1, {x, 1, 25}];

In[115]:=

Show[Graphics[{PointSize[0.003], Table[{Hue[0.8 (q0 - 1)/2], Point[{Re[#], Im[#]}]& /@ Cases[NRoots[qft[x] == 0 /. q -> N[q0], x], _?NumberQ, {-1}]}, {q0, -1, 1, 2/501}]}], Frame -> True, PlotRange -> 3/2 {{-1, 1}, {-1, 1}}] 1.5 1 0.5 0 -0.5 -1

-1

-0.5

0

0.5

1

1.5

Here are three examples for the q-Taylor series of random polynomials. In[116]:=

Show[GraphicsArray[ (SeedRandom[#]; (* q-Taylor series *)

Symbolic Computations

206

qft[x_] = qTaylorSeries[q][(* random polynomial *) Sum[Random[Integer, 10 {-1, 1}] x^k, {k, 10}], {x, 1, 9}]; (* make graphics *) Graphics[{PointSize[0.003], Table[{Hue[0.8 (q0 - 1)/2], Point[{Re[#], Im[#]}]& /@ Cases[NRoots[qft[x] == 0 /. q -> N[Exp[I q0]], x], _?NumberQ, {-1}]}, {q0, -1, 1, 2/1001}]}, Frame -> True, PlotRange -> All, PlotRange -> 3/2 {{-1, 1}, {-1, 1}}, FrameTicks -> False])& /@ (* the seeds *) {51879769166741319900, 67570387056305739148}]]

Many operations that apply to “ordinary functions” can also be applied to series. These include, for example, D, Integrate, Plus, Times, Power, etc. The results are SeriesData-objects (this is similar to interval arithmetic, in which the result has the head Interval). We present a few examples. Here is the initial object. In[117]:= Out[117]=

ser = Series[Tan[Sin[x]] - Sin[Tan[x]], {x, 0, 10}] x7 29 x9  +  + O@xD11 30 756

Here is its derivative. In[118]:= Out[118]=

D[ser, x] 7 x6 29 x8  +  + O@xD10 30 84

This is its indefinite integral with respect to x. In[119]:= Out[119]=

Integrate[ser, x] 29 x10 x8  +  + O@xD12 240 7560

Here is an algebraic expression formed from it. In[120]:= Out[120]=

ser + 5 ser^2 + Sqrt[ser] 29 x7ê2 5 x7  x11ê2 +  + O@xD15ê2  ! +  $%%%%%%% è!!!!!! 252 6 30 30

In the next input ser is raised to its own power. In[121]:= Out[121]=

ser^ser Log@30D 7 Log@xD 29 29 Log@30D 29 Log@xD 1 + J−   +   N x7 + J  −   +   N x9 + O@xD11 30 30 756 756 108

If SeriesData-objects are used as arguments of functions, a new SeriesData-object that has the corresponding order is automatically formed.

1.6 Classical Analysis In[122]:= Out[122]= In[123]:= Out[123]=

207

Exp[ser] x7 29 x9 1 +  +  + O@xD11 30 756 AiryAi[ser] x7 29 x9 1 11 1 −     2 −  1  + O@xD 2ê3 1ê3 1ê3 Gamma@  D Gamma@   DL Gamma@   DL 30 H3 756 H3 3 3 3 3

However, for a function that is not explicitly defined, nothing happens. In[124]:= Out[124]=

f[ser] x7 29 x9 fA  +  + O@xD11 E 30 756

If two series expansions are such that all of their terms coincide up to a certain order, their difference may still not be 0. They could be series expansions of two distinct functions that just happen to agree up to that order. In[125]:= Out[125]= In[126]:= Out[126]=

s1 = Series[Sin[x], {x, 0, 3}] x3 x −  + O@xD4 6 s2 = s1; s1 - s2 O@xD4

One must be careful with the following subtractions of two SeriesData-objects. The following result is also not 0. (Because evaluation of the summands happens before the actual summation this is exactly the same input as the last one.) In[127]:= Out[127]=

s1 - s1 O@xD4

And the result of the following is not 1. In[128]:= Out[128]=

s1/s1 1 + O@xD3

This happens because Mathematica computes the two arguments before subtracting, and at the point when the subtraction takes place, it no longer knows anything about the previous equality of the two arguments. As a little application of Series, we will check the first few instances of the following neat identity [1841]. Let the (formal) series in x be f = 1 + a1 x + a2 x2 + ∫. Then the determinant of the matrix C with entries ci j = @xi D H f HxL j L is given by detHCL = anHn+1Lê2 . 1 In[129]:=

Out[129]=

With[{n = 7}, Module[{f = 1 + Sum[a[i] x^i, {i, n}] + O[x]^(n + 1)}, Table[Expand[Det[Table[If[i == 0, If[j == 0, 1, 0], SeriesCoefficient[f^i, j]], {i, 0, k}, {j, 0, k}]]], {k, 0, n}]]] 81, a@1D, a@1D3 , a@1D6 , a@1D10 , a@1D15 , a@1D21 , a@1D28
True, Axes -> False]]

200

300

400

Symbolic Computations

214

-3 -3.5 -4 -4.5 -5 -5.5 -6 0

2000

4000

6000

8000

10000

Next, we discuss a peculiarity of Solve. When applied with series (with the head SeriesData) as arguments in the Equal-objects of the first argument of Solve: Solve[series1 == series2 , {var1 , var2 , …, varn }] solves the equations resulting from comparing the coefficients in series1 and series2 for the variables vari . This allows the convenient solution of differential equations by assuming a power series expansion for the solution. We now look at an example involving the (nonlinear!) differential equation of a planar mathematical pendulum y££ HtL = sinHyHtLL. In[174]:= Out[174]= In[175]:= Out[175]=

ySeries = Sum[a[i] t^i, {i, 0, 6}] + O[t]^7 a@0D + a@1D t + a@2D t2 + a@3D t3 + a@4D t4 + a@5D t5 + a@6D t6 + O@tD7 ySeriesDiff = D[ySeries, {t, 2}] 2 a@2D + 6 a@3D t + 12 a@4D t2 + 20 a@5D t3 + 30 a@6D t4 + O@tD5

Now, we express the constants a[2] and a[3] in terms of a[0] and a[1] (which are to be determined by the initial conditions) using Solve. In[176]:= Out[176]=

Solve[ySeriesDiff == Sin[ySeries], {a[2], a[3], a[4], a[5], a[6]}] 1 99a@5D →  H−a@1D − a@1D3 Cos@a@0DD + 2 a@1D Cos@2 a@0DDL, 120 1 a@6D →  H−1 + a@1D4 − 11 a@1D2 Cos@a@0DD + 2 Cos@2 a@0DDL Sin@a@0DD, 720 1 a@4D →  H−2 a@1D2 Sin@a@0DD + Sin@2 a@0DDL, 48 1 1 a@3D →  a@1D Cos@a@0DD, a@2D →  Sin@a@0DD== 6 2

This leads us to the following solution for yHtL. In[177]:= Out[177]=

In[178]:= Out[179]=

ySeries /. % 1 9a@0D + a@1D t +  Sin@a@0DD t2 + 2 1 1  a@1D Cos@a@0DD t3 +  H−2 a@1D2 Sin@a@0DD + Sin@2 a@0DDL t4 + 6 48 1  H−a@1D − a@1D3 Cos@a@0DD + 2 a@1D Cos@2 a@0DDL t5 + 120 1  H−1 + a@1D4 − 11 a@1D2 Cos@a@0DD + 2 Cos@2 a@0DDL Sin@a@0DD t6 + O@tD7 = 720 (* quick check of the solution *) D[%%, {t, 2}] == Sin[%%] // Simplify True

Although Series alone can deal with Laurent and Puiseux series as well as Taylor series, this may not be the case when it is used in conjunction with Solve. In the following example, we expand y[x] and y''[x] in a series about x = 0, and compare the coefficients of the x j . Mathematica does not currently handle this kind of series in Solve. Here is the case of a pure Taylor series.

1.6 Classical Analysis In[180]:= Out[180]=

215

Solve[Series[y''[x] + y[x] + 2 + x^2, {x, 0, 4}] == 0, Table[Derivative[k][y][0], {k, 2, 6}]] 88y @0D → −2 − y@0D, yH3L @0D → −y @0D, yH4L @0D → y@0D, yH5L @0D → y @0D, yH6L @0D → −y@0D 5&)]], {50}]}], Frame -> True] 4

2

0

-2

-4

-4

-2

0

2

4

The specification of the functions in the second argument of DSolve is analogous to that for NDSolve; that is, if no argument is specified for the function to be found, DSolve returns a pure function (with the dummy

1.7 Differential and Difference Equations

235

variable typically being the independent variable from the input equations). Here this is demonstrated using the simple differential equation y≥ HxL = - yHxL [1199], [1863]. In[4]:= Out[4]=

y2 = DSolve[{y''[x] == -y[x], y[0] == 0}, y, x] 88y → Function@8x With[{ = c++, d = Exponent[p[C], C]}, [, d] /; True]] i j j j j j 99Q → FunctionA8k -f'[x] DiracDelta[x] /. DiracDelta[x] f_[x] :> f[0] DiracDelta[x] DiracDelta@xD

The solution of the initial value problem is obtained using the fundamental solution GHxL (Green’s function) [1704] for arbitrary initial values and adding the initial conditions yHnL H0L in the form ⁄nk=1 ∑k-1 GHxL ê ∑ xn yHn-kL H0L to the right-hand side as an inhomogeneous term. Here is a simple example—the differential equation y≥ HxL + yHxL = e-x with initial conditions yH0L = y0 and y£ H0L = y p . We use DSolve to solve the initial value problem. In[80]:=

Out[80]=

sol = DSolve[{y''[x] y[0] == Cos@xD −  + y0 Cos@xD + 2

+ y[x] == Exp[-x], y0, y'[0] == yp}, y[x], x][[1, 1, 2]] // Expand 1 Sin@xD 1  −x Cos@xD2 +  + yp Sin@xD +  −x Sin@xD2 2 2 2

This is a fundamental solution for this problem. In[81]:=

gf[x_] = Limit[DSolve[{y''[x] + y[x] == DiracDelta[x], (* right sided initial conditions; after δ kicked *)

Symbolic Computations

278

Out[81]=

y[∂] == 0, y'[∂] == 1}, y[x], x][[1, 1, 2]] /. DiracDelta[c_] Sin[c_] :> 0 // Simplify, ∂ -> 0, Direction -> -1] Sin@xD UnitStep@xD

Now, we use the fundamental solution to build the solution of the inhomogeneous equation and to fulfill the initial conditions. In[82]:=

Out[82]=

sol1 = Integrate[Expand[gf[x - ξ] Exp[-ξ]], {ξ, 0, Infinity}, GenerateConditions -> False] + (* the initial conditions as part of the inhomogeneous part *) (gf[x - ξ] yp /. ξ -> 0) + (D[gf[x - ξ], x] y0 /. ξ -> 0) /. DiracDelta[c_] Sin[c_] :> 0 1 y0 Cos@xD UnitStep@xD + yp Sin@xD UnitStep@xD +  H−x − Cos@xD + Sin@xDL UnitStep@xD 2

For x > 0 (the region under consideration), the solution so-obtained agrees with the one from DSolve. In[83]:= Out[83]=

Expand[sol - %] // Simplify[#, x > 0]& 0

Within the realm of distributions, differential equations get more solutions than just the classical ones. Let us look at the first-order differential equation x2 u£ HxL = 1. In[84]:=

ode = ξ^2 u'[ξ] - 1;

In the space of ordinary functions, we have the solution uHxL = c1 - 1 ê x. In[85]:= Out[85]=

DSolve[ode == 0, u[ξ], ξ] 1 99u@ξD → −  + C@1D== ξ

In the space of generalized functions we have the solution uGF HxL = c1 + c2 qHxL + c3 dHxL - 1 ê x. Let us check this. In[86]:= Out[86]=

uGF[ξ_] = c[1] + c[2] UnitStep[ξ] + c[3] DiracDelta[ξ] - 1/ξ 1 −  + c@1D + c@3D DiracDelta@ξD + c@2D UnitStep@ξD ξ

Directly substituting the solution into Mathematica does not give zero. In[87]:= Out[87]=

ξ^2 uGF'[ξ] - 1 // Expand ξ2 c@2D DiracDelta@ξD + ξ2 c@3D DiracDelta @ξD

Using Simplify, we can get zero. In[88]:= Out[88]=

Simplify[%] 0

To get the last zero, we have to add the two rules xn dHxL = 0 and xn dHnL HxL = H-1Ln n ! ê Hn - nL! dHn-nL HxL. In[89]:=

δSimplify[expr_, x_] := With[{rules = {x^n_. Derivative[ν_][DiracDelta][x] :> (-1)^n ν!/(ν - n)! Derivative[ν - n][DiracDelta][x], x^n_. DiracDelta[x] :> 0}}, FixedPoint[Expand[#] //. rules&, expr]]

Now it is straightforward to see that uGF HxL is indeed a solution of the differential equation x2 uHxL = 1. In[90]:= Out[90]=

δSimplify[%%, ξ] 0

1.8 Integral Transforms and Generalized Functions

279

No option of DSolve is currently available to generate solutions of differential equations that are distributions. Let us deal with a slightly more complicated example, the hypergeometric differential equation xH1 - xL y££ HxL + Hg - Ha + b + 1L xL y£ HxL - a b yHxL = 0. Classically, the solutions are hypergeometric functions (see Chapter 3). These become rational functions for integer parameters. Here is an example. In[91]:=

ode2F1[x_, y_, {α_, β_, γ_}] = x (1 - x) y''[x] + (γ - (α + β +1) x) y'[x] - α β y[x];

In[92]:=

With[{α = 12, β = 7, γ = 10}, DSolve[ode2F1[x, y, {α, β, γ}] == 0, y, x]] H28 + 3 x H7 + 2 xLL C@1D 99y → FunctionA8x= γ > β

Here is a distributional solution of our special case of the hypergeometric differential equation. In[95]:= Out[95]=

yGF[x, {12, 7, 10}] 1 1 DiracDeltaH6L @xD −  DiracDeltaH7L @xD +  DiracDeltaH8L @xD 2 12

Substituting this solution into the differential equation and applying our δSimplify shows that this is indeed a solution. In[96]:= Out[96]=

In[97]:= Out[97]=

With[{α = 12, β = 7, γ = 10, y = Function[x, Evaluate[%]]}, ode2F1[x, y, {α, β, γ}]] // Expand −84 DiracDeltaH6L @xD + 52 DiracDeltaH7L @xD − 20 x DiracDeltaH7L @xD − 12 DiracDeltaH8L @xD + 11 x DiracDeltaH8L @xD − 5 13 x2 DiracDeltaH8L @xD +  DiracDeltaH9L @xD −  x DiracDeltaH9L @xD + 6 6 1 1 1  x2 DiracDeltaH9L @xD +  x DiracDeltaH10L @xD −  x2 DiracDeltaH10L @xD 12 12 2 δSimplify[%, x] 0

For some more uses of series of Dirac d distributions, see [289], [1728], [969], [1729]; for a spectacular weak solution of the Euler PDEs, see [1615]; for distributional solutions of functional equations, see [454], [456], [1569], and [372]. As a little application of how to deal with the UnitStep and the DiracDelta function in Mathematica, let us check that yHx, tL = qH2 Hx - k tL g + pL qHp - 2 g Hx - k tLL cosd+1 Hg Hx - k tLL e Hk x-w tL is a “finite length solito-

Symbolic Computations

280

nic” solution (also called compacton [1509], [1093], [1165], [1360], [1475], [1166], [406], [1817], [560], [1818], [1873], [1819]) of the following nonlinear Schrödinger equation [300]: ∑yHx, tL 1 ∑2 yHx, tL 1 1 ∑ rHx, tL 2 Å ÅÅÅ Å i ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = - ÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅ Å x J ÅÅÅÅÅÅÅÅ Å ÅÅÅÅÅÅÅ Å ÅÅÅ Å ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ N yHx, tL ∑ x2 ∑t 2 8 rHx, tL ∑x êêêêêêêêêê where rHx, tL = yHx, tL yHx, tL, 0 < x < 1, d = x ê H1 - xL, and w = Hk 2 + g2 Hd + 1LL ê 2. (For arbitrarily narrow solitons, see [434].) Here, we implement the equations from above. In[98]:=

In[100]:=

δ = ξ/(1 - ξ); ω = 1/2 (k^2 + γ^2 (1 + δ)); Ω[ψ_] := Module[{ψc = ψ /. c_Complex :> Conjugate[c], ρ, j}, ρ = ψ ψc; ξ/8 (D[ρ, x]/ρ)^2]

Without the finite length restriction (the terms qH2 Hx - k tL g + pL qHp - 2 g Hx - k tLL in yHx, tL, it is straightforward that yHx, tL is a solution of the equation. In[101]:=

ψ[x_, t_] = Cos[γ (x - k t)]^(1 + δ) Exp[I (k x - ω t)];

In[102]:=

Factor[I D[ψ[x, t], t] + 1/2 D[ψ[x, t], {x, 2}] - Ω[ψ[x, t]] ψ[x, t]]

Out[102]=

0

Including the finite length condition makes things a bit more tricky. Here is the finite length solution. In[103]:=

ψ1[x_, t_] = ψ[x, t] UnitStep[2 γ (x - k t) + Pi] UnitStep[Pi - 2 γ (x - k t)];

Just plainly redoing the calculation above will not give the desired result. In[104]:= Out[104]=

Simplify[Factor[I D[ψ1[x, t], t] + 1/2 D[ψ1[x, t], {x, 2}] Ω[ψ1[x, t]] ψ[x, t]]] === 0 False

So let us do the calculation step by step. First, we form the first time derivative with respect to t. In[105]:= Out[105]=

D[ψ1[x, t], x] 1

2

2

ξ

ξ

 MMM  1−ξ 1−ξ 2  Ik x− 2 t Ik +γ I1+  γ Cos@H−k t + xL γD1+  DiracDelta@π + 2 H−k t + xL γD UnitStep@π − 2 H−k t + xL γD − 1

2 +γ2 I1+ ξ MMM 1−ξ

2  Ik x− 2 t Ik

ξ

 1−ξ γ Cos@H−k t + xL γD1+  DiracDelta@π − 2 H−k t + xL γD 1

2

2

ξ

ξ

 MMM  1−ξ 1−ξ UnitStep@π + 2 H−k t + xL γD +  Ik x− 2 t Ik +γ I1+  k Cos@H−k t + xL γD1+  UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γD − 1 ξ ξ 2 2 ξ  MMM  1−ξ 1−ξ  Ik x− 2 t Ik +γ I1+  γ J1 +  N Cos@H−k t + xL γD  Sin@H−k t + xL γD 1−ξ UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γD

We implement a generalization of x dHxL = 0 for the form f HtL dHgHtLL to simplify the expression above. In[106]:=

δrule = Times[factors__, DiracDelta[y_]] :> Module[{t0, factor1}, (* the t such that y vanishes *) t0 = t /. Solve[y == 0, t][[1]]; (* the value of factor at t0 *) factor1 = Times[factors] //. _UnitStep -> 1 /. t -> t0; (* the zero result *) 0 /; ((Together //@ factor1) /. 0^_ -> 0) === 0];

1.8 Integral Transforms and Generalized Functions

281

Applying δrule to the first time derivative gives a better result—no Dirac d functions appear anymore. In[107]:= Out[107]=

timeDeriv1 = Expand[D[ψ1[x, t], t]] /. δrule 1 ξ ξ 2 2 1  MMM 2  1−ξ 1−ξ −   Ik x− 2 t Ik +γ I1+  k Cos@H−k t + xL γD1+  2 UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γD − 1 ξ ξ 2 2 1  MMM 2  1−ξ 1−ξ γ Cos@H−k t + xL γD1+  UnitStep@π − 2 H−k t + xL γD   Ik x− 2 t Ik +γ I1+  2 1 ξ MMM 2 2 1 1−ξ UnitStep@π + 2 H−k t + xL γD −   J  Ik x− 2 t Ik +γ I1+  γ2 ξ 2 H1 − ξL ξ

 1−ξ UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γDN + Cos@H−k t + xL γD1+  1

2

2

ξ

ξ

 MMM  1−ξ 1−ξ k γ Cos@H−k t + xL γD  Sin@H−k t + xL γD  Ik x− 2 t Ik +γ I1+  UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γD + 1 ξ MMM ξ 2 2 1 1−ξ 1−ξ  J Ik x− 2 t Ik +γ I1+  k γ ξ Cos@H−k t + xL γD  Sin@H−k t + xL γD 1−ξ

UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γDN

In a similar way, we deal with the first and second space derivative. In[108]:= Out[108]=

spaceDeriv1 = Expand[D[ψ1[x, t], x]] /. δrule 1

2 +γ2 I1+ ξ MMM 1−ξ

 Ik x− 2 t Ik

ξ

 1−ξ k Cos@H−k t + xL γD1+  UnitStep@π − 2 H−k t + xL γD 1

2

2

ξ

ξ

 MMM  1−ξ 1−ξ UnitStep@π + 2 H−k t + xL γD −  Ik x− 2 t Ik +γ I1+  γ Cos@H−k t + xL γD  Sin@H−k t + xL γD UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γD − 1 ξ MMM ξ 2 2 1 1−ξ 1−ξ  J Ik x− 2 t Ik +γ I1+  γ ξ Cos@H−k t + xL γD  Sin@H−k t + xL γD 1−ξ

UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γDN In[109]:=

spaceDeriv2 = Expand[D[spaceDeriv1, x]] /. δrule;

The nonlinear term still needs to be dealt with. In[110]:=

Out[111]=

ψ1c = ψ1[x, t] /. c_Complex :> Conjugate[c]; ρ1 = ψ1[x, t] ψ1c 2ξ

 1−ξ Cos@H−k t + xL γD2+  UnitStep@π − 2 H−k t + xL γD2 UnitStep@π + 2 H−k t + xL γD2

The rule ruleθ simplifies powers of Heaviside distributions. In[112]:=

ruleθ = u_UnitStep^e_ :> u

Out[112]=

u_UnitStepe_  u

In[113]:=

ρ1 = ρ1 /. ruleθ

Out[113]=



 1−ξ Cos@H−k t + xL γD2+  UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γD

After carrying out the spatial differentiation, we again apply our rule δrule. In[114]:= Out[114]=

ρDeriv1 = Expand[D[ρ1, x]] /. δrule 2ξ

 1−ξ −2 γ Cos@H−k t + xL γD1+  Sin@H−k t + xL γD UnitStep@π − 2 H−k t + xL γD 2ξ 1  1−ξ UnitStep@π + 2 H−k t + xL γD −  J2 γ ξ Cos@H−k t + xL γD1+  1−ξ

Sin@H−k t + xL γD UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γDN

In the process of forming the expression 1 ê rHx, tL ∑ rHx, tL ê ∑ x, we must be especially careful. Formally, the terms qHp - 2 Hx - k tL gL qH2 Hx - k tL g + pL cancel because inside Times they are treated like a commutative, associative quantity.

Symbolic Computations

282 In[115]:= Out[115]=

ξ/8 (ρDeriv1/ρ1)^2 // Expand 1 γ2 ξ2 Tan@H−k t + xL γD2 γ2 ξ3 Tan@H−k t + xL γD2  γ2 ξ Tan@H−k t + xL γD2 +    +    2 1−ξ 2 H1 − ξL2

We restore the finite length conditions “by hand”. In[116]:= Out[116]=

Ω[ψ1] = % UnitStep[2 γ (x - k t) + Pi] UnitStep[Pi - 2 γ (x - k t)] γ2 ξ2 Tan@H−k t + xL γD2 γ2 ξ3 Tan@H−k t + xL γD2 z 1 i  j   +    y j γ2 ξ Tan@H−k t + xL γD2 +  z 1−ξ 2 H1 − ξL2 k2 { UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γD

Putting everything together, we arrive at the zero we were hoping for. This indeed shows that ψ1[x, t] describes a finite length soliton of the above nonlinear Schrödinger equation. In[117]:= Out[117]=

Factor[Expand[I timeDeriv1 + 1/2 spaceDeriv2 - Ω[ψ1] ψ1[x, t]] /. ruleθ] 0

Here is a space-time picture of the absolute value of the finite length soliton for certain parameters. It is really a localized, moving, shape-invariant solution of a nonlinear wave equation that is concentrated at every time on a compact space domain. For a fixed time (right graphic), one sees that the transition between the zero-elongation and the nonzero-elongation domain is smooth (which is needed to fulfill the second-order differential equation). In[118]:= Out[118]= In[119]:=

Ψ = With[{k = 2, γ = 1/2, ξ = 1/2}, Evaluate[ψ1[x, t]]] 2 9t 1  I− 4 +2 xM CosA  H−2 t + xLE UnitStep@π + 2 t − xD UnitStep@π − 2 t + xD 2

Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {(* 3D plot of the compacton *) Plot3D[Evaluate[Abs[Ψ]], {x, -12, 12}, {t, -4, 4}, Mesh -> False, PlotPoints -> 140, PlotRange -> All], (* plot of the compacton at a fixed time *) Plot[Evaluate[Abs[Ψ] /. t -> 2], {x, -0, 8}, PlotRange -> All, AspectRatio -> 1/3, Frame -> True, Axes -> False]}]]]

1 0.75 0.5 0.25 0 -10

4 2 0 -5

0

1 0.8 0.6 0.4 0.2 0

0

2

4

6

8

-2 5

10

-4

Until now, we encountered only one possibility that Mathematica would return a Dirac d function if we did not input one; this was by differentiation of the UnitStep function. More functions generate generalized functions, also in case one does not explicitly input the UnitStep or the DiracDelta distribution. The most important one is the Fourier transform [1387]. The Fourier transform t @ f HtLD HwL of a function f HtL is defined as ¶ t @ f HtLD HwL = H2 pL-1ê2 Ÿ-¶ ei w t f HtL dt [920]. (The square brackets in the traditional form notation t @ f HtLD HwL indicate the fact that the Fourier transform of f HtL is a linear functional of f HtL and a function of w.)

1.8 Integral Transforms and Generalized Functions

283

FourierTransform[f(t), t, ω] represents the Fourier transform of the function f HtL with respect to the variable t and the kernel ei w t .

Here is the Fourier transform of an “ordinary” function. In[120]:=

Clear[t, ω, x, y, s, Ω, a, b, term] FourierTransform[Exp[-x^2] x^3, x, y] y2

Out[121]=

− 4 y H−6 + y2 L −  è!!!!  8 2

The Fourier transformation is a linear operation. In[122]:= Out[122]=

FourierTransform[α Sin[x^2] + β Exp[-x^2], x, y] y2 1 è!!!! y2 y2  J 2 − 4 β + α CosA  E − α SinA  EN 2 4 4

Derivative operators transform under a Fourier transformation into multiplication operators. This property makes them useful for solving ordinary and partial differential equations [532], [750], [443], [183], [879]. In[123]:= Out[123]=

FourierTransform[y''[x], x, ξ] −ξ2 FourierTransform@y@xD, x, ξD

The Fourier transform of the function 1 is essentially a Dirac d distribution [257]. In[124]:= Out[124]=

FourierTransform[1, t, ω] è!!!!!!!! 2 π DiracDelta@ωD

The following Fourier transform of cosHtL and sinHtL too gives a result that contains Dirac d distribution. In[125]:= Out[125]=

FourierTransform[α Cos[t] + β Sin[t], t, ω] π π  α DiracDelta@−1 + ωD + $%%%%%%%  β DiracDelta@−1 + ωD + $%%%%%%% 2 2 π π  α DiracDelta@1 + ωD − $%%%%%%%  β DiracDelta@1 + ωD $%%%%%%% 2 2

Be aware that carrying out the “integral” (using Integrate) will not result in a Dirac d distribution. In[126]:=

Integrate[Exp[I k t] Exp[I ω t], {t, -Infinity, Infinity}, Assumptions -> Im[k] == 0]/(2 Pi) Integrate::idiv : Integral of  t Hk+ωL does not converge on 8−∞, ∞ (η[#][x]&)]], x, s]]], s, x] // Expand

Here are the first three partial sums of the hk HxL shown. In[197]:=

Out[198]=

yApproxList[x_] = Rest[FoldList[Plus, 0, Take[yApproxList[x], 3] x2 55 5 x2 x4 91,  + Cos@xD,  −  +  − 6 Cos@xD + 2 8 4 8

Table[η[k][x], {k, 0, 5}]]]; 1 1  x2 Cos@xD +  Cos@2 xD − 2 x Sin@xD= 2 8

We compare the approximate solutions with a high-precision numerical solution ndsol. The following graphics show, that with each hk HxL the solution becomes substantially better and the fifth approximation has an error less than 10-10 for 0 § x d 0.8. In[199]:=

(* high-precision numerical solution *) ndsol = NDSolve[{yN''[x] + a[x] yN'[x] + b[x] yN[x] == f[yN[x]], yN[0] == 1, yN'[0] == 0}, yN, {x, 0, 5/2}, WorkingPrecision -> 50, MaxSteps -> 10^5, PrecisionGoal -> 30, AccuracyGoal -> 30];

In[201]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity, (* order increases from red to blue *)  = Table[Hue[k/7], {k, 0, 5}]}, {(* absolute differences *) Plot[Evaluate[Join[yApproxList[x], yN[x] /. ndsol]], {x, 0, 5/2}, PlotRange -> All, PlotStyle -> Prepend[, GrayLevel[0]]], (* logarithms of the differences *) MapIndexed[(δN[#2[[1]]][x_?NumberQ] := Log[10, Abs[SetPrecision[#1, 60] - yN[SetPrecision[x, 60]] /. ndsol[[1]]]])&, yApproxList[x]]; (* show logarithms of the differences *) Plot[Evaluate[Table[δN[k][x], {k, 6}]], {x, 0, 5/2}, PlotRange -> {All, {-10, 2}}, PlotStyle -> ]}]]]

Symbolic Computations

294 7

2

6 0.5 5

1

1.5

2

2.5

-2

4

-4

3

-6

2

-8 0.5

1

1.5

2

2.5

-10

For the application of the Adomian decomposition to boundary value problems, see [455], [1816].

1.9 Additional Symbolics Functions Now, we are nearly at the end of our chapter about symbolic computations. Many features of Mathematica have been discussed, but as many have not been discussed. The next section will deal with some applications of the discussed functions. In addition to the functionality built into the Mathematica kernel, a number of important packages in the standard package directory of Mathematica are useful for symbolic calculations, and they enhance the power of the corresponding built-in functions and offer new functionality. In addition to Calculus`Limit`, Calculus`PDSolve1`, and Calculus`DSolve`, which were already mentioned above, the following packages are often very useful: Calculus`VectorAnalysis`, DiscreteMath` RSolve`, and Calculus`VariationalMethods` . The functions contained in these packages can be deduced immediately from their names. Because of space and time limitations, we look only briefly at what these packages can accomplish. The package Calculus`VariationalMethods` implements the calculation of variational derivatives of integrals and the associated Euler-Lagrange equation (for an introduction to variational calculations, see, e.g., [240], [664], or for somewhat more detail, see [439] and [1806]). In[1]:=

Needs["Calculus`VariationalMethods`"]

In[2]:=

?VariationalD VariationalD@f, u@xD, xD or VariationalD@f, u@x,y,...D, 8x,y,...= 0] 1 1+k  GammaA  E 2 2 sum = SymbolicSum`SymbolicSum[α^k (1 + k) Gamma[(1 + k)/2]/2, {k, 0, Infinity}, GenerateConditions -> False] − 12 12 è!!!! 1 1 1 1 y i "########### − 1 1 α α z j 2 J π − π −   +  α2 α − π "########   ErfiA"########   EN 2  α2 Gamma@0, −  1 j α2 α2 α2 2 D z j α z j   z     −   j −  z j 2 3 z α α 2 j z z j { k

Using the functions FullSimplify we can show that the sum and the integral are identical. (FullSim plify simplifies identities with special functions, we will discuss it in Chapter 3.) In[15]:= Out[15]=

FullSimplify[int - sum, α < 0] 0

Here is another example. We first sum a series [734] and then recover the nth term. In[16]:= Out[16]= In[17]:=

Sum[([x] - [y])^n/(x - y)^(n + 1) λ^n, {n, Infinity}] // Simplify λ H@xD − @yDL    Hx − yL Hx − y − λ @xD + λ @yDL SeriesTerm[%, {λ, 0, n}] // Simplify[#, n > 1]& n

Out[17]=

@xD−@yD I   M x−y   x−y

As a small application of the function SeriesTerm, we will prove the following identity (due to Ramanujan) about the Taylor series coefficients of three rational functions [856], [570]. 3

3

ij k ij 9 x2 + 53 x + 1 yzyz ij k ij -12 x2 - 26 x + 2 yzyz j@x D j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å zz + j@x D j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz = k x3 - 82 x2 - 82 x + 1 {{ k k x3 - 82 x2 - 82 x + 1 {{ k 3

ij k ij -10 x2 + 8 x + 2 yzyz j@x D j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz + H-1Lk k x3 - 82 x2 - 82 x + 1 {{ k Using the function Series, we can easily explicitly verify the identity for the first few coefficients. In[18]:=

Out[20]=

abc = {1 + 53 x + 9 x^2, 2 - 26 x - 12 x^2, 2 + 8 x - 10 x^2}/ (1 - 82 x - 82 x^2 + x^3); (#1 + #2 - #3)& @@@ Transpose[#[[3]]^3& /@ Series[abc, {x, 0, 12}]] 81, −1, 1, −1, 1, −1, 1, −1, 1, −1, 1, −1, 1
0]& H−1Lk

We end with another application of the series terms also due to Ramanujan: Calculating integrals through series ¶ terms. For a sufficiently nice function f HxL, the kth moment mk @ f HxLD =Ÿ0 xk f HxL dx can be calculated through k the analytic continuation of the series coefficient cHkL = @x D H f HxLL to negative integer k by mk = -H-1L-k k ! H-k - 1L! c-k-1 (Ramanujan’s master theorem [157]). Here is a simple example. In[23]:=

f[x_] = x^2 Exp[-x] Sin[x]^2;

In[24]:=

c[k_] = SeriesTerm[f[x], {x, 0, k}]; intc[k_] = k! (-1)^(-k - 1) (-k - 1)! c[-k - 1] 1 1  IH−1L−4−2 k I−1 + 5 2 H−3−kL Cos@H−3 − kL ArcTan@2DDM 2π H−1 − kL ! k ! Gamma@3 + kD Sin@H−3 − kL πDM

Out[25]=

This is the result of the direct integration. In[26]:= Out[26]=

intI[k_] = Integrate[x^k f[x], {x, 0, Infinity}, Assumptions -> k > 0] 3 k 1  I1 − 5− 2 − 2 Cos@H3 + kL ArcTan@2DDM Gamma@3 + kD 2

For negative integer k, intc[k] is indeterminate. For concrete k we could use Limit or Series to obtain a value. For generic k, we simplify first the Gamma functions using FullSimplify. In[27]:= Out[27]=

intI[k]/intc[k] // FullSimplify // Simplify[#, Element[k, Integers]]& 1

(For calculating series terms of arbitrary order, see [1040], [1041], and [1043].)

Symbolic Computations

298

1.10 Three Applications 1.10.0 Remarks In this section, we will discuss three larger calculations. Here, “larger” mainly refers to the necessary amount of operations to calculate the result and not so much to the number of lines of Mathematica programs to carry it out. The first two are “classical” problems. Historically, the first one was solved in an ingenious method. Here we will implement a straightforward calculation. Carrying out the calculation of an extension of the second one (cosH2 p ê 65537L) took more than 10 years at the end of the nineteenth century. The third problem is a natural continuation from the visualizations discussed in Section 3.3 of the Graphics volume [1736]. The code is adapted to Mathematica Version 5.1. As mentioned in the Introduction, later versions of Mathematica may allow for a shorter implementation and more efficient implementation.

1.10.1 Area of a Random Triangle in a Square In the middle of the last century, J. J. Sylvester proposed calculating the expectation value of the convex hull of n randomly chosen points in a plane square. For n = 1, the problem is trivial, and for n = 2, the question is relatively easy to answer. For n ¥ 3, the straightforward formulation of the problem turns out to be technically quite difficult because of the multiple integrals to be evaluated. In 1885, M. W. Crofton came up with an ingenious trick to solve special cases of this problem. (His formulae are today called Crofton’s theorem.) At the same time, he remarked: The intricacy and difficulty to be encountered in dealing with such multiple integrals and their limits is so great that little success could be expected in attacking such questions directly by this method [direct integration]; and most of what has been done in the matter consists in turning the difficulty by various considerations, and arriving at the result by evading or simplifying the integration. [1031] The general setting of the problem is to calculate the expectation value of the minHn - 1, dL-dimensional volume of the convex hull of n points in d dimensions, for instance, the volume of a random tetrahedron formed by four randomly chosen points in 3 . For details about what is known, the Crofton theorem and related matters, see [35], [262], [562], [263], [1217], [832], [1031], [1238], [277], and [1410]. For an ingenious elementary derivation for the n = 3 case, see [1596]; for a tetrahedron in a cube, see [1910]. For the case of a tetrahedron inside a tetrahedron, see [1196].) In this subsection, we will show that using the integration capabilities of Mathematica it is possible to tackle such problems directly—this means by carrying out the integrations. (This subsection is based on [1733].) In the following, let the plane polygon be a unit square. We will calculate the expectation value of the area of a random triangle within this unit square (by an affine coordinate transformation, the problem in an arbitrary convex quadrilateral can be reduced to this case). Here is a sketch of the situation. In[1]:=

With[{P1 = {0.2, 0.3}, P2 = {0.8, 0.2}, P3 = {0.4, 0.78}}, Show[Graphics[ {{Thickness[0.01], Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 0}}]}, {Thickness[0.002], Hue[0], Line[{P1, P2, P3, P1}]},

1.10 Three Applications

299

{Text["P1", {0.16, 0.26}], Text["P2", {0.84, 0.16}], Text["P3", {0.40, 0.82}]}}], AspectRatio -> Automatic]]

P3

P1 P2

Let 8x1, y1 a && b || a && c;

This is one of the resulting regions. In[7]:= Out[7]=

l1[[99]] 1 x1 −y1 + x2 y1 x1 − x2 + x2 y1 0 < x1 <  && 1 − x1 < y1 < 1 && x1 < x2 <  &&   < y2 <   && 2 y1 −1 + x1 x1 x1 − x2 + x2 y1 − x1 y2 x2 y1 − x3 y1 − x1 y2 + x3 y2    < x3 < 1 &&     < y3 < 1 y1 − y2 −x1 + x2

Because we want to integrate the area function over the regions, we will convert from xl < x < xu to 8xl , x, xu l, Direction -> -1]; (* the upper limit *) uValue = Limit[indefiniteIntegral, ξ -> u, Direction -> +1]; Factor[Together[uValue - lValue]]]

To speed up the indefinite integration and the calculation of the limits, we apply some transformation rules implemented in LogExpand to the expressions. LogExpand splits all Log[expr] into as many subparts as possible to simplify the integrands. Because we know that the integrals we are dealing with are real quantities, we do not have to worry about branch cut problems associated with the logarithm function, and so drop all imaginary parts at the end. In[16]:=

LogExpand[expr_] := PowerExpand //@ Together //@ expr

Now, we have all functions together and can actually carry out the integration. To get an idea about the form of the expressions appearing in the six integrations, let us have a look at the individual integration results of the first region. (The indefinite integrals are typically quite a bit larger than the definite ones, as shown in the following results.) This is the description of the first six-dimensional region. In[17]:= Out[17]=

regions[[1]] 1 −x1 + y1 x2 y1 99x1, 0,  =, 8y1, 0, x1 {Automatic, (# /. Log[x_] :> Log[2, x]/Log[2])&}]& @ (Re[Together[Plus @@ Apply[multiDimensionalIntegrate[area, ##]&, regions, {1}]]] // Timing) 11 91133.01 Second,  = 288

All p and logH2L terms cancelled, and we got (taking into account the triangles with negative orientation) for the expectation value, the simple result A = 11 ê 144. The degree of difficulty to do multidimensional integrals is often depending sensitively from the order of the integration. As a check of the last result and for comparison, we now first evaluate the three integrations over the yi and then the three integration over the xi . For this situation, we have only 62 six-dimensional regions. In[26]:=

cad2 = GenericCylindricalAlgebraicDecomposition[ signedTriangleArea && unitCube6D, {x1, x2, x3, y1, y2, y3}]; regions2 = Apply[List, Apply[{#3, #1, #5} &, cad2[[1]] //. a_ && (b_ || c_) :> a && b || a && c, {2}], {0, 2}];

Out[30]=

Length[regions2] 62

And doing the integrations and simplifying the result takes now only a few seconds. Again, we obtain the result 11/288. In[31]:=

Out[31]=

Simplify[Together[Re[Plus @@ Apply[multiDimensionalIntegrate[area, ##]&, regions2, {1}]]], TransformationFunctions -> {(# /. Log[k_Integer] :> (Plus @@ ((#2 Log[#1])& @@@ FactorInteger[k])))&}] // Timing 11 932.51 Second,  = 288

Symbolic Computations

304

Using numerical integration, we can calculate an approximative value of this integral to support the result 11 ê 144. In[32]:=

Out[32]=

(SeedRandom[111]; NIntegrate[Evaluate[Abs[area]], {x1, 0, 1}, {y1, 0, 1}, {x2, 0, 1}, {y2, 0, 1}, {x3, 0, 1}, {y3, 0, 1}, Method -> QuasiMonteCarlo, MaxPoints -> 10^6, PrecisionGoal -> 3]) 0.0763889

This result confirms the above result. In[33]:= Out[33]=

N[2 %%[[2]]] 0.0763889

We could now go on and calculate the probability distribution for the areas. The six-dimensional integral to be calculated is now 1

1

1

1

1

1

pHAL ~ ‡ ‡ ‡ ‡ ‡ ‡ dHA - H x1 , x2 , x3 , y1 , y2 , y3 LL d y3 dx3 d y2 dx2 d y1 dx1 , 0

0

0

0

0

0

H x1 , x2 , x3 , y1 , y2 , y3 L = †x3 y1 - x2 y1 + x1 y2 - x3 y2 + x2 y3 - x1 y3 §. (Here we temporarily changed A Ø 2 A so that all variables involved range over the interval @0, 1D. This time, before subdividing the integration variable space into subregions, we carry out the integral over y3 to eliminate the Dirac d function. To do this, we use the identity b

b

dHy - x0,k L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ dx ‡ dHy - f HxLL dx = ‡ ‚ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ † f £ Hx0,k L§ k a

a

where the x0,k are the zeros of f HxL in @a, bD. Expressing y3 through x1 , x2 , x3 , y1 , y2 , and A yields the following expression. In[34]:=

Out[34]=

soly3 = Solve[A == (* or - *) (-x2 y1 + x3 y1 + x1 y2 - x3 y2 x1 y3 + x2 y3), y3][[1, 1, 2]] −A − x2 y1 + x3 y1 + x1 y2 − x3 y2    x1 − x2

And the derivative from the denominator becomes †x1 - x2 §. In[35]:= Out[35]=

D[-x2 y1 + x3 y1 + x1 y2 - x3 y2 - x1 y3 + x2 y3, y3] −x1 + x2

Now is a good time to obtain a decomposition of the space into subregions. In addition to the constraints following from the geometric constraints of the integration variables being from the unit square, we add three more inequalities: 1) 0 < y3 H x1 , x2 , x3 , y1 , y2 ; AL < 1 to ensure the existence of a zero inside the Dirac d function argument; 2) A > 0 for positive oriented areas; and 3) x1 > x2 to avoid the absolute value in the denominator (the case x1 < x2 follows from symmetry). In[36]:=

cad = Experimental`GenericCylindricalAlgebraicDecomposition[ 0 < soly3 < 1 && A > 0 && x1 > (* or < *) x2 && 0 < x1 < 1 && 0 < x2 < 1 && 0 < x3 < 1 && 0 < y2 < 1 && 0 < y1 < 1, {A, x1, x2, x3, y1, y2}];

1.10 Three Applications

305

This time, we get a total of 1282 subregions. In[37]:= Out[37]=

(l1 = cad[[1]] //. a_ && (b_ || c_) :> (a && b) || (a && c)) // Length 1282

One expects the probability distribution pHAL to be a piecewise smooth function of l. Six l-interval arise naturally from the decomposition. In[38]:= Out[38]= In[39]:=

Union[First /@ l1] 1 1 1 1 1 1 1 1 1 1 0 < A <  »»  < A <  »»  < A <  »»  < A <  »»  < A <  »»  < A < 1 6 6 5 5 4 4 3 3 2 2 ASortedRegions = {#[[1, 1, 2]] < A < #[[1, 1, 3]] , Rest /@ #}& /@ Split[Sort[(# /. Inequality[a_, Less, b_, Less, c_] :> {b, a, c} /. And -> List)& /@ (List @@ l1)], #1[[1]] === #2[[1]]&];

Here is the number of regions for the six l-intervals. In[40]:= Out[40]=

{#1, Length[#2] "subregions"}& @@@ ASortedRegions 1 1 1 990 < A <  , 317 subregions=, 9  < A <  , 324 subregions=, 6 6 5 1 1 1 1 9  < A <  , 310 subregions=, 9  < A <  , 216 subregions=, 5 4 4 3 1 1 1 9  < A <  , 99 subregions=, 9  < A < 1, 16 subregions== 3 2 2

The regions themselves look quite similar to the above ones. In[41]:= Out[41]=

{#1, #2[[1]]}& @@@ ASortedRegions 1 990 < A <  , 98x1, 0, A 0

To calculate the sixfold integral, we will follow the already twice successfully-used strategy to first calculate a decomposition of the integration domain. Because of the obvious fourfold rotational symmetry of pHx, yL around the square center 81 ê 2, 1 ê 2 a && b || a && c;

In[59]:=

Length[l1]

Out[59]=

327

All cells span the specified x,y-domain. This means, the density pHx, yL is continuous within this domain. In[60]:= Out[60]=

Union[Take[#, 2]& /@ l1] 1 1  < x < 1 &&  < y < x 2 2

1.10 Three Applications

309

The cells of the 6D integration domain have similar-looking boundaries as the cells from the above calculations. In[61]:=

xyRegions = (# /. Inequality[a_, Less, b_, Less, c_] :> {b, a, c} /. And -> List)& /@ ((* remove x and y parts *) List @@ Drop[#, 2]& /@ l1);

In[62]:=

xyRegions[[1]] −x + y −x1 y + x2 y 99x1, 0,  =, 8x2, 0, x1 2/Pi // N[#, 10]& 80.13621111723 + 0. × 10−12 , 0.1362111172
pp], _Polygon, Infinity], {-2}]; Graphics3D[{EdgeForm[], (* generate seven other parts *) Map[(# + {1/2, 1/2, 0})&, {Apply[{#2, #1, #3}&, #, {-2}], #}&[

1.10 Three Applications

311

{Map[(# {-1, 1, 1})&, #, {-2}], #}&[ {Map[(# {1, -1, 1})&, #, {-2}], #}&[polys]]], {-2}]}, BoxRatios -> {1, 1, 1/2}, Axes -> True]], (* modeled probability *) Module[{d = 60, o = 10^4, data, if}, data = Compile[{}, Module[{T = Table[0, {d}, {d}], p1, p2, p3, xc, yc, mp, σ}, Do[{p1, p2, p3} = Table[Random[], {3}, {2}]; mp = (p1 + p2 + p3)/3; (* orientation of the normals *) σ = Sign[(Reverse[p2 - p1]{1, -1}).(mp - p1)]; (* are discretized square points inside triangle? *) Do[If[σ (Reverse[p2 - p1]{1, -1}).({x, y} - p1) > 0 && σ (Reverse[p3 - p2]{1, -1}).({x, y} - p2) > 0 && σ (Reverse[p1 - p3]{1, -1}).({x, y} - p3) > 0, (* increase counters *) {xc, yc} = Round[{x, y} (d - 1)] + 1; T[[xc, yc]] = T[[xc, yc]] + 1], {x, 0, 1, 1/(d - 1)}, {y, 0, 1, 1/(d - 1)}], {o}]; T]][]; (* interpolated scaled counts *) if = Interpolation[Flatten[MapIndexed[Flatten[ {(#2 - {1, 1})/(d - 1), #1}]&, data/o, {2}], 1]]; (* interpolated observed frequencies *) Plot3D[if[x, y], {x, 0, 1}, {y, 0, 1}, Mesh -> False]]}]]]

0.2

0.2 1

0.1

0.75

0 0

0.1 0 0

0.5 0.25

0.5

0.25 0.75 1

1 0.8 0.6 0.2

0.4 0.4

0.6

0

0.2 0.8 0 8

1

0

We end by integrating the calculated probability density pHx, yL over the unit square. pHx, yL is the probability that the point 8x, y< is inside a randomly chosen triangle. This means the average of pHx, yL is again the area of a randomly chosen triangle, namely 11 ê 144. In[76]:= Out[76]=

8 Integrate[p[x, y], {x, 1/2, 1}, {y, 1/2, x}] 11  144

For a similar probabilistic problem, the Heilbronn triangle problem, see [936].

Symbolic Computations

312

2p 1.10.2 cosI ÅÅÅÅ ÅÅÅ M à la Gauss 257 In the early morning of March 29 in 1796, Carl Friedrich Gauss (while still in bed) recognized how it is possible to construct a regular 17-gon by ruler and compass; or more arithmetically and less geometrically speaking, he 2p ÅÅÅÅ L in terms of square roots and the four basic arithmetic operations of addition, subtraction, expressed cosH ÅÅÅÅ 17 multiplication, and division only. (This discovery was the reason why he decided to become a mathematician j [1472], [704], [1792].) His method works immediately for all primes of the form 22 + 1, so-called Fermat numbers F j [1080]. For j = 0 to 4, we get the numbers 3, 5, 17, 257, and 65537. ( j = 5, …, 14 do not give primes; we return to this at the end of this section.) The problem to be solved is to express the roots of z p = 1, where p is a Fermat prime in square roots. One obvious solution of this equation is z = 1. After dividing z p = 1 by this solution, we get as the new equation to be solved: z p-1 + z p-2 + ∫ + z + 1 = 0. It can be shown that there are no further rational zeros; so this equation cannot be simplified further in an easy l2pi ÅÅÅÅÅÅ M, l integer, way. Let us denote (by following Gauss’s notation here and in the following) the solution expI ÅÅÅÅÅÅÅÅ p êê 1 § l § p - 1 of this equation by l (which is, of course, a solution, but which contains a pth root). Gauss’s idea, which solves the above equation exclusively in square roots, is to group the roots of the above equation in a recursive way such that the explicit values of the sums of these roots can be expressed in numbers and square roots. Each step then rearranges these roots until finally only groups of length two remain. These last groups are j 2p ÅÅÅÅÅ M. then just of the form cosI ÅÅÅÅÅÅÅÅ p Let us describe this idea in more detail. First, we need the number-theoretic notion of a primitive root: the number g is called a primitive root of p if the set of numbers 8gi mod p 0 have primitive roots; they have fHfHnLL different ones; fHnL is Euler’s totient function.) The order of the integers in Array[PowerMod[base, #, prime]&, p - 1, 0] exhibits some interesting symmetry, as can be visualized for the prime = 257 case with the following input. In[2]:=

primitiveRootsGraphics[b_] := Graphics[ {Thickness[0.002], Line[Append[#, First[#]]&[ (* connect numbers in their permuted order *) {Cos[#], Sin[#]}& /@ N[2Pi Array[ PowerMod[b, #, 257]&, 256, 0]/257]]]}, PlotRange -> All, AspectRatio -> Automatic]

In[3]:=

(* reduced residue system exists for the following 128 numbers *) rssNumbers = Flatten[Position[Table[Sort[Array[ PowerMod[i, #, 257]&, 256, 0]] == Range[256], {i, 256}], True]];

In[5]:=

(* visualizations of the powermod sequences *) Function[bs, Show[GraphicsArray[Function[b,

1.10 Three Applications

313

primitiveRootsGraphics[b]] /@ bs]]] /@ (* display nine examples *) Partition[rssNumbers[[{1, 2, 3, 33, 42, 43, 66, 106, 114}]], 3]

Make Input

Show[primitiveRootsGraphics[#]]& /@ rssNumbers

(For some interesting discussions about the number of crossings and the number of regions in such pictures, see [1428].) f

ó The next concept we need is that of the so-called periods. A period l to the primitive root g, containing the root êê l and having length f, is defined by the expression below. (The dependence on the fixed quantities p and g is suppressed.) f -1 êêêêêêêêêêêê f jHp-1L ó l = ‚ l g ÅÅÅÅÅÅÅÅÅÅÅÅf ÅÅÅÅÅÅ j=0

êêêêêêêê êê Because the root l + p is equivalent to the root l, we implement the construction of the periods in the following êê way. (We again use PowerMod because of speed and denote l by R[l].)

Symbolic Computations

314 In[7]:=

period[λ_, f_, p_, g_] := Plus @@ (R /@ Mod[Mod[λ, p] Array[ PowerMod[g^((p - 1)/f), #, p]&, f, 0], p])

Let us look at two examples for the prime 17 and the primitive root 3. In[8]:= Out[8]= In[9]:= Out[9]=

period[1, 8, 17, 3] R@1D + R@2D + R@4D + R@8D + R@9D + R@13D + R@15D + R@16D period[3, 8, 17, 3] R@3D + R@5D + R@6D + R@7D + R@10D + R@11D + R@12D + R@14D

We see that their sum just gives the sum of all roots. This is always the case if p is a Fermat prime; here, the case p = 257 is checked. In[10]:= Out[10]= In[11]:= Out[11]=

period[1, 128, 257, 3] + period[3, 128, 257, 3] == Plus @@ Array[R, 256] True period[5, 128, 257, 3] + period[9, 128, 257, 3] == Plus @@ Array[R, 256] True

Dividing the last period again into subperiods by using the above definition for the periods, we find that the period period[3, 8, 17, 3] can be expressed as the sum of the following periods. In[12]:= Out[12]= In[13]:= Out[13]=

period[3, 4, 17, 3] R@3D + R@5D + R@12D + R@14D period[11, 4, 17, 3] R@6D + R@7D + R@10D + R@11D

It can be shown that one can always represent a period in this way: One root of one of the new periods is êêêêêêêêêêêêêêêê êêêêêêêêêêêêê p-1 êê identical to the old one (l), whereas one root of the other period is generated by the root Jl g ÅÅÅÅÅfÅÅÅÅÅ Å N modH p - 1L. The other roots of the two periods under consideration follow immediately from the above definition of the 17-1 periods. In our example, we have this for one root of the second period: I33 ÅÅÅÅÅÅÅÅ8ÅÅÅÅÅÅ M mod 16 = 11. In doing this division process for the periods repeatedly, we end up in periods of length two. These periods are of the form êê êêêêêêêê êê êêêêêêêê 2p ÅÅÅÅ M, 2 cosI2 µ 2 ÅÅÅÅppÅ M, …. To explicitly calculate the 1 + p - 1, 2 + p - 2, …, which give immediately 2 cosI ÅÅÅÅ p values of the periods in square roots, we need the following theorem: The (numerical) values L1 , L2 of two periods l1 , l2 (which contain no higher roots than square roots and are to be discriminated from the periods l1 , l2 themselves) obtained by splitting one period are the solutions of a quadratic equation. If L1 and L2 are the solutions of L2 + a1 L + a2 = 0; by Vieta’s theorem, we have L1 L2 = -a1 and L1 + L2 = a2 . The sum of the two periods is just the period before splitting, and the (numerical) value of the starting period is -1. It is 2f ò important to observe that the product of two periods of length f, obtained by splitting a period l , can always be expressed as a linear combination of periods of length 2 f . The explicit formula for carrying out this multiplication of two periods is given by f

f

f

f

õúúúúú ùúúúúû ò õúúúúúùúúúû õúúúúú ùúúúû lm = l1 m1 + l2 m1 + ∫ + l f m1 where f

f ó êêêê êêêê êêêê ó êêêê êêêê êêêê l = l1 + l2 + ∫ + l f and m = m1 + m2 + ∫ + m f .

1.10 Three Applications

315

After this multiplication, the periods on the right-hand side can then be expressed as periods of length 2 f or as Å2ÅÅÅÅÅ , they can always be expressed as pure numbers, which ensures that we have pure numbers. (For f = ÅÅÅÅp-1 appropriate starting values for the recursive calculation.) Here, the above two periods of length 8 of p = 17 (period[1, 8, 17, 3] and period[3, 8, 17, 3]; m1 = 1, l1 = 3, l2 = 5, l3 = 6, l4 = 7, l5 = 10, l6 = 11, l7 = 12, l8 = 14) are multiplied in this manner. In[14]:=

Out[14]=

period[ 3 + 1, 8, 17, 3] + period[ 5 + 1, 8, 17, 3] + period[ 6 + 1, 8, 17, 3] + period[ 7 + 1, 8, 17, 3] + period[10 + 1, 8, 17, 3] + period[11 + 1, 8, 17, 3] + period[12 + 1, 8, 17, 3] + period[14 + 1, 8, 17, 3] // Factor 4 HR@1D + R@2D + R@3D + R@4D + R@5D + R@6D + R@7D + R@8D + R@9D + R@10D + R@11D + R@12D + R@13D + R@14D + R@15D + R@16DL

By taking into account the original equation this obviously simplifies to -4. (The value of the period of length 16 was -1.) The two values for the periods of length ÅÅÅÅp-1 Å2ÅÅÅÅÅ can be given in closed form. In[15]:=

{1/2 (-1 + I^(((p - 1)/2)^2) Sqrt[p]), 1/2 (-1 - I^(((p - 1)/2)^2) Sqrt[p])};

This agrees with the direct numerical calculation, as shown here for p = 17. In[16]:= Out[16]= In[17]:= Out[17]=

% /. p -> 17 // N 81.56155, −2.56155< {period[1, 8, 17, 3] /. (R -> (Exp[2Pi I #/17.]&)), period[3, 8, 17, 3] /. (R -> (Exp[2Pi I #/17.]&))} // N // Chop 81.56155, −2.56155
17 the various lists of rules that are in use inside GaussSolve are quite big, we use Dispatch to accelerate their application (with the exception of the list solList, which is not used actively internally, but only serves as a container for the results). In[18]:=

GaussSolve[p:(3 | 5 | 17 | 257 | 65537), Λ_Symbol] := Module[{g = 3, λ, newλs, Timesλ, allλs, rules1, rules2, Simplifyλ, solStep, solArgs, solNList, solList = {Λ[1, p - 1] -> - 1}}, (* the λ’s *) λ[t_, f_] := λ[t, f] = Function[γ, Mod[Mod[t, p] Array[ PowerMod[γ, #, p]&, f, 0], p]][g^((p - 1)/f)]; (* newλs function definition with remembering *) newλs[t_, f_] := newλs[t, f] = {t, Mod[Mod[t, p] PowerMod[g, (p - 1)/f, p], p]}; (* Timesλ function for λ multiplication *) Timesλ[t_, u_, f_] := Plus @@ (Λ[#, f]& /@ Mod[λ[u, f] + t, p]); (* allλs lists *) allλs[p - 1] = {1}; allλs[f_] := allλs[f] = Flatten[Map[newλs[#, 2f]&, allλs[2f], {-1}]]; (* rules1 for λ canonicalization *) rules1[f_] := rules1[f] = Dispatch[Map[Λ[#, f]&, Flatten[Function[a, Apply[Rule, Transpose[{Rest[a], Table[#, {Length[Rest[a]]}]&[First[a]]}], {1}]] /@ (λ[#, f]& /@ allλs[f])], {-1}]]; (* rules2 for λ eliminating one λ *) rules2[(p - 1)/2] = Λ[g, (p - 1)/2] -> - 1 - Λ[1, (p - 1)/2]; rules2[f_] := rules2[f] = Dispatch[ Λ[#[[2, 2]], f] -> Λ[#[[1]], 2f] - Λ[#[[2, 1]], f]& /@ Map[{#, newλs[#, 2f]}&, allλs[2f], {-1}]]; (* Simplifyλ for simplifying products of λs *) Simplifyλ[t_, u_, f_] := Fold[Expand[#1 //. #2]&,

1.10 Three Applications

317

Expand[Timesλ[t, u, f] //. rules1[f]], rules2 /@ (f 2^Range[0, Log[2, (p - 1)/f] - 1])]; (* solStep for period subdivision *) solStep[t_, f_] := Module[{u, v, x1Px2, x1Tx2, sol1, sol2, sol1N, sol2N, numSol1}, {u, v} = newλs[t, f]; x1Px2 = Λ[t, f]; x1Tx2 = Simplifyλ[u, v, f/2]; {sol1, sol2} = # + Sqrt[#^2 - x1Tx2]{1, -1}&[x1Px2/2]; numSol1 = Λ[u, f/2] //. solNList; {sol1N, sol2N} = N[{sol1, sol2} //. solNList]; solList = Flatten[{solList, If[Abs[sol1N - numSol1] < Abs[sol2N - numSol1], {Λ[u, f/2] -> sol1, Λ[v, f/2] -> sol2}, {Λ[u, f/2] -> sol2, Λ[v, f/2] -> sol1}]}]; ]; (* solNList for numerical values of the periods *) solNList = Dispatch[Apply[(Λ @ ##) -> (Plus @@ Exp[N[2Pi I λ[##]/p]])&, Flatten[Function[i, {#, i}& /@ allλs[i]] /@ (2^Range[Log[2, p - 1], 1, -1]), 1], {1}]]; (* stepArgs for period arguments *) stepArgs = Flatten[Function[i, {#, i}& /@ allλs[i]] /@ (2^Range[Log[2, p - 1], 2, -1]), 1]; (* do the work *) solStep @@ #& /@ stepArgs; solList]

Now, let us calculate the two simple cases p = 3 and p = 5 as a warm up. In[19]:= Out[19]= In[20]:= Out[20]=

(Λ[1, 2] //. GaussSolve[3, Λ])/2 1 −  2 (Λ[1, 2] //. GaussSolve[5, Λ])/2 // Expand è!!!! 5 1 −  +  4 4

The results agree with the well-known expressions for cosH2 p ê 3L and cosH2 p ê 5L. Here is the list of the values of the periods for p = 17. In[21]:=

(list17 = GaussSolve[17, Λ]) // InputForm

Out[21]//InputForm=

{Λ[1, 16] -> -1, Λ[1, 8] -> Λ[1, 16]/2 + Sqrt[4 + Λ[1, 16]^2/4], Λ[3, 8] -> Λ[1, 16]/2 - Sqrt[4 + Λ[1, 16]^2/4], Λ[1, 4] -> Λ[1, 8]/2 + Sqrt[1 + Λ[1, 8]^2/4], Λ[9, 4] -> Λ[1, 8]/2 - Sqrt[1 + Λ[1, 8]^2/4], Λ[3, 4] -> Λ[3, 8]/2 + Sqrt[1 + Λ[3, 8]^2/4], Λ[10, 4] -> Λ[3, 8]/2 - Sqrt[1 + Λ[3, 8]^2/4], Λ[1, 2] -> Λ[1, 4]/2 + Sqrt[Λ[1, 4]^2/4 - Λ[3, 4]], Λ[13, 2] -> Λ[1, 4]/2 - Sqrt[Λ[1, 4]^2/4 - Λ[3, 4]], Λ[9, 2] -> Λ[9, 4]/2 - Sqrt[1 + Λ[1, 8] + Λ[3, 4] + Λ[9, 4]^2/4], Λ[15, 2] -> Λ[9, 4]/2 + Sqrt[1 + Λ[1, 8] + Λ[3, 4] + Λ[9, 4]^2/4], Λ[3, 2] -> Λ[3, 4]/2 + Sqrt[Λ[1, 4] - Λ[1, 8] + Λ[3, 4]^2/4], Λ[5, 2] -> Λ[3, 4]/2 - Sqrt[Λ[1, 4] - Λ[1, 8] + Λ[3, 4]^2/4], Λ[10, 2] -> Λ[10, 4]/2 - Sqrt[-Λ[1, 4] + Λ[10, 4]^2/4], Λ[11, 2] -> Λ[10, 4]/2 + Sqrt[-Λ[1, 4] + Λ[10, 4]^2/4]} 2p Here is the final expression for cosH ÅÅÅÅ ÅÅÅÅ L. 17 In[22]:=

(Λ[1, 2] //. list17)/2 // Expand // Factor

Symbolic Computations

318

Out[22]=

1  16

i j è!!!!!!! # è!!!!!!! "################################ j j j j−1 + 17 + 2 H17 − 17 L + k y "################################ è!!!!!!! "################################ è!!!!!!! # "################################### è!!!!!!! è!!!!!!! # z z $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 J34 + 6 17 − 2 H17 − 17 L + 34 H17 − 17 L − 8 2 H17 + 17 L N% z z z {

We numerically check this result. Because the result is 0, we cannot get any significant digit, and so the N::meprec message is issued. In[23]:= Out[23]=

(% - Cos[2Pi/17]) // SetPrecision[#, 1000]& 0. × 10−1000

Next is the result for cosH2 µ 2 p ê 17L. (Because we have eliminated most of the L[j, 2]’s with even j, we make use of cosH2 jp ê pL = cosH2 H p - jL p ê pL and use L[15, 2].) In[24]:= Out[24]=

(Λ[15, 2] //. list17)/2 // Expand // Factor 1  16

i j è!!!!!!! # è!!!!!!! "################################ j j j−1 + 17 − 2 H17 − 17 L + j k y "################################ è!!!!!!! "################################ è!!!!!!! # "################################### è!!!!!!! è!!!!!!! # z z $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 J34 + 6 17 + 2 H17 − 17 L − 34 H17 − 17 L + 8 2 H17 + 17 L N% z z z {

In[25]:= Out[25]=

(% - Cos[2 2Pi/17]) // SetPrecision[#, 1000]& 0. × 10−1000

Using the powerful function RootReduce we could also prove the last equality symbolically. In[26]:= Out[26]= In[27]:= Out[27]=

(%% // Simplify // RootReduce) (Together[TrigToExp[Cos[2 2Pi/17]]] // RootReduce) 0 Together[TrigToExp[Cos[2 2Pi/17]]] 1 −  H−1L13ê17 H1 + H−1L8ê17 L 2

The last value of interest here is cosH8 µ 2 p ê 17L. In[28]:= Out[28]=

(Λ[9, 2] //. list17)/2 // Expand // Factor 1  16

i j è!!!!!!! # è!!!!!!! "################################ j j j j−1 + 17 − 2 H17 − 17 L − k y "################################ è!!!!!!! "################################ è!!!!!!! # "################################### è!!!!!!! è!!!!!!! # z z $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 J34 + 6 17 + 2 H17 − 17 L − 34 H17 − 17 L + 8 2 H17 + 17 L N% z z z {

Here is again a quick numerical check for the last result. In[29]:= Out[29]=

(% - Cos[8 2Pi/17]) // SetPrecision[#, 1000]& 0. × 10−1000

Now, as promised in the title of this subsection, we calculate cosH2 p ê 257L [1487], [638]. In[30]:=

list257 = GaussSolve[257, Λ];

We select only those parts that are explicitly needed for the evaluation of cosH2 p ê 257L. In[31]:=

Flatten[Function[{lhs, rhs}, (* until we have all needed Λ’s *)

1.10 Three Applications

319

FixedPoint[{#, Complement[Union[Cases[ (* what is in the rhs *) rhs[[#]]& /@ Flatten[Position[lhs, #]& /@ Last[#]], _Λ, {0, Infinity}]], Flatten[#]]}&, (* this we need of course *) {{Λ[1, 2]}}, SameTest -> (Last[#2] === {}&)]][ (* all lhs and rhs from list257 *) First /@ list257, Last /@ list257]]; solListPiD257 = (list257[[#]]& /@ Flatten[Function[lhs, Position[lhs, #]& /@ %][First /@ list257]]); 2p Here is a shortened version of this list of replacement rules necessary to express cosH ÅÅÅÅ ÅÅÅÅÅ L. 257 In[33]:=

solListPiD257 // Short[#, 6]&

Out[33]//Short=

1 1  Λ@1, 4D2 + Λ@1, 16D − Λ@1, 32D + Λ@136, 8D + Λ@197, 4D% , 9Λ@1, 2D →  Λ@1, 4D + $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 2 1 1 Λ@1, 4D →  Λ@1, 8D + $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Λ@1, 8D2 − Λ@3, 8D + Λ@131, 8D − Λ@131, 16D , 2 4 1 Λ@1, 16D →  Λ@1, 32D + 2 1 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% −Λ@1, 32D +  Λ@1, 32D2 − Λ@1, 128D + 2 Λ@3, 32D − 2 Λ@3, 64D − Λ@9, 32D , 4 1 1 Λ@1, 32D →  Λ@1, 64D + $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 + 2 Λ@1, 64D +  Λ@1, 64D2 + Λ@1, 128D% , 28 , 2 4 1 1 Λ@243, 32D →  Λ@3, 64D + $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 − Λ@1, 128D + 2 Λ@3, 64D +  Λ@3, 64D2% , 2 4 1 1 Λ@27, 64D →  Λ@3, 128D − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 +  Λ@3, 128D2 , 2 4 1 1 Λ@81, 32D →  Λ@1, 64D − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 + 2 Λ@1, 64D +  Λ@1, 64D2 + Λ@1, 128D% , 2 4 1 1 5 − 2 Λ@1, 64D + 3 Λ@1, 128D +  Λ@9, 64D2% = Λ@215, 32D →  Λ@9, 64D − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 2 2p The value for cosH ÅÅÅÅ ÅÅÅÅÅ L is now easily obtained, but because of its size, we do not display it here. 257 In[34]:= Out[34]=

(cos2PiD257 = (Λ[1, 2] //. Dispatch[solListPiD257])/2) // ByteCount 1822680

It contains only square roots, but it contains a lot of them. In[35]:= Out[35]=

Cases[cos2PiD257, Power[_, 1/2], {0, Infinity}, Heads -> True] // Length 5133

If the reader wants to see all of them, the following code opens a new notebook with the typeset formula for the square root version of cosH2 p ê 257L.

Symbolic Computations

320 Make Input

NotebookPut[Notebook[{Cell[BoxData[ FormBox[MakeBoxes[#, TraditionalForm]&[cos2PiD257], TraditionalForm]], "Output", ShowCellBracket -> False, CellMargins -> {{0, 0}, {5, 5}}, PageWidth -> Infinity, FontColor -> GrayLevel[1], (* allow to see all square roots *) CellHorizontalScrolling -> True]}, WindowSize -> {Automatic, Fit}, Background -> RGBColor[0.31, 0., 0.51], ScrollingOptions -> {"HorizontalScrollRange" -> 500000}, WindowMargins -> {{0, 0}, {Automatic, 10}}, WindowElements -> {"HorizontalScrollBar"}, WindowFrameElements -> {"CloseBox"}]]

Here is a numerical check of the result. In[36]:= Out[36]=

(cos2PiD257 - Cos[2Pi/257]) // SetPrecision[#, 1000]& 0. × 10−996

One could now go on and calculate the following quite large calculation for the denominator 65537. Make Input

l65537 = GaussSolve[65537, L]

It will take around one day on a modern workstation. Here are the first lines of the result (of size 55 MB). {Λ[ 1, Λ[ 1, Λ[ 3, Λ[ 1, Λ[ 9, Λ[ 3, Λ[ 27, Λ[ 1,

65536] 32768] 32768] 16384] 16384] 16384] 16384] 8192]

-> -> -> -> -> -> -> ->

Λ[ 81,

8192] ->

Λ[

9,

8192] ->

Λ[729,

8192] ->

Λ[

8192] ->

3,

-1, Λ[1, 65536]/2 + Sqrt[16384 + Λ[1, 65536]^2/4], Λ[1, 65536]/2 - Sqrt[16384 + Λ[1, 65536]^2/4], Λ[1, 32768]/2 - Sqrt[ 4096 + Λ[1, 32768]^2/4], Λ[1, 32768]/2 + Sqrt[ 4096 + Λ[1, 32768]^2/4], Λ[3, 32768]/2 - Sqrt[ 4096 + Λ[3, 32768]^2/4], Λ[3, 32768]/2 + Sqrt[ 4096 + Λ[3, 32768]^2/4], Λ[1, 16384]/2 - Sqrt[ 1040 + 32 Λ[1, 16384] + Λ[1, 16384]^2/4 + 16 Λ[1, 32768]], Λ[1, 16384]/2 + Sqrt[1040 + 32 Λ[1, 16384] + Λ[1, 16384]^2/4 + 16 Λ[1, 32768]], Λ[9, 16384]/2 + Sqrt[1040 - 32 Λ[1, 16384] + 48 Λ[1, 32768] + Λ[9, 16384]^2/4], Λ[9, 16384]/2 - Sqrt[1040 - 32 Λ[1, 16384] + 48 Λ[1, 32768] + Λ[9, 16384]^2/4], Λ[3, 16384]/2 + Sqrt[1024 - 16 Λ[1, 32768] + 32 Λ[3, 16384] + Λ[3, 16384]^2/4]}

(Although the above implementation strictly follows Gauss’s original work, we could have used more efficient procedures. See [835].) Let us briefly discuss the numbers n for which the value cosH2 p ê nL can be expressed in square roots (or geometrically speaking, which n-gons can be constructed by ruler and compass [466], [825]?). 5

The above-mentioned number 22 - 1 = 4294967295 is not a prime number; the factors are all Fermat numbers F j with j = 0, …, 4. In[37]:=

FactorInteger[2^(2^5) - 1]

1.10 Three Applications Out[37]=

321

883, 1 Modular]]); // Timing 858.55 Second, Null
False, PlotPoints -> {{21, 5}, {21, 5}, {16, 5}}]

We could now continue and slowly morph the knot into a ball (similar to Section 3.3 of the Graphics volume) [1745]. Here are the coordinate plane cross sections of such a morphing. We leave it to the reader to implement the corresponding 3D animation. In[16]:=

Function[sign, (* add and subtract constant *) Show[GraphicsArray[Show /@ Transpose[Table[ ContourPlot[Evaluate[treFoilKnotPoly[#1, #2, #3] + (* build and cut connections *) sign 10^∂], {#4, -5, 5}, {#5, -4, 4}, PlotPoints -> 120, Contours -> {0}, ContourShading -> False, ContourStyle -> {Hue[0.8 (∂ - 55)/6]}, DisplayFunction -> Identity, Frame -> False, PlotLabel -> #6 "-plane"]& @@@ (* the 3 coordinate plane data *)

Symbolic Computations

326 {{x, y, 0, x, y, "x,y"}, {x, 0, z, x, z, "x,z"}, {0, y, z, y, z, "y,z"}}, {∂, 18, 26, 1/3}]]]]] /@ {+1, -1} x,y-plane

x,z-plane

y,z-plane

x,y-plane

x,z-plane

y,z-plane

And here are two 3D plots of the resulting surfaces. By adding a constant to the polynomial, we squeeze the tube and by subtracting a constant, we thicken the tube. In[17]:=

Show[GraphicsArray[ (* show squeezed and fattened version *) Graphics3D[{EdgeForm[], Cases[ ContourPlot3D[Evaluate[treFoilKnotPoly[x, y, z] + #], {x, -5, 5}, {y, -5, 5}, {z, -2, 2}, Boxed -> False, MaxRecursion -> 1, DisplayFunction -> Identity, PlotPoints -> {{21, 6}, {21, 6}, {13, 6}}], _Polygon, Infinity] /. (* cut vertices off *) Polygon[l_] :> Polygon[Plus @@@ Partition[Append[l, l[[1]]], 2, 1]/2]}, Boxed -> False]& /@ (* two constant values *) {8 10^21, -10^23}]]

In a similar manner, one can implicitize many other surfaces, when their parametrization is in terms of trigonometric or hyperbolic functions, for instance, the Klein bottle from Section 2.2.1 of the Graphics volume [1736].

1.10 Three Applications

327

Here is their implicit form together with the code for making a picture of the resulting polynomial. (For the implicitization of a “realistic looking” Klein bottle, see [1734].) Make Input

Needs["Graphics`ContourPlot3D`"] Clear[x, y, z, r, ϕ] Show[Graphics3D[ (* convert back from polar coordinates to Cartesian coordinates *) Apply[{#1 Cos[#2], #1 Sin[#2], #3}&, Cases[ContourPlot3D[Evaluate[ 768 x^4 - 1024 x^5 - 128 x^6 + 512 x^7 - 80 x^8 - 64 x^9 + 16 x^10 + 144 x^2 y^2 - 768 x^3 y^2 - 136 x^4 y^2 + 896 x^5 y^2 - 183 x^6 y^2 176 x^7 y^2 + 52 x^8 y^2 + 400 y^4 + 256 x y^4 - 912 x^2 y^4 + 256 x^3 y^4 + 315 x^4 y^4 - 144 x^5 y^4 - 16 x^6 y^4 + 4 x^8 y^4 904 y^6 - 128 x y^6 + 859 x^2 y^6 - 16 x^3 y^6 - 200 x^4 y^6 + 16 x^6 y^6 + 441 y^8 + 16 x y^8 - 224 x^2 y^8 + 24 x^4 y^8 - 76 y^10 + 16 x^2 y^10 + 4 y^12 - 2784 x^3 y z + 4112 x^4 y z - 968 x^5 y z 836 x^6 y z + 416 x^7 y z - 48 x^8 y z + 1312 x y^3 z + 2976 x^2 y^3 z 5008 x^3 y^3 z - 12 x^4 y^3 z + 2016 x^5 y^3 z - 616 x^6 y^3 z 64 x^7 y^3 z + 32 x^8 y^3 z - 1136 y^5 z - 4040 x y^5 z + 2484 x^2 y^5 z + 2784 x^3 y^5 z - 1560 x^4 y^5 z - 192 x^5 y^5 z + 128 x^6 y^5 z + 1660 y^7 z + 1184 x y^7 z - 1464 x^2 y^7 z 192 x^3 y^7 z + 192 x^4 y^7 z - 472 y^9 z - 64 x y^9 z + 128 x^2 y^9 z + 32 y^11 z - 752 x^4 z^2 + 1808 x^5 z^2 - 1468 x^6 z^2 + 512 x^7 z^2 64 x^8 z^2 + 6280 x^2 y^2 z^2 - 5728 x^3 y^2 z^2 - 4066 x^4 y^2 z^2 + 5088 x^5 y^2 z^2 - 820 x^6 y^2 z^2 - 384 x^7 y^2 z^2 + 96 x^8 y^2 z^2 136 y^4 z^2 - 7536 x y^4 z^2 + 112 x^2 y^4 z^2 + 8640 x^3 y^4 z^2 2652 x^4 y^4 z^2 - 1152 x^5 y^4 z^2 + 400 x^6 y^4 z^2 + 2710 y^6 z^2 + 4064 x y^6 z^2 - 3100 x^2 y^6 z^2 - 1152 x^3 y^6 z^2 + 624 x^4 y^6 z^2 1204 y^8 z^2 - 384 x y^8 z^2 + 432 x^2 y^8 z^2 + 112 y^10 z^2 + 3896 x^3 y z^3 - 7108 x^4 y z^3 + 3072 x^5 y z^3 + 768 x^6 y z^3 768 x^7 y z^3 + 128 x^8 y z^3 - 3272 x y^3 z^3 - 4936 x^2 y^3 z^3 + 8704 x^3 y^3 z^3 - 80 x^4 y^3 z^3 - 2496 x^5 y^3 z^3 + 608 x^6 y^3 z^3 + 2172 y^5 z^3 + 5632 x y^5 z^3 - 2464 x^2 y^5 z^3 - 2688 x^3 y^5 z^3 + 1056 x^4 y^5 z^3 - 1616 y^7 z^3 - 960 x y^7 z^3 + 800 x^2 y^7 z^3 + 224 y^9 z^3 + 752 x^4 z^4 - 1792 x^5 z^4 + 1472 x^6 z^4 - 512 x^7 z^4 + 64 x^8 z^4 - 3031 x^2 y^2 z^4 + 1936 x^3 y^2 z^4 + 2700 x^4 y^2 z^4 2304 x^5 y^2 z^4 + 448 x^6 y^2 z^4 + 697 y^4 z^4 + 3728 x y^4 z^4 + 24 x^2 y^4 z^4 - 3072 x^3 y^4 z^4 + 984 x^4 y^4 z^4 - 1204 y^6 z^4 1280 x y^6 z^4 + 880 x^2 y^6 z^4 + 280 y^8 z^4 - 800 x^3 y z^5 + 1488 x^4 y z^5 - 768 x^5 y z^5 + 128 x^6 y z^5 + 992 x y^3 z^5 + 1016 x^2 y^3 z^5 - 1728 x^3 y^3 z^5 + 480 x^4 y^3 z^5 - 472 y^5 z^5 960 x y^5 z^5 + 576 x^2 y^5 z^5 + 224 y^7 z^5 + 16 x^4 z^6 + 388 x^2 y^2 z^6 - 384 x^3 y^2 z^6 + 96 x^4 y^2 z^6 - 76 y^4 z^6 384 x y^4 z^6 + 208 x^2 y^4 z^6 + 112 y^6 z^6 - 64 x y^3 z^7 + 32 x^2 y^3 z^7 + 32 y^5 z^7 + 4 y^4 z^8 /. (* to polar coordinates *) {x -> r Cos[ϕ], y -> r Sin[ϕ]}], {r, 0.6, 3.3}, {ϕ, 0, 2Pi}, {z, -1.3, 1.3}, PlotPoints -> {18, 40, 24}, MaxRecursion -> 0, DisplayFunction -> Identity], _Polygon, Infinity], {-2}]]]

Symbolic Computations

328

For more on the subject of implicitization of surfaces, see [1197], [351], and [1591] and references cited therein. We end with another implicit surface originating from a trefoil knot. Starting with a parametrized space curve cHtL, we construct the parametrized surface HcHt + a ê 2L + cHt + a ê 2LL ê a (the average of two symmetrically located points with respect to t). The following code calculates the implicit form of this surface for the trefoil knot. We use the function Resultant to eliminate the parametrization variables. For brevity, we express the resulting surface in cylindrical coordinates. Make Input

(* a function to convert from trigonometric to polynomial variables *) [expr_] := Numerator[Together[TrigToExp[expr] /. {t -> Log[T]/I, α -> Log[Α]/I}]] (* make algebraic form of average *) cAv = ((c /. t -> t + α) + (c /. t -> t - α))/2 cAvAlg = [{x, y, z} - cAv]/{I, 1, I} (* eliminate parametrization variables *) res1 = Resultant[cAvAlg[[1]], cAvAlg[[2]], Α] // Factor res2 = Resultant[cAvAlg[[1]], cAvAlg[[3]], Α] // Factor res3 = Resultant[res1[[-1]] /. T -> Sqrt[T2], res2[[-1, 1]] /. T -> Sqrt[T2], T2, Method -> SylvesterMatrix]; (* express implicit form of surface in cylindrical coordinates *) cAvImpl = Factor[res3][[3, 1]] /. {x -> r Cos[ϕ], y -> r Sin[ϕ]} // FullSimplify In[18]:=

cAvImpl = r^6 (2 + r) (r - 2) (1 - 44 r^2 + 64 r^4) + 24 r^4 (-12 - 3 r^2 + 80 r^4) z^2 128 r^2 (-123 + 36 r^2 + 64 r^4) z^4 - 8192 z^6 + r^3 (2 z (993 r^4 - 80 r^6 - 4144 z^2 + 8192 z^4 + r^2 (84 - 5760 z^2)) Cos[3 ϕ] + r^3 (-4 + 177 r^2 - 300 r^4 + 64 r^6 32 (-109 + 48 r^2) z^2) Cos[6 ϕ] - 64 r^6 z Cos[9 ϕ] 16 (3 r^6 (-4 + r^2) + 2 r^2 (69 - 114 r^2 + 64 r^4) z^2 256 (-2 + 3 r^2) z^4) Sin[3 ϕ] + 4 r^3 z (157 - 174 r^2 + 512 z^2) Sin[6 ϕ] - 48 r^6 (-4 + r^2) Sin[9 ϕ]);

In[19]:=

Needs["Graphics`ContourPlot3D`"]

In[20]:=

(* a function for making a hole in a polygon *) makeHole[Polygon[l_], f_] := Module[{mp = Plus @@ l/Length[l], , },  = Append[l, First[l]];  = (mp + f (# - mp))& /@ ; {(* new polygons *) MapThread[Polygon[Join[#1, Reverse[#2]]]&, Partition[#, 2, 1]& /@ {, }]}]

1.10 Three Applications

329

The next pair of graphics shows the parametric and the implicit version of this surface. We make use of the threefold rotational symmetry of the surface in the generation of the implicit plot. In[22]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity, polysCart,  = {{-1, Sqrt[3], 0}, {-Sqrt[3], -1, 0}, {0, 0, 2}}/2.}, {(* the parametrized 3D plot *) ParametricPlot3D[Evaluate[Append[ ((c /. t -> t + α) + (c /. t -> t - α))/2, {EdgeForm[], SurfaceColor[#, #, 3]&[Hue[(t + Pi)/(2Pi)]]}]], {t, -Pi, Pi}, {α, 0, Pi/2}, Axes -> False, PlotPoints -> {64, 32}, BoxRatios -> {1, 1, 0.6}, PlotRange -> {{-3, 3}, {-3, 3}, {-1, 1}}] /. p_Polygon :> makeHole[p, 0.76], (* the implicit 3D plot; use symmetry *) polysCart = Apply[{#1 Cos[#2], #1 Sin[#2], #3}&, Cases[(* contour plot in cylindrical coordinates *) ContourPlot3D[cAvImpl, {r, 0, 3}, {ϕ, -Pi/3, Pi/3}, {z, -1, 1}, PlotPoints -> {28, 24, 32}, MaxRecursion -> 0], _Polygon, Infinity], {-2}]; Graphics3D[{EdgeForm[], (* generate all three parts of the surface *) {polysCart, Map[ .#&, polysCart, {-2}], Map[..#&, polysCart, {-2}]}} /. p_Polygon :> {SurfaceColor[#, #, 2.4]&[ Hue[Sqrt[#.#]&[0.24 Plus @@ p[[1]]/Length[p[[1]]]]]], makeHole[p, 0.72]}, BoxRatios -> {1, 1, 0.6}]}]]]

For the volume of such tubes, see [309].

Symbolic Computations

330

Exercises 1.L2 The 2 in the Factorization of x i - 1, Heron’s Formula, Volume of Tetrahedron, Circles of Apollonius, Circle ODE, Modular Transformations, Two-Point Taylor Expansion, Quotential Derivatives a) Program a function which finds all i for which numbers other than 0 or ≤1 appear as coefficients of x j

(0 § j § i) in the factorized decomposition of x j - 1 (1 § i § 500) [586]. Do not use temporary variables (no Block or Module constructions). b) Let P1 , P2 , and P3 be three points in the plane. Starting from the formula A = †HP2 - P1 LäHP3 - P1 L§ ê 2 for the area A of the triangle formed by P1 , P2 , and P3 , derive a formula for the area which only contains the lengths of the three sides of the triangle (Heron’s area formula). c) Let P1 , P2 , P3 , and P4 be four points in 3 . Starting from the formula V = HareaOfOneFace height ê 3L for the

volume V of the tetrahedron formed by P1 , P2 , P3 , and P4 , derive a formula for the volume which only contains the lengths of the six edges of the tetrahedron [841]. d) Given are three circles in the plane that touch each other pairwise. In the “middle” between these three circles

now put a fourth circle that touches each of the three others. Calculate the radius of this circle as an explicit function of the radius of the three other circles (see [1630], [416], [155], [1680], [839], and [695]). e) Calculate the differential equation that governs all circles in the x,y-plane (from I.I.5.6 of [896]). f) Show that the three equations

u4 - vHuL4 - 2 u vHuL H1 - u2 vHuL2 L = 0 u6 - vHuL6 + 5 vHuL2 u2 Hu2 - vHuL2 L - 4 u vHuL H1 - u4 vHuL4 L = 0 H1 - u8 L H1 - vHuL8 L - H1 - u vHuLL8 = 0 are solutions of the (so-called modular) differential equation [1438] iji 1 + k 2 y2 1 + l 2 £ 2 yzz £ 2 jjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz - J ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ3ÅÅÅÅ N l HkL zz l HkL + 3 l≥ HkL2 - 2 l£ HkL l£££ HkL = 0. j k - k3 l l { k k { 1

1

The change of variables between 8k, l< and 8u, v< is given by k ÅÅ4ÅÅ = u and l ÅÅ4ÅÅ = v. g) The function f HxL

ÅÅÅÅÅÅÅÅÅÅ dx i yz 1-hHxL f HxL eŸ gHxL dx+Ÿ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ dx j jjc + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 1-hHxL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ dxzzzz wHxL = c1 e-Ÿ ÅÅÅÅÅÅÅÅ jj 2 ‡ 1 - hHxL k {

fulfills a linear second-order differential equation [700]. Derive this differential equation. h) Prove the following two identities (from [1838] and [897]):

6p 10 p 1 tanJ ÅÅÅÅÅÅ tan-1 H4LN = 2 JcosJ ÅÅÅÅÅÅÅÅÅÅ N + cosJ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ NN 17 17 4 è!!!! 7 i i1 p 1 i 1 yzyz è!!!! ij 1 i 1 yzyzyz cosJ ÅÅÅÅÅÅ N = ÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅ jjjcosjjj ÅÅÅÅÅÅ cos-1 jjj ÅÅÅÅÅÅÅÅè!!!! ÅÅÅÅÅÅÅÅÅÅ zzzz + 3 sinjj ÅÅÅÅÅÅ cos-1 jjj ÅÅÅÅÅÅÅÅè!!!! ÅÅÅÅÅÅÅÅÅÅ zzzzzz 6 k k3 7 6 3 k k 2 7 {{ k 2 7 {{{

Exercises

331

i) Given a rectangular box of size w1 µ h1 µ d1 . Is it possible to put a second box of size w2 µ h2 µ d2 in the first one such that 1 ê w2 + 1 ê h2 + 1 ê d2 is equal to, less than, or greater than w1 + h1 + d1 ? j) What geometric object is described by the following three inequalities?

†f x§ + †y§ < 1 fl †f y§ + †z§ < 1 fl †x§ + †f z§ < 1 (f is the Golden ratio.) k) Check the following integral identity [1062]: 2

2 ¶ x x x iè!!!! ¶ f HtL y f HtL y2 1 y i i1 ÅÅÅÅÅ dtz dx = ‡ j ÅÅÅÅÅ ‡ f HtL dtz dx + jjj x ‡ ÅÅÅÅÅÅÅÅÅÅ ÅÅÅ dt + ÅÅÅÅÅÅÅÅ ÅÅÅÅ!Å ‡ f HtL dtzzz . ‡ j‡ ÅÅÅÅÅÅÅÅ è!!! t t { { 0 k x 0 k x 0 x x 0 k { x

l) Check the following identity [1900] for small integer n and r: n

pHak L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Hx - ak Lr+1 ¤nl = 1 Hak - al L k=1

l∫k

r ij y n n yzz i n r jj HrL jj p HxL + „ H-1L j ijj yzz pHr- jL HxL Ajjj‚ Hx - ai L-1 , ‚ Hx - ai L-2 , …, ‚ Hx - ai L- j zzzzzz zzz j jj kj{ j {z k i=1 i=1 i=1 j=1 k {

H-1Lr ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ n r! ¤k=1 Hx - ak L

Here pHzL is a polynomial of degree equal to or less than n; the ak are arbitrary complex numbers and the multivariate polynomials AHt1 , …, t j L are defined through AHt1 , t2 , …, t j L =

‚ k1 ,k2 ,…,k j k1 +2 k2 +∫+ j k j = j

t j kj j! t1 k1 t2 k2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J ÅÅÅÅÅÅÅÅ N J ÅÅÅÅÅÅÅÅ N ∫ J ÅÅÅÅÅÅÅÅ N . j k1 ! k2 ! ∫ k j ! 1 2

m) Given five points in 2 , find all relations between the oriented areas (calculated, say, with the determinantal

formula from Subsection 1.9.2) of the nine triangles that one can form using the points. n) Is it possible to position six points P1 , …, P6 in the plane in such a way that they have the following integer distances between them [814]?

P1 P2 P3 P4 P5 P6

P1 0 87 158 170 127 68

P2 87 0 85 127 136 131

P3 158 85 0 68 131 174

P4 170 127 68 0 87 158

P5 127 136 131 87 0 85

P6 68 131 174 158 85 0

o) Show that there are no 3 µ 3 Hadamard matrices [78], [1866], [681]. (An n µ n Hadamard matrix Hn is a matrix with elements ≤1 that fulfills Hn .HTn = n 1n .) p) The two-point Taylor series of order for a function f HzL analytic in z1 , z2 is defined through [1158]

Symbolic Computations

332

o

f HzL = ‚ Hn Hz1 , z2 L Hz - z1 L + n Hz2 , z1 L Hz - z2 L L Hz - z1 Ln Hz - z2 Ln + Ro+1 Hz, z1 , z2 L. n=0

Here Ro+1 Hz, z1 , z2 L is the remainder term and the coefficients n Hz1 , z2 L are given as f Hz2 L 0 Hz1 , z2 L = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z2 - z1 n

Hk + n - 1L! H-1Lk k f Hn-kL Hz1 L + H-1Ln+1 n f Hn-kL Hz2 L n Hz1 , z2 L = „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . k ! n! Hn - kL! Hz1 - z2 Lk+n+1 k=0

H20L Calculate the two-point Taylor series 0,2 p @sinD HzL of order 20 for f HzL = sinHzL, z1 = 0, and z2 = 2 p. Find maxz1 §z§z2 † f HzL - 20 HzL§.

q) While for a smooth function yHxL, the relation d yHxL ê dx = 1 ê HdxHyL ê d yL holds; the generalization

d n yHxL ê dxn = 1 ê Hd n xHyL ê d yn L for n ¥ 2 in general does not hold. Find functions yHxL such that the generalization holds for n = 2 [245]. Can you find one for n = 3?

r) Define a function (similar to the built-in function D) that implements the quotential derivatives n . ê xn of a function f HxL defined recursively by [1297]

n f HxL  i n-1 f HxL yz ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅ = ÅÅÅÅÅÅ Å jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ z n x x k xn-1 { with the first quotential derivatives . ê x defined as 1 f HxL  f HxL f Hq xL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅ = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = lim lnJ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N. qØ1 x1 x f HxL Show that  f HyHxLL ê x =  f HyHxLL ê y yHxL ê x. Define the multivariate quotential derivative recursively starting with the rightmost ones, meaning 2 f Hx, yL  i  f Hx, yL y ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = ÅÅÅÅÅÅÅÅ j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z. x y x k y { Show by explicit calculation that  f Hx, yL 2 f Hx, yL  f Hx, yL 2 f Hx, yL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅ . x y x y x y k s) Conjecture the value of the following sum: ⁄¶ k=1 H¤ j=1 a j-1 ê Hx + a j LL. Here a0 = 1, ak œ , ak ∫ 0, x ∫ 0

[1648]. 2.L1 Horner’s Form, Bernoulli Polynomials, Squared Zeros, Polynomialized Radicals, Zeros of Icosahedral Equation, Iterated Exponentials, Matrix Sign Function, Appell–Nielsen Polynomials a) Given a polynomial pHxL, rewrite it in Horner’s form.

Exercises

333 x+1

b) Bernoulli polynomials Bn HxL are uniquely characterized by the property Ÿx

Bn HtL dt = xn . Use this method to implement the calculation of Bernoulli polynomials Bn HxL. Try to use only built-in variables (with the exception of x and n, of course). c) Given the polynomial x4 + a3 x3 + a2 x2 + a1 x + a0 with zeros x1 , x2 , x3 , and x4 , calculate the coefficients (as

functions of a0 , a1 , a2 , and a3 ) of a polynomial that has the zeros x21 , x22 , x23 , and x24 .

d) Express the real zeros of

-1 + x + 2

3 5 è!!!!!!!!!!!!!! è!!!!!!!!!!!!!! è!!!!!!!!!!!!!! 1 + x2 - 3 1 + x3 + 5 1 + x5 - 4 = 0

as the zeros of a polynomial. e) Show that all nontrivial solutions of x10 + 11 x5 - 1 = 0 stay invariant under the following 60 substitutions:

xöei x ei xö- ÅÅÅÅÅÅ x e j Hei + x He4 + eLL xö ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ x - ei He4 + eL e j Hx - ei He4 + eLL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ xö- ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ei + x He4 + eL f) Iterated exponentials expHc1 z expHc2 z expHc3 z ∫LLL can be used to approximate functions [966], [1881],

[1882], [47]. Find values for c1 , c2 , …, c10 such that expHc1 z expHc2 z expHc3 z ∫LLL approximates the function 1 + lnH1 + zL around z = 0 as best as possible.

g) Motivate symbolically the result of the following input.

m = Table[1/(i + j + 1), {i, 5}, {j, 5}]; FixedPoint[(# + Inverse[#])/2&, N[m], 100] h) Efficiently calculate the list of coefficients of the polynomial 500

Hx4 + x3 + x2 + x + 1L

1000

Hx2 + x + 1L

Hx + 1L2000

without making use of any polynomial function like Expand, Coefficient, CoefficientList, …. i) What is the minimal distance between the roots of z3 + c2 z + 1 = 0 for real c? j) Let f HkL HzL = f H f Hk-1L HzLL, f H1L HzL = f HzL = z2 - c. Then the following remarkable identity holds [1135], [119]: ¶ ij ¶ y H ÅÅÅÅ2z Lk zk zzz jj expjjj- „ ck ÅÅÅÅÅÅÅÅ zzz = 1 + „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ k z j ¤kj=1 f H jL H0L k k=1 k=1 {

where

Symbolic Computations

334

2k

1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . ck = „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ HkL £ f Hz j L H f HkL £ Hz j L - 1L j=1

The sum appearing in the definition of the ck extends over all 2k roots of f HkL HzL = z. Expand both sides of the identity in a series around z = 0 and check the equality of the terms up to order z4 explicitly. k) Write a one-liner that, for a given integer m, quickly calculates the matrix of values e

x ∑d I ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ M sinHxL ce,d = lim ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ d xØ0 ∑x

for 1 § e § m, 0 § d § m. l) The Appell–Nielsen polynomials pn HzL are defined through the recursion p£n HzL = pn-1 HzL, the symmetry

constraint pn HzL = H-1Ln pn H-z - 1L, and the initial condition p0 HzL = 1 [324], [1341]. Write a one-liner that calculates the first n Appell–Nielsen polynomials. Visualize the polynomials.

m) Write a one-liner that uses Integrate (instead of the typically used D) to derive the first n terms of the

Taylor expansion of a function f around x that is based on the following identity [729], [549] n-1

h h1 hn-1 hk f Hx + hL = „ ÅÅÅÅÅÅÅÅÅ f HkL HxL + ‡ ‡ ∫ ‡ f HnL Hx + hn L dhn … dh2 dh1 . k! 0 0 0 k=0

n) A generalization of the classical Taylor expansion of a function f HxL around a point x0 into functions jk HxL,

k = 0, 1, …, n (where the jk HxL might be other functions that the monomials xk ) can be written as [1839] ƒƒi 0 j1 HxL j0 HxL ƒƒj ƒƒjj j0 Hx0 L j1 Hx0 L ƒƒƒjjj f Hx0 L ƒƒjj £ 1 j£0 Hx0 L j£1 Hx0 L f HxL º - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ †ƒjjjj f Hx0 L W Hj0 Hx0 L, …, jn Hx0 LL ƒƒjj ƒƒjj ª ª ª ƒƒjj ƒƒƒj f HnL Hx L jHnL Hx L jHnL Hx L 0 0 0 ƒk 0 1

yzƒƒƒƒ zzƒƒ zzƒƒ zzzƒƒƒ zz§. zzƒ zzƒƒ zzƒƒ ∏ ª zzƒƒ zƒ HnL ∫ jn Hx0 L {ƒƒƒ ∫ jn HxL ∫ jn Hx0 L ∫ j£n Hx0 L

Here the WHj0 HxL, …, jn HxLL is the Wronskian of the j0 HxL, …, jn HxL and it is assumed not to vanish at x0 . Implement this approximation and approximate f HxL = cosHxL around x0 = 0 through expHxL, expHx ê 2L, …, expHx ê mL. Can this formula be used for m = 25? o) Show that the function [1222] 2

HHHzL + 2 z £ HzLL2 - 4 z £ HzL2 L wHzL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ £ 8 HHzL  HzL HHzL + 2 Hz - 1L £ HzLL HHzL + 2 z £ HzLLL where HzL = c1 1 HzL + c 2 2 HzL and f1,2 HzL are solutions of H1 - zL z  ££ HzL + H1 - 2 zL  £ HzL - f HzL ê 4 = 0 fulfills the following special case of the Painlevé VI equation:

Exercises

335

1 1 1 1 1 1 1 w££ HzL = ÅÅÅÅÅ J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N w£ HzL2 - J ÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N w£ HzL + z 2 wHzL wHzL - 1 wHzL - z z-1 wHzL - z wHzL HwHzL - 1L HwHzL - zL ij zHz - 1L y ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + 4zz. 2 Hz - 1L2 z2 k HwHzL - zL2 { 3.L1 Nested Integration, Derivative[-n], PowerFactor, Rational Painlevé II Solutions a) Given that the following definition is plugged into Mathematica, what will be the result of f[2][x]?

f[n_][x_] := Integrate[f[n - 1][x - z], {z, 0, x}] f[0][x_] = Exp[-x]; Consider the evaluation process. How would one change the first two inputs to get the “correct” result as if from Nest[Integrate[# /. {x -> x - z}, {z, 0, x}]&, Exp[-x], 2] b) Find two (univariate) functions f and g, such that Integrate[f, x] + Integrate[g, x] gives a different

result than does Integrate[f + g, x]. Find a (univariate) functions f and integration limits xl , xm , and xu , such that Integrate[f, {x, xl , xu }] gives a different result than does Integrate[f, {x, xl , xm }] + Integrate[f, {x, xm , xu }]. c) What does the following code do?

Derivative[i_Integer?Negative][f_] := With[{pI = Integrate[f[C], C]}, derivative[i + 1][Function[pI] /. C -> #] /; FreeQ[pI, Integrate, {0, Infinity}]] Predict the results of Derivative[+4][Exp[1 #]&] and Derivative[-4][Exp[1 #]&]. d) Is it possible to find a function f Hx, yL such that D[Integrate[f(x, y), x], y] is different from

Integrate[D[f(x, y), y], x]? e) Write a function PowerFactor that does the “reverse” of the function PowerExpand. It should convert products of radicals into one radical with the base having integer powers. It should also convert sums of logarithms into one logarithm and s logHaL into logHas L. f) The rational solutions of w≥ HzL = 2 wHzL3 - 4 z wHzL + 4 k, k œ + (a special Painlevé II equation) can be

expressed in the following way [967], [910], [1215], [952]: k 3 Let the polynomials qk HzL be defined by the generating function ⁄¶ k=0 qk HzL x = expHz x + x ê 3L (for k < 0, let qk HzL = 0). Let the determinants sk HzL be defined by matrices Hai j L0§i, j§k-1 with ai j = qk+i-2 j HzL (for k = 0, let s0 HzL = 1). Then, wk HzL is given as wn HzL = ∑logHsk+1 HzL ê sk HzLL ê ∑ z. Calculate the first few wk HzL explicitly. 4.L1 Differential Equations for the Product, Quotient of Solutions of Linear Second-Order Differential Equations Let y1 HzL and y2 HzL be two linear independent solutions of y££ HzL + f HzL y£ HzL + gHzL yHzL = 0 The product uHzL = y1 HzL y2 HzL obeys a linear third-order differential equation u£££ HzL + a p @ f HzL, gHzLD u££ HzL + b p @ f HzL, gHzLD u£ HzL + c p @ f HzL, gHzLD uHzL = 0

Symbolic Computations

336

The quotient wHzL = y1 HzL ê y2 HzL obeys (Schwarz’s differential operator; see, for instance, [847] and [1906]) w£££ HzL w£ HzL + aq @ f HzL, gHzLD w££ HzL2 + bq @ f HzL, gHzLD w£ HzL2 = 0 Calculate a p , b p , c p and aq , bq . (For analogous equations for the solutions of higher-order differential equations, see [1024].) 5.L1 Singular Points of ODEs, Integral Equation a) First-order ordinary differential equations of the form y£ HxL = PHx, yL ê QHx, yL possess singular points 8x*i , y*i
False, AspectRatio -> 1, PlotLabel -> StyleForm[label, FontWeight -> "Bold", FontSize -> 7]]; Plot[Evaluate[Table[sol1[x, {Cos[ϕ], Sin[ϕ]}], {ϕ, Pi/30, 2Pi, 2Pi/12}]], {x, -1.1, 1}, Evaluate[opts["Knot point"]]] Knot point

Now, we solve y£ HxL = HyHxL + xL ê x. In[5]:= DSolve[{y'[x] == (x + y[x])/x, y[x0] == y0}, y[x], x][[1]]

x y0 + x x0 Log@xD − x x0 Log@x0D x0

Out[5]= 9y@xD →    = In[6]:= sol2[x_, {x0_, y0_}] = x Log[x] + x (y0/x0 - Log[x0]);

The Off[Plot::plnr] serves to suppress any error message resulting from computation of complex values. In[7]:= Off[Plot::plnr];

Plot[Evaluate[Table[sol2[x, {Cos[ϕ], Sin[ϕ]}], {ϕ, Pi/10, 2Pi, 2Pi/22}]], {x, -1.1, 1}, Evaluate[opts["Knot point"]]]

Solutions

409 Knot point

Next, we solve y£ HxL = yHxL ê x. In[9]:= DSolve[{y'[x] == y[x]/x, y[x0] == y0}, y[x], x][[1]]

x y0 x0

Out[9]= 9y@xD →  = In[10]:= sol3[x_, {x0_, y0_}] =

x y0/x0;

Here again is a plot. In[11]:= Plot[Evaluate[Table[sol3[x, {Cos[ϕ], Sin[ϕ]}], {ϕ, Pi/10, 2Pi, 2Pi/22}]],

{x, -1.1, 1}, Evaluate[opts["Knot point"]]] Knot point

Now, we solve y£ HxL = - yHxL ê x. In[12]:= DSolve[{y'[x] == -y[x]/x, y[x0] == y0}, y[x], x][[1]]

x0 y0 x

Out[12]= 9y@xD →  = In[13]:= sol4[x_, {x0_, y0_}] = x0 y0/x;

The associated plot is as follows. In[14]:= Plot[Evaluate[Table[sol4[x, {Cos[ϕ], Sin[ϕ]}], {ϕ, 0, 2Pi, 2Pi/13}]],

{x, -1.1, 1}, PlotRange -> {{-2, 2}, {-2, 2}}, Evaluate[opts["Saddle point"]]] Saddle point

For y£ HxL = -x ê yHxL, we get two solutions from DSolve. In[15]:= DSolve[{y'[x] == -x/y[x], y[x0] == y0}, y[x], x] Out[15]= 99y@xD → −

è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! −x2 + x02 + y02 =, 9y@xD → −x2 + x02 + y02 ==

In[16]:= sol5[x_, {x0_, y0_}] = {-Sqrt[-x^2 + x0^2 + y0^2], Sqrt[-x^2 + x0^2 + y0^2]};

Now, we plot both solutions.

Symbolic Computations

410 In[17]:= Show[Table[Plot[Evaluate[sol5[x, {x0, 0}]], {x, -x0, x0},

DisplayFunction -> Identity], {x0, 0.1, 1, 0.1}], DisplayFunction -> $DisplayFunction, Evaluate[opts["Vortex point"]]] Vortex point

Remaining is the differential equation that gives eddy points. Again, we can find a solution, although not explicitly for yHxL. In[18]:= DSolve[{y'[x] == (y[x] - x)/(y[x] + x)}, y[x], x]

Solve::tdep : The equations appear to involve the variables to be solved for in an essentially non−algebraic way. More… y@xD x

y@xD2 x

1 2

Out[18]= SolveAArcTanA  E +  LogA1 +  2  E  C@1D − Log@xD, y@xDE In[19]:= sol6[{x_, y_}] = -2 ArcTan[y/x] + Log[1/(x^2 (1 + y^2/x^2))];

We now plot this result. Unfortunately, for this transcendental equation, ImplicitPlot is of little use because it can only plot polynomial equations. Also, ContourPlot does not give a very good result because of the branch cut of Log. In[20]:= ContourPlot[Evaluate[Re[sol6[{x, y}]]],

{x, -2, 2}, {y, -2, 2}, PlotPoints -> 100, Contours -> 20, ContourShading -> False] 2 1 0 -1 -2

-2

-1

0

1

2

Therefore, we now create a special implementation. We could try a numerical implementation using FindRoot, for example, of the following form. However, it is difficult to represent larger pieces like this. The form of the solution suggests the use of polar coordinates. In[21]:= sol6[{r Cos[ϕ], r Sin[ϕ]}] // Simplify

1 r

Out[21]= −2 ArcTan@Tan@ϕDD + LogA 2 E In[22]:= Solve[% == c, r] 1 H−c−2 ArcTan@Tan@ϕDDL 

Out[22]= 99r → − 2

1 H−c−2 ArcTan@Tan@ϕDDL

=, 9r →  2

==

We arrive at the following formula. In[23]:= % // PowerExpand 1 H−c−2 ϕL 

Out[23]= 99r → − 2

1 H−c−2 ϕL

=, 9r →  2

==

The final graphics of the integral curves is the following. In[24]:= Show[Table[

ParametricPlot[Evaluate[Exp[c - ϕ]{Cos[ϕ], Sin[ϕ]}], {ϕ, c + 0.1, 3Pi + c}, DisplayFunction -> Identity], {c, 0, 2Pi 24/25, 2Pi/25}],

Solutions

411 DisplayFunction -> $DisplayFunction, PlotRange -> All, Evaluate[opts["Eddy point"]]] Eddy point

We demonstrate the appearance of various singular points in the following example. For a “random” bivariate function yHx, yL, we will integrate the equations x£ HsL = ∑yHxHsL, yHsLL ê ∑ xHsL, y£ HtL = -∑ yHxHsL, yHsLL ê ∑ xHsL. We see saddle points, vortex points, and knot points [85], [448]. In[25]:= Module[{L = 4, pp = 41, T = 5, o = 90, ms = 100, = 3/2,

ps = 21, λ = 2, ipo, ipoX, ipoY, eqs, pathList, nsol}, SeedRandom[123]; (* a streamfunction *) ipo = (* smooth interpolation *) Interpolation[ (* random data *) Flatten[Table[{x, y, Random[Real, {-1, 1}]}, {x, -L, L, 2L/pp}, {y, -L, L, 2L/pp}], 1], InterpolationOrder -> 8]; (* derivatives *) {ipoX, ipoY} = D[ipo[x[t], y[t]], #]& /@ {x[t], y[t]}; (* differential equations for flow lines *) eqs = Thread[{x'[t], y'[t]} == #/Sqrt[#.#]&[{ipoX, -ipoY}]]; (* calculate flow lines *) pathList = Table[ ((* solve for flow lines *) Internal`DeactivateMessages[ nsol = NDSolve[Join[eqs, {x[0] == x0, y[0] == y0}], {x, y}, {t, 0, #}, MaxSteps -> ms, PrecisionGoal -> 3, AccuracyGoal -> 3]]; (* visualize flow lines *) ParametricPlot[Evaluate[{x[t], y[t]} /. nsol], {t, 0, DeleteCases[nsol[[1, 1, 2, 1, 1]], 0.][[1]]}, (* color flow lines differently *) PlotStyle -> {{Thickness[0.002], RGBColor[ (x0 + )/(2 ), 0.2, (y0 + )/(2 )]}}, DisplayFunction -> Identity, PlotPoints -> 200])& /@ {T, -T}, (* grid of initial conditions *) {x0, - , , 2 /ps}, {y0, - , , 2 /ps}]; (* display flow lines and stream function *) Show[(* contour plot of the stream function *) {ContourPlot[Evaluate[ipo[x, y]], {x, -L/2, L/2}, {y, -L/2, L/2}, PlotPoints -> 400, Contours -> 60, ContourLines -> False, PlotRange -> All, DisplayFunction -> Identity], Show[pathList]}, DisplayFunction -> $DisplayFunction, Frame -> True, Axes -> False, FrameTicks -> False, PlotRange -> {{-λ, λ}, {-λ, λ}}, AspectRatio -> Automatic]]

Symbolic Computations

412

For higher-order singularities, see [1726]. b) We start with implementing the exact solution for separable kernels. The function iSolve (named in analogy to DSolve) attempts this. Because a kernel might be separable, but structurally not in separated form, we allow for an optional function  that attempts to separate the kernel. While we could be more elaborate with respect to matching the pattern of a Fredholm integral equation of the second kind, we require here the canonical form. The step-by-step implementation of iSolve is self-explanatory. In[1]:= iSolve[eq:(y_[x_] + λ_ Integrate[_ y[ξ_], {ξ_, a_, b_}] == f_),

y_, x_, _:Identity] := Module[{ = Integrate, intExpand, eq1, integrals, Rules, functions, eq2, eqs, s, separableQ}, (* thread integrals over sums and pull integration variable-independent out *) intExpand = Function[int, (int //. [p_Plus, i_] :> ( [#, i]& /@ p) //. HoldPattern[Integrate[c_?(FreeQ[#, ξ, Infinity]&) rest_, {ξ, a, b}]] :> c Integrate[rest, {ξ, a, b}])]; (* separate kernel *) eq1 = intExpand[ExpandAll[ //@ (Subtract @@ eq)]]; (* integrals over y[ζ] and kernel functions *) integrals = Union[Cases[eq1, _ , Infinity]]; (* replace integrals by variables [i] *) Rules = Rule @@@ Transpose[{integrals /. ξ -> ζ_, s = Array[, Length[integrals]]}]; (* was the kernel  separable? *) separableQ = FreeQ[Rules, x, Infinity]; (* kernel functions h_j[.] *) functions = ((First /@ integrals)/y[ξ]) /. ξ -> x; (* replace integrals by variables *) eq2 = eq1 /. Rules; (* make linear system in the [i] *) eqs = intExpand[ExpandAll[ [eq2 #, {x, a, b}]& /@ functions]] //. Rules; (* solve linear system, backsubstitute into eq2 and solve for y[x] *) Solve[(eq2 /. Solve[(# == 0)& /@ eqs, s][[1]]) == 0, y[x]] /; (* was iSolve applicable? *) separableQ] 1

The next inputs solve the example equation yHxL - l Ÿ0 sinHx + xL yHxL dx = cosHxL. In[2]:= [x_, ξ_] := Sin[x + ξ]

f[x_] := Cos[x] IEq = y[x] - λ Integrate[[x, ξ] y[ξ], {ξ, 0, 1}] == f[x]; IEqSol = iSolve[y[x] - λ Integrate[[x, ξ] y[ξ], {ξ, 0, 1}] == f[x], y, x, TrigExpand] // Simplify 2 Hλ Cos@2 − xD − H−4 + λL Cos@xD + 2 λ Sin@xDL Out[5]= 99y@xD → −      == −8 + λ2 H1 + Cos@2DL + 8 λ Sin@1D2

Here is a quick check for the correctness of the result. In[6]:= yExact = IEqSol[[1, 1, 2]];

IEq /. y -> Function[x, Evaluate[yExact]] // Simplify

Solutions

413 Out[7]= True

In the calculation of the truncated Fredholm and Neumann resolvents, we have to carry out many definite integrals. Because we do not worry about convergence and hope to carry out all integrals successfully term by term, we do not use the built-in function Integrate directly, but rather implement a function integrate, that expands products and powers. In[8]:= integrate[l_List, i_] := Integrate[#, i]& /@ l

integrate[p_Plus, i_] := Integrate[#, i]& /@ p integrate[p:Times[___, _Plus] | p:Power[_Plus, _Integer], i_] := integrate[Expand[p], i] integrate[e_, i_] := Integrate[e, i]

The function FredholmResolventList calculates a list of the successive resolvent approximations arising from truncating the Fredholm minor and the Fredholm determinant at lo+1 . In[12]:= FredholmResolventList[_, {ξ_, a_, b_}, {x_, ξ_}, o_, _:Identity] :=

Module[{c, d, , , , }, (* make recursive definitions for Fredholm minor and determinant *) (* avoid variable interference by applying Set and SetDelayed *) Set @@ {[_, _],  /. {x -> , ξ -> }}; Set @@ {d[0][_, _], [, ]}; SetDelayed @@ {d[k_][_, _], Unevaluated @ With[{p = Pattern[#, _]& @@ {}, p = Pattern[#, _]& @@ {}}, d[k][p, p] =  @ (c[k] [, ] k integrate[[, ] d[k - 1][, ], {, a, b}])]}; c[0] := 1; c[k_] := c[k] =  @ integrate[d[k - 1][, ], {, a, b}]; (* calculate c[k] and d[k] recursively and form successive resolvent approximations *) Divide @@ Transpose[Rest[FoldList[Plus, 0, Table[(-1)^k/k! λ^k {d[k][x, ξ], c[k]}, {k, 0, o}]]]]]

For the example integral equation, all higher ck and dk Hx, xL vanish identically and we obtain the exact solution. In[13]:= FSerKernels = FredholmResolventList[[x, ξ], {ξ, 0, 1}, {x, ξ}, 3,

Simplify] − 1 λ H−Cos@x − ξD + Cos@1 − x − ξD Sin@1DL + Sin@x + ξD 1 − λ Sin@1D

2     , Out[13]= 9Sin@x + ξD,  2

− 12 λ H−Cos@x − ξD + Cos@1 − x − ξD Sin@1DL + Sin@x + ξD      , 1 − 14 λ2 Cos@1D2 − λ Sin@1D2 − 12 λ H−Cos@x − ξD + Cos@1 − x − ξD Sin@1DL + Sin@x + ξD      = 1 − 14 λ2 Cos@1D2 − λ Sin@1D2 In[14]:= yFSerSols[x_] = f[x] + λ integrate[FSerKernels f[ξ], {ξ, 0, 1}]; In[15]:= yFSerSols[x][[-1]] == yExact // Simplify Out[15]= True

We end with the implementation of the iterated kernels. The function NeumannResolventList calculates the resolvent arising from o + 1 iterated kernels. In[16]:= NeumannResolventList[_, {ξ_, a_, b_}, {x_, ξ_}, o_, _:Identity] :=

Module[{, , , , kernels}, Set @@ {[_, _],  /. {x -> , ξ -> }}; kernels = NestList[[integrate[[, ] (# /.  -> ), {, 0, 1}]]&, [, ], o] /. { -> x,  -> ξ}; Rest[FoldList[Plus, 0, MapIndexed[λ^(#2[[1]] - 1) #1&, kernels]]]]

The iterated kernels become increasingly complicated functions. In[17]:= NSerKernels = NeumannResolventList[[x, ξ], {ξ, 0, 1},

{x, ξ}, 5, Simplify];

{LeafCount /@ NSerKernels, Short[NSerKernels, 12]} Out[19]= 984, 26, 78, 168, 292, 454 1, k2 -> 3/2}], {x, 0, 20}, (* setting options to get a pretty picture *) PlotRange -> All, PlotPoints -> 200, PlotStyle -> {Thickness[0.007], Thickness[0.002], Thickness[0.002], {Thickness[0.002], Dashing[{0.02, 0.02}]}, {Thickness[0.002], Dashing[{0.02, 0.02}]}}, Frame -> True, FrameLabel -> ({#["r"], #["V"], None, "∂"}&[ StyleForm["r", FontWeight -> "Bold", FontSize -> 6]&])] 2

0



r

1

-1 -2 0

5

10

r

15

20

For the practical importance of such conditions, see [301], [1474], [1887], [1888], [113], and [1663]. For a nontrivial background potential, see [1367]; for bound states in gaps, see [1508]. b) The function GraeffeSolve implements the calculation of the polynomials pk HzL and the root zn,k . After the †zk § are calculated as precisely as possible given the initial precision prec, ≤ zk is formed and the appropriate sign is selected. In[1]:= Off[RuleDelayed::rhs];

GraeffeSolve[poly_, z_Symbol, prec_] := Module[{k = 1, oldRoots = {0, 0}, newRoots}, Clear[p]; p[0, ζ_] = N[poly /. z -> ζ, prec]; (* polynomial recursion *) p[k_, ζ_] := p[k, ζ_] = Expand[p[k - 1, ] p[k - 1, -]] /. (* avoid 0. z^o *) {_?(# == 0&) -> 0, ^n_ :> ζ^(n/2)}; While[FreeQ[p[k, ζ], Overflow[] | Underflow[], Infinity] && (coeffs = CoefficientList[p[k, ζ], ζ]; (* next polynomial; normalized *) p[k, ζ_] = Expand[p[k, ζ]/Max[Abs[coeffs]]]; (* new root approximations *) newRoots = Abs[Divide @@@ Partition[coeffs, 2, 1]]^(2^-k); (* are roots still changing? *) newRoots =!= oldRoots), oldRoots = newRoots; k++]; {z -> #}& /@ (* add sign *) Select[Join[newRoots, -newRoots], (poly /. z -> #) == 0&]]

Here the function GraeffeSolve is used to solve p = z5 + 5 z4 - 10 z3 - 10 z2 + 5 z + 2 = 0. We start with 100 digits. In[3]:= poly[z_] := 2 + 5 z - 10 z^2 - 10 z^3 + 5 z^4 + z^5;

(* display shortened result *) (grs = GraeffeSolve[poly[z], z, 110]) // N[#, 10]& Out[5]= 88z → 0.5973232647 PD[2, j][[2]]}, {i, numKnots[2]}, {j, numKnots[2]}] // TableForm 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

Now, we want to plot the shape functions. Because they are defined on a triangle, the built-in commands Plot3D and ParametricPlot3D are not immediately applicable (although one could proceed with ParametricPlot3D ). We thus go to a little more trouble and decompose the unit triangle into subtriangles that we can use to plot the shape functions. In[11]:= ShapeFunctionPlot[n_Integer?Positive, k_Integer?Positive,

pp_Integer?Positive, opts___Rule] := Module[{x, y, , , tabv, tabd}, (* calculate all z-values *) auxFu[ξ_, η_] = ShapeFunction[n, k, ξ, η];  = Table[{x, y}, {y, 0, 1, 1/pp}, {x, 0, 1 - y, 1/pp}];  = Table[auxFu[x, y], {y, 0, 1, 1/pp}, {x, 0, 1 - y, 1/pp}]; (* triangulate the basic triangle {{0, 0}, {1, 0}, {0, 1}} *) tabv = Table[Polygon[ {{[[i, j, 1]], [[i, j, 2]], [[i, j]]}, {[[i + 1, j, 1]], [[i + 1, j, 2]], [[i + 1, j]]}, {[[i + 1, j + 1, 1]], [[i + 1, j + 1, 2]], [[i + 1, j + 1]]}, {[[i, j + 1, 1]], [[i, j + 1, 2]], [[i, j + 1]]}}], {j, 1, pp - 1}, {i, 1, pp - j}]; (* boundary *) tabd = Table[Polygon[ {{[[j, - 2, 1]], [[j, -2, 2]], [[j, -2]]}, {[[j, - 1, 1]], [[j, -1, 2]], [[j, -1]]}, {[[j + 1, -1, 1]], [[j + 1, -1, 2]], [[j + 1, -1]]}}], {j, pp}]; (* display shape functions *) Show[Graphics3D[{{GrayLevel[0.6], tabv, tabd}}], opts, Axes -> False, AxesEdge -> {{-1, -1}, {+1, -1}, {-1, -1}},

Solutions

419 Lighting -> False, PlotRange -> All, BoxRatios -> {1, 1, 0.7}, AxesLabel -> {x, y, None}, Boxed -> True, TextStyle -> {FontFamily -> "Times", FontSize -> 6}, PlotLabel -> "SF[" ToString[n] ", " ToString[k] "]"]] /; (k Identity], {i, numKnots[1]}]]] SF@1, 1D

SF@1, 2D

SF@1, 3D

In[13]:= Show[GraphicsArray[#]]& /@

Table[ShapeFunctionPlot[2, 3i + j, 12, DisplayFunction -> Identity], {i, 0, 1}, {j, 3}] SF@2, 1D

SF@2, 2D

SF@2, 3D

SF@2, 4D

SF@2, 5D

SF@2, 6D

In[14]:= (* suppress message for only one picture in the last row *)

Show[GraphicsArray[#]]& /@ Table[ShapeFunctionPlot[3, 3i + j, 12, DisplayFunction -> Identity], {i, 0, 2}, {j, 3}] SF@3, 1D

SF@3, 2D

SF@3, 3D

Symbolic Computations

420 SF@3, 4D

SF@3, 5D

SF@3, 6D

SF@3, 7D

SF@3, 8D

SF@3, 9D

In[16]:= ShapeFunctionPlot[3, 10, 12] SF@3, 10D

We turn now to the computation of the integrals of the element vector and to the entries in the stiffness and mass matrices. Because these involve integrals of the shape functions yi Hx, yL over the triangle with vertices P1 = 8x1 , y1 x1} // Simplify Out[21]= x3 η + x2 ξ − x1 H−1 + η + ξL In[22]:= y[ξ_, η_] = (ay ξ + by η + cy) /.

{ay -> - y1 + y2, by -> - y1 + y3, cy -> y1} // Simplify Out[22]= y3 η + y2 ξ − y1 H−1 + η + ξL

We then get the following Jacobian determinant. In[23]:= Simplify[Det[Outer[D, {x[ξ, η], y[ξ, η]}, {ξ, η}]]] Out[23]= x3 Hy1 − y2L + x1 Hy2 − y3L + x2 H−y1 + y3L 1 1-x p

Next, we implement the relation Ÿ0 Ÿ0

x hq dh dx = p! q ! ê H p + q + 2L (for our applications p and q are positive integers).

The function TriangularIntegration implements the integration of polynomials over the unit triangle. In[24]:= (* Additivity of the integration *)

TriangularIntegration[p_Plus, {x_, y_}] := TriangularIntegration[#, {x, y}]& /@ p; (* Factors that do not depend on the integration variables are moved in front of the integral *) TriangularIntegration[c_ z_, {x_, y_}] := c TriangularIntegration[z, {x, y}] /; FreeQ[c, x] && FreeQ[c, y]; (* let q be 0 *) TriangularIntegration[x_^p_., {x_, y_}] := TriangularIntegration[x^p, {x, y}] = p!/(p + 2)!; (* let p be 0 *) TriangularIntegration[y_^q_., {x_, y_}] := TriangularIntegration[x^q, {x, y}] = q!/(q + 2)!; (* the actual integration formula *) TriangularIntegration[x_^p_. y_^q_., {x_, y_}] := TriangularIntegration[x^p y^q, {x, y}] = (p! q!) /(p + q + 2)!; (* integration of a constant *) TriangularIntegration[c_, {x_, y_}] := (c/2) /; FreeQ[c, x] && FreeQ[c, y];

(For the efficient integration of analytic functions over triangles, see [446].) By comparing our triangular integration with the built-in command Integrate, we see that our work was justified. In[36]:= Timing[TriangularIntegration[a + b x + c y^2 + d x^3 y^6 +

a 2

b 6

c 12

d 9240

e x^12 y^ 16, {x, y}]] e 26466926850

Out[36]= 90. Second,  +  +  +  +   =

In[37]:= Timing[Integrate[a + b x + c y^2 + d x^3 y^6 + e x^12 y^ 16,

a 2

{x, 0, 1}, {y, 0, 1 - x}]] // Simplify b c d e 6 12 9240 26466926850

Out[37]= 91.35 Second,  +  +  +  +   =

Now to the heart of this problem: the computation of the element vector and the mass and stiffness matrices. For the element vector, we have HeL fi = ‡ yi Hx, yL dxdy = J ‡ jHeL i Hx, hL dx dh = J fi . RT

UT

Here, RT denotes the real triangle, whereas UT denotes the unit triangle. J is the Jacobian determinant †∑Hx, yL ê ∑ Hx, hL§. We get this relationship by means of the relations HeL xHx, hL = ‚ x j jHeL j Hx, hL, yHx, hL = ‚ y j j j Hx, hL j

j

Symbolic Computations

422

(where x j , y j are the coordinates of the point P j in the actual triangle RT), which hold for the isoparametric mappings yi HxHx, hL, yHx, hLL = jHeL i Hx, hL. Thus, we compute only the element vector in the unit triangle fiHeL (i.e., we do not explicitly write the Jacobian determinant). In[38]:= ElementVectorElement[n_Integer?Positive, i_Integer?Positive] :=

(ElementVectorElement[n, i] = TriangularIntegration[Expand[ShapeFunction[n, i, ξ, η]], {ξ, η}]) /; (i All, Frame -> True, Axes -> False, PlotStyle -> {PointSize[0.008]}, DisplayFunction -> Identity], (* values over the base points; coloring according to size *) Graphics3D[{Hue[0.76 #[[2]]/Max[evec]], Line[{Append[#[[1]], 0], Append[#[[1]], Abs[#[[2]]]]}]}& /@ Transpose[{Table[PD[n, k], {k, numKnots[n]}], evec}], BoxRatios -> {1, 1, 0.5}, PlotRange -> All, Axes -> True]}]]]

0.1 0.2 0.15 0.1 0.05 0 0

0 -0.1 -0.2 0

20

40

60

1 0.75 0.5 0.25

0.5

80

0.25 0.75

1

0

The computation of the mass matrix is essentially analogous to that for the eigenvector. Using similar notation as in the element vector case, we have HeL HeL mij = ‡ yi Hx, yL y j Hx, yL dxdy = J ‡ jHeL i Hx, hL j j Hx, hL dx dh = J mij . RT

UT

Again, we find only the coordinate-free part. In[44]:= MassMatrixElement[n_Integer?Positive,

i_Integer?Positive, j_Integer?Positive] := (MassMatrixElement[n, i, j] = (* because of symmetry *) MassMatrixElement[n, j, i] = TriangularIntegration[Expand[ShapeFunction[n, i, ξ, η] * ShapeFunction[n, j, ξ, η]], {ξ, η}]) /; ((i J, -(-(x2 y1) + x3 y1 + x1 y2 - x3 y2 - x1 y3 + x2 y3) -> -J}) // Simplify x3 H−y + y1L + x1 Hy − y3L + x H−y1 + y3L x2 Hy − y1L + x Hy1 − y2L + x1 H−y + y2L Out[48]= 99ξ →     , η →     == x3 Hy1 − y2L + x1 Hy2 − y3L + x2 H−y1 + y3L J ∑ ∑ ∑ ∑ We now can calculate the following four quantities: ÅÅÅÅ ÅÅ xHx, yL, ÅÅÅÅ ÅÅ hHx, yL, ÅÅÅÅ ÅÅ xHx, yL, ÅÅÅÅ ÅÅ hHx, yL. ∑x ∑y ∑y ∑y

In[49]:= Ξ[x_, y_] = (x1 y - x3 y - x

Η[x_, y_] = (x2 y - x1 y + x

y1 + x3 y1 + x y3 - x1 y3)/J; y1 - x2 y1 - x y2 + x1 y2)/J;

In[51]:= {dξdx = D[Ξ[x, y], x], dηdx = D[Η[x, y], x],

dξdy = D[Ξ[x, y], y], dηdy = D[Η[x, y], y]} −y1 + y3 y1 − y2 x1 − x3 −x1 + x2 J J J J

Out[51]= 9   ,  ,  ,   =

∑ ∑ ∑ ∑ We now rewrite ÅÅÅÅ ÅÅ yi Hx, yL ÅÅÅÅ ÅÅ y j Hx, yL + ÅÅÅÅ ÅÅ yi Hx, yL ÅÅÅÅ ÅÅ y j Hx, yL in the form ∑x ∑x ∑y ∑y

Symbolic Computations

424

∑ ij ∑ HeL y Hx, hLz ÿ j ÅÅÅÅÅÅÅÅÅ ji Hx, hL ÿ ÅÅÅÅÅÅ ÅÅÅ jHeL ∑x j k ∑x {

2 2 jijijj ÅÅÅÅ∑ÅÅ ÅÅÅ xHx, yLyz + ijj ÅÅÅÅ∑ÅÅÅÅÅÅ xHx, yLyz zyz + ∑ x ∑ y { k { k k {

2 2 ∑ yz ij ∑ yz zy yz jiij ∑ ij ∑ HeL j ÅÅÅÅÅÅÅÅÅÅ ji Hx, hL ÿ ÅÅÅÅÅÅÅÅÅÅ jHeL j Hx, hL ÿ jj ÅÅÅÅÅÅÅÅÅ hHx, yL + j ÅÅÅÅÅÅÅÅÅÅ hHx, yL z + ∑ x ∑ y ∑h ∑ h { k { { { kk k ij ÅÅÅÅ∑ÅÅÅÅÅ jHeL Hx, hL ÿ ÅÅÅÅ∑ÅÅÅÅÅÅ jHeL Hx, hL + ÅÅÅÅ∑ÅÅÅÅÅÅ jHeL Hx, hL ÿ ÅÅÅÅ∑ÅÅÅÅÅÅ jHeL Hx, hLyz µ j i ∑h j ∑h i ∑x j k ∑x { ∑ ∑ ∑ y ij ∑ z j ÅÅÅÅÅÅÅÅÅ xHx, yL ÿ ÅÅÅÅÅÅÅÅÅ hHx, yL + ÅÅÅÅÅÅÅÅÅÅ xHx, yL ÿ ÅÅÅÅÅÅÅÅÅÅ hHx, yL ∑x ∑y ∑y { k ∑x

and introduce 2 2 Hx3 - x1 L2 + Hy3 - y1 L2 ii ∑ y i ∑ y y A = jjjj ÅÅÅÅÅÅÅÅÅ xHx, yLzz + jj ÅÅÅÅÅÅÅÅÅÅ xHx, yLzz zz J = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J ∑ x ∑ y { k { { kk 2 2 Hx2 - x1 L2 + Hy2 - y1 L2 ii ∑ y y y i ∑ C = jjjj ÅÅÅÅÅÅÅÅÅ hHx, yLzz + jj ÅÅÅÅÅÅÅÅÅÅ hHx, yLzz zz J = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J ∑ y ∑ x k { k { k { ∑ ∑ ∑ ∑ Hy3 - y1 L Hy2 - y1 L + Hx3 - x1 L Hx2 - x1 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . B = ijj ÅÅÅÅÅÅ ÅÅÅ xHx, yL ÅÅÅÅÅÅÅÅÅÅ hHx, yL + ÅÅÅÅÅÅÅÅÅÅ xHx, yL ÅÅÅÅÅÅÅÅÅÅ hHx, yLyz J = - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J ∑x ∑y ∑y k ∑x {

This leads to the following result: ∑ ∑ ∑ ∑ sij = ‡ ijj ÅÅÅÅÅÅ ÅÅÅ yi Hx, yL ÅÅÅÅÅÅÅÅÅÅ y j Hx, yL + ÅÅÅÅÅÅÅÅÅÅ yi Hx, yL ÅÅÅÅÅÅÅÅÅÅ y j Hx, yLyz dxdh ∑x ∑y ∑y { RT k ∑ x ∑ HeL ∑ HeL = A ‡ ÅÅÅÅÅÅÅÅÅ ji Hx, hL ÅÅÅÅÅÅÅÅÅÅ j j Hx, hL dxdh + ∑x UT ∑x ∑ ∑ HeL C ‡ ÅÅÅÅÅÅÅÅÅÅ ji Hx, hL ÅÅÅÅÅÅÅÅÅÅ jHeL j Hx, hL dxdh + ∑h ∑h UT ∑ HeL ∑ HeL ∑ HeL yz i ∑ B ‡ jj ÅÅÅÅÅÅÅÅÅÅ jHeL i Hx, hL ÅÅÅÅÅÅÅÅÅÅ j j Hx, hL + ÅÅÅÅÅÅÅÅÅÅ ji Hx, hL ÅÅÅÅÅÅÅÅÅ j j Hx, hL dxdh. ∑h ∑h ∑x { UT k ∑ x In[52]:= StiffnessMatrixElement[n_Integer?Positive,

i_Integer?Positive, j_Integer?Positive] := (StiffnessMatrixElement[n, i, j] = (* because of symmetry *) StiffnessMatrixElement[n, j, i] = With[{SF = ShapeFunction}, (* sum of the three terms *) A TriangularIntegration[ Expand[D[SF[n, i, ξ, η], ξ] D[SF[n, j, ξ, η], ξ]], {ξ, η}] + C TriangularIntegration[ Expand[D[SF[n, i, ξ, η], η] D[SF[n, j, ξ, η], η]], {ξ, η}] + B TriangularIntegration[ Expand[D[SF[n, i, ξ, η], ξ] D[SF[n, j, ξ, η], η] + D[SF[n, i, ξ, η], η] D[SF[n, j, ξ, η], ξ]], {ξ, η}]]) /; ((i {1, 1}]& A A 2A 2B 2B 2C  + B + C2  + B6 B6 + C6 −   −   0 −   −   2 6 3 3 3 3 A  2

A6 + B6 Out[55]//TableForm=

B6 + C6 2A 2B   −   3 3



B6

− B6

2A 2B −   −   3 3

2B   3

0

2C

0

2B   3

2B 2C −   −   3 3

2A 2B −   −   3 3

0

4A 4B 4C   +   +   3 3 3

4B 4C −   −   3 3

4B   3

0

2B   3

2B   3

4B 4C −   −   3 3

4A 4B 4C   +   +   3 3 3

4A 4B −   −   3 3

2B 2C −   −   3 3

0

2B 2C −   −   3 3

4B   3

4A 4B −   −   3 3

4A 4B 4C   +   +   3 3 3



For a larger order, we will visualize the resulting mass and stiffness matrices. Here are these two matrices shown for n = 10 for the unit triangle. In[56]:= With[{n = 10},

Show[GraphicsArray[ ListDensityPlot[(* scale *) ArcTan[#], PlotRange -> All, Mesh -> False, DisplayFunction -> Identity]& /@ (* calculate exact mass and stiffness matrices *) {MassMatrix[n], StiffnessMatrix[n] /. {A -> 1, C -> 1, B -> 0}}]]] 60

60

50

50

40

40

30

30

20

20

10

10

0

0

10

20

30

40

50

60

0

0

10

20

30

40

50

60

The subject of finite elements contains many other opportunities for programming with Mathematica. For example, we mention algorithms for minimizing the bandwidth of sparse matrices (following, e.g., Cuthill–McKee [424], Gibbs–Poole– Stockmeyer ([723] and [711]), or Sloan [1625]). Because of their special nature, we do not go any further into the explicit implementation of these finite-element computations. Hp,dL

b) We start by implementing the interpolating functions ck,l HxL. Using the function InterpolatingPolynomial , their construction is straightforward for explicitly given integers e, p, d, k, and l. While the unexpanded form has a better stability for numerical evaluation, we expand the functions here to speed-up the integrations to be carried out later. In[1]:= χ[p_, d_][k_, l_, ξ_] :=

Expand[InterpolatingPolynomial[ Table[{j/p, Table[KroneckerDelta[j, k]* KroneckerDelta[l, i], {i, 0, d}]}, {j, 0, p}], ξ]]

Here are two examples: In[2]:= {χ[3, 0][0, 0, ξ], χ[2, 2][1, 1, ξ]}

11 ξ 2

9 ξ3 2

Out[2]= 91 −  + 9 ξ2 −  , −32 ξ3 + 160 ξ4 − 288 ξ5 + 224 ξ6 − 64 ξ7 = H p,dL

We sidestep a moment and visualize some of the ck,l HxL. The function maxAbs[p, d][k, l] calculates the maximum of Hp,dL the absolute value of the ck,l HxL over the x-interval @0, 1D. In[3]:= maxAbs[p_, d_][k_, l_] :=

Module[{f = χ[p, d][k, l, ξ], extξs}, (* solve for extrema *) extξs = Select[N[{ToRules[Roots[D[f, ξ, ξ] == 0, ξ, Cubics -> False, Quartics -> False]]}, 50], (Im[ξ /. #] == 0 && 0 1}}]]]]

The magnitude of the functions decreases quickly with higher-order continuity.

Symbolic Computations

426 In[4]:= With[{p = 4, d = 4},

Table[{j, Max[Table[maxAbs[p, d][i, j], {i, 0, p}]] // N}, {j, 0, d}]] Out[4]= 880, 5.69702 Identity, FrameTicks -> None, PlotRange -> All, Frame -> True, Axes -> False] Show[GraphicsArray[#]]& /@ Table[ Table[graph[µ, µ][k, l], {l, 0, µ}, {k, 0, µ}], {µ, 3}]

Solutions

427

H p,dL

Before starting the implementation of the functions to solve the eigenvalue problem, we will renumber the ck,l . For fixed p Hp,dL Hp,dL and d, we want to number the functions ck,l HxL = ch HxL using one index to easily assemble the global finite element matrices. We number them consecutively with increasing k, and within each k with increasing l. The function reducesIn dices does the inverse: given the linear numbering h, it generates the pairs Hk, lL. In[10]:= reducesIndices[p_, d_][h_] :=

Sequence[Floor[h/(d + 1)], h - (d + 1) Floor[h/(d + 1)]]

Here are the sixteen pairs corresponding to cH3,3L h HxL. In[11]:= Table[{k, {reducesIndices[3, 3][k]}}, {k, 0, 15}] Out[11]= 880, 80, 0 0.552822387840412}}

We check the quality of the last solution by carrying out the analogous high-precision minimum finding.

Solutions

433 In[32]:= E0HP[k_Real, c_Real, p_] := E0[SetPrecision[k, p], SetPrecision[c, p]] In[33]:= FindMinimum[E0HP[k, c, 40], {k, 676/1000, 677/1000},

{c, 552/1000, 553/1000}, WorkingPrecision -> 40, AccuracyGoal -> 30, PrecisionGoal -> 12] // InputForm Out[33]//InputForm= {-1.087601654783025491545086158701827384862564482964963290073`40.000000000000014, {k -> 0.676676064354807845758317031858668238295065265493370387719`40., c -> 0.552836442352877515708540883326376881666840781036556972182`40.}}

One could go a few steps more on the symbolic side by producing a polynomial equation for l in the following manner. Make Input

(* generate polynomial *) det = Factor[Numerator[Together[Det[dMat[k, c]]]]]/c^16; (* the two equations *) {eqk, eqc} = Factor[{D[det, k], D[det, c]}] (* degrees of the two polynomials in c, k, and l *) Print[Exponent[#, {c, k, l}]& /@ {det, eqk, eqc}]; (* find solution *) FindRoot[Evaluate[# == 0& /@ {det, eqk, eqc}], {c, 55/100}, {k, 76/100}, {l, -108/100}, WorkingPrecision -> 22, MaxIterations -> 40]

8848, 12, 6 0) /. e[b] -> e, evEq[3], e]]]] // Timing Out[20]= 80.06 Second, 880.804175, 1.72205 0) /. e[b] -> e, evEq[n]}] In[30]:= Timing[frSolve[3, {12/10, 18/10}]] Out[30]= 80.04 Second, 88e → 0.8074145723427270178250477, b → 1.203732086388840409673660 "Times"]& /@ {"order", "e", "b"}}] order e b 1 0.81250000000000000000 1.4142135623730950488 2 0.80417481745966978669 1.7220450774801061761 Out[31]//TableForm= 3 0.80417481745966978669 1.7220450774801061761 4 0.80380028862649106880 1.9072606757405776050 5 0.80380028862649106880 1.9072606757405776050 6 0.80379477116055950769 1.4099008797774434924

9. Hyperspherical Coordinates, Constant Negative Curvature Surface a) Here is the computation of the Jacobian for the change of coordinate systems. The use of Outer permits a short, elegant, and fast implementation. In[1]:= x[dim_][n_] := x[dim][n] = r Product[Sin[ϑ[i]], {i, n - 1}] Cos[ϑ[n]];

(* the last coordinate *) x[dim_][dim_] := x[dim][dim] = r Product[Sin[ϑ[i]], {i, dim - 1}] var[n_] := var[n] = Union[Array[ϑ, n - 1], {r}]

Now, we apply Simplify to simplify the resulting sums of products of trigonometric functions. In[5]:= NaivJacobiDeterminant[dim_] :=

Simplify[Det[Outer[D, Array[x[dim], dim], Union[Array[ϑ, dim - 1], {r}]]]]

Symbolic Computations

438

For comparison, consider the following FastJacobiDeterminant , which works only with the identity sinHxL2 + cosHxL2 = 1 (in two slightly different versions at two stages). In[6]:= FastJacobiDeterminant[dim_] := Factor[

(Det[Outer[D, Array[x[dim], dim], Union[Array[ϑ, dim - 1], {r}]]] //. {a_ Cos[x_]^2 + a_ Sin[x_]^2 -> a})] /. {Cos[x_]^2 + Sin[x_]^2 -> 1}

Here are the computations of some Jacobian determinants with the times required. In[7]:= timings[k_Integer] := {k, {Timing[NaivJacobiDeterminant[k]],

Timing[FastJacobiDeterminant[k]]}} In[8]:= Table[timings[k], {k, 2, 7}] Out[8]= 882, 880.01 Second, r 0, x[ϕ] -> x},

(* algebraic relation between Sin and Cos *) Sin[ϕ]^2 + Cos[ϕ]^2 - 1}, {Cos[ϕ], Cos[ϕMax], h, l}, {Sin[ϕ], x}, MonomialOrder -> EliminationOrder] /. {Cos[ϕ] -> c, Cos[ϕMax] -> cm} // Factor Out[14]= 8c2 H3 c − 2 cmL l H−h − l + c lL H−h + c2 h − l + c2 l + c3 l + cm l − 2 c2 cm lL


a ArcTan[(x - y)/(1 + x y)] // Simplify i j j j j 1 j−ArcTan@Csc@ϑD Sec@ϕDD Cos@ϑD −   Out[9]= 3 j j è!!!! j j 2! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3 + Cos@2 ϕD j j j k ϑ E TanA  è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! i i 2 j j ArcTanA    E H−2 Cos@ϕD + 2 3 + Cos@2 ϕD L j j j j "############################################################################################################### è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # j j 2+Cos@2 ϕD− 2 Cos@ϕD 3+Cos@2 ϕD j j j  jCos@ϕD j       + j è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! j j è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! j j j j 2 + Cos@2 ϕD − 2 Cos@ϕD 3 + Cos@2 ϕD j j j j k k ϑ E TanA 

y y 2 z z z ArcTanA   # E H2 Cos@ϕD + è!!!! 2! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3 + Cos@2 ϕD L y z z z z z z "############################################################################################################### z z z 2+Cos@2 ϕD+è!!!!! 2 Cos@ϕD è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3+Cos@2 ϕD z z z z z z        z z z ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! z z z è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! z z z z z z 2 + Cos@2 ϕD + 2 Cos@ϕD 3 + Cos@2 ϕD z z zz zz {{{

We rewrite the last result in a slightly more condensed form. In[10]:= int2Indef = -3 ArcTan[Csc[ϑ] Sec[ϕ]] Cos[ϑ] -

(3 Sqrt[2] ArcTanh[(Sqrt[-3 - Cos[2 ϕ]] Tan[ϑ])/Sqrt[2]] Cos[ϕ])/ Sqrt[-3 - Cos[2 ϕ]]; In[11]:= D[int2Indef, ϑ] - int1 // Simplify Out[11]= 0

This indefinite integral int2Indef is a continuous function of j and J over the integration domain. In[12]:= With[{∂ = 10^-6}, Show[GraphicsArray[

ParametricPlot3D[{ϕ, (* map from rectangular plotparameter domains *) τ ArcTan[1/Sin[ϕ]], #[int2Indef] /. ϑ -> τ ArcTan[1/Sin[ϕ]]}, {ϕ, ∂, 2Pi/4 - ∂}, {τ, ∂, 1 - ∂}, DisplayFunction -> Identity, PlotRange -> All, PlotLabel -> #]& /@ (* show real and imaginary part *) {Re, Im}]]]

Symbolic Computations

682

0.5

1

1.5 Re

0

1

-3.5

0

0.5

1

0 Im0.5 1.5

1

1.5

0.5

-4

0

-4.5 0

-0.5 0.5

-1 1

1.5

The value of int2Indef at J = p ê 2 cannot be determined by substitution; we need to take the limit “by hand”. In[13]:= int2Upper = Assuming[0 < ϕ < Pi/4,

3 π Cos@ϕD 2 3 + Cos@2 ϕD

Limit[int2Indef,

ϑ -> Pi/2, Direction -> +1]]

Out[13]= −   è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The lower limit is easy to calculate. int2Indef /. ϑ -> ArcTan[1/Sin[ϕ]] // Simplify[#, 0 < ϕ < Pi/4]& è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! 3+Cos@2 ϕD Csc@ϕD è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   E Cos@ϕD 3 2 ArcTanA  è!!!!! 3 ArcTanA 1 + Csc@ϕD2 Tan@ϕDE 2     −  Out[14]= −    è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3 + Cos@2 ϕD 1 + Csc@ϕD2 In[14]:= int2Lower =

Carrying out the remaining definite integral over j confirms our conjecture that the value of the integral is p2 ê 32. In[15]:= FullSimplify[int2Upper - int2Lower, 0 < ϕ < Pi/4]

3 π Cos@ϕD 2 3 + Cos@2 ϕD

è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3+Cos@2 ϕD Csc@ϕD 2! ArcTanA    E Cos@ϕD 3 è!!!! è!!!!!

è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3 ArcTanA 1 + Csc@ϕD2 Tan@ϕDE

2     +  Out[15]= −   +    è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2

3 + Cos@2 ϕD

1 + Csc@ϕD

In[16]:= Integrate[(* slightly simplified form of the integrand *)

(3 Cos[ϕ] ((2 ArcTanh[(Sqrt[-3 - Cos[2 ϕ]] Csc[ϕ])/Sqrt[2]])/ Sqrt[-3 - Cos[2 ϕ]] - Pi/Sqrt[3 + Cos[2 ϕ]]))/Sqrt[2] + (3 ArcTan[Sqrt[1 + Csc[ϕ]^2] Tan[ϕ]])/Sqrt[1 + Csc[ϕ]^2], {ϕ, 0, Pi/4}] Out[16]=

π2  32

c) A direct attempt to evaluate the integral fails (not unexpectedly, else it would not be an exercise in the GuideBooks). In[1]:= integrand = (x^2 + x y + y^2)^ν Exp[-(x + y)];

Integrate[integrand, {x, 0, Infinity}, {y, 0, Infinity}] ∞

Out[2]= ‡

0



ν

−x−y Hx2 + x y + y2 L  y  x ‡  0

An attempt to evaluate the integral in polar coordinates works. In[3]:= intPolar = integrand /. {x -> r Cos[ϕ], y -> r Sin[ϕ]} // Simplify ν

Out[3]= −r HCos@ϕD+Sin@ϕDL Hr2 H1 + Cos@ϕD Sin@ϕDLL

In[4]:= Integrate[intPolar r, {r, 0, Infinity}, {ϕ, 0, Pi/2},

Out[4]=

Assumptions :> Re[ν] > -1] −ν i 1  ! −ν j z jI− − è!!!!   j ! y 3M i j−  z Gamma@2 H1 + νLD è!!!!! è!!!! H− + 3 L H1 + 2 νL k k + 3 { ν ij y i 1 +  è!!!! 3! z 2 è!!!! 3! è!!!! ! j jj−  ! z I + 3 M Hypergeometric2F1A−1 − 2 ν, −ν, −2 ν,  ! E − è!!!! − + è!!!! 3 kk  + 3 { è!!!!! ν ! è!!!! y y y i 1 −  3 3 2 z z z Hypergeometric2F1A−1 − 2 ν, −ν, −2 ν,  j  ! z ! Ezz 2j è!!!! è!!!!  + 3 {{ k − + 3 {

The result for this manifestly real integral contains i. We try another approach to obtain an explicitly real result. The structure of the integrand strongly suggests using the new variable u = x + y. A natural companion of this variable is v = x - y. This is the integrand after the change of variables.

Solutions

683 In[5]:= intpm = (integrand /. Solve[{u == x + y, v == x - y}, {x, y}][[1]])/

Out[5]= 2−1−2 ν

(* functional determinant from change of variables *) (Outer[D, {x + y, x - y}, {x, y}] // Det // Abs) // Factor //@ #& ν −u H3 u2 + v2 L

A moment of reflection shows that the new limits are u : 0 …¶, v : -u … u. Now, we obtain an explicit result for the integral in terms of a product of a Gamma function and a Gauss hypergeometric function. In[6]:= Integrate[intpm, {u, 0, Infinity}, {v, -u, u}]

3 ν 1 3 1 4 2 2 3 If@Re@νD > −1, Gamma@2 + 2 νD, Integrate@−u u1+2 ν , 8u, 0, ∞ Log[Factor[Together[a]]]]&, TrigToExp[expr]] In[7]:= (* calculate the indefinite integral wrt x, y, and z *) Short[indefiniteIntegral = Integrate[# 2(1 - z), z]& /@ Expand[logRewrite[ Integrate[Integrate[Sqrt[x^2 + y^2 + z^2] * 2(1 - x), x] 2(1 - y), y]]], 8] 1024 z 4 y3 z y4 z 1024 1 1  + 92 + Out[8]//Short=  −  +  −  405 9 4 1215 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! y i 4 Ix2 +  x z + y Iy + x2 + y2 + z2 MM z 1 2 j  x4 j    Ez z j z+ j4 z − z + 8 + x H2  + xL LogA−  4 H2 −  xL x y2 Hx +  zL { k i 1 j 4 3 2 2 2   j j−30 H4 x + y H−5  + 4 yLL z − 15 H5 x + H5 + 4  yL y L z + 450 j k 10 H4 x2 + y H−5  + 4 yLL z3 + 15 H5 + 2  yL z4 − 48 z5 + 5 + 15 H5 + 4  yL y4 Log@y2 + z2 D + è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 15 x H3 x4 + 10 x2 y H−2  + yL + 5 y3 H−4  + 3 yLL LogAz + x2 + y2 + z2 E + è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! 2 2 2 2 40 Ix + y Hy −  zL + x x + y + z M 30 H5 + 4  yL y4 LogA     E + x2 y4 H−5  + 4 yL Hy −  zL è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! 4 2 2 2 2 2 30 z H−5 + 4 zL LogAx +  y z + z + x x + y + z E + è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 40 Ix2 −  x z + y Iy + x2 + y2 + z2 MM 15 H5 + 4  xL x4 LogA     E + x4 H−5  + 4 xL y2 Hx −  zL è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! 40 Ix2 +  x z + y Iy + x2 + y2 + z2 MM y 1 z 15  x4 H5  + 4 xL LogA−     Ez z −   H 1 L z 4 2 450 x H5  + 4 xL y Hx +  zL { In[9]:= (* replace limit procedure *)

replaceLimits[expr_, xyz_] := Module[{exprNew = Expand[logRewrite[expr]] /. (* get rid of terms that would produce 0 Infinity and that in the limit give 0 *) xyz^n_?Positive Log[xyz] -> 0, δ}, δ = (exprNew /. xyz -> 1) - (exprNew /. xyz -> 0); (* in case direct substitution fails, use series expansion *) If[δ === Indeterminate, Normal[Series[exprNew, {xyz, 1, 0}]] Normal[Series[exprNew, {xyz, 0, 0}]], δ]] In[11]:= (* substitute all limits *) Out[12]=

Fold[replaceLimits, indefiniteIntegral, {z, y, x}] // Together 1 è!!!!! è!!!!!  I16 + 68 2 − 24 3 + H21 − 84 L Log@1 − D + 420 è!!!!! è!!!!! H21 + 84 L Log@1 + D − 189 Log@2D + 42 Log@1 + 2 D + 42 Log@2 + 2 D + è!!!!! è!!!!! è!!!!! 378 Log@1 + 3 D − H21 − 84 L Log@H2 − L + 3 D − H21 + 84 L Log@H2 + L + 3 DM

In[13]:= FullSimplify[%] Out[13]=

1 è!!!!! è!!!!!  I16 + 68 2 − 24 3 − 28 π + 42 ArcSinh@1D − 420 è!!!!! è!!!!! è!!!!! 168 Log@2D + 42 Log@2 + 2 D + 378 Log@1 + 3 D − 21 Log@4 I2 + 3 MDM

In[14]:= N[%] Out[14]= 0.661707

Collecting

all logarithms, the last è!!!! 1ê2 è!!!! logI4 I3 I3 + 2 2 MM + 7 2 + 7M ë 5.

result

can

be

further

simplified

to

Here is the comparison with a numerical simulation. In[15]:= Compile[{{n, _Integer}},

Module[{sum = 0.}, Do[sum = sum + Sqrt[(Random[] - Random[])^2 +

I4 + 17

è!!!! è!!!! 2 - 6 3 - 7 pM ë 105+

Solutions

685 (Random[] - Random[])^2 + (Random[] - Random[])^2], {n}]; sum/n]][10^6] Out[15]= 0.661383

Carrying out the 3D integration numerically also yields a similar result, namely 0.661707. In[16]:= NIntegrate[2(1 - x) 2(1 - y) 2(1 - z) Sqrt[x^2 + y^2 + z^2],

{x, 0, 1}, {y, 0, 1}, {z, 0, 1}] Out[16]= 0.661707

In a similar way, we could calculate the average line length in a triangle. For the triangle with vertices 80, 0 ζ^2 // PowerExpand) 2 ζ dim 2 è!!!!! −1 + ζ−2 dim I−1 + −ζ + π ζ Erf@ζDM Out[20]= −     è!!!!! 2  π ζ

We canonicalize the integrand by reducing powers of z in the denominators through partial integration. We do not keep the integrated parts explicitly. From the form of the integrand, we see that at infinity they do not contribute and the contributions from the origin cancel the singular contributions from the remaining integrals. Instead, we drop all terms that at are singular at the origin at the end. In[21]:= (* use linearity and extract prefactors *)

partialIntegrate[p_Plus] := partialIntegrate /@ p; partialIntegrate[a_?NumericQ b_] := a partialIntegrate[b] (* the main partial integration rule; drop endpoint contributions *)

Symbolic Computations

686

partialIntegrateRule = partialIntegrate[a_ ζ^n_?(# < -1&)] :> -partialIntegrate[(1/(n + 1) ζ^(n + 1)) D[a, ζ]]; In[26]:= dropSingularTerms[expr_, ζ_] := expr - Normal[Series[expr, {ζ, 0, -1}]] In[27]:= makeReducedIntegrand[dim_, ζ_] := dropSingularTerms[#, ζ]& @

(FixedPoint[ExpandAll[# /. partialIntegrateRule]&, partialIntegrate[ExpandAll[integrand[dim, ζ]]]] /. partialIntegrate -> Identity)

Here are the resulting 1D integrals for the average distances for the first four dimensions. In[28]:= Table[makeReducedIntegrand[d, ζ], {d, 4}] // Simplify // TraditionalForm Out[28]//TraditionalForm=

2 2 2 è!!!!! 2 ‰-2 z I4 I1 + ‰z M z + 5 ‰z p erfHzLM 2 ‰-z : ÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅÅ Å ÅÅÅ , ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , è!!!!! è!!!!! 3 p 15 p z 2 2 2 2 è!!!!! 2 2 ‰-3 z I-42 ‰2 z p z erfHzL2 + 21 ‰z I4 + ‰z M p erfHzL + 4 I-9 + 17 ‰z + 2 ‰2 z M zM ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , è!!!! ! 105 p z

1 2 2 2 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅ!ÅÅÅÅÅÅ I‰-4 z I-252 ‰3 z p3ê2 erf HzL3 - 144 ‰2 z I17 + 4 ‰z M p z erfHzL2 + è!!!! 1890 p z 2 2 2 è!!!!! 2 2 2 9 ‰z I197 + 208 ‰z + 15 ‰2 z M p erf HzL + 4 I-338 + 216 ‰z + 219 ‰2 z + 8 ‰3 z M zMM>

And for dimensions 1, 2, 3, we recover the above-calculated results. In[29]:= Table[Integrate[makeReducedIntegrand[d, ζ], {ζ, 0, Infinity}], {d, 3}] //

Simplify 1 1 è!!!!! 2 + 5 ArcSinh@1DM, 3 15 1 i 1 y è!!!! ! è!!!!!  j ! Ez j4 + 17 2 − 6 3 − 7 π + 21 ArcSinh@1D + 84 ArcSinhA  z= è!!!! 105 k 2 {

Out[29]= 9  ,  I2 +

The average distances for d = 4 can with some effort be integrated in closed form, but the resulting 1D integral can easily be integrated numerically. For an asymptotic expansion for the k-dimensional case, see [57]; for the shape that minimizes the average value of the distance, see [146]. e) The "unpleasant" term is the square root in the denominator. It makes the integrand nonfactorizable. By using the inverse Laplace transform HxL of the square root function, we can make it factorizable. In[1]:= InverseLaplaceTransform[1/Sqrt[x], x, p] Out[1]=

1  ! è!!!!! è!!!! p π

Here is the resulting integral after exchanging the integration order. ¶

¶ ¶ ¶ yz 1 ijjj 1 z -sHx+y+zL -x-y-z j e sinHa x + b y + c zL dz d y dxzzzz ds . Ha, b, cL = ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ · ÅÅÅÅÅÅÅÅ è!!!! è!!!ÅÅÅÅ!Å jjj‡ ‡ ‡ e z p s { k0 0 0 0

This yields the following input for the calculation of Ha, b, cL. Mathematica can calculate the resulting fourfold integral. In[2]:= 1/Sqrt[Pi] Integrate[

Integrate[1/Sqrt[s] Exp[-(1 + s) (x + y + z)] Sin[a x + b y + c z], {x, 0, Infinity}, {y, 0, Infinity}, {z, 0, Infinity}, Assumptions -> Re[s] > 0, GenerateConditions -> False], {s, 0, Infinity}] // (* abbreviate *) Short[#, 6]& 1 ! Out[2]//Short=  è!!!! bc π IfAH−1 ≤ Im@aD ≤ 1 »» Re@aD ≠ 0L && H−1 ≤ Im@bD ≤ 1 »» Re@bD ≠ 0L && H−1 ≤ Im@cD ≤ 1 »» Re@cD ≠ 0L,

Solutions

687

1

1 −  + 33 +  ,

1

1 è!!!!!!! è!!!!!!! è!!!!!!! b H1 + sL2 I c2 Abs@cD + a2 c Sign@aDM + b2 Abs@bD Hc H 1 L2 − 1 L        , IntegrateA  ! è!!!! 2 2 2 s Ha + H1 + sL L Hb + H1 + sL2 L Hc2 + H1 + sL2 L 8s, 0, ∞ GaussKronrod]}] Out[4]= 80.0263132 − 0.0115489 , 0.0263161 − 0.0115477 
b], b -> c], {c, 1, 0}]]]]/Sqrt[Pi]]] 3 è!!!!! I1 + 2 M π#  "############################## 32

For real a, b, c, we would prefer a manifestly real result. By using the following two simplifications, we arrive at the expression Real[a, b, c]. In[7]:= FullSimplify[Sqrt[abc - I] Sqrt[abc + I], abc > 0] Out[7]=

è!!!!!!!!!!!!!!!!!!!!!! ! 1 + abc2

In[8]:= ComplexExpand[FunctionExpand[Sqrt[-I/Sign[abc - I]] Sqrt[Sign[abc - I]]],

TargetFunctions -> {Re, Im}] // Simplify[#, abc > 0]& 1 2

1 2

Out[8]= CosA  H−ArcTan@abcD + ArcTan@abc, −1DLE +  SinA  H−ArcTan@abcD + ArcTan@abc, −1DLE In[9]:= f[a_, b_, c_] = -Sqrt[2] (a - b) Sqrt[1 + a^2] Sqrt[1 + b^2]*

Sqrt[c^2]/c Sqrt[Sqrt[1 + c^2] - 1]; (* integral is a symmetric function in a, b, c *) Real[a_, b_, c_] = Sqrt[Pi] (f[a, b, c] + f[b, c, a] + f[c, a, b])/ (2 (a - c) (b - c) (a - b)* Sqrt[1 + a^2] Sqrt[1 + b^2] Sqrt[1 + c^2]) è!!!!!!!!!!!!!!!! # è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! ! è!!!!!!! "################################## i ji j è!!!! 2 a2 −1 + 1 + a2 1 + b2 Hb − cL 1 + c2 j j j j Out[11]= j     − j−  j a jj j kk è!!!!!!! "################################## è!!!!!!!!!!!!!!!! # è!!!!!!!!!!!!!!!! è!!!!! è!!!!!!!!!!!!!!!! 2 1 + a2 b2 −1 + 1 + b2 H−a + cL 1 + c2      − b è!!!!!!!!!!!!!!!! # y è!!!!!!!!!!!!!!!! è!!!!!!! "################################## è!!!!! è!!!!!!!!!!!!!!!! y 2 1 + a2 Ha − bL 1 + b2 c2 −1 + 1 + c2 z è!!!!! z z z ì      z πz z z z z z z c { { è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! I2 1 + a2 Ha − bL 1 + b2 Ha − cL Hb − cL 1 + c2 M

For a = b = c = 1, we again obtain the result 3 ê 32 H1 + 21ê2 L

1ê2

.

In[12]:= Series[Series[Real[a, b, c], {b, a, 0}], {c, a, 0}] // Normal // FullSimplify

3

è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!!!! a2 Ia6 + a2 I3 − 5 1 + a2 M + a4 I8 − 5 1 + a2 M + 4 I−1 + 1 + a2 MM "####### π è!!!!!!!!!!!!!!!! 3 2 2 8 a H1 + a L I−1 + 1 + a M

Out[12]= −       2 5ê2 In[13]:= % /. a -> 1 // FullSimplify Out[13]=

3 è!!!!!  "############################## I1 + 2 M π# 32

For similar integrals, see [1361]. For some more challenging multidimensional integrals, see [675], [816], [1363]. f) A direct call to Integrate does not give a result. In[1]:= integrand =

(2 Cos[x] - Cos[x - y - z] - Cos[x - y + z])/ (y^2 (x - z)^2);

In[2]:= Integrate[integrand, {x, 0, Infinity}, {y, 0, x}, {z, 0, y}] ∞

Out[2]= ‡

0

x



0

1   Hx Cos@xD − 2 y Cos@xD + x Cos@x − 2 yD − x y2 H−x + yL 2 x Cos@x − yD + 2 y Cos@x − yD + 2 x Hx − yL Cos@x − yD CosIntegral@−xD Sin@xD − 2 x Hx − yL Cos@x − yD CosIntegral@−x + yD Sin@xD − x2 Cos@2 x − yD SinIntegral@xD + x y Cos@2 x − yD SinIntegral@xD − x2 Cos@yD SinIntegral@xD + x y Cos@yD SinIntegral@xD + x2 Cos@2 x − yD SinIntegral@x − yD − x y Cos@2 x − yD SinIntegral@x − yD + x2 Cos@yD SinIntegral@x − yD − x y Cos@yD SinIntegral@x − yDL  y  x

Carrying out a properly seeded numerical Monte–Carlo integration yields a value that is suspiciously near to -2 p. In[3]:= NIntegrate[Evaluate[integrand], {x, 0, Infinity}, {y, 0, x}, {z, 0, y},

Method -> MonteCarlo[Floor[2Pi^Pi]], MaxPoints -> 10^6] Out[3]= −6.28195

Solutions

689

Frequently integrals ranging from 0 to ¶ are easier to carry out than integrals with finite limits; so, we try to carry out the x-integration first. But the inner integral limit limits depend on the variable x. So, we change the inner integration variables to have parameter-free limits. In[4]:= newIntegrand = x (y integrand /. z -> Z y) /. y -> Y x Out[4]=

2 Cos@xD − Cos@x − x Y − x Y ZD − Cos@x − x Y + x Y ZD      Y Hx − x Y ZL2

Now, it is possible to carry out the outer x-integral. In[5]:= Integrate[newIntegrand, {x, 0, Infinity}, Out[5]=

Assumptions -> Element[{Y, Z}, Reals]] π H−2 + Abs@1 + Y H−1 + ZLD + Abs@−1 + Y + Y ZDL      2 Y H−1 + Y ZL2

And the inner two integrals, now over the unit square, are also easily done now. As conjectured, the result of the triple integral is -2 p. In[6]:= Integrate[%, {Y, 0, 1}, {Z, 0, 1}] Out[6]= −2 π

36. Duffing Equation, Secular Terms a) Here, a series for y[t] is implemented. In[1]:= Y = Sum[∂^i y[i][t], {i, 0, 6}] + O[∂]^7 Out[1]= y@0D@tD + y@1D@tD ∂ + y@2D@tD ∂2 + y@3D@tD ∂3 + y@4D@tD ∂4 + y@5D@tD ∂5 + y@6D@tD ∂6 + O@∂D7

We substitute the series into the differential equation. In[2]:= eqs = Factor[Numerator[Together[#]]]& /@

CoefficientList[Normal[D[Y, {t, 2}] + Y + ∂ Y^3], ∂];

The first equation becomes the following. In[3]:= eqs[[1]] Out[3]= y@0D@tD + y@0D @tD

Taking the initial conditions into account, the solution is simply cos. In[4]:= solList = {y[0] -> (Cos[#]&)} Out[4]= 8y@0D → HCos@#1D &L
Subscript[c, "c", µ] Cos[t], C[_] Sin[t] :> Subscript[c, "s", µ] Sin[t]} Out[11]= 99x1 @tD → J2 c2s,0 Cos@2 tD J2 c2s,0 Cos@tD ω1 cs,0 t Sin@tD ω1 cs,0 Cos@tD cc,1 +   +    +   −    + Sin@tD cs,1 == 2 ω0 ω0 4 ω20 12 ω20

To get a periodic solution for x1 HtL, we cannot afford the term cs,0 t sinHtL w1 ê w0 . In general, the secular terms (meaning linearly growing in t) of the form t periodicFunctionInt spoil the periodicity and must be eliminated [1185]. In[12]:= secularTerms = Plus @@ Cases[dsol[[1, 1, 2]], t^_. _] Out[12]=

t Sin@tD ω1 cs,0    ω0

With the wk , k ¥ 1 to be determined, we get the condition w1 = 0 for a periodic x1 HtL. In[13]:= ωCondition = Factor //@ Solve[secularTerms == 0, Subscript[ω, µ]] Out[13]= 88ω1 → 0

Function[t, Evaluate[dsolG[[1, 1, 2]]]]] Out[16]= 9x0 → Function@t, cs,0 Cos@tDD,

J2 c2s,0 Cos@2 tD J2 c2s,0 x1 → FunctionAt, Cos@tD cc,1 +   −    + Sin@tD cs,1 E= 4 ω20 12 ω20

It seems now straightforward to wrap up the last inputs in a Do-loop to calculate x2 HtL to x10 HtL. We just expect all results to become a bit larger for the higher orders. Unfortunately they do not just become a bit larger, but considerable larger. So before calculating the higher orders of the xk HtL we will pause a moment and ponder about some optimizations. For the higher orders, the inhomogeneous term in w20 x≥k HtL + w20 xk HtL = pk will be a large sum. When DSolve calculates the inhomogeneous solution, DSolve will carry out integrals of the form Ÿ sinHtL pk dt and Ÿ cosHtL pk dt. These integrals will take a while to evaluate for large expressions pk with head Plus. So, we implement an optimized function  for this purpose. It carefully constructs the solution of w20 x≥k HtL + w20 xk HtL = pk . The solution is In[17]:= (* general solution *)

sol = c1 Cos[t] + c2 Sin[t] Cos[t] Integrate[pk[t] Sin[t], t] + Sin[t] Integrate[pk[t] Cos[t], t];

Solutions

693 (* check *) D[sol, t, t] + sol - pk[t] // Simplify Out[20]= 0 In[21]:= [lhs_ == 0, Subscript[x_, µ_][t_], t_] :=

Module[{f = Expand[lhs - Subscript[ω, 0]^2 * (Subscript[x, µ]''[t] + Subscript[x, µ][t])]}, {{Subscript[x, µ][t] -> Expand[ (* homogeneous solution *) Subscript[c, "c", µ] Cos[t] + Subscript[c, "s", µ] Sin[t] (* inhomogeneous solution *) (-Cos[t]   [f Sin[t], t] + Sin[t]   [f Cos[t], t])/Subscript[ω, 0]^2]}}]

We handle the integrals Ÿ sinHtL pk dt and Ÿ cosHtL pk dt with the specialized function    . This function first collects the terms of pk with respect to sina HtL cosb HtL, and then uses a look-up for these integrals. In[22]:=   [f_, t_] := With[{ = Expand[f]},

If[Head[] === Plus,    [, t], Integrate[, t]]]

In[23]:=    [f_, t_] :=

Module[{cosSinPoly, coeffs}, cosSinPoly = Expand[Plus @@ (TrigExpand /@ (List @@ Expand[f]))]; (* collect wrt powers of Sin[t] and Cos[t] *) coeffs = Internal`DistributedTermsList[cosSinPoly, {Cos[t], Sin[t]}][[1]]; (* integrate and expand *) Expand[Plus @@ ((CosSinIntegral[#1] #2)& @@@ coeffs)]] In[24]:= (* cached integrals *)

CosSinIntegral[{m_, n_}] := CosSinIntegral[{m, n}] = TrigExpand[Integrate[Cos[t]^m Sin[t]^n, t]]

By adding some other optimizations (like preprocessing the differential equation using Together before substituting the already calculated results for the xk HtL), we have the following modification of the above code for x1 HtL. Now it takes a couple of minutes to calculate x2 HtL to x10 HtL. In[26]:= Do[(* the ODE for the current order *)

ode = Together[εTerms[[µ + 1]]] //. xRules //. ωRules; (* solve ODE *) dsol = [ode == 0, Subscript[x, µ][t], t]; (* secular terms *) secularTerms = Factor[Plus @@ Cases[dsol[[1, 1, 2]], t^_. _]]; (* condition for the current ω *) ωCondition = Factor //@ Solve[secularTerms == 0, Subscript[ω, µ]]; (* update ωRules and ωRules *) ωRules = AppendTo[ωRules, ωCondition[[1, 1]]]; dsolG = ExpandAll[dsol //. ωRules]; xRules = AppendTo[xRules, Subscript[x, µ] -> Function[t, Evaluate[dsolG[[1, 1, 2]]]]], {µ, 2, o - 2}]

The resulting conditions on the wk are of the form wk = f Hw0 , J2 , …, Jk+1 , cc,0 , …, cc,k-2 , cs,1 , …, cs,k-2 L. As a function of k, they quickly grow in size. In[27]:= {ByteCount /@ ωRules, LeafCount /@ ωRules,

(* number of terms in the sum *) Length[Cases[#, _Plus, Infinity][[1]]]& /@ Rest[ωRules]} Out[27]= 8896, 768, 792, 4184, 4664, 15344, 21432, 58936, 84952, 196648 2s/(1 + s^2), Cos[ϑ] -> (1 - s^2)/(1 + s^2)}) 8− 2 s + x + s2 x, − 1 + 3 s2 − 3 s4 + s6 + 2 y + 6 s2 y + 6 s4 y + 2 s6 y
80, Contours -> {0}], (* parametrized rotated curve *) ParametricPlot3D[Evaluate[ {{1, 0, 0}, {0, Cos[ϕ], Sin[ϕ]}, {0, -Sin[ϕ], Cos[ϕ]}}. {Sin[ϑ], 1/2 Cos[ϑ]^3, 0}], {ϕ, 0, Pi}, {ϑ, 0, 2Pi}, PlotPoints -> {20, 21}]}]]] 1 0.5 0

-0.5 -1 - 1.5 - 1 - 0.5

0

0.5

1

1.5

First, we generate a rational parametrization for the spindle.

Solutions

695 In[5]:= {x, y, z} - {Sin[ϑ], Cos[ϕ] Cos[ϑ]^3/2, -Cos[ϑ]^3 Sin[ϕ]/2} /.

{Sin[ϑ] -> 2 s/(1 + s^2), Cos[ϑ] -> (1 - s^2)/(1 + s^2), Sin[ϕ] -> 2 u/(1 + u^2), Cos[ϕ] -> (1 - u^2)/(1 + u^2)} H1 − s2 L3 u 2s H1 − s2 L3 H1 − u2 L  + y,   + z= Out[5]= 9− 2 + x, −  1+s 2 H1 + s2 L3 H1 + u2 L H1 + s2 L3 H1 + u2 L

Then, we generate an equivalent system of polynomials. In[6]:= Numerator[Together[#]]& /@ % Out[6]= 8−2 s + x + s2 x, −1 + 3 s2 − 3 s4 + s6 + u2 − 3 s2 u2 + 3 s4 u2 −

s6 u2 + 2 y + 6 s2 y + 6 s4 y + 2 s6 y + 2 u2 y + 6 s2 u2 y + 6 s4 u2 y + 2 s6 u2 y, u − 3 s2 u + 3 s4 u − s6 u + z + 3 s2 z + 3 s4 z + s6 z + u2 z + 3 s2 u2 z + 3 s4 u2 z + s6 u2 z
EliminationOrder] Out[7]= 8H−1 + xL2 H1 + xL2 H−1 + 3 x2 − 3 x4 + x6 + 4 y2 + 4 z2 L
{30, 20, 20}, MaxRecursion -> 0, PlotRange -> All]

In this case, we could have obtained the implicit equation easier. Because the implicit equation of the cross section had the form p1 HxL + p2 HyL, because of symmetry, the 3D polynomial must have the form p1 HxL + p2 HyL + p2 HzL. b) Instead of taking x==(Cos[ϕ] Sin[ϑ])^(1/3) , we use x^3==Cos[ϕ] Sin[ϑ] . This has the advantage that everything is polynomial in x, y, and z. Here, rational parametrizations for the trigonometric expressions that parametrically define a sphere are constructed. In[1]:= {x^3, y^3, z^3} - {Cos[ϕ] Sin[ϑ], Sin[ϕ] Sin[ϑ], Cos[ϑ]} /.

{Sin[ϑ] -> 2 s/(1 + s^2), Cos[ϑ] -> (1 - s^2)/(1 + s^2), Sin[ϕ] -> 2 u/(1 + u^2), Cos[ϕ] -> (1 - u^2)/(1 + u^2)} 2 s H1 − u2 L 4su 1 − s2   + x3 , −  Out[1]= 9−    + y3 , − 2 + z3 = H1 + s2 L H1 + u2 L H1 + s2 L H1 + u2 L 1+s In[2]:= Numerator[Together[#]]& /@ % Out[2]= 8−2 s + 2 s u2 + x3 + s2 x3 + u2 x3 + s2 u2 x3 , −4 s u + y3 + s2 y3 + u2 y3 + s2 u2 y3 , −1 + s2 + z3 + s2 z3
EliminationOrder]] Out[3]= 8H−1 + zL H1 + z + z2 L H−1 + x6 + y6 + z6 L
0, x^(1/3), -(-x)^(1/3)]; ParametricPlot3D[Evaluate[cubeRoot /@ {Cos[ϕ] Sin[ϑ], Sin[ϕ] Sin[ϑ], Cos[ϑ]}], {ϕ, 0, 2 Pi}, {ϑ, 0, Pi}]], (* implicit form *) ContourPlot3D[x^6 + y^6 + z^6 - 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotPoints -> 20, MaxRecursion -> 0, PlotRange -> All, Axes -> True]}]]]

-0.5 -1 1 1

0

0.5

1 -0.5 -1 1 1

0.5

0

0.5

1

0.5

0

0

-0.5 -1 -1 -0.5

-0.5 -1 -1 -0.5

0

0.5 0 5

1

0

0.5 0 5

1

c) Here is a picture of the cubed sphere. In[1]:= ParametricPlot3D[Evaluate[{Cos[ϕ] Sin[ϑ], Sin[ϕ] Sin[ϑ], Cos[ϑ]}^3],

{ϕ, 0, 2Pi}, {ϑ, 0, Pi}, PlotRange -> All, PlotPoints -> 30] -0.5 -1 1 1

0

0.5

1

0.5 0 -0.5 -1 -1 -0.5

0

0.5 0 5

1

In a similar way as the last example, we replace the trigonometric functions by corresponding rational parametrizations and polynomialize everything. In[2]:= {x, y, z} - {Cos[ϕ] Sin[ϑ], Sin[ϕ] Sin[ϑ], Cos[ϑ]}^3 /.

{Sin[ϑ] -> 2 s/(1 + s^2), Cos[ϑ] -> (1 - s^2)/(1 + s^2), Sin[ϕ] -> 2 u/(1 + u^2), Cos[ϕ] -> (1 - u^2)/(1 + u^2)} 8 s3 H1 − u2 L3 64 s3 u3 H1 − s2 L3 Out[2]= 9−   + x, −   + y, −   + z= H1 + s2 L3 H1 + u2 L3 H1 + s2 L3 H1 + u2 L3 H1 + s2 L3 In[3]:= eqs = Numerator[Together[#]]& /@ % Out[3]= 8−8 s3 + 24 s3 u2 − 24 s3 u4 + 8 s3 u6 + x + 3 s2 x + 3 s4 x + s6 x + 3 u2 x + 9 s2 u2 x + 9 s4 u2 x +

3 s6 u2 x + 3 u4 x + 9 s2 u4 x + 9 s4 u4 x + 3 s6 u4 x + u6 x + 3 s2 u6 x + 3 s4 u6 x + s6 u6 x, −64 s3 u3 + y + 3 s2 y + 3 s4 y + s6 y + 3 u2 y + 9 s2 u2 y + 9 s4 u2 y + 3 s6 u2 y + 3 u4 y + 9 s2 u4 y + 9 s4 u4 y + 3 s6 u4 y + u6 y + 3 s2 u6 y + 3 s4 u6 y + s6 u6 y, −1 + 3 s2 − 3 s4 + s6 + z + 3 s2 z + 3 s4 z + s6 z
EliminationOrder]], 100] Out[4]= $Aborted

So, we guide the calculation by hand. The last equation does not contain the variable u; so, we eliminate u from the first two equations.

Solutions

697 In[5]:= Short[polyIns = Factor[Resultant[eqs[[1]], eqs[[2]], u]], 12]

Out[5]//Short= 68719476736 s18

H−262144 s18 + 12288 s12 x2 + 73728 s14 x2 + 184320 s16 x2 + 245760 s18 x2 + 184320 s20 x2 + 73728 s22 x2 + 12288 s24 x2 − 192 s6 x4 − 2304 s8 x4 − 12672 s10 x4 − 42240 s12 x4 − 95040 s14 x4 − 152064 s16 x4 − 177408 s18 x4 − 152064 s20 x4 − 95040 s22 x4 − 42240 s24 x4 − 12672 s26 x4 − 2304 s28 x4 − 192 s30 x4 + x6 + 18 s2 x6 + 153 s4 x6 + 816 s6 x6 + 3060 s8 x6 + 8568 s10 x6 + 18564 s12 x6 + 31824 s14 x6 + 43758 s16 x6 + 48620 s18 x6 + 43758 s20 x6 + 31824 s22 x6 + 18564 s24 x6 + 8568 s26 x6 + 73 + 2448 s6 x2 y4 + 9180 s8 x2 y4 + 25704 s10 x2 y4 + 55692 s12 x2 y4 + 95472 s14 x2 y4 + 131274 s16 x2 y4 + 145860 s18 x2 y4 + 131274 s20 x2 y4 + 95472 s22 x2 y4 + 55692 s24 x2 y4 + 25704 s26 x2 y4 + 9180 s28 x2 y4 + 2448 s30 x2 y4 + 459 s32 x2 y4 + 54 s34 x2 y4 + 3 s36 x2 y4 + y6 + 18 s2 y6 + 153 s4 y6 + 816 s6 y6 + 3060 s8 y6 + 8568 s10 y6 + 18564 s12 y6 + 31824 s14 y6 + 43758 s16 y6 + 48620 s18 y6 + 43758 s20 y6 + 31824 s22 y6 + 18564 s24 y6 + 8568 s26 y6 + 3060 s28 y6 + 816 s30 y6 + 153 s32 y6 + 18 s34 y6 + s36 y6 L

The polynomial polyIns contains only even powers of s, as the last equation of the polynomialized equation does. In[6]:= Cases[polyIns, s^_, Infinity] // Union Out[6]= 8s2 , s4 , s6 , s8 , s10 , s12 , s14 , s16 , s18 , s20 , s22 , s24 , s26 , s28 , s30 , s32 , s34 , s36
S^(n/2),

eqs[[-1]] /. s^(n_) :> S^(n/2), S]]) // Short[#, 8]& Out[7]//Short= 18014398509481984

H−1 + 9 x2 − 36 x4 + 84 x6 − 126 x8 + 126 x10 − 84 x12 + 36 x14 − 9 x16 + x18 + 9 y2 + 9 x2 y2 − 234 x4 y2 + 711 x6 y2 − 990 x8 y2 + 711 x10 y2 − 234 x12 y2 + 9 x14 y2 + 9 x16 y2 − 36 y4 − 234 x2 y4 − 513 x4 y4 + 2961 x6 y4 − 2961 x8 y4 + 513 x10 y4 + 234 x12 y4 + 36 x14 y4 + 84 y6 + 711 x2 y6 +

219 + 1512 x2 y2 z10 − 1512 x4 y2 z10 − 711 x6 y2 z10 + 513 y4 z10 − 1512 x2 y4 z10 + 513 x4 y4 z10 + 711 y6 z10 − 711 x2 y6 z10 + 126 y8 z10 − 84 z12 − 234 x2 z12 + 234 x4 z12 + 84 x6 z12 − 234 y2 z12 − 3339 x2 y2 z12 − 234 x4 y2 z12 + 234 y4 z12 − 234 x2 y4 z12 + 84 y6 z12 + 36 z14 + 9 x2 z14 + 36 x4 z14 + 9 y2 z14 − 9 x2 y2 z14 + 36 y4 z14 − 9 z16 + 9 x2 z16 + 9 y2 z16 + z18 L

Here, the cubed sphere is shown using the implicit representation. We show the contour surfaces for various values of the calculated polynomial. In[8]:= Needs["Graphics`ContourPlot3D`"]

Show[GraphicsArray[Function[c, (* one-eight of the surface *) cp3D = ContourPlot3D[Evaluate[N[res[[-1]]]], {x, 0, 3/2}, {y, 0, 3/2}, {z, 0, 3/2}, Contours -> {c}, PlotPoints -> {20, 4}, MaxRecursion -> 1, PlotRange -> All, DisplayFunction -> Identity]; Graphics3D[{EdgeForm[], (* form other surface patches *) {#, Map[{-1, 1, 1}#&, #, {-2}]}&[ {#, Map[{1, -1, 1}#&, #, {-2}]}&[ {#, Map[{1, 1, -1}#&, #, {-2}]}&[ Cases[cp3D, _Polygon, Infinity]]]]}]] /@ (* contour values *) {0, 1, -1/4}]]

Symbolic Computations

698 d) The following yields a parametrization of the surface under consideration. In[1]:= parametrization =

{3 Cos[ϕ1] + Cos[ϕ1]( Cos[ϕ1] Cos[ϕ2]^3 + Sin[ϕ1] Sin[ϕ2]^3), 3 Sin[ϕ1] + Sin[ϕ1]( Cos[ϕ1] Cos[ϕ2]^3 + Sin[ϕ1] Sin[ϕ2]^3), (-Sin[ϕ1] Cos[ϕ2]^3 + Cos[ϕ1] Sin[ϕ2]^3)};

Here, a picture of the twisted torus is shown. In[2]:= ParametricPlot3D[Evaluate[parametrization], {ϕ1, 0, 2 Pi}, {ϕ2, 0, 2 Pi},

PlotPoints -> {72, 23}]

1 0.5 0 -0.5 -1 -4 4

4 2 0 -2

0

-2 2 4

-4

Using GroebnerBasis, we eliminate the parameter variables. In[3]:= Short[res = GroebnerBasis[Join[parametrization -

{x, y, z}, {Sin[ϕ1]^2 + Cos[ϕ1]^2 - 1, Sin[ϕ2]^2 + Cos[ϕ2]^2 - 1}], {x, y, z}, {Cos[ϕ1], Sin[ϕ1], Cos[ϕ2], Sin[ϕ2]}, MonomialOrder -> EliminationOrder], 6] Out[3]//Short= 8262144 x8 − 245760 x10 + 89088 x12 − 15680 x14 + 1392 x16 − 60 x18 + x20 + 3288064 x6 y2 − 1835328 x8 y2 + 533016 x10 y2 − 95018 x12 y2 + 9516 x14 y2 − 486 x16 y2 + 10 x18 y2 + 10834809 x4 y4 − 6402948 x6 y4 + 1684566 x8 y4 − 281814 x10 y4 + 322 + 324 x5 y3 z9 − 324 x3 y5 z9 − 324 x y7 z9 + 48 x8 z10 + 6 x10 z10 + 246 x6 y2 z10 + 30 x8 y2 z10 + 396 x4 y4 z10 + 60 x6 y4 z10 + 246 x2 y6 z10 + 60 x4 y6 z10 + 48 y8 z10 + 30 x2 y8 z10 + 6 y10 z10 + x8 z12 + 4 x6 y2 z12 + 6 x4 y4 z12 + 4 x2 y6 z12 + y8 z12
{{20, 4}, {20, 4}, {10, 4}}, MaxRecursion -> 1, PlotRange -> All, DisplayFunction -> Identity, Contours -> {#}]& /@ (* contour values *) {-10^8, 0, 10^8}]]

e) The following represents a parametric version of the rotated disk. In[1]:= parametrization = {{Cos[ϕ], Sin[ϕ], 0}, {-Sin[ϕ], Cos[ϕ], 0},

{0, 0, 1}}.(Cos[ϕ/4]^2 {Cos[s], 0, Sin[s]});

Here is a graphic showing this surface. To get a better view of the inner parts, we cut some holes in the polygons of this surface (right graphic). In[2]:= makeHole[Polygon[l_], factor_] :=

Module[{mp = Plus @@ l/Length[l], newPoints, nOld, nNew},

Solutions

699 newPoints = (mp + factor(# - mp))& /@ l; nOld = Partition[Append[#, First[#]]&[l], 2, 1]; nNew = Partition[Append[#, First[#]]&[newPoints], 2, 1]; {MapThread[Polygon[Join[#1, Reverse[#2]]]&, {nOld, nNew}], Line[Append[#, First[#]]]&[newPoints]}] In[3]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {(* parametrized surface *) ParametricPlot3D[Evaluate[parametrization], {s, -Pi, Pi}, {ϕ, 0, 4Pi}, PlotRange -> All], (* lower half of this surfaces with holed polygons *) Show[Graphics3D[ {EdgeForm[], Thickness[0.002], (* add some color *) SurfaceColor[RGBColor[1, 0, 0], RGBColor[0, 0, 1], 2.12], Cases[ParametricPlot3D[Evaluate[ parametrization], {s, -Pi, Pi}, {ϕ, 0, 4Pi}, PlotRange -> All, DisplayFunction -> Identity, PlotPoints -> {20, 40}], _Polygon, Infinity] /. (* cut holes into polygons *) p_Polygon :> makeHole[p, 0.72]}], PlotRange -> {{-1, 1}, {-1, 1}, {-1, 0}}]}]]] -0.5

0

0.5

1 0.5 0 -0.5 -1 -1 -0.5

0

0.5 0 5

1

Again, using the GroebnerBasis command with EliminationOrder easily yields the implicit representation we are looking for. In[4]:= res = Factor /@ GroebnerBasis[Join[TrigExpand[

parametrization /. {ϕ -> 4ϕ}] - {x, y, z}, {Cos[ϕ]^2 + Sin[ϕ]^2 - 1, Cos[s]^2 + Sin[s]^2 - 1}], {x, y, z}, {Cos[ϕ], Sin[ϕ], Cos[s], Sin[s]}] Out[4]= 8−256 x6 + 2304 x8 − 6144 x10 + 4096 x12 − 608 x4 y2 + 9344 x6 y2 − 30720 x8 y2 + 24576 x10 y2 + y4 − 448 x2 y4 + 14208 x4 y4 − 61440 x6 y4 + 61440 x8 y4 − 96 y6 + 9600 x2 y6 − 61440 x4 y6 + 81920 x6 y6 + 2432 y8 − 30720 x2 y8 + 61440 x4 y8 − 6144 y10 + 24576 x2 y10 + 4096 y12 − 256 x4 z2 + 4608 x6 z2 − 18432 x8 z2 + 16384 x10 z2 − 352 x2 y2 z2 + 14080 x4 y2 z2 − 73728 x6 y2 z2 + 81920 x8 y2 z2 − 96 y4 z2 + 14336 x2 y4 z2 − 110592 x4 y4 z2 + 163840 x6 y4 z2 + 4864 y6 z2 − 73728 x2 y6 z2 + 163840 x4 y6 z2 − 18432 y8 z2 + 81920 x2 y8 z2 + 16384 y10 z2 + 2304 x4 z4 − 18432 x6 z4 + 24576 x8 z4 + 4736 x2 y2 z4 − 55296 x4 y2 z4 + 98304 x6 y2 z4 + 2432 y4 z4 − 55296 x2 y4 z4 + 147456 x4 y4 z4 − 18432 y6 z4 + 98304 x2 y6 z4 + 24576 y8 z4 − 6144 x4 z6 + 16384 x6 z6 − 12288 x2 y2 z6 + 49152 x4 y2 z6 − 6144 y4 z6 + 49152 x2 y4 z6 + 16384 y6 z6 + 4096 x4 z8 + 8192 x2 y2 z8 + 4096 y4 z8
{25, 25, 18}, MaxRecursion -> 0], (* lower half of this surfaces with holed polygons *) Graphics3D[{EdgeForm[], Thickness[0.002], SurfaceColor[Hue[0.45], Hue[0.34], 2.12],

Symbolic Computations

700

Cases[cp3D, _Polygon, Infinity] /. p_Polygon :> makeHole[p, 0.75]}, PlotRange -> All], (* 2D contour lines in cross section plane z == 0*) cp2D = ContourPlot[Evaluate[res[[1]] /. z -> 0], {x, -1.15, 1.15}, {y, -1.15, 1.15}, PlotPoints -> 240]; cls = #[[30]]& /@ Partition[Sort[Flatten[cp2D[[1]]]], 960]; ListContourPlot[cp2D[[1]], ContourShading -> False, Contours -> cls, FrameTicks -> None, ContourStyle -> {Thickness[0.003]}]}]]]

38. Riemann Surface of Kronig–Penney Dispersion Relation This is the function to be drawn. In[1]:= f[e_] = ArcCos[Cos[Sqrt[e]] + 4/Sqrt[e] Sin[Sqrt[e]]];

Here are the real and the imaginary parts slightly above and below the imaginary axis. In[2]:= (* small number to avoid discontinuities *) ∂ = 10^-8;

Show[GraphicsArray[ Function[pm, Plot[Evaluate[#[f[er + pm I ∂]]], {er, -50, 200}, DisplayFunction -> Identity, Frame -> True, Axes -> False]& /@ {Re, Im}] /@ {+1, -1}]] 3 2.5 2 1.5 1 0.5 0 -50 0 50 100 150 200

0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -50 0 50 100150200

3 2.5 2 1.5 1 0.5 0 -50 0 50 100 150 200

0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -50 0 50 100150200

Trying to use Plot3D[Im[…]] results in a graphic with some discontinuities. In[4]:= Plot3D[Evaluate[Im[f[er + I ei]]], {er, -10, 60}, {ei, -10, 10},

PlotRange -> All, PlotPoints -> 80]

4 2 0 -2 -4

10 5 0

0 -5

20 40 60

-10

Most of the discontinuities are all of the following type. The discontinuities seen in the picture are due to the branch cuts of ArcCos (right graphic). In[5]:= Show[GraphicsArray[

Block[{$DisplayFunction = Identity}, {(* shape around branch cuts *)

Solutions

701 Plot3D[Im[ArcCos[3/2 - (er + I ei)^2]], {er, -3/2, 3/2}, {ei, -1, 1}, PlotRange -> All, PlotPoints -> 40], (* branch cuts of ArcCos *) Plot3D[Im[-ArcCos[(er + I ei)]], {er, -2, 2}, {ei, -1, 1}, PlotRange -> All, PlotPoints -> 40]}]]]

1 0 -1

1 0.5

-2 2

0

-1

1 0 -1

-0.5

0 1

1 0.5 -1

-1

0 0

-0.5 1

2

-1

è!!!! è!!!! è!!!! The discontinuities along the real axis of Im[f[e]] start and end when the expression cosI e M + 4 ë e sinI e M equals ±1. Here are these values calculated. In[6]:= bandEdges =

Apply[(e /. FindRoot[Cos[#1] == Cos[Sqrt[e]] + 4/Sqrt[e] Sin[Sqrt[e]], {e, #2}, AccuracyGoal -> 25, WorkingPrecision -> 30])&, {{0, 4}, {Pi, 10}, {Pi, 20}, {0, 39}, {0, 51}, {Pi, 88}, {Pi, 103}, {0, 156}, {0, 173}, {Pi, 250}}, {1}] Out[6]= 84.63863032958029877395067640646, 9.86960440108935861883449099988, 20.9567972007820985332003083282, 39.4784176043574344753379639995, 53.1032012738816121322797455030, 88.8264396098042275695104189989, 103.509669390474740997663195663, 157.913670417429737901351855998, 173.097898796290472053168615070, 246.740110027233965470862274997
Identity]&, Partition[bandEdges, 2], {1}], DisplayFunction -> $DisplayFunction, PlotRange -> All] 3 2.5 2 1.5 1 0.5 50

100

150

200

250

Adding multiples of p, we can redraw the last picture in the following way. Slightly more common is the right picture, which is obtained by interchanging K and e. In[8]:= Show[GraphicsArray[

Block[{$DisplayFunction = Identity}, {(* show (∂) *) Graphics[{{Thickness[0.01], GrayLevel[0.7], Line[Table[{e, Sqrt[e]}, {e, 0, 250}]]}, MapIndexed[If[OddQ[#2[[1]]], {#[[1]], +#1[[2]] + (#2[[1]] - 1) Pi}, {#[[1]], -#1[[2]] + #2[[1]] Pi}]&, Cases[#, _Line, Infinity]& /@ pic[[1]], {-2}]} // N, PlotRange -> All, Frame -> True], (* show ∂() *) Graphics[{#, Map[{-1, 1}#&, N[#], {-2}]}& @ MapIndexed[If[OddQ[#2[[1]]], {+#1[[2]] + (#2[[1]] - 1) Pi, #1[[1]]}, {-#1[[2]] + #2[[1]] Pi, #1[[1]]}]&,

Symbolic Computations

702 Cases[#, _Line, Infinity]& /@ pic[[1]], {-2}], PlotRange -> All, Frame -> True, FrameTicks -> {Table[{i Pi, i Pi}, {i, -5, 5}], Automatic, None, None}]}]]] 250

15 12.5

200

10

150

7.5 100

5

50

2.5 0 0

50

100

150

200

250

0

-5 p -4 p -3 p -2 p -p

0

p

2p 3p 4p 5p

Now, we must deal with the lines of singularities that originate between two band edges and go into the complex plane. This kind of singularity is caused by having the imaginary part of f[e] change its sign. Here are the lines where this happens. In[9]:= ContourPlot[Im[f[er + I ei]], {er, -100, 250}, {ei, -30, 30},

PlotPoints -> 100, Contours -> {0}, ContourShading -> False] 30 20 10 0 -10 -20 -30 -100-50 0 50 100 150 200 250

We can get an implicit equation describing these lines by taking the real part of f[e]. In[10]:= Imf = Plus @@ (Cases[Expand[ComplexExpand[Cos[Sqrt[er + I ei]] +

4/(Sqrt[er + I ei]) Sin[Sqrt[er + I ei]]] /. {Abs[I ei + er] -> Sqrt[er^2 + ei^2], Arg[I ei + er] -> ArcTan[er, ei]}], _Complex _]/I) 1 1 1ê4 Out[10]= −     J4 CoshAHei2 + er2 L SinA  ArcTan@er, eiDEE 2 Hei2 + er2 L1ê4 1 1 2 2 1ê4 CosA  ArcTan@er, eiDEEN + SinA  ArcTan@er, eiDE SinAHei + er L 2 2 1 1 1 1ê4 2 J4 CosA   ArcTan@er, eiDE CosAHei + er2 L CosA  ArcTan@er, eiDEE      2 2 Hei2 + er2 L1ê4 1 2 2 1ê4 SinA  ArcTan@er, eiDEEN − SinhAHei + er L 2 1 1 1ê4 2 2 1ê4 CosA  ArcTan@er, eiDEE SinhAHei2 + er2 L SinA  ArcTan@er, eiDEE SinAHei + er L 2 2

By viewing er as a function of ei in the last equation, we see that the following expression must be zero. In[11]:= Imf1 = Imf /. er -> er[ei]

1 Hei2 + er@eiD2 L

Out[11]= −    1ê4

1 1 SinA  ArcTan@er@eiD, eiDEE SinA  ArcTan@er@eiD, eiDE 2 2 1 1 1ê4 SinACosA  ArcTan@er@eiD, eiDE Hei2 + er@eiD2 L EN +   2 Hei2 + er@eiD2 L1ê4 1 1 1ê4 J4 CosA  ArcTan@er@eiD, eiDE CosACosA  ArcTan@er@eiD, eiDE Hei2 + er@eiD2 L E 2 2 1 1ê4 SinhAHei2 + er@eiD2 L SinA  ArcTan@er@eiD, eiDEEN − 2 1 1ê4 SinACosA  ArcTan@er@eiD, eiDE Hei2 + er@eiD2 L E 2 1 1ê4 SinhAHei2 + er@eiD2 L SinA  ArcTan@er@eiD, eiDEE 2 1ê4

J4 CoshAHei2 + er@eiD2 L

Solutions

703

Differentiating this expression with respect to ei and solving for er'[ei] gives us a differential equation for these lines. In[12]:= Short[ode = Equal @@ (Solve[D[Imf1, ei] == 0, er'[ei]][[1, 1]]), 12] 2

1 1 1ê4 i Out[12]//Short= er @eiD j4 CosA  ArcTan@er@eiD, eiDE CosACosA  ArcTan@er@eiD, eiDE Hei2 + er@eiD2 L E k

2

2 1 1ê4 yì SinA  ArcTan@er@eiD, eiDEE er@eiD Hei2 + er@eiD2 L + 19 z CoshAHei + er@eiD L z 2 { 2 1 1 1ê4 i j j4 ei CosA  ArcTan@er@eiD, eiDE CosACosA  ArcTan@er@eiD, eiDE Hei2 + er@eiD2 L E 2 2 k 1 1ê4 2 2 1ê4 SinA  ArcTan@er@eiD, eiDEE Hei2 + er@eiD2 L + CoshAHei + er@eiD L 2 2 1 2 2 1ê4

14 + 4 er@eiD Hei + er@eiD L SinA  ArcTan@er@eiD, eiDE 2 1 1ê4 SinACosA  ArcTan@er@eiD, eiDE Hei2 + er@eiD2 L E 2 1 1ê4 z SinA  ArcTan@er@eiD, eiDEEy SinhAHei2 + er@eiD2 L 2 { 2 1ê4

2

Let us solve the resulting differential equation numerically. The fri are the initial conditions. In[13]:= fr1 = er /. FindRoot[Evaluate[Imf == 0 /. ei -> 1], {er, 15},

WorkingPrecision -> 22, AccuracyGoal -> 20] Out[13]= 14.63566800020600747569 In[14]:= ∂ = 10^-9; (* starting slightly away from 0 *)

nsol1 = NDSolve[{ode, er[1] == fr1}, er, {ei, ∂, 10}, PrecisionGoal -> 12, MaxSteps -> 5000][[1, 1, 2]] Out[15]= InterpolatingFunction@881. × 10−9 , 10. 22, AccuracyGoal -> 20] Out[16]= 45.96726058494253542007 In[17]:= nsol2 = NDSolve[{ode, er[1] == fr2}, er, {ei, ∂, 10},

PrecisionGoal -> 12, MaxSteps -> 5000][[1, 1, 2]] Out[17]= InterpolatingFunction@881. × 10−9 , 10. -Power[e, pmOneHalf]) Out[26]= True

Now let us make use of the other sheets of arccos. Rewriting ArcCos in logarithms and square roots shows that we must look at the other sheets of the square root and the logarithm function. In[27]:= ArcCos[x] // TrigToExp Out[27]=

π 1 − x2 E   +  LogA x + è!!!!!!!!!!!!!!!! 2

The other sheets of the logarithm do not contribute here because they are different from the principal sheet by a purely imaginary quantity. The second sheet of the square root produces a second sheet in our picture. The value of f[e] on this sheet is simply the negative of the value from the first sheet. Here, the two sheets for ArcCos are shown. In[28]:= Show[GraphicsArray[Function[pm,

Plot3D[Im[Pi/2 + I Log[I (xr + I xi) + pm Sqrt[1 - (xr + I xi)^2]]], {xr, -2, 2}, {xi, -1, 1}, PlotPoints -> 20, DisplayFunction -> Identity]] /@ {+1, -1}]]

1 0

-1 -2

1 0.5

-1

0

-0.5

0 1 2

-1

1 0

-1 -2

1 0.5

-1

0

-0.5

0 1 2

-1

Now, we generate all other parts of the surface and display them together. In[29]:= ImPolys2 = {ImPolys1, Map[{1, 1, -1} #&, ImPolys1, {-2}]};

Show[Graphics3D[ImPolys2], BoxRatios -> {1, 1, 1}]

Solutions

705

For the more complicated problem of determining the Riemann surface of eHV L (defined implicitly via cosHK L= cosHe1ê2 L + V e-1ê2 sinHe1ê2 L) as a function of the potential strength V , see [1752], [637]. 39. Envelopes of Secants in an Ellipse, Lines Intersecting Four Lines a) This is the equation of the ellipse under consideration. In[1]:= ellipse[x_, y_] := x^2 + 4 y^2 - 4

This is the implicit representation of a line that joins the two points {x1, y1} and {x2, y2}. In[2]:= line[{x_, y_}, {{x1_, y1_}, {x2_, y2_}}] =

Numerator[Together[y - (y2 - y1)/(x2 - x1) (x - x1) - y1]] Out[2]= x1 y − x2 y − x y1 + x2 y1 + x y2 − x1 y2

The distance between the two points {x1, y1} and {x2, y2} is given by the following expression. In[3]:= dist[{x1_, y1_}, {x2_, y2_}] = (x1 - x2)^2 + (y1 - y2)^2 - 1 Out[3]=

− 1 + Hx1 − x2L2 + Hy1 − y2L2

Now, we must calculate the envelope. If f Hx, y, cL is a family of curves in the x,y-plane, parametrized by c, then the envelope (an implicit function of x and y) formed by this family is obtained by eliminating c from the two equations f Hx, y, cL = 0, ∑ f Hx, y, cL ê ∑ c = 0. In our case, let the x-coordinate of the first point x1 be the parameter to be eliminated. y1 due to the defining equation of the ellipse as well as x2 and y2 (due to the distance restriction) are then implicitly depending on x1 . So, we have the following set of equations (it is important to take the derivatives of the individual equations into account, too, because they are algebraically independent from the equations). In[4]:= {(* the first point lies on the ellipse *)

ellipse[x1, y1[x1]], D[ellipse[x1, y1[x1]], x1], (* the second point lies on the ellipse *) ellipse[x2[x1], y2[x1]], D[ellipse[x2[x1], y2[x1]], x1], (* the distance between the two points is 1 *) dist[{x1, y1[x1]}, {x2[x1], y2[x1]}], D[dist[{x1, y1[x1]}, {x2[x1], y2[x1]}], x1], (* the line between the two points *) line[{x, y}, {{x1, y1[x1]}, {x2[x1], y2[x1]}}], D[line[{x, y}, {{x1, y1[x1]}, {x2[x1], y2[x1]}}], x1]} Out[4]= 8− 4 + x12 + 4 y1@x1D2 , 2 x1 + 8 y1@x1D y1 @x1D, − 4 + x2@x1D2 + 4 y2@x1D2 , 2 x2@x1D x2 @x1D + 8 y2@x1D y2 @x1D, − 1 + Hx1 − x2@x1DL2 + Hy1@x1D − y2@x1DL2 , 2 Hx1 − x2@x1DL H1 − x2 @x1DL + 2 Hy1@x1D − y2@x1DL Hy1 @x1D − y2 @x1DL, x1 y − y x2@x1D − x y1@x1D + x2@x1D y1@x1D + x y2@x1D − x1 y2@x1D, y − y2@x1D − y x2 @x1D + y1@x1D x2 @x1D − x y1 @x1D + x2@x1D y1 @x1D + x y2 @x1D − x1 y2 @x1D
y1s, y2'[x1] -> y2s,

y1[x1] -> y1, y2[x1] -> y2, x2[x1] -> x2} Out[5]=

8− 4 + x12 + 4 y12 , 2 x1 + 8 y1 y1s, − 4 + x22 + 4 y22 , 2 x2 x2s + 8 y2 y2s, − 1 + Hx1 − x2L2 + Hy1 − y2L2 , 2 Hx1 − x2L H1 − x2sL + 2 Hy1 − y2L Hy1s − y2sL, x1 y − x2 y − x y1 + x2 y1 + x y2 − x1 y2, y − x2s y + x2s y1 − x y1s + x2 y1s − y2 + x y2s − x1 y2s
EliminationOrder] Out[6]= 8−19440 + 29160 x2 − 18495 x4 + 6165 x6 − 1080 x8 + 80 x10 + 7776 y2 −

3456 x2 y2 + 6390 x4 y2 − 3876 x6 y2 + 624 x8 y2 + 7344 y4 − 22320 x2 y4 + 1077 x4 y4 + 1648 x6 y4 + 5472 y6 + 4440 x2 y6 + 2000 x4 y6 + 1296 y8 + 1152 x2 y8 + 256 y10
120, Contours -> {0}, ContourStyle -> {Thickness[0.005], RGBColor[0, 0, 1]}, ContourShading -> False, AspectRatio -> Automatic] 1 0.5 0 -0.5 -1 -2

-1

0

1

2

The routine makeLines calculates all line segments such that one point has the x-coordinate x. In[8]:= makeLines[x_] :=

Module[{x1y1Sol = Prepend[#, x1 -> x]& /@ (* calculate y coordinate of the first point *) NSolve[x^2 + 4 y1^2 - 4 == 0, y1], x2y2Sol}, x2y2Sol = Function[x1y1, Join[x1y1, #]& /@ Select[(* calculate the second point *) NSolve[{x2^2 + 4 y2^2 - 4 == 0, (x1 - x2)^2 + (y1 - y2)^2 - 1 == 0} /. x1y1, {x2, y2}], And @@ (Im[#] == 0& /@ ({x2, y2} /. #))&]] /@ x1y1Sol; (* form the line *) Line[{{x1, y1}, {x2, y2}}] /. Flatten[x2y2Sol, 1]]

Here are some of these line segments together with the previously calculated envelope. In[9]:= Show[{Graphics[{

{Thickness[0.002], Hue[0], (* the ellipse itself *) Line[Table[{x, Sqrt[4 - x^2]/2}, {x, -2, 2, 1/100}]], Line[Table[{x, -Sqrt[4 - x^2]/2}, {x, -2, 2, 1/100}]]}, {Thickness[0.002], GrayLevel[1/2], (* the line segments *) Table[makeLines[x], {x, -2, 2, 1/10}]}}], (* the envelope *) cp} // N, PlotRange -> All, Frame -> True, AspectRatio -> Automatic] 1 0.5 0 -0.5 -1 -2

-1

0

1

2

The contour surfaces of the resulting polynomial looks much more complicated as a function of two complex variables. In[10]:= Show[GraphicsArray[Show @ Table[

(* show nodal lines for changing imaginary part of x and y *) ContourPlot[Evaluate[ComplexExpand[#[gb1[[1]] /.

Solutions

707 {x -> xr + I im, y -> yr + I im}]]], {xr, -3, 3}, {yr, -2, 2}, PlotPoints -> 120, Contours -> {0}, FrameTicks -> None, DisplayFunction -> Identity, ContourStyle -> {Thickness[0.002], Hue[im/2.4]}, ContourShading -> False, AspectRatio -> Automatic], {im, 2, 0, -2/60}]& /@ (* show nodal lines of real and imaginary part *) {Re, Im}]]

b) Without loss of generality, we will take the first line along the x-axis, and the second line in the x,y-plane intersecting the first line at origin. Each of the four lines will be parametrized in such a way that x-constant is 0 and x-parameter is 1. ξ[i, j] is the jth component of the ith line. In[1]:= fourLines = Flatten[

Table[a[i, j] + b[i, j] t[i] - ξ[i, j], {i, 4}, {j, 3}]] /. {a[_, 1] -> 0, b[_, 1] -> 1} /. {a[1, 2] -> 0, a[1, 3] -> 0, b[1, 2] -> 0, b[1, 3] -> 0, a[2, 1] -> 0, a[2, 2] -> 0, a[2, 3] -> 0, b[2, 3] -> 0} Out[1]= 8t@1D − ξ@1, 1D, −ξ@1, 2D, −ξ@1, 3D, t@2D − ξ@2, 1D, b@2, 2D t@2D − ξ@2, 2D, −ξ@2, 3D, t@3D − ξ@3, 1D, a@3, 2D + b@3, 2D t@3D − ξ@3, 2D, a@3, 3D + b@3, 3D t@3D − ξ@3, 3D, t@4D − ξ@4, 1D, a@4, 2D + b@4, 2D t@4D − ξ@4, 2D, a@4, 3D + b@4, 3D t@4D − ξ@4, 3D
0, B[1] -> 1}; In[3]:= eqs = Join[fourLines, intersectingLines];

Now, we have 24 equations with 4 unknowns A[2], A[3], B[2], and B[3], 9 parameters, and 20 variables to eliminate. In[4]:= {Length[eqs], Length[Union[Cases[eqs, _A | _B, Infinity]]]& /@

(* the variables *) {_A | _B, _a | _b, _ξ | _t | _T}} Out[4]= 824, 84, 4, 4 EliminationOrder] Out[5]= 8A@3D B@2D − A@2D B@3D, A@3D b@2, 2D, a@4, 3D b@4, 2D − A@3D b@4, 2D − a@4, 2D b@4, 3D + A@2D b@4, 3D − a@4, 3D B@2D + a@4, 2D B@3D, a@3, 3D b@3, 2D − A@3D b@3, 2D − a@3, 2D b@3, 3D + A@2D b@3, 3D − a@3, 3D B@2D + a@3, 2D B@3D, A@2D b@2, 2D B@3D
RationalFunctions] Out[6]= 8Ha@3, 3D a@4, 3D b@3, 2D − a@3, 2D a@4, 3D b@3, 3D − a@3, 3D a@4, 3D b@4, 2D +

a@3, 3D a@4, 2D b@4, 3DL B@3D + H−a@3, 3D a@4, 2D + a@3, 2D a@4, 3DL B@3D2 , a@4, 3D b@3, 3D b@4, 2D − a@3, 3D b@3, 2D b@4, 3D + a@3, 2D b@3, 3D b@4, 3D − a@4, 2D b@3, 3D b@4, 3D + H−a@4, 3D b@3, 3D + a@3, 3D b@4, 3DL B@2D +

Symbolic Computations

708 Ha@4, 2D b@3, 3D − a@3, 2D b@4, 3DL B@3D, A@3D, −a@3, 3D a@4, 3D b@3, 2D + a@3, 2D a@4, 3D b@3, 3D + a@3, 3D a@4, 3D b@4, 2D − a@3, 3D a@4, 2D b@4, 3D + A@2D H−a@4, 3D b@3, 3D + a@3, 3D b@4, 3DL + Ha@3, 3D a@4, 2D − a@3, 2D a@4, 3DL B@3D
#2[[1]] + 1]&, Rest[sol]]]]] 2

3

4

5

6

7

8

9

So it is the seventh solution that is of interest to us. In[13]:= goodSol =

{r -> (2 qx^2 + 5 qy + 3 qx qy - 2 qy^2)/(2 qx + 4 qy), t -> 1/10*(10 + 2 qx^2 - 3 qy - 2 qy^2 + qx (-4 + 3 qy)), s -> (2 qx^2 + qy - 2 qy^2 + qx*(-2 + 3 qy))/(2 (-5 + qx + 2 qy))};

Here are 15 different paths with randomly chosen starting points for this case. In[14]:= Block[{qx, qy, P12, P23, P31},

Show[Graphics[ {{Thickness[0.02], GrayLevel[0], Line[{P1, P2, P3, P1}]}, (* random start points *) Table[qx = Random[Real, {0.2, 0.4}]; qy = Random[Real, {0, qx}]; {Thickness[0.002], Hue[Random[]], (* billiard path *) {P12, P23, P31} = {P1 + r (P2 - P1), P2 + s (P3 - P2), P3 + t (P1 - P3)} /. N[goodSol]; Line[{{qx, qy}, P12, P23, P31, {qx, qy}}]}, {15}]}, PlotRange -> All, Frame -> True, FrameTicks -> None, AspectRatio -> Automatic]]]

Here is the square of the length of the balls flight. In[15]:= pL = ((Q

- P12).(Q - P12) + (P12 - P23).(P12 - P23) + (P23 - P31).(P23 - P31) + (Q - P31).(Q - P31)) 2 2 Out[15]= qy + Hqx − rL + H−1 + rL + 4 s2 + t2 + H−1 + qx + tL2 + H−2 + qy + 2 tL2 + H−2 + 2 s + 2 tL2 2

Let us graphically look if there is a minimum somewhere. The right graphic shows a magnification of the interesting area. In[16]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity, ∂ = 10^-6}, {(* show function over full region *) ContourPlot[Evaluate[Sqrt[pL /. sol[[7]]]], {qx, ∂, 1 - ∂}, {qy, ∂, 2 - ∂}, PlotPoints -> 60,

Symbolic Computations

710 Contours -> 30, ColorFunction -> (Hue[0.7 (1 - #)]&)], (* show function near minima *) ContourPlot[Evaluate[Sqrt[pL /. sol[[7]]]], {qx, 0.2, 0.6}, {qy, 0, 0.2}, PlotPoints -> 60, Contours -> 30, ColorFunction -> (Hue[0.7 (1 - #)]&)]}]]] 2

0.2

1.5

0.15

1

0.1

0.5

0.05

0

0 0

0.2

0.4

0.6

0.8

1

0.2

0.3

0.4

0.5

0.6

So it seems there is a minimum near qx==0.46, qy==0.08. In[17]:= FindMinimum[Evaluate[Sqrt[pL /. sol[[7]]]], {qx, 0.46}, {qy, 0.08}] Out[17]= 81.03603, 8qx → 0.46341, qy → 0.0842235 EliminationOrder]; (* solve with respect to  *) sol = Solve[gb[[1]] == 0, Subscript[, n]]; (* simplify result *) (Equal @@ sol[[1, 1]]) // (Factor //@ #)&]

Here are the resulting logarithmic residues. In[2]:= Table[makeLogarithmicResidue[k], {k, 10}] // TraditionalForm

1 2

1 6

Out[2]//TraditionalForm= :1  FH0L, 2  FH0L FH0L, 3  ÅÅÅÅÅ FH0L HFH0L2 + F£ H0LL, 4  ÅÅÅÅÅ FH0L HFH0L3 + 3 F£ H0L FH0L + F££ H0LL,

1 5  ÅÅÅÅÅÅ ÅÅ FH0L HFH0L4 + 6 F£ H0L FH0L2 + 4 F££ H0L FH0L + 3 F£ H0L2 + FH3L H0LL, 24 1 6  ÅÅÅÅÅÅÅÅÅÅÅÅÅ FH0L HFH0L5 + 10 F£ H0L FH0L3 + 10 F££ H0L FH0L2 + 15 F£ H0L2 FH0L + 5 FH3L H0L FH0L + 10 F£ H0L F££ H0L + FH4L H0LL, 120 1 7  ÅÅÅÅÅÅÅÅÅÅÅÅÅ FH0L HFH0L6 + 15 F£ H0L FH0L4 + 20 F££ H0L FH0L3 + 45 F£ H0L2 FH0L2 + 15 FH3L H0L FH0L2 + 720 60 F£ H0L F££ H0L FH0L + 6 FH4L H0L FH0L + 15 F£ H0L3 + 10 F££ H0L2 + 15 F£ H0L FH3L H0L + FH5L H0LL, 1 8  ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ HFH0L HFH0L7 + 21 F£ H0L FH0L5 + 35 F££ H0L FH0L4 + 105 F£ H0L2 FH0L3 + 35 FH3L H0L FH0L3 + 5040 210 F£ H0L F££ H0L FH0L2 + 21 FH4L H0L FH0L2 + 105 F£ H0L3 FH0L + 70 F££ H0L2 FH0L + 105 F£ H0L FH3L H0L FH0L + 7 FH5L H0L FH0L + 105 F£ H0L2 F££ H0L + 35 F££ H0L FH3L H0L + 21 F£ H0L FH4L H0L + FH6L H0LLL, 1 9  ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ IFH0L IFH0L8 + 28 F£ H0L FH0L6 + 56 F££ H0L FH0L5 + 210 F£ H0L2 FH0L4 + 70 FH3L H0L FH0L4 + 40320 560 F£ H0L F££ H0L FH0L3 + 56 FH4L H0L FH0L3 + 420 F£ H0L3 FH0L2 + 280 F££ H0L2 FH0L2 + 420 F£ H0L FH3L H0L FH0L2 + 28 FH5L H0L FH0L2 + 840 F£ H0L2 F££ H0L FH0L + 280 F££ H0L FH3L H0L FH0L + 168 F£ H0L FH4L H0L FH0L + 8 FH6L H0L FH0L + 2

10

105 F£ H0L4 + 280 F£ H0L F££ H0L2 + 35 FH3L H0L + 210 F£ H0L2 FH3L H0L + 56 F££ H0L FH4L H0L + 28 F£ H0L FH5L H0L + FH7L H0LMM, 1  ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ IFH0L IFH0L9 + 36 F£ H0L FH0L7 + 84 F££ H0L FH0L6 + 378 F£ H0L2 FH0L5 + 126 FH3L H0L FH0L5 + 362880 1260 F£ H0L F££ H0L FH0L4 + 126 FH4L H0L FH0L4 + 1260 F£ H0L3 FH0L3 + 840 F££ H0L2 FH0L3 + 1260 F£ H0L FH3L H0L FH0L3 + 84 FH5L H0L FH0L3 + 3780 F£ H0L2 F££ H0L FH0L2 + 1260 F££ H0L FH3L H0L FH0L2 + 756 F£ H0L FH4L H0L FH0L2 +

Solutions

715 2

36 FH6L H0L FH0L2 + 945 F£ H0L4 FH0L + 2520 F£ H0L F££ H0L2 FH0L + 315 FH3L H0L FH0L + 1890 F£ H0L2 FH3L H0L FH0L + 504 F££ H0L FH4L H0L FH0L + 252 F£ H0L FH5L H0L FH0L + 9 FH7L H0L FH0L + 280 F££ H0L3 + 1260 F£ H0L3 F££ H0L + 1260 F£ H0L F££ H0L FH3L H0L + 378 F£ H0L2 FH4L H0L + 126 FH3L H0L FH4L H0L + 84 F££ H0L FH5L H0L + 36 F£ H0L FH6L H0L + FH8L H0LMM>

42. Geometry Puzzle Using Mathematica’s symbolic capabilities, it is straightforward to calculate the angle ®CDE. To do this, we calculate the points D and E. This allows us to express the cosine of ®CDE and we also get ®CDE itself. There are the three vertices of the triangle. In[1]:= b = {-1, 0};

c = {+1, 0}; a = {0, Tan[80 Degree]};

We define a function intersectionPoint that calculates the point of intersection between two lines. Every line is given in the form of one point on this line and a direction. In[4]:= intersectionPoint[{p1_, dir1_}, {p2_, dir2_}] :=

First[p1 + s dir1 /. Solve[Thread[p1 + s dir1 p2 + t dir2], {s, t}]]

So, we get the following expression for the coordinates of the point D. In[5]:= d = intersectionPoint[{a, b - a}, {c, {Cos[110 Degree], Sin[110 Degree]}}]

2 Cos@110 °D Tan@80 °D Sin@110 °D − Cos@110 °D Tan@80 °D 2 Cos@110 °D Tan@80 °D Tan@80 °D − Tan@80 °D J−1 −     N= Sin@110 °D − Cos@110 °D Tan@80 °D

Out[5]= 91 +     ,

It is best to transform every number into an algebraic number. For trigonometric functions with arguments of the form rational p, this can always be done. The function toAlgebraicNumber implements this conversion. In[6]:= toAlgebraicNumber[y_] :=

TrigToExp[y] /. Degree -> Pi/180 /. E^α_ -> (-1)^(α/(I Pi))

Now the point D looks the following way. In[7]:= toAlgebraicNumber[d]

 H−H−1L4ê9 − H−1L5ê9 L H−H−1L7ê18 + H−1L11ê18 L  H−H−1L −H−1L L H−H−1L +H−1L L HH−1L4ê9 − H−1L5ê9 L I 12  H−H−1L7ê18 − H−1L11ê18 L −     M 2 HH−1L4ê9 −H−1L5ê9 L

Out[7]= 91 +         , 4ê9  5ê9 7ê18 11ê18

 H−H−1L4ê9 − H−1L5ê9 L 1    −   H−1L4ê9 − H−1L5ê9 H−1L4ê9 − H−1L5ê9

i i j j j 4ê9 j j −1 − − H−1L5ê9 L j j j j H−H−1L j j j k k

y z zy  H−H−1L4ê9 − H−1L5ê9 L H−H−1L7ê18 + H−1L11ê18 L z z z         z z z zz 1  H−H−1L4ê9 −H−1L5ê9 L H−H−1L7ê18 +H−1L11ê18 L 4ê9 5ê9 7ê18 11ê18 z HH−1L − H−1L L I 2  H−H−1L − H−1L L −     M z 2 HH−1L4ê9 −H−1L5ê9 L {{ =

The function RootReduce generates this normal form of the above algebraic number. In[8]:= d = RootReduce[Simplify[%]] Out[8]= 8Root@−1 − 3 #1 + #13 &, 2D, Root@−3 + 18 #12 − 15 #14 + #16 &, 6D
α) == 0, α][[1, 1, 2]]; (* reduce odePoly by using the original polynomial *) reducedOdePoly = FixedPoint[Expand[# /. y[x]^m_ :> lT^Quotient[m, n] y[x]^Mod[m, n]]&, odePoly]; (* make linear equations for the C[i] *) CEqs = (# 0&) /@ CoefficientList[reducedOdePoly, y[x]]; (* solve the equations CEqs for the C[i] *) CSols = Solve[CEqs, Table[C[i], {i, 0, n}]][[1]]; (* the C[i] appearing on the rhs of CSols *) commonCs = Cases[Last /@ CSols, _C, Infinity]; (* the resulting differential equation *) res = Numerator[Together[(ode /. CSols /. ((# -> 1)& /@ commonCs))]]; (* some (optional) cosmetics to get a nicer looking solution *) res = Collect[res, Table[D[y[x], {x, i}], {i, 0, n}], Factor]; (* turn on Solve message again *) If[Head[oldMessageState] === String, On[Solve::svars]]; (* return the differential equation *) res == 0]

We start with a simple quadratic polynomial. In[2]:= ode = polynomialToDifferentialEquation[y^2 + x == 0, y, x] Out[2]= H1 − 2 xL y@xD + 4 x2 y @xD + 4 x2 y @xD 0

The solution of the polynomial y =

è!!!! x satisfies the derived differential equation.

In[3]:= Expand /@ (ode /. y -> (Function[x, x^(1/2)])) Out[3]= True

Solutions

717

Here is a slightly more complicated quadratic polynomial. In[4]:= ode = polynomialToDifferentialEquation[y^2 + a y + b x == 0, y, x] Out[4]= 2 b y @xD + H−a2 + 4 b xL y @xD 0

A call to DSolve solves the derived differential equation. In[5]:= DSolve[ode, y[x], x]

è!!!!!!!!!!!!!!!!!!!!!!!!! a2 − 4 b x C@1D 2b

  + C@2D== Out[5]= 99y@xD → − 

By fixing the integration constants, we could reproduce the solutions of the original quadratic polynomial. In[6]:= Solve[y^2 + a y + b x == 0, y]

1 2

Out[6]= 99y →  I−a −

1 è!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!! a2 − 4 b x M=, 9y →  I−a + a2 − 4 b x M== 2

This is a simple cubic polynomial. In[7]:= ode = polynomialToDifferentialEquation[y^3 + x == 0, y, x] Out[7]= H−10 + 6 x − 9 x2 L y@xD + 27 x3 y @xD + 27 x3 y @xD + 27 x3 yH3L @xD 0

The root y =

3 è!!!! x of the polynomial is also a solution of the differential equation.

In[8]:= Expand /@ (ode[[1]] /. y -> (Function[x, x^(1/3)])) Out[8]= 0

And here is a slightly more complicated cubic. In[9]:= ode = polynomialToDifferentialEquation[y^3 + y + x == 0, y, x] Out[9]= −9 H−8 + 27 xL y@xD + 3 H−32 + 513 x2 L y @xD +

3 H−32 + 513 x2 L y @xD − H4 + 27 x2 L H4 − 27 x + 27 x2 L yH3L @xD 0

Here is a quick check for the correctness of the differential equation. In[10]:= Together //@ (ode /. MapAt[Function[x, #]&, #, {1, 2}]& /@

Solve[y^3 + y + x == 0, y]) Out[10]= 8True, True, True
D[Root[a*x + b*#1 + #1^5 &, 1], {x, k}] /.

y[x] -> Root[a*x + b*#1 + #1^5 &, 1] // FullSimplify Out[13]= True

For related differential equations, see [410]. b) We use the package Graphics`Polyhedra` to construct a list of neighbors for each vertex of a stellated icosahedron. We number the 20 vertices from the stellation process as 13, …, 32.

Symbolic Computations

718 In[1]:= Needs["Graphics`Polyhedra`"] In[2]:= neighbors = {#[[1, 1]],(* union *) Union[Flatten[Last /@ #]]}& /@

Split[Sort[Join[Sequence @@ (* neighbors formed by the stellation process *) Apply[{{#1, {#2, #3}}, {#2, {#1, #3}}, {#3, {#1, #2}}}&, Faces[Icosahedron], {1}], (* original neighbors *) Sequence @@ MapIndexed[{{12 + #2[[1]], #1}, {#1[[1]], {12 + #2[[1]]}}, {#1[[2]], {12 + #2[[1]]}}, {#1[[3]], {12 + #2[[1]]}}}&, Faces[Icosahedron]]], #1[[1]] < #2[[1]]&], #1[[1]] === #2[[1]]&];

Here are the first and last elements of the list neighbors. In[3]:= Take[neighbors, 2] Out[3]= 881, 82, 3, 4, 5, 6, 13, 14, 15, 16, 17 0] es

Out[6]=

e +  e H−e + esL  es 2  e I−1 +  e M

If we let es = k e, we obtain the following e-independent result for the overlap. In[7]:= overlap[e, k e] // PowerExpand Out[7]=

e + k H−e + e kL    e H−1 + k L2

The overlap integral can take on any value between 0 and 1. In[8]:= Plot[Evaluate[%], {k, -4, 4}]

0.8 0.6 0.4 0.2

-4

-2

2

4

Solutions

723 ¶

For some similar, not well-defined expressions of the form Ÿ-¶ dHxL f HxL dx, see [774]; for a well-defined limit of this type, see [1281]. c) This is the well-known formula for dH f HxLL. We associate all definitions with d instead of with the built-in function DiracDelta. In[1]:= Derivative[0][δ][f] = δ[x - ξ]/Abs[f'[ξ]] Out[1]=

δ@x − ξD   Abs@f @ξDD

The first derivative then takes the following form. In[2]:= d1 = Derivative[1][δ][f] = 1/f'[x] D[Derivative[0][δ][f], x] Out[2]=

δ @x − ξD   Abs@f @ξDD f @xD

To eliminate the x-dependence of the factor 1 ê f £ HxL, we implement the identity n

in y g HxL d HnL Hx - xL = ‚ H-1Lk jj zz g HkL HxL dHn-kL Hx - xL kk { k=0 which transforms the x-dependence of the prefactor to a x-dependence. In[3]:= Derivative /:

g_?(MemberQ[#, x, {0, Infinity}]&)*Derivative[n_][δ][x - ξ] := (Sum[(-1)^k Binomial[n, k] (D[g, {x, k}] /. x -> ξ) * Derivative[n - k][δ][x - ξ], {k, 0, n}])

Using this rule, d£ H f HxLL takes on the following form. In[4]:= d1 Out[4]=

δ @x − ξD δ@x − ξD f @ξD   +   Abs@f @ξDD f @ξD Abs@f @ξDD f @ξD2

Now let us look at the second derivative. In[5]:= Derivative[2][δ][f] = 1/f'[x] D[Derivative[1][δ][f], x] 

Out[5]=





δ @x−ξD f @ξD δ @x−ξD   +   Abs@f @ξDD f @ξD2 Abs@f @ξDD f @ξD    f @xD

The above rule for Derivative did not go into effect because the expression was not of the form of a product of something x-dependent with dHkL Hx - xL. To get the rule working, we must expand the expression. In[6]:= Expand[%] Out[6]=

3 δ @x − ξD f @ξD 3 δ@x − ξD f @ξD2 δ @x − ξD δ@x − ξD fH3L @ξD   +   −    +  Abs@f @ξDD f @ξD3 Abs@f @ξDD f @ξD2 Abs@f @ξDD f @ξD3 Abs@f @ξDD f @ξD4

In[7]:= d2 = Simplify[%] Out[7]=

3 δ@x − ξD f @ξD2 + f @ξD2 δ @x − ξD + f @ξD H3 δ @x − ξD f @ξD − δ@x − ξD fH3L @ξDL        Abs@f @ξDD f @ξD4

For f HxL = x, we get an identity. In[8]:= d2 /. f -> Function[x, x] Out[8]= δ @x − ξD

To “numerically” check the formula for d2, we use a smoothed version of the Dirac d distribution. In[9]:= smoothδ[x_, δ_] := 1/Sqrt[Pi δ]Exp[-x^2/δ]

This smoothed version can be easily integrated by NIntegrate. In[10]:= With[{δ = 0.001},

NIntegrate[Evaluate[Derivative[2, 0][smoothδ][x^3 - 1, δ]], {x, 0, 3}, MaxRecursion -> 10]] Out[10]= 0.371279

Symbolic Computations

724 Comparing with the symbolic result, we see a good agreement. In[11]:= {#, N[#]}&[Integrate[d2 /. f -> Function[x, x^3 - 1] /.

ξ -> 1 /. δ -> DiracDelta, {x, 0, 3}]] 10 27

Out[11]= 9  , 0.37037=

Here is another function used for the check. In[12]:= {With[{δ = 0.001},

NIntegrate[Evaluate[Derivative[2, 0][smoothδ][Cos[x], δ]], {x, 1, 2}, MaxRecursion -> 10]], Integrate[d2 /. f -> Function[x, Cos[x]] /. ξ -> Pi/2 /. δ -> DiracDelta, {x, 0, 3}]} Out[12]= 81.00226, 1
δIntegrateSimplify] // Expand Out[13]= 6 f@ξD f @ξD4 + 12 f@ξD2 f @ξD2 f @ξD ¶

Here is the Euler–Lagrange equation for a functional of the form F@ f HxLD = Ÿ-¶ LH f HxL, f £ HxL, f ≥ HxLL dx.

Symbolic Computations

736 In[14]:= (el2 = [Integrate[F[f[y], f'[y], f''[y]],

{y, -Infinity, Infinity}], f[x], SimplifyFunction -> δIntegrateSimplify]) /. (* shorten result *) (h:(Derivative[__][F]))[__] :> h // Simplify Out[14]= FH1,0,0L − FH1,1,0L f @xD + FH2,0,1L f @xD2 − FH0,2,0L f @xD + FH1,0,1L f @xD + 2 FH1,1,1L f @xD f @xD + FH0,2,1L f @xD2 + 2 FH1,0,2L f @xD fH3L @xD + 2

2 FH0,1,2L f @xD fH3L @xD + FH0,0,3L fH3L @xD + FH0,0,2L fH4L @xD

The function VariationalD from the package Calculus`VariationalMethods` calculates the Euler–Lagrange equation from the above integrand. In[15]:= Needs["Calculus`VariationalMethods`"]

Expand[VariationalD[F[f[x], f'[x], f''[x]], f[x], x] - el2] Out[16]= 0

Now, we show that the Korteweg–de Vries bracket vanishes. These are the i [1540]. In[17]:= [0] := Integrate[u[x], {x, -Infinity, Infinity}]

[1] := Integrate[u[x]^2/2, {x, -Infinity, Infinity}] [2] := Integrate[-u[x]^3 + u'[x]^2/2, {x, -Infinity, Infinity}] [3] := Integrate[5/2 u[x]^4 - 5 u[x] u'[x]^2 + u''[x]^2/2, {x, -Infinity, Infinity}]

The function KdVBracket implements the Korteweg–de Vries bracket. In[21]:= KdVBracket[cq1_, cq2_] :=

Module[{q1, q2, integrand, yIndefIntegral, yDefIntegral}, {q1, q2} = [#, u[y], SimplifyFunction -> δIntegrateSimplify]& /@ {cq1, cq2}; integrand = q1 D[q2, y]; yIndefIntegral = Integrate[integrand, y]; If[FreeQ[yIndefIntegral, Integrate, {0, Infinity}, Heads -> True], (* substitute for completeness; integral must vanish now *) yDefIntegral = (yIndefIntegral /. y -> +Infinity) (yIndefIntegral /. y -> -Infinity); (* u and its derivatives vanish at ±∞ *) yDefIntegral /. {u[+Infinity] -> 0, Derivative[k_][u][+Infinity] -> 0, u[-Infinity] -> 0, Derivative[k_][u][-Infinity] -> 0}, yIndefIntegral]]

All of the 8i ,  j < vanish. In[22]:= Table[KdVBracket[ [i], [j]], {i, 0, 3}, {j, 0, 3}] // Flatten Out[22]= 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
_] := [[functional, f1, SimplifyFunction -> ], fs, SimplifyFunction -> ] (* multiple differentiation; no simplification *) [functional_, f1_, fs__] := [[functional, f1], fs] /; FreeQ[{fs}, Rule | RuleDelayed, {1}]

Here are again two examples. In[27]:= [Integrate[f[y]^2, {y, -Infinity, Infinity}], f[x], f[z]] Out[27]= 2 DiracDelta@x − zD In[28]:= [Integrate[f[y] f'[y]^2, {y, -Infinity, Infinity}], f[x], f[z]] Out[28]= −2 HDiracDelta @x − zD f @xD + f@xD DiracDelta @x − zD + DiracDelta@x − zD f @xDL

The second functional derivative of the above-used point particle action is -H∑2 . ê ∑ t22 + V HxHt1 LLL dHt1 - t2 L..

Solutions

737 In[29]:= [Integrate[1/2 x'[t]^2 - V[x[t]],

{t, -Infinity, Infinity}], x[τ1], x[τ2]] Out[29]= −DiracDelta @τ1 − τ2D − DiracDelta@τ1 − τ2D V @x@τ1DD ¶

For F@ f HxLD = Ÿ-¶ f HxL hHxL dx, we have the general result dn F ê Hd f Hy1 L ∫ d f Hyn LL = F@ f D hHy1 L ∫ hHyn L. Here is the case n = 3 is explicitly calculated. In[30]:= [Exp[Integrate[f[y] h[y], {y, -Infinity, Infinity}]],

f[x], f[z], f[w]] Out[30]= Integrate@f@yD h@yD,8y,−∞,∞ &) First[{Ψ}], Rest[{Ψ}]]

` ` So, we can calculate the first terms of expItIA + BMM.

_] &,

Symbolic Computations

738 In[17]:= (rhs = [[E^(t Subscript[ω, 1] OverHat[A])] ⊗

[E^(t Subscript[ω, 2] OverHat[B])] ⊗ [E^(t Subscript[ω, 3] OverHat[A])] ⊗ [E^(t Subscript[ω, 4] OverHat[B])] ⊗ [E^(t Subscript[ω, 5] OverHat[A])] ⊗ [E^(t Subscript[ω, 6] OverHat[B])] ⊗ [E^(t Subscript[ω, 7] OverHat[A])], t]) // Short[#, 6]& 1 1 1 ˆ ˆ2 ˆ3 ˆ4 ˆ Out[17]//Short= 1 + t ⊗ A ω1 +  t2 ⊗ A ω21 +  t3 ⊗ A ω31 +  t4 ⊗ A ω41 + t ⊗ B ω2 + 2 6 24 1 1 1 1 ˆ ˆ ˆ2 ˆ ˆ3 ˆ ˆ2 ˆ ˆ2 t2 A ⊗ B ω1 ω2 +  t3 A ⊗ B ω21 ω2 +  t4 A ⊗ B ω31 ω2 +  t2 ⊗ B ω22 +  t3 A ⊗ B ω1 ω22 + 2 6 2 2 1 ˆ2 ˆ2 1 ˆ2 ˆ2 1 ˆ ˆ ˆ2  t4 A ⊗ B ω21 ω22 + 307 +  t4 B ⊗ A ω4 ω6 ω27 +  t4 A ⊗ B ⊗ A ω5 ω6 ω27 + 4 2 2 1 ˆ2 ˆ2 1 ˆ3 1 ˆ4 1 ˆ ˆ3  t4 B ⊗ A ω26 ω27 +  t3 ⊗ A ω37 +  t4 ⊗ A ω1 ω37 +  t4 B ⊗ A ω2 ω37 + 4 6 6 6 1 1 1 1 1 ˆ4 ˆ ˆ3 ˆ4 ˆ ˆ3 ˆ4  t4 ⊗ A ω3 ω37 +  t4 B ⊗ A ω4 ω37 +  t4 ⊗ A ω5 ω37 +  t4 B ⊗ A ω6 ω37 +  t4 ⊗ A ω47 6 6 6 6 24

Up to order 4 in t, the difference between right-hand side and left-hand side should vanish identically. In[18]:= (shouldBeZero = rhs - lhs) // Short[#, 12]&

ˆ

ˆ

1 ˆ2 ˆ2 ˆ ˆ ˆ ˆ 2 1 ˆ3 ˆ3 ˆ ˆ2 ˆ2 ˆ ˆ ˆ2 ˆ2 ˆ ˆ ˆ ˆ ˆ ˆ ˆ  t3 I ⊗ A + ⊗ B + A ⊗ B + A ⊗ B + B ⊗ A + B ⊗ A + A ⊗ B ⊗ A + B ⊗ A ⊗ BM − 6 1 ˆ4 ˆ4 ˆ ˆ3 ˆ2 ˆ2 ˆ3 ˆ ˆ ˆ3 ˆ2 ˆ2 ˆ3 ˆ ˆ ˆ ˆ2  t4 I ⊗ A + ⊗ B + A ⊗ B + A ⊗ B + A ⊗ B + B ⊗ A + B ⊗ A + B ⊗ A + A ⊗ B ⊗ A + 24 2 2 ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ2 ˆ ˆ2 ˆ ˆ2 ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ A ⊗ B ⊗ A + A ⊗ B ⊗ A + B ⊗ A ⊗ B + B ⊗ A ⊗ B + B ⊗ A ⊗ B + A ⊗ B ⊗ A ⊗ B + B ⊗ A ⊗ B ⊗ AM + 1 1 1 ˆ ˆ2 ˆ3 ˆ4 ˆ ˆ ˆ t ⊗ A ω1 +  t2 ⊗ A ω21 +  t3 ⊗ A ω31 +  t4 ⊗ A ω41 + t ⊗ B ω2 + t2 A ⊗ B ω1 ω2 + 2 6 24 1 ˆ2 ˆ 1 ˆ3 ˆ 1 ˆ2 1 ˆ ˆ2 1 ˆ2 ˆ2  t3 A ⊗ B ω21 ω2 +  t4 A ⊗ B ω31 ω2 +  t2 ⊗ B ω22 +  t3 A ⊗ B ω1 ω22 +  t4 A ⊗ B ω21 ω22 + 2 6 2 2 4 1 1 1 1 ˆ3 ˆ ˆ3 ˆ4 ˆ ˆ3  t3 ⊗ B ω32 +  t4 A ⊗ B ω1 ω32 +  t4 ⊗ B ω42 + 298 +  t4 B ⊗ A ω4 ω5 ω27 + 6 24 2 6 1 ˆ4 1 ˆ ˆ2 1 ˆ ˆ ˆ2 1 ˆ2 ˆ2  t4 ⊗ A ω25 ω27 +  t3 B ⊗ A ω6 ω27 +  t4 A ⊗ B ⊗ A ω1 ω6 ω27 +  t4 B ⊗ A ω2 ω6 ω27 + 4 2 2 2 1 ˆ ˆ ˆ2 1 ˆ2 ˆ2 1 ˆ ˆ ˆ2  t4 A ⊗ B ⊗ A ω3 ω6 ω27 +  t4 B ⊗ A ω4 ω6 ω27 +  t4 A ⊗ B ⊗ A ω5 ω6 ω27 + 2 2 2 1 ˆ2 ˆ2 1 ˆ3 1 ˆ4 1 ˆ ˆ3  t4 B ⊗ A ω26 ω27 +  t3 ⊗ A ω37 +  t4 ⊗ A ω1 ω37 +  t4 B ⊗ A ω2 ω37 + 4 6 6 6 1 1 1 1 1 ˆ4 ˆ ˆ3 ˆ4 ˆ ˆ3 ˆ4  t4 ⊗ A ω3 ω37 +  t4 B ⊗ A ω4 ω37 +  t4 ⊗ A ω5 ω37 +  t4 B ⊗ A ω6 ω37 +  t4 ⊗ A ω47 6 6 6 6 24

Out[18]//Short= −t I ⊗ A + ⊗ BM −  t2 I ⊗ A + ⊗ B + A ⊗ B + B ⊗ AM −

ˆ ˆ For generic, noncommuting operators A and B, we have the following independent operator products in shouldBeZero. In[19]:= allOperators = Union[Cases[shouldBeZero, _CircleTimes, {0, Infinity}]]

ˆ

ˆ2

ˆ3

ˆ4

ˆ

ˆ2

ˆ3

ˆ4

ˆ ˆ ˆ ˆ2

ˆ ˆ3

ˆ2

ˆ

Out[19]= 9 ⊗ A, ⊗ A , ⊗ A , ⊗ A , ⊗ B, ⊗ B , ⊗ B , ⊗ B , A ⊗ B, A ⊗ B , A ⊗ B , A ⊗ B,

ˆ2 ˆ2 ˆ3 ˆ ˆ ˆ ˆ ˆ2 ˆ ˆ3 ˆ2 ˆ ˆ2 ˆ2 ˆ3 ˆ ˆ ˆ ˆ ˆ ˆ ˆ2 A ⊗ B , A ⊗ B, B ⊗ A, B ⊗ A , B ⊗ A , B ⊗ A, B ⊗ A , B ⊗ A, A ⊗ B ⊗ A, A ⊗ B ⊗ A , ˆ ˆ2 ˆ ˆ2 ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ2 ˆ ˆ2 ˆ ˆ2 ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ A ⊗ B ⊗ A, A ⊗ B ⊗ A, B ⊗ A ⊗ B, B ⊗ A ⊗ B , B ⊗ A ⊗ B, B ⊗ A ⊗ B, A ⊗ B ⊗ A ⊗ B, B ⊗ A ⊗ B ⊗ A=

We take the c-number coefficients with respect to these operators—they should vanish. In[20]:= (operatorCoefficients =

Coefficient[shouldBeZero, #]& /@ allOperators) // Short[#, 6]& t2 1 1 Out[20]//Short= 9−t + t ω1 + t ω3 + t ω5 + t ω7 , −  +  t2 ω21 + t2 ω1 ω3 +  t2 ω23 + 2 2 2 1 1 t2 ω1 ω5 + t2 ω3 ω5 +  t2 ω25 + t2 ω1 ω7 + t2 ω3 ω7 + t2 ω5 ω7 +  t2 ω27 , 26 , 2 2 4 t −  + t4 ω1 ω2 ω3 ω4 + t4 ω1 ω2 ω3 ω6 + t4 ω1 ω2 ω5 ω6 + t4 ω1 ω4 ω5 ω6 + t4 ω3 ω4 ω5 ω6 , 24 t4 −  + t4 ω2 ω3 ω4 ω5 + t4 ω2 ω3 ω4 ω7 + t4 ω2 ω3 ω6 ω7 + t4 ω2 ω5 ω6 ω7 + t4 ω4 ω5 ω6 ω7 = 24

For every power of t, we extract the corresponding coefficients. This leads to the following, quite complicated, polynomial system of nonlinear equations for w1 , w2 , w3 , w4 , w5 , w6 , and w7 . In[21]:= (algebraicEquations =

DeleteCases[Union[Flatten[Map[Numerator[Together[#]]&,

Solutions

739 CoefficientList[#, t]& /@ operatorCoefficients, {2}]]], 0]); Short[algebraicEquations, 12]

Out[22]//Short= 8−1 + ω2 + ω4 + ω6 , −1 + 2 ω1 ω2 + 2 ω1 ω4 + 2 ω3 ω4 + 2 ω1 ω6 + 2 ω3 ω6 + 2 ω5 ω6 ,

−1 + 6 ω2 ω3 ω4 + 6 ω2 ω3 ω6 + 6 ω2 ω5 ω6 + 6 ω4 ω5 ω6 , −1 + 24 ω1 ω2 ω3 ω4 + 24 ω1 ω2 ω3 ω6 + 24 ω1 ω2 ω5 ω6 + 24 ω1 ω4 ω5 ω6 + 24 ω3 ω4 ω5 ω6 , 23 , −1 + ω31 + 3 ω21 ω3 + 3 ω1 ω23 + ω33 + 3 ω21 ω5 + 6 ω1 ω3 ω5 + 3 ω23 ω5 + 3 ω1 ω25 + 3 ω3 ω25 + ω35 + 3 ω21 ω7 + 6 ω1 ω3 ω7 + 3 ω23 ω7 + 6 ω1 ω5 ω7 + 6 ω3 ω5 ω7 + 3 ω25 ω7 + 3 ω1 ω27 + 3 ω3 ω27 + 3 ω5 ω27 + ω37 , −1 + 4 ω2 ω33 + 12 ω2 ω23 ω5 + 12 ω2 ω3 ω25 + 4 ω2 ω35 + 4 ω4 ω35 + 12 ω2 ω23 ω7 + 24 ω2 ω3 ω5 ω7 + 12 ω2 ω25 ω7 + 12 ω4 ω25 ω7 + 12 ω2 ω3 ω27 + 12 ω2 ω5 ω27 + 12 ω4 ω5 ω27 + 4 ω2 ω37 + 4 ω4 ω37 + 4 ω6 ω37 , −1 + ω41 + 4 ω31 ω3 + 6 ω21 ω23 + 4 ω1 ω33 + ω43 + 4 ω31 ω5 + 12 ω21 ω3 ω5 + 12 ω1 ω23 ω5 + 4 ω33 ω5 + 6 ω21 ω25 + 12 ω1 ω3 ω25 + 6 ω23 ω25 + 4 ω1 ω35 + 4 ω3 ω35 + ω45 + 4 ω31 ω7 + 12 ω21 ω3 ω7 + 12 ω1 ω23 ω7 + 4 ω33 ω7 + 12 ω21 ω5 ω7 + 24 ω1 ω3 ω5 ω7 + 12 ω23 ω5 ω7 + 12 ω1 ω25 ω7 + 12 ω3 ω25 ω7 + 4 ω35 ω7 + 6 ω21 ω27 + 12 ω1 ω3 ω27 + 6 ω23 ω27 + 12 ω1 ω5 ω27 + 12 ω3 ω5 ω27 + 6 ω25 ω27 + 4 ω1 ω37 + 4 ω3 ω37 + 4 ω5 ω37 + ω47
3}; In[7]:= Solve[(gb[[1]] /. rRules) == 0, A2] // RootReduce Out[7]= 88A2 → 0 0, {r, 0, Infinity}, Assumptions -> Z > 0], {k, 10}] 81, 4, 9, 16, 25, 36, 49, 64, 81, 100
All, Frame -> True, Axes -> False, PlotStyle -> Table[{Thickness[0.002], Hue[k/10]}, {k, 0, 10}], AxesLabel -> {"ρ", ""}, (* limit n -> ∞ *) Prolog -> {{Thickness[0.01], GrayLevel[1/2], Line[Table[{ρ, Re[ρ Sqrt[4 ρ - ρ^2]/(2 Pi)]}, {ρ, 0, 6, 1/20}] // N]}}]

Classical Orthogonal Polynomials

842

0.8

0.6

0.4

0.2

0 0

1

2

3

4

5

6

For the average electron distance in dD atoms, see [363].

2.6 Legendre Polynomials The Legendre polynomials arise as the solutions of the eigenvalue problem H1 - z2 L Y££ HzL - 2 z Y£ HzL + lHl + 1L YHzL = 0 ,

z œ H-1, 1L

with the requirement that the solution be finite at z = ≤1. In this case, the eigenvalues are l = n (n œ , n ¥ 0). The Mathematica formula for the Legendre polynomials follows. LegendreP[n, z] (n œ , n ¥ 0) gives the nth Legendre polynomial Pn HzL. If n is not a nonnegative integer, the value of the corresponding analytic continuation of Pn HzL is understood.

We now look at the first few Legendre polynomials explicitly. In[1]:=

With[{p = LegendreP}, Table[HoldForm[p[ν, z]] == p[n, z] /. ν -> n, {n, 0, 6}]] // TableForm // TraditionalForm

Out[1]//TraditionalForm=

P0 HzL  1 P1 HzL  z 2

3z ÅÅÅÅÅÅ - ÅÅ12ÅÅ P2 HzL  ÅÅÅÅ 2 3

5z 3z P3 HzL  ÅÅÅÅ ÅÅÅÅÅÅ - ÅÅÅÅ ÅÅÅ 2 2 4

2

5

3

35 z 15 z P4 HzL  ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ - ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ + ÅÅ38ÅÅ 8 4 63 z 35 z 15 z P5 HzL  ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ - ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ + ÅÅÅÅ ÅÅÅÅÅÅ 8 4 8 6

4

2

231 z 315 z 105 z 5 P6 HzL  ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ - ÅÅÅÅ ÅÅ 16 16 16 16

Here are plots of these polynomials. In[2]:=

Show[GraphicsArray[#]]& /@ Table[(* the individual plots *) Plot[LegendreP[3i + j, z], {z, -1, 1}, PlotLabel -> (StyleForm[TraditionalForm[ HoldForm[LegendreP[#, z]]],

2.6 Legendre Polynomials

843 FontSize -> 7]&[3i + j]), DisplayFunction -> Identity], {i, 0, 2}, {j, 0, 2}] P0 HzL

P1 Hz L

2

P2 Hz L

1

1.5

1 0.8 0.6 0.4 0.2

0.5

1 -1

0.5 -1

-0.5

-0.5

0.5

1

-0.5

-0.5

0.5

1

-0.5

-1

-0.5

-1

P6 HzL 1 0.8 0.6 0.4 0.2

-0.2 -0.4

-1 0.5

-0.5

-1

-0.5

0.5

1

0.5

1

-0.5

1

-1

P8 Hz L 1 0.8 0.6 0.4 0.2

0.5

1

0.5

1

-0.5

-1

-1

-0.5

-0.2 -0.4

This tests whether they satisfy the above differential equation. In[3]:=

Out[4]=

LegendreDifferentialOperator[w_, z_, n_] := (1 - z^2) D[w, {z, 2}] - 2 z D[w, z] + n (n + 1) w; Expand[LegendreDifferentialOperator[#[[1]], z, #[[2]]]]& /@ Table[{LegendreP[n, z], n}, {n, 0, 6}] 80, 0, 0, 0, 0, 0, 0
Table[Hue[x], {x, 0, 7/10, 1/10}]], (* n = 12, real m *) Plot3D[Log @ Abs @ LegendreP[12, m, z], {z, -1 + ∂, 1 - ∂}, {m, -6, 6}, PlotPoints -> 90]}]]] 10000 8000 6000

40 20 0 -20 -40

4000 2000

5 2.5 0

-1

-0.5

0.5

1

-2000

-0.5

-2.5

0 0.5

The zeros of Pm n HzL shift toward the right as m increases. Here is an example. In[21]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {(* roots as a function of real µ *) ContourPlot[Re[LegendreP[15, m, z]], {z, -0.95, 0.95}, {m, -15., 15.}, Contours -> {0}, ContourShading -> False, FrameLabel -> {"z", "m"}, PlotPoints -> 300], (* roots as a function of complex µ *) Graphics[Table[{Hue[ϕ/(2Pi)], Point[{Re[#], Im[#]}]& /@ (z /. NSolve[Sum[((Pochhammer[-18, k] Pochhammer[18 + 1, k])/

-5

2.6 Legendre Polynomials

847

(Gamma[1 - Exp[I ϕ] + k] k!)) ((1 - z)/2)^k, {k, 0, 18}] == 0, z])}, {ϕ, 0, 2Pi, 2Pi/120}], AspectRatio -> 1, Frame -> True]}]]] 15 0.075

10

0.05

m

5

0.025

0

0

-5

-0.025 -0.05

-10

-0.075

-15

-0.75-0.5-0.25 0 0.25 0.5 0.75 z

-1

-0.5

0

0.5

1

Now, we test whether the associated Legendre polynomials actually satisfy the above differential equation. In[22]:=

Out[23]=

AssociatedLegendreDifferentialOperator[w_, z_, n_, m_] := (1 - z^2) D[w, {z, 2}] - 2z D[w, z] + (n(n + 1) - m^2/(1 - z^2)) w; Map[Simplify[Expand[ AssociatedLegendreDifferentialOperator[#[[1]], z, #[[2]], #[[3]]]]]&, Table[{LegendreP[n, m, z], n, m}, {n, 0, 4}, {m, 0, n}], {2}] 880 Identity], {i, 0, 2}, {j, 0, 2}]

Classical Orthogonal Polynomials

850 T0 Hz L

T1 Hz L

2

1.5 1

-1

-0.5

0.5

- 0.5

-1

- 0.5

- 0.5

0.5 0.5

1

- 0.5

1

T3 Hz L

-1

1

0.5

0.5

-1

T 2 Hz L

1

-1

- 0.5

-1

-1

T4 Hz L

T 5 Hz L

1

1

1

0.5

0.5

0.5

0.5

1

-1

- 0.5

0.5

1

-1

-0.5

-0.5

- 0.5

-1

-1

-1

T6 Hz L

T7 Hz L

T 8 Hz L

1

1

0.5

0.5 0.5

-0.5

1

-1

- 0.5

1

0.5

1

0.5

1

- 0.5

1 0.5 0.5

- 0.5

-1

0.5

- 0.5

1

-1

-0.5

-1

- 0.5 -1

We can test whether they satisfy the above differential equation as follows. In[3]:=

Out[4]=

ChebyshevTDifferentialOperator[w_, z_, n_] := (1 - z^2) D[w, {z, 2}] - z D[w, z] + n^2 w; Expand[ChebyshevTDifferentialOperator[#[[1]], z, #[[2]]]]& /@ Table[{ChebyshevT[n, z], n}, {n, 0, 6}] 80, 0, 0, 0, 0, 0, 0
Automatic]] /@ (* black or white and random coloring *) {GrayLevel[If[EvenQ[#[[1]]], 1, 0]]&, Hue[Random[]]&}]]

2.8 Chebyshev Polynomials of the Second Kind

853

For more on Chebyshev polynomials, see, in particular, [478] and [389].

2.8 Chebyshev Polynomials of the Second Kind The Chebyshev polynomials Un HzL arise as the solution of the eigenvalue problem H1 - z2 L Y££ HzL - 3 z Y£ HzL + lHl + 2L YHzL = 0 ,

z œ H-1, 1L

with the requirement that the solution be finite at z = ≤1. In this case, the eigenvalues are l = n (n œ , n ¥ 0). The Mathematica formula for the Chebyshev polynomials Un HzL follows. (Note the spelling of Chebyshev; for other possibilities, see [270].) ChebyshevU[n, z] Hn œ , n ¥ 0L gives the nth Chebyshev polynomial Un HzL. If n is not a nonnegative integer, the analytic continuation of Un HzL is understood.

Here are the first few Chebyshev polynomials Un HzL. In[1]:=

With[{p = ChebyshevU}, Table[HoldForm[p[ν, z]] == p[n, z] /. ν -> n, {n, 0, 6}]] // TableForm // TraditionalForm

Out[1]//TraditionalForm=

U0 HzL  1 U1 HzL  2 z U2 HzL  4 z2 - 1 U3 HzL  8 z3 - 4 z U4 HzL  16 z4 - 12 z2 + 1 U5 HzL  32 z5 - 32 z3 + 6 z U6 HzL  64 z6 - 80 z4 + 24 z2 - 1

Here is a plot of these polynomials. In[2]:=

Show[GraphicsArray[#]]& /@ Table[(* the individual plots *) Plot[ChebyshevU[3i + j, z], {z, -1, 1}, PlotLabel -> StyleForm[TraditionalForm[ HoldForm[ChebyshevU[3i + j, z]]],

Classical Orthogonal Polynomials

854

FontSize -> 7], DisplayFunction -> Identity], {i, 0, 2}, {j, 0, 2}] U0 Hz L

U1 Hz L

2

1.5

-1

0.5

-0.5

0.5

- 0.5

1

U3 Hz L

0.5

1

1

-1

- 0.5

-2

-1

U4 Hz L

U5 Hz L

2

- 0.5

2

-1

4

-1

3

1

1

-1

U2 Hz L

2

5

6

4

4

3 0.5

-1

1

-2 -1

-4

-0.5

U6 Hz L

0.5

-1

-0.5

1

U7 Hz L

6 4

1

0.5

1

0.5

1

2

2

1

0.5

-2 -4 -6

U8 Hz L

4

8

2

6 4

-1

2

-1

- 0.5

0.5

-0.5

0.5

-2

1

2

-1

-4

1

- 0.5

-2

This tests whether they satisfy the differential equation. In[3]:=

Out[4]=

ChebyshevUDifferentialOperator[w_, z_, n_] := (1 - z^2) D[w, {z, 2}] - 3 z D[w, z] + n (n + 2) w; Expand[ChebyshevUDifferentialOperator[#[[1]], z, #[[2]]]]& /@ Table[{ChebyshevU[n, z], n}, {n, 0, 6}] 80, 0, 0, 0, 0, 0, 0< è!!!!!!!!!!!!!!

1

The weight function is In[5]:=

Out[5]=

z2 , and the interval of orthogonality is H 1, 1L.

-

-

Table[Integrate[Expand[ChebyshevU[i, x] ChebyshevU[j, x]] Sqrt[1 - x^2], {x, -1, 1}], {i, 0, 3}, {j, 0, 3}] - Pi/2 IdentityMatrix[4] // Flatten // Union 80
0, 1, 0]], negative regions *) 1/2}, {#[[2]], i + 1/2}]}& /@

2.8 Chebyshev Polynomials of the Second Kind

859

Partition[Join[{-1}, Last /@ List @@ (* the zeros *) NRoots[ChebyshevU[i, z] == 0, z, 30], {1}], 2, 1], {i, 2, 50}]], Frame -> True, PlotRange -> All, FrameLabel -> {"z", "n"}] 50 40

n

30 20 10

-1

-0.5

0 z

0.5

1

We end this section by visualizing how the interlacing of the zeros of Un-1 HxL and Un HxL looks for larger n. By connecting the interlaced zeros with a piecewise straight curves of slope ≤1, the limit curve 1ê2 2 ê p Ix arcsinHxL + H1 + x2 L M is approached [314]. (This limit curve is also obtained for rescaled zeros of other orthogonal polynomials.) The right graphic shows the curves for the zeros of Tn-1 HxL and Tn HxL. We use the first 100 polynomials that have zeros. In[28]:=

(* a curve with slope ±1 between the points minMaxList; rightmost line segment has slope -1 *) makeZigZagCurve[minMaxList_] := FoldList[{#2[[1]], #1[[2]] + #2[[2]] (#2[[1]] - #1[[1]])}&, minMaxList[[-1]] {1, 1}, MapIndexed[{#1, -(-1)^#2[[1]]}&, Reverse[minMaxList]]]

In[30]:=

With[{o = 100}, Show[GraphicsArray[ Graphics[{{(* color curves *) MapIndexed[{Hue[0.8 #2[[1]]/o], (* interlace zeros and form zigzag curve *) Line[makeZigZagCurve[#1]]}&, Sort[Flatten[#]]& /@ Partition[ Table[Chop[N[z /. {ToRules[Roots[#[k, z] == 0, z]]}]], {k, o}], 2, 1]]}, {Thickness[0.002], GrayLevel[0], (* theoretical limit curve *) Line[Table[{x, 2/Pi (x ArcSin[x] + Sqrt[1 - x^2])}, {x, -1, 1, 1/100}]]}} // N, PlotRange -> {0.3, 1.5}, Frame -> True, PlotLabel -> #]& /@ {ChebyshevU, ChebyshevT}]]] ChebyshevU

ChebyshevT

1.4

1.4

1.2

1.2

1

1

0.8

0.8

0.6

0.6

0.4

0.4 -1

-0.5

0

0.5

1

-1

-0.5

0

0.5

1

Classical Orthogonal Polynomials

860

2.9 Relationships Among the Orthogonal Polynomials There are a number of relationships among the various classical orthogonal polynomials. We do not discuss all of them here, but instead simply check some of them for special choices of parameter values. † Gegenbauer polynomials are, up to the normalization constant, special Jacobi polynomials. More precisely, GHa + 1 ê 2L GH2 a + nL Ha-1ê2,a-1ê2L Cna HzL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ HzL. ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ P HGH2 aL GHa + n + 1 ê 2LL n We can see this with an example. In[1]:=

Out[2]=

JacobiGegenbauerRelation[n_, α_] := Expand[Gamma[α + 1/2] Gamma[2α + n]/Gamma[2α]/Gamma[α + n + 1/2]* JacobiP[n, α - 1/2, α - 1/2, z]] == Expand[GegenbauerC[n, α, z]] Apply[JacobiGegenbauerRelation, {{1, 1}, {2, 2}, {2, 1}, {1, 2}}, {1}] 8True, True, True, True
0]}, {n, 6}] // TableForm

Out[3]//TableForm=

2z −1 + 2 z2

2z −1 + 2 z2 3

3

8z −2 z +   3

8z −2 z +   3

1   − 4 z2 + 4 z4 2

1   − 4 z2 + 4 z4 2

32 z5

5

32 z 2 z − 8 z3 +  5

2 z − 8 z3 + 5 6

6

1 32 z −   + 6 z2 − 16 z4 +  3 3

1 32 z −   + 6 z2 − 16 z4 +  3 3

† Hermite polynomials Hn HzL can be found from Laguerre polynomials LHaL n HzL by - ÅÅ1ÅÅ

H2 n HzL = H-1Ln 22 n n ! Ln 2 Hz2 L ÅÅ1ÅÅ

H2 n+1 HzL = H-1Ln 22 n+1 n ! z Ln2 Hz2 L. Here again are a few examples. In[4]:=

HermiteLaguerreRelation[n_Integer] := Apply[Equal, {{Expand[HermiteH[2n, z]], Expand[(-1)^n 2^(2n) n! LaguerreL[n, -1/2, z^2]]}, {Expand[HermiteH[2n + 1, z]], Expand[(-1)^n 2^(2n + 1) n! z LaguerreL[n, 1/2, z^2]]}}, {1}]

2.9 Relationships among the Orthogonal Polynomials In[5]:= Out[5]=

861

Table[HermiteLaguerreRelation[n], {n, 0, 4}] // Flatten // Union 8True
ChebyshevT[n, z] ChebyshevT@n, zD

To complete this chapter, we discuss one more nontrivial relationship between orthogonal polynomials: ¶

sk sm ÅÅÅÅÅÅÅÅÅÅ Hm Hx - 2 sL expH-s2 + 2 xsL = „ LHk-mL H2 s2 L Hk HxL ÅÅÅÅÅÅÅÅÅ m m! k! k=0

for m = 0, 1, … ([399]). We can examine the “correctness” of this assertion for some special cases. We fix m, and we compute both expressions up to the same order in s. In order to keep the powers on the right-hand side from becoming too large, we make use of the property of SeriesData-objects to collapse expressions of the form f HxL + OHxLn to order n. In[10]:=

hermiteLaguerreTest[m_Integer?(# >= 0&), n_Integer?(# >= 0&)] := Cancel /@ Collect[Normal @ (* make a series around s = 0 *) Series[s^m/m! HermiteH[m, x - 2s] Exp[-s^2 + 2s x], {s, 0, n}], s] == Cancel /@ Collect[Normal[Sum[LaguerreL[m, k - m, 2s^2] *

Classical Orthogonal Polynomials

862

HermiteH[k, x]/k! s^k, {k, 0, n}] + (* make the expansion in a series *) O[s]^(n + 1)], s]

Here are a few special cases. In[11]:= Out[11]=

Table[hermiteLaguerreTest[i, j], {i, 0, 6}, {j, 0, 6}] // Flatten // Union 8True
{0}, PlotPoints -> 222, FrameTicks -> None]

Expressions with more than one kind of orthogonal polynomial often arise as solutions of partial differential equations after separation of variables. A typical example is the quantum-mechanical treatment of the hydrogen atom. Here we give another, not so well known example. The (unnormalized) eigenfunctions of the An-1 Calogero–Sutherland model [528], [245], [441], [231], [164] n

n

n 1 lHl - 1L HlL zy ji HlL - ÅÅÅÅÅÅ D yn,m Hx1 , …, xn L + jjjj‚ x2j zzzz yHlL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ yn,m Hx1 , …, xn L = n,m Hx1 , …, xn L + „ „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 Hxk - x j L2 k j=1 { j=1 k= j+1

¶n,m yHlL n,m Hx1 , …, xn L can be expressed through Hermite and Laguerre polynomials ij n n y 2 jj z -r ê2 H HyL LHn-3+1 Hn-1L l nLê2 Hr2 - y2 L lz Hx , …, x L = yHlL jj‰ ‰ Hxk - x j L zzz e n m n,m 1 n k j=1 k= j+1 { 1ê2

where r = H⁄nj=1 x2j L

1ê2

and y = n-1ê2 H⁄nj=1 x j L .

The eigenvalues ¶n,m are ¶n,m =Hm + 2 nL ê 2 + Hn + l nHn - 1L L. HlL Hx1 , …, xn L, the Calogero–Sutherland Hamiltonian and the energy eigenvalues Here are the eigenfunctions yn,m ¶n,m defined. In[13]:=

(* wave functions *) ψCS[xs_List, λ_, n_Integer, m_Integer] := Module[{ν = Length[xs], y, r}, y = Plus @@ xs/Sqrt[ν]; r = Sqrt[xs.xs]; Product[(xs[[k]] - xs[[j]])^λ,

2.9 Relationships among the Orthogonal Polynomials

863

{j, 1, ν}, {k, j + 1, ν}] Exp[-r^2/2] HermiteH[m, y]* LaguerreL[n, (ν - 3)/2 + λ ν (ν - 1)/2, r^2 - y^2]] In[15]:=

(* Hamiltonian *) CS[xs_List, λ_] := With[{ν = Length[xs]}, (Sum[-D[#, {xs[[k]], 2}] + xs[[k]]^2 #, {k, ν}]/2 + λ (λ - 1) Sum[(xs[[k]] - xs[[j]])^-2, {j, 1, ν}, {k, j + 1, ν}] #)&]

In[17]:=

∂CS[ν_, λ_, n_, m_] := (m + 2 n) + 1/2(ν + λ ν (ν - 1))

HlL Verifying the eigenfunctions is already a large amount of work for small n and m. y6,3 Hx1 , x2 , x3 L has 1396 terms when expanded. After differentiation and multiplication, we get 10273 terms. In[18]:=

Out[18]=

Block[{ξ = {x1, x2, x3}, ν = 3, n = 6, m = 4, Ψ}, Ψ = ψCS[ξ, λ, n, m]; CS[ξ, λ][Ψ] - ∂CS[ν, λ, n, m] Ψ // Together] // Timing 82.74 Second, 0
240, Contours -> 20, ContourLines -> False, ColorFunction -> (Hue[0.8 #]&), PlotRange -> All]], (* 3D contour plot of ψCS[{x1, x2, x3}, 4, 4, 4] *) With[{L = 8}, ContourPlot3D[Evaluate[N @ ψCS[{x1, x2, x3}, 4, 4, 4]], {x1, -L, L}, {x2, -L, L}, {x3, -L, L}, Contours -> {10^4}, MaxRecursion -> 1, ContourStyle -> {EdgeForm[]}, PlotPoints -> {36, 3}, ViewPoint -> {4, 1, 2}]]}]]] 10 5 0 -5 -10 -10

-5

0

5

10

Because we are at the end of our discussion of the orthogonal polynomials, let us examine how a value pn HzL (fixed n) evolves as the sum of terms of the form ci zi . In[21]:=

Module[{f, g, r, p, n = 8}, (* make Function that gives a list of summands c[i] z^i *) f[poly_] := Function[C, #]& @ ((C^Range[0, Exponent[#, C]])* N[CoefficientList[#, C]])&[poly[C]];

864

Classical Orthogonal Polynomials (* make a line from a list of summands c[i] z^i *) g[poly_, y_] := Line[{Re[#], Im[#]}& /@ Rest[FoldList[Plus, 0, poly[y]]]]; Show[GraphicsArray[#]]& /@ Map[Function[poly, Graphics[{Thickness[0.002], Table[(* z varies inside unit disk *) g[poly, r Exp[I ϕ]], {r, 0, 1., 1/12.}, {ϕ, 0, 2Pi // N, 2Pi/12 // N}]}, AspectRatio -> 1, Frame -> True, FrameTicks -> None, PlotRange -> All, DisplayFunction -> Identity]], (* the polynomials under investigation *) Table[f[#], {i, n}]& /@ {HermiteH[i, #]&, LaguerreL[i, 2, #]&, JacobiP[i, 2 - I, 2 + I, #]&, LegendreP[i, 0, #]&, GegenbauerC[i, 1/2 + I/2, #]&, ChebyshevT[i, #]&, ChebyshevU[i, #]&}, {2}]]

There are a lot of interesting things to say and visualize about the classical orthogonal polynomials, for instance, finding and visualizing which coefficients and terms are the dominant ones. In[22]:=

coefficientDensityPlot[poly_, maxDegree_, opts___] := Show[Graphics[{PointSize[0.003], (* make a grayed polygon from every coefficient *) MapIndexed[{GrayLevel[#], Rectangle[Reverse[#2] - {1/2, 1/2} , Reverse[#2] + {1/2, 1/2}]}&, (* the rescaled list of coefficients *)

2.9 Relationships among the Orthogonal Polynomials

865

(# - Min[#])/(Max[#] - Min[#])& /@ (* list of all polynomials up to degree maxDegree *) Table[CoefficientList[poly, x], {n, maxDegree}], {-1}]}], PlotRange -> All, AspectRatio -> 1, Frame -> True, (* make label *) FrameLabel -> {TraditionalForm[poly], "n"}, opts]; (* make a picture of every orthogonal polynomial *) Show[GraphicsArray[#]]& /@ Map[coefficientDensityPlot[#, 50, DisplayFunction -> Identity]&, (* the polynomials *) {{HermiteH[n, x], LaguerreL[n, x], ChebyshevT[n, x]}, {ChebyshevU[n, x], GegenbauerC[n, 2, x], LegendreP[n, x]}, {JacobiP[n, -4, 5, x], JacobiP[n, 2, 5, x], JacobiP[n, 30, 30, x]}}, {2}]

40

40

40

30

30

30 n

50

n

50

n

50

20

20

20

10

10

10

0

0

0

10

20 30 Hn HxL

40

50

0

10

20 30 Ln HxL

40

0

50

50

50

40

40

40

30

30

30

20

20

20

10

10

10

0

0 0

10

20 30 Un HxL

40

50

0

10

20

30

CnH2L HxL

40

0

50

40

30

30

30

20

20

20

10

10

10

0

10

20

30

H-4,5L HxL Pn

40

50

20 30 Tn HxL

40

50

0

10

20 30 Pn HxL

40

50

0

10

20

40

50

n

50

40

n

50

40

n

50

0

10

n

n

n

50

0

0

0

10

20 30 PnH2,5L HxL

40

50

0

30

H30,30L HxL Pn

Because all orthogonal polynomials have simple real zeros only, we can construct a symmetric real tridiagonal companion matrix whose eigenvalues coincide with the zeros of the original polynomial [381], [508], [612]. The function SchmeisserCompanionMatrix generates this matrix for a given polynomial poly. In[25]:=

(* a message in case the polynomial roots are not all real *) SchmeisserCompanionMatrix::mhcr = "Polynomial `1` has complex roots in `2`."; SchmeisserCompanionMatrix[poly_, x_, _:Expand] :=

866

Classical Orthogonal Polynomials Module[{n = Exponent[poly, x], ν = 0, cond, LC, r, q, c, }, (* leading coefficient of a polynomial *) LC[_] := If[ === 0, 1, Coefficient[, x, Exponent[, x]]]; (* initial conditions for the modified Euclidean algorithm *) f[1] = [poly/LC[poly]]; f[2] = [1/n D[f[1], x]]; While[ν == 0 || ν 0, Abs[i - j] === 1, Sqrt[c[Min[i, j]]], True, 0], {i, n}, {j, n}]] /; cond] /; PolynomialQ[poly, x]

The next graphics show the structure of the eigenvectors of these companion matrices for various orthogonal polynomials. In[29]:=

With[{n = 100, prec = Sequence[]}, Show[GraphicsArray[#]]& /@ Map[Function[poly, ListDensityPlot[ArcTan @ (* the eigenvectors *) Eigenvectors[N[ SchmeisserCompanionMatrix[poly[n, x], x], prec]], Mesh -> False, PlotRange -> All, FrameTicks -> False, DisplayFunction -> Identity]], (* the polynomials *) {(* largest zero increases *) {HermiteH, LaguerreL, LaguerreL[#1, #1^2, #2]&, (* inverse argument *) Expand[#2^#1 ChebyshevU[#1, 1/#2]]&}, (* zeros in fixed interval *) {ChebyshevT, ChebyshevU, LegendreP, JacobiP[#1, 3, 4, #2]&}}, {2}]]

2.9 Relationships among the Orthogonal Polynomials

867

As a final example, we find the image of the iterated set of roots of the unit circle. In[30]:=

With[{roots = {7, 6, 5, 4, 3, 2}, n = 16}, Show[GraphicsArray[#]]& /@ Map[(* map onto the polynomials *) Function[poly, Graphics[{PointSize[0.003], Map[Point[{Re[#], Im[#]}]&, (* iterate the polynomial equation solving *) Rest[FoldList[Function[{x, y}, (* the numerical values of the roots *) Cases[NRoots[poly[y, C] == #1, C]& /@ x, _?NumberQ, {-1}]], (* points on the unit circle *) Table[N[Exp[2Pi I i/n]], {i, 0, n - 1}], roots]], {-1}]}, PlotRange -> All, Frame -> True, FrameTicks -> None, PlotLabel -> StyleForm[ToString[InputForm[ Head[poly[C, C]]]], "MR"]]], (* the polynomials *) {{LegendreP, ChebyshevT}, {ChebyshevU, LaguerreL}, {HermiteH, JacobiP[#1, 5, -1, #2]&}, {JacobiP[#1, -2 + I, I, #2]&, GegenbauerC[#1, -1/3, #2]&}}, {2}]] LegendreP

ChebyshevT

ChebyshevU

LaguerreL

HermiteH

JacobiP

Classical Orthogonal Polynomials

868 JacobiP

GegenbauerC

2.10 Ground-State of the Quartic Oscillator Let us end this chapter with an application of the Hermite polynomials from quantum mechanics.

Mathematical Remark: Ground-State Energy of the Quartic Oscillator The calculation of the ground-state energy ¶0 of the quartic oscillator in standard quantization [141] -y≥0 HzL + z4 y0 HzL = ¶0 y0 HzL is an important test ground for many algorithms (some were mentioned in exercises of Chapter 1 of the Numerics volume [567]; see also [377], [280], [281], [236], [522], [143], [514], [546], [126], [597], [258], [516], [269], [17], [617], [283], [144], [48], [598], [64], [421], [316], [629], [16], [268], [523], [398], [599], [262], [149], [32], [261], [600], [601], [470], [352], [40], [198], [161], [338], [232], [422], [331], [339], [174], [453], [575], [10], [11], [111], [571], [407], [243], [397], [18], [282], [12], [259] for various calculations about the anharmonic oscillator). For comparing the various methods, it is important to know the numerical value of ¶0 to a high precision (no explicit symbolic expression is known for ¶0 ). A very natural method is the expansion of y0 HzL in harmonic oscillator eigenfunctions y0 HzL = ⁄¶ k=0 ak fk HzL. This converts the original Sturm–Liouville problem into a Hill determinant problem [54], [204]. After truncating the resulting infinite matrix, the calculational task is the diagonalization of a matrix  with matrix elements m,n = ‡





fm HzL H-f≥n HzL + z4 fn HzLL dz,

where the fn HzL are the eigenfunctions of the corresponding harmonic oscillator problem: -f≥n HzL + z2 fn HzL = H2 n + 1L fn HzL with fn HzL = cn expH-z2 ê 2L Hn HzL and cn = Hp1ê2 2n n!L 1

-1ê2

.

For the matrix diagonalization, we will use the first p (up to p = 500) harmonic oscillator states to calculate an H pL approximate value for ¶0 , which we will call ¶0 . In addition, we will estimate the number of correct digits of ¶0 . HpL As we will see, for the p-range under consideration, the error dHpL ¶0 = °¶0 - ¶0 • obeys roughly the equation HpL log10 d¶0 º H0.1 … 0.2L p. These are the exact, normalized wave functions for the harmonic oscillator.

2.10 Ground-State of the Quartic Oscillator In[1]:=

869

φ[n_, z_] := Exp[-z^2/2] HermiteH[n, z]/c[n] c[n_] := Sqrt[Sqrt[Pi] 2^n n!]

Because orthogonal polynomials evaluate numerically also for noninteger first arguments we have a quick look at the behavior of the fn HzL for noninteger n. The following graphic shows that only for integer n, the functions fn HzL vanish as z Ø ≤¶. In[3]:=

φNHP[n_, z_] := φ[SetPrecision[n, 30], SetPrecision[z, 30]]

In[4]:=

Plot3D[Log[10, Abs[φNHP[n, z]]], {z, -6, 6}, {n, -1/2, 2}, PlotPoints -> 120, Mesh -> False]

5

2

0

1.5

-5 1 -5

-2.5

0.5 0

0

2.5 5

-0.5



To avoid carrying out the time-consuming (symbolic or numeric) integration Ÿ-¶ fm HzL H-f≥n HzL + z4 fn HzLL dz m bk Hn+k HzL, where the explicitly, we will rewrite expressions of the form zm Hn HzL as linear combinations ⁄k=-m bk are z-independent [367]. The function reduceProducts is implementing this. We use the three-term recursion relation for the Hermite polynomials here. In[5]:=

reduceProducts[expr_] := FixedPoint[Expand[# /. z_^m_. HermiteH[n_, z_] :> (* recursion relation for Hermite polynomials *) z^(m - 1)(n HermiteH[n - 1, z] + HermiteH[n + 1, z]/2)]&, expr] ¶

For our quartic oscillator, we get the following form of the matrix elements Ÿ-¶ fm HzL H-f≥n HzL + z4 fn HzLL dz [409], [447], [411], [179], [410], [56], [556], [368], [297], [256], [496] (for overlap integrals of shifted harmonic oscillator eigenfunctions, see [526], [309]). For the term -f≥n HzL, we use the differential equation of the harmonic oscillator and reexpress it as H2 n + 1L fn HzL - z2 fn HzL. In[6]:=

make[V_, z_] := c[m]/c[n] Simplify[ reduceProducts[(2n + 1) HermiteH[n, z] - z^2 HermiteH[n, z] + (* the potential *) V HermiteH[n, z]] /. (* use orthogonality *) HermiteH[n_, z] -> KroneckerDelta[n, m]]

In[7]:=

make[z^4, z] /. KroneckerDelta[a_, b_] :> Subscript[δ, a, b] 1 è!!!!!!!!!!!!!!  ! J 2m m ! Jn H−6 + 11 n − 6 n2 + n3 L δm,−4+n + è!!!!!!!!!!!!! 2n n ! 1  H32 H−1 + nL2 n δm,−2+n + 4 H5 + 10 n + 6 n2 L δm,n + 8 δm,2+n + 8 n δm,2+n + δm,4+n LNN 16

Out[7]=

We rewrite the last expression slightly and add an outer If to avoid the unnecessary, but time-consuming, è!!!!!!!!!!!!!!!! calculation of 2Hm-nLê2-4 m! ê n! in the case †n - m§ > 4. In[8]:=

[n_, m_] := ([n, m] = With[{δ = KroneckerDelta}, If[n - m > 4, 0, (2^((m - n)/2 - 4) Sqrt[m!/n!])* (16 (n - 3)(n - 2)(n - 1) n δ[m, n - 4] + 32 (n - 1)^2 n δ[m, n - 2] + 4 (5 + 2 n(5 + 3 n)) δ[m, n] + 8 (1 + n) δ[m, n + 2] + δ[m, n + 4])]]) /; n >= m

Classical Orthogonal Polynomials

870

(* use symmetry of  *) [n_, m_] := [m, n] /; n < m

Here is a quick check for the correctness of  by comparing it with the result of the direct integration. In[12]:=

Out[12]=

With[{m = 4}, Table[[m, n] == Integrate[φ[m, z]* (-D[φ[n, z], z, z] + z^4 φ[n, z]), {z, -Infinity, Infinity}], {n, 0, 8}]] 8True, True, True, True, True, True, True, True, True
False, PlotRange -> All, Frame -> True, PlotJoined -> True] -2 -4 -6 -8 -10 -12 10

20

30

40

50

2.10 Ground-State of the Quartic Oscillator

871

It is interesting to also look at the eigenvectors. They describe the mixing of the harmonic oscillator states to build up the states of the anharmonic oscillators. We show a density plot of the absolute values of the eigenvector components. One sees that the lowest eigenfunctions are quite similar to the harmonic oscillator eigenfunctions. Higher states are complicated mixtures of harmonic oscillator states. The “checkerboard”-like overall structure results from the fact that the contribution of the antisymmetric (symmetric) harmonic oscillator states to the symmetric (antisymmetric) anharmonic oscillator states is identical zero [68]. The very high states are dominated by truncation effects and do not correctly mimic the anharmonic oscillator states. In[19]:=

With[{p = 100}, With[{es = Eigensystem[N[Table[[n, m], {n, 0, p}, {m, 0, p}]]]}, ListDensityPlot[Abs[Reverse[es[[2]]]], Mesh -> False, ColorFunction -> (Hue[0.8 #]&)]]] 100 80 60 40 20 0

0

20

40

60

80

100

Now, let us calculate some more precise values for the ground-state energy. The call to the function Eigenval ues is quite expensive. It returns a list of all eigenvalues. On the other hand, we are only interested in the lowest one here. So, we use a numerical root-finding procedure for the characteristic polynomial. We do not calculate the characteristic polynomial symbolically, but rather for each l numerically using Det. (Using the band-diagonality of the matrix m,n , we could also implement a five-term recursion relation for the determinant for a given l.) Here is the 100 µ 100 matrix with precision 500. In[20]:=

100 = Table[N[[n, m], 500], {n, 0, 100}, {m, 0, 100}];

We should use a high enough precision in all calculations. To make sure that we really have enough precision and to better watch the progress in the root finding, we will implement the following function .  calculates the value of the characteristic polynomial and as a side effect prints the current value for l, difference to the last value of l and the value of the characteristic polynomial as well as the precision of these three numbers. The precision Precision[det] is especially important. We must be sure that the calculation of the determinant resulted in a value for det with valid digits. In[21]:=

[λ_?NumberQ, mat_, prec_, info¿_] := Module[{δ, det}, (* data to be printed *) δ = λ - λOld; λOld = λ; (* the determinant value *) det = Det[mat - SetPrecision[λ, prec] * IdentityMatrix[Length[mat]]]; (* print progress? *) If[info¿ === True, Print[{{Precision[λ]}, {N[δ, 3], Precision[δ]}, {N[det, 3], Precision[det]}}]]; (* return result *) det]

The next input uses FindRoot on [λ, 100, 500, True] calculate λ100.

Classical Orthogonal Polynomials

872 In[22]:=

λ100 = λ /. FindRoot[[λ, 100, 500, True], {λ, 106/100, 107/100}, WorkingPrecision -> 500, Compiled -> False, AccuracyGoal -> 100] 88500. -1 ê 4): ¶n = 4 n + 2 a + 2 1

x2

yn HxL = x ÅÅ2ÅÅ H2 a+1L e- ÅÅÅÅ2ÅÅÅ Lan Hx2 L. (For g < -1 ê 4, see [233])

Solutions

897

Solutions 1. Generating Function for Tn HxL, Mehler’s Formula, Bauer–Rayleigh Expansion, and More a) Here is a “straightforward” implementation. In[1]:= MapIndexed[ (* coefficients * powers *)

((#2[[1]] - 1)! z^((-#2[[1]] + 1)) #1)&, List @@ Normal[ (* the series *) Series[Exp[z x] Cosh[z Sqrt[x^2 - 1]], {z, 0, 5}]]]; In[2]:= Expand /@ % Out[2]= 81, x, −1 + 2 x2 , −3 x + 4 x3 , 1 − 8 x2 + 8 x4 , 5 x − 20 x3 + 16 x5 < In[3]:= % == Table[ChebyshevT[i, x], {i, 0, 5}] Out[3]= True

For the symbolic proof, we use Sum. Using cosHn arccosHxLL for Tn HxL, we can compute the infinite sum. In[4]:= ChebyshevT[i, x] // FunctionExpand Out[4]= Cos@i ArcCos@xDD In[5]:= Sum[z^n/n! Cos[n ArcCos[x]], {n, 0, Infinity}] Out[5]=

− ArcCos@xD z  ArcCos@xD z 1  I +  M 2

To get rid of the exponentials, we use ComplexExpand. In[6]:= ComplexExpand[% /. ArcCos[x] -> X] /. X -> ArcCos[x]

è!!!!!!!!!!!!!!!!

Out[6]= x z CosA 1 − x2 zE

To get the formula mentioned, we change the square root last. In[7]:= % /. Sqrt[x_] -> I Sqrt[-x]

è!!!!!!!!!!!!!!!!!!!!

Out[7]= x z CoshA −1 + x2 zE

b) This is another straightforward case. In[1]:= ((Series[1/Sqrt[1 - a^2] Exp[-1/(1 - a^2)(z^2 + ζ^2 - 2z ζ a)],

{a, 0, #}] // Normal // Expand) == (Exp[-z^2 - ζ^2] Sum[a^i/2^i/i! HermiteH[i, z] HermiteH[i, ζ], {i, 0, #}] // Expand))& /@ Range[0, 6, 1] Out[1]= 8True, True, True, True, True, True, True
r, {l, 5}, {m, -l, l}] Out[2]= 88x −  y, z, x +  y "Bold", FontSize -> 7], Prolog -> {Thickness[0.01], GrayLevel[1/2], Line[{{0, 0}, {0, 1}, {1, 1}, {1, 0}}]},

Classical Orthogonal Polynomials

904

PlotStyle -> Table[{Thickness[0.002], Hue[(i - 1)/max 0.7]}, {i, 0, max}], DisplayFunction -> Identity, opts]

Next, we collect the approximations for the various polynomials produced by gFAP in a GraphicsArray. Because the different orthogonal polynomials have different domains, we do not always use the same domain for the arguments. The gray curve in the background is the function being approximated, namely qHzL qH1 - zL. In[22]:= Off[Integrate::gener];

Show[GraphicsArray[#]]& {{gFAP[{LaguerreL, n, gFAP[{GegenbauerC, n, {gFAP[{JacobiP, n, gFAP[{HermiteH, n, {gFAP[{ChebyshevT, n, gFAP[{ChebyshevU, n, {gFAP[{LegendreP, n,

/@ 1, 1, 1, 1, 1, 1, 1,

z, z, z, z, z, z, z,

{0, {0, {0, {0, {0, {0, {0,

1}, 1}, 10, {0, 4}], 1}, 1}, 10, {-1, 1}]}, 1}, 2, 2}, 10, {-1, 1}], 1}}, 10, {-2, 3}]}, 1}}, 10, {-0.99, 0.99}], 1}}, 10, {-0.99, 0.99}]}, 1}}, 10, {-1, 1}]}}

LaguerreL

GegenbauerC

1.2

1

1

0.8

0.8

0.6

0.6

0.4

0.4

0.2

0.2 1

2

3

4

-1

-0.5

JacobiP

1

1

0.8

0.8

0.6

0.6

0.4

0.4

0.2

0.2 -0.5

0.5

-0.2

1

-2

-1

1

-0.2

ChebyshevT

0.8

1

0.6 0.4

0.5

0.2 0.5

1

-0.5

-1

-0.5

-0.2

LegendreP 1.2 1 0.8 0.6 0.4 0.2 -1

-0.5

-0.2

3

1

1.5

-0.5

2

ChebyshevU

2

-1

1

HermiteH

1.2

-1

0.5

-0.2

0.5

1

Now, we look at the Parseval identity. We again define an auxiliary function. In[24]:= (* format numbers uniformly *)

tokDigits[t_Real] := StringJoin[Flatten[{"0.", ToString /@ Take[RealDigits[t][[1]], 3]}]]

0.5

1

Solutions

905 In[26]:= ParsevalSum[{polyData__}, max_] :=

FoldList[Plus, 0, (* add up *) N[Table[ (* the single Fourier coefficients *) GeneralizedFourierCoefficient[ polyData]^2, {n, 0, max}]]] // Rest (* drop first 0 *)// (tokDigits /@ #)&

Then, we use it to create a numerical table of the sum of the absolute value squared of the Fourier coefficients. In[27]:= parsevalData =

{ParsevalSum[{LaguerreL, ParsevalSum[{GegenbauerC, ParsevalSum[{JacobiP, ParsevalSum[{HermiteH, ParsevalSum[{ChebyshevT, ParsevalSum[{ChebyshevU, ParsevalSum[{LegendreP,

n, n, n, n, n, n, n,

1, 1, 1, 1, 1, 1, 1,

z, z, z, z, z, z, z,

{0, {0, {0, {0, {0, {0, {0,

1}, 1}, 10], 1}, 1}, 10], 1}, 2, 2}, 10], 1}}, 10], 1}}, 10], 1}}, 10], 1}}, 10]} // Transpose;

In[28]:= TableForm[parsevalData, TableSpacing -> {1, 2},

(* make table headings *) TableHeadings -> {Range[0, 10],

StyleForm[TraditionalForm[#], FontFamily -> "Times", FontWeight -> "Bold"]& /@ {LaguerreL[n, z], GegenbauerC[n, α, z], LegendreP[n, z], HermiteH[n, z], ChebyshevT[n, z], ChebyshevU[n, z], JacobiP[n, α, β, z]}}] Ln HzL CnHaL HzL Pn HzL Hn HzL Tn HzL Un HzL PnHa,bL HzL 0 0.248 0.486 0.416 0.413 0.456 0.486 0.500 1 0.503 0.893 0.826 0.587 0.739 0.893 0.875 2 0.689 0.903 0.876 0.623 0.776 0.903 0.875 3 0.801 0.923 0.876 0.750 0.920 0.923 0.929 4 0.857 0.925 0.892 0.750 0.924 0.925 0.929 Out[28]//TableForm= 5 0.880 0.954 0.937 0.821 0.938 0.954 0.951 6 0.886 0.955 0.944 0.824 0.939 0.955 0.951 7 0.887 0.961 0.944 0.859 0.960 0.961 0.962 8 0.887 0.961 0.948 0.865 0.960 0.961 0.962 9 0.888 0.970 0.963 0.880 0.965 0.970 0.969 10 0.891 0.971 0.965 0.887 0.965 0.971 0.969

3. Transmission through Layers, Sums of Zeros a) Here is the definition of the function. In[1]:= transmission[n_Integer?(# >= 0&), k_Symbol | k_?(Im[#] == 0&)] = Out[1]=

1/(1 + (ChebyshevU[n, Cos[k] + Sin[k]/k]/k)^2) 1   2 Sin@kD ChebyshevUAn,Cos@kD+   E k     1 +  k2

Here is a plot of transmission. In[2]:= Show[GraphicsArray[#]]& /@ Table[

Plot[Evaluate[transmission[n + i, k]], {k, 10^- 10, 20}, AxesOrigin -> {0, 0}, MaxBend -> 1, Ticks -> None, PlotRange -> All, DisplayFunction -> Identity, PlotPoints -> 20, Epilog -> { {GrayLevel[0.9], Rectangle[{7, 0.45}, {13, 0.6}]}, Text["n = " ToString[n + i], {10, 1/2}]}], {n, 0, 8, 4}, {i, 0, 3}]

n=0

n=1

n=2

n=3

Classical Orthogonal Polynomials

906

n=4

n=5

n=6

n=7

n=8

n=9

n = 10

n = 11

Treating the first argument of transmission as a continuous variable shows an interesting pattern in the n,k-plane [43], [455]. The emergence of “bands” is clearly visible for larger k [188]. In[3]:= transmission[ν_, k_] = 1/(1 + (ChebyshevU[n, Cos[k] + Sin[k]/k]/k)^2); In[4]:= With[{∂ = 10^-8},

ContourPlot[Evaluate[Abs[transmission[n, k]]], {k, ∂, 20}, {n, ∂, 12}, PlotRange -> {0.8, 1.2}, PlotPoints -> 600, ColorFunction -> (Hue[5 #]&), ContourLines -> False, Contours -> 50, FrameTicks -> None, AspectRatio -> 0.6]]

We call attention to the series of increasingly deeper minima and to the small oscillations on the wide plateaus. This function represents the transmission properties of layered structures (n is the number of layers). For some special applications, see [457], [193], [485], [239], [121], [454], [542], [186], [152], [587], [305], [334], [627], [505], [44], [238], [426], [228], [491], [623], [564], [227], [461], [548], [388], [531], [85], [558], [415], [35], [492], [498], [493], [602], [434], [139], [557], [132], [332], [504], [408], and [589]. b) We start by defining the function σ[n, o] to calculate exact values for given integers n and o. In[1]:= σ[n_, o_] := RootSum[Function[z, Evaluate[ChebyshevT[n, z]]], #^o&]

Because of the symmetry of Tn HzL, the sHnL o vanish for odd o. In[2]:= Table[σ[n, 7], {o, 5}, {n, 1, 6}] // Flatten // Union Out[2]= 80
True] 10 8 6 4 2 0 0

5

10

15

20

Solutions

907

The following data confirm this conjecture. In[4]:= Table[σ[n, 6]/n, {n, 12}]

1 8

9 32

5 16

5 16

5 16

5 16

5 16

5 16

5 16

5 16

5 16

Out[4]= 90,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  = In[5]:= Table[σ[n, 8]/n, {n, 12}]

1 16

27 128

17 64

35 128

35 128

35 128

35 128

35 128

35 128

35 128

35 128

Out[5]= 90,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  =

Using the representation Tn HzL = cosHn arccosHzLL, we can calculate sHnL o in closed form for a given o. In[6]:= Table[{o, (* find large n value *)

Simplify[#, And @@ Table[Not[Element[k/n, Integers]], {k, o/2}]]& @ Sum[Cos[(Pi + k 2 Pi)/(2 n)]^o, {k, 0, n - 1}]}, {o, 10}] n 3n Out[6]= 981, 0 All, Frame -> True]}]]

Classical Orthogonal Polynomials

910 50 10 40

7.5

30

5 2.5 -1

-0.5

-2.5

20 0.5

1

10 0

-5

-1

-0.5

0

0.5

1

5. Symmetric Polynomials a) We begin with the power sums. The implementation is immediate. In[1]:= PowerSum[k_, varList_] := Plus @@ (varList^k)

We do not have to require that k be an integer. Here is an example. In[2]:= PowerSum[k, {x, y, z}] Out[2]= xk + yk + zk

Now, we look at discriminants. First, we have to construct all pairs 8i, j< with i > j. We do this with the following construction. In[3]:= n = 6;

Flatten[MapThread[List, {Range[1, Range[2, Out[4]= 881, 2 0.1]]

We choose a such that the expectation values of the energy of the coherent states coincides with the harmonic oscillator eigenfunction’s eigenvalues 1 + 2 a2 = 2 n + 1. In[15]:= Module[{δx = 1/20, n = 30, pp = 200, α1, ipo, ∂ = 10^-8},

α1 = Sqrt[n]; Do[ipo[x] = ψCIntT[α1, x, n][[1, 1, 2]], {x, -15, 15, δx}]; data = Table[ipo[x][t], {x, -15, 15, δx}, {t, ∂, 2Pi - ∂, (2Pi - 2∂)/pp}]];

The following pictures show 3D and contour plots of how the harmonic oscillator eigenfunctions develop as a function of T. The second row of pictures shows the imaginary parts. For T = 2 p, it vanishes. For both the real and the imaginary part, we show a 3D plot and a contour plot. In[16]:= Module[{(* common option settings *)

opts = Sequence[PlotRange -> All, DisplayFunction -> Identity, MeshRange -> {{-15, 15}, {0, 2Pi}}]}, Function[reIm, Show[GraphicsArray[{ (* the 3D plot *) ListPlot3D[reIm[Transpose[data]], opts, Mesh -> False, Ticks -> False, ViewPoint -> {0, -2, 1}], (* the contour plot *) ListContourPlot[reIm[Transpose[data]], opts, FrameTicks -> False, ColorFunction -> (Hue[0.8 #]&), Contours -> 50, ContourLines -> False]}]]] /@ {Re, Im}]

Solutions

939

d) We will assume n = 50 in the following calculations. Here are the harmonic oscillator eigenfunctions and the classical probability density. In[1]:= n = 50; In[2]:= φ[n_, x_] := Exp[-x^2/2] HermiteH[n, x]/Sqrt[Sqrt[Pi] 2^n n!]

Pcl[x_] := UnitStep[x + Sqrt[2n + 1]] * UnitStep[Sqrt[2n + 1] - x] 1/Pi/Sqrt[2n + 1 - x^2]; pcl = {{Hue[0], Thickness[0.002], Line[Table[{x, Pcl[x]} // N, {x, -12, 12, 24/500}]]}};

A graphic shows clearly that Pcl HxL is the average of Pqu HxL locally. In[5]:= Plot[φ[50, x]^2, {x, -12, 12}, PlotPoints -> 500,

Frame -> True, Axes -> False, Prolog -> pcl] 0.2 0.15 0.1 0.05 0 -10

-5

0

5

10

è The averaged probability density Pqu Hx; ¶L we calculate numerically from the exact indefinite integral. In[6]:= [x_] = (Integrate[#, x]& /@ Expand[φ[50, x]^2]) // Simplify; In[7]:= PAv[x_, ∂_] := With[{ξ = SetPrecision[x, 30], ε = SetPrecision[∂, 30]},

([ξ + ε] - [ξ - ε])/(2 ε)]

è 2 ¶ è The next graphic shows the mean difference dH¶L = Ÿ-¶ IPqu Hx; ¶L - Pcl HxLM dx between Pqu Hx; ¶L and Pcl HxL. In[8]:= δ[∂_] := 2 NIntegrate[Evaluate[(

Interpolation[Table[{x, PAv[x, ∂]}, {x, 0, 10.1, 10.1/500}]][x] - Pcl[x])^2], {x, 0, Sqrt[101] - 10^-6}]

In[9]:= Off[NIntegrate::ncvb]

δs = Table[{10^e, δ[10^e]}, {e, -2, 1, 3/30}]; ListPlot[δs // N, PlotJoined -> True] 0.13 0.125 0.12 0.115 0.11 0.105 2

4

6

8

10

The last graphic shows that an optimal averaging ∂ is about 0.4. This agrees with a handwaving approximation in which we è è!!!!!!!!!!! want to smooth Pqu HxL over about one period, this means ¶ º 2 2 ê n . The resulting Pqu Hx; 0.4L agrees well with Pqcl HxL. In[12]:= ipo = Interpolation[Table[{x, PAv[x, 0.4]}, {x, -12, 12, 24/1000}]];

Plot[ipo[x], {x, -12, 12}, PlotRange -> All]

Classical Orthogonal Polynomials

940 0.14 0.12 0.1 0.08 0.06 0.04 0.02 -10

-5

5

10

For the simultaneous limit n Ø ¶ and Ñ Ø 0, see [83]. e) Here, we define the functions Yn Ha, zL. In[1]:= φ[n_, z_] := Exp[-z^2/2] HermiteH[n, z]/Sqrt[Sqrt[Pi] 2^n n!] In[2]:= Ψ[η_, n_, z_] = Evaluate //@ (1/Sqrt[n! LaguerreL[n, 1 - 1/η]] *

Sum[(1/η - 1)^((n - k)/2) n!/(n - k)!/Sqrt[k!] φ[k, z], {k, 0, n}]);

To interpolate we use the simple function hHL =  n + H1 - L a ë

è!!!!! .

In[3]:= φΨ[_, x_] := With[{n = 12, α = 2},

Ψ[, Round[ n + (1 - ) α/Sqrt[]], x]]

The transition between the harmonic oscillator eigenstate and the coherent state is piecewise smooth. Each time the number of summands in Yn Ha, zL increases, we get discontinuities. In[4]:= Plot3D[φΨ[, x], {x, -6, 6}, {, 0.03, 1 - 10^-4},

PlotPoints -> 120, Mesh -> False, PlotRange -> All, ViewPoint -> {0, 3, 1}] 0.2 0.4 0.6 0.8 0 1 0.5 0 -0.5 5

2.5

0

-2.5

-5

f) The following inputs implement the new eigenfunctions yn @fn D Hz; lL and the potential @fn D Hz; lL. In[1]:= int[n_, z_] := int[n, z] =

With[{ = Integrate[#, {ζ, -Infinity, z}, GenerateConditions -> False]&}, (* thread over sums *) If[Head[#] === Plus,  /@ #, [#]]&[Expand[φ[n][ζ]^2]]] ψ[n_][λ_, z_] := ψ[n][λ, z] = Sqrt[λ (λ + 1)] φ[n][z]/(int[n, z] + λ); [n_][λ_, z_] := [n][λ, z] = V[z] - 2D[Log[int[n, z] + λ], {z, 2}]

Here is a short verification that the yn @fn D Hz; lL are eigenfunctions of the potential @fn D Hz; lL. In[6]:= -D[ψ[n][λ, z], {z, 2}] + [n][λ, z] ψ[n][λ, z] -

ε ψ[n][λ, z] // Simplify // Numerator è!!!!!!!!!!!!!!!!!!!!!!!! λ H1 + λL HHε − V@zDL φ@nD@zD + φ@nD @zDL

Out[6]= −

In the limit l Ø ¶, we recover the starting eigenfunctions fn HzL and the starting potential V HzL. In[7]:= Series[ψ[n][λ, z], {λ, Infinity, 3}] //

DeleteCases[#, GenerateConditions -> False, Infinity]& // Simplify

Solutions

941 z

H1 − 2 Ÿ φ@nD@ζD2  ζL φ@nD@zD 2λ

−∞   + Out[7]= φ@nD@zD +  z z 2 1 2 1 i i y y 2 j−1 − 4 ‡ φ@nD@ζD2  ζ + 8 j z φ@nD@zD J  N +  j ‡ φ@nD@ζD  ζz z λ 8 k k −∞ { { −∞ 2 3 z z z 1 3 1 4 1 i i y i y y 2 2 j1 + 2 ‡ φ@nD@ζD2  ζ + 8 j z φ@nD@zD J  N + OA  E  j ‡ φ@nD@ζD  ζz − 16 j‡ φ@nD@ζD  ζz z λ λ 16 k k −∞ { k −∞ { { −∞

In[8]:= Series[[n][λ, z], {λ, Infinity, 2}] //

DeleteCases[#, GenerateConditions -> False, Infinity]& // Simplify z 4 Hφ@nD@zD φ@nD @zDL j 1 3 i y y 1 N2 + OA  2    + i2 φ@nD@zD4 + 4 j Out[8]= V@zD −  E ‡ φ@nD@ζD  ζz φ@nD@zD φ@nD @zDz J  λ λ k k −∞ { { λ

Here are the explicit fn HzL for the harmonic oscillator. In[9]:= V[z_] := z^2;

φ[n_][z_] = 1/Sqrt[Sqrt[Pi] 2^n n!] Exp[-z^2/2] HermiteH[n, z];

Of course, also in this special case the yn @fn D Hz; lL are eigenfunctions of the potential @fn D Hz; lL. In[11]:= Table[-D[ψ[n][λ, z], {z, 2}] + [n][λ, z] ψ[n][λ, z] -

(2n + 1) ψ[n][λ, z], {n, 0, 5}] // Together

Out[11]= 80, 0, 0, 0, 0, 0
Table[{Thickness[0.002], Hue[λ/3]}, {λ, 1/24, 2, 2/24}], DisplayFunction -> Identity, Frame -> True, Axes -> False], {n, 0, 8}], PlotRange -> All] In[13]:= gr2 = (DownValues[In][[-2]] /. (* modify last input *)

HoldPattern[ψ[n][λ, z]] :> ([n][λ, z] - V[z])/10)[[2]] In[14]:= Show[GraphicsArray[{gr1, gr2}]] 8

8

6

6

4

4

2

2

0

0 -4

-2

0

2

4

-4

-2

0

2

4

Now let us try to conjecture the values of the two mentioned integrals. Carrying out some numerical experiments for the integrand @fn D Hz; lL - V HzL for various n and positive l yields immediately the conjecture that the integral is 0. In[15]:= Off[NIntegrate::ploss]; Off[NIntegrate::ncvb];

Table[{n, NIntegrate[Evaluate[Together[[n][1/(1 + n), z] - V[z]]], {z, -6, 0, 6}, WorkingPrecision -> 22, AccuracyGoal -> 6]}, {n, 0, 5}] Out[16]= 880, 0. × 10−7 All, Mesh -> False, Axes -> False, PlotRange -> {All, All, {0, 1.5}}]] In[9]:= Show[GraphicsArray[ΨtGraphics[#, DisplayFunction -> Identity]& /@ #]]& /@

Partition[Table[t, {t, 0, Pi/2, Pi/2/8}], 3]

Classical Orthogonal Polynomials

944

Make Input

Do[ΨtGraphics[t], {t, 0, Pi/2, Pi/2/20}]

h) The implementations of the d-dimensional factorial, d-dimensional derivative, and the d-dimensional Hermite polynomials are straightforward. In[1]:= dNumber[d_][n_] := n + (d - 1)/2 (1 - (-1)^n)

dFactorial[d_][n_] := Product[dNumber[d][k], {k, 1, n}] (* == If[EvenQ[n], 2^n (n/2)! Gamma[(n + d)/2]/Gamma[d/2], 2^n ((n - 1)/2)! Gamma[(n + d + 1)/2]/Gamma[d/2]] *) In[4]:= dD[d_][f_, x_] := D[f, x] + (d - 1)/2/(2x) (f

- (f /. x -> -x))

In[5]:= dHermiteH[d_][n_, x_] := Factor[Together[

n!/dFactorial[d][n] (-1)^n Exp[x^2] Nest[dD[d][#, x]&, Exp[-x^2], n]]] In[6]:= φ[d_][n_, x_] := dFactorial[d][n] /(n! Sqrt[Pi^(d/2) 2^n dFactorial[d][n]])*

Exp[-x^2/2] dHermiteH[d][n, x]

Here are closed forms for the lowest eigenfunctions. The dimension d appears polynomially in the d-dimensional Hermite polynomials and nonpolynomially in the normalization. In[7]:= Table[φ[d][n, x], {n, 0, 4}] // Simplify x2

− 2 π

2

x è!!!!! −  2  2 x dπ

x2

− 2 H1 + d − 4 x2 L 2 2 dπ

Out[7]= 9  ! ,   , −   , è!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!! è!!!!!!!!!!!!!!!! dê2 dê2 dê2 x2

x2

− 2 x H5 + d − 4 x2 L − 2 H5 + d2 − 40 x2 + 16 x4 + d H6 − 8 x2 LL −   ,      = è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!! dê2 2 d H2 + dL π 8 2 d H2 + dL πdê2

The next graphics show the real and imaginary part and the absolute value of the first four eigenfunctions. In[8]:= Table[Show[GraphicsArray[

Plot3D[Evaluate[#[φ[d][n, x]]], {x, -2, 2}, {d, -6, 6}, PlotPoints -> 80, ClipFill -> None, Mesh -> False, PlotRange -> {-3, 3}, DisplayFunction -> Identity]& /@ {Re, Im, Abs}]], {n, 0, 3}]

Solutions

945

2 0 -2 -2 2

5 2.5 -1

0 0

-2 2

-2.5 1

0 0

-2 2

-5

5 2.5 -1

0 0

-2 2

-2 2

-1

0 0

-2 2

-1

-5 2

0 0

-2.5 1

-5 2

5 2.5 -1

-5

0 0

-2.5 1

-5 2

2 0 -2 -2 2

-2.5 1

-1

2

0 0

-5 2

2 0 -2 -2 2

5 2.5

1

5 2.5

-5

-2.5 1

-2.5

2 0 -2 -2 2

0 0

0 0

2

2 0 -2

-2.5 1

-1

-1

-5

-2.5 1

5 2.5

2

5 2.5

-5

5 2.5

-2 2

0 0

2

2 0 -2

1

2 0 -2

-2.5 1

-1

2 0 -2

-2.5

5 2.5

2

2 0 -2 -2 2

0 0

2 0 -2

-2.5 1

-1

-5

5 2.5 -1

5 2.5

2

2 0 -2 -2 2

2 0 -2

5 2.5 -1

-5

0 0

2

-2.5 1

-5 2

The following graphics show the real and imaginary part and the phase of fHdL n HxL as d varies on the unit circle. In[9]:= Show[GraphicsArray[

Plot3D[Evaluate[#[φ[Exp[I ϕ]][8, x]]], {x, -4, 4}, {ϕ, 0, 2Pi}, PlotPoints -> 80, ClipFill -> None, Mesh -> False, PlotRange -> All, DisplayFunction -> Identity]& /@ {Re, Im, Arg}]]

0.5 0 -0.5 -4 4

6 4 -2

0

2 2

4

0

2 0 -2 -4 4

6 4 -2

0

2 2

4 0

2 0 -2 -4 4

6 4 -2

0

2 2 4

0

Classical Orthogonal Polynomials

946 10. High-Order Perturbation Theory, Eigenvalue Differential Equation a) We calculate the matrix elements for VHzL = z4 in the harmonic oscillator basis. In[1]:= reduceProducts[expr_] :=

FixedPoint[Expand[# /. z_^m_. HermiteH[n_, z_] :> (* recursion relation for Hermite polynomials *) z^(m - 1)(n HermiteH[n - 1, z] + HermiteH[n + 1, z]/2)]&, expr] In[2]:= make[V_, z_] :=

Sqrt[2^m m!]/Sqrt[2^n n!] Simplify[reduceProducts[V HermiteH[n, z]] /. (* use orthogonality *) HermiteH[n_, z] -> KroneckerDelta[n, m]] In[3]:= (V[n_, m_] = Sqrt[2^n n!]/Sqrt[2^m m!] make[z^4, z]) /.

KroneckerDelta[a_, b_] :> Subscript[δ, a, b] Out[3]= n H−6 + 11 n − 6 n2 + n3 L δm,−4+n +

1  H16 n H1 − 3 n + 2 n2 L δm,−2+n + 12 H1 + 2 n + 2 n2 L δm,n + 12 δm,2+n + 8 n δm,2+n + δm,4+n L 16

We write ∂[n][j] for HnL¶ j and c[n][j][k] for HnLc j,k . The implementation of the above recursion relations for HnL¶ j and HnL c j,k is straightforward. We choose n = 2n n ! to simplify the calculations and so avoid the calculation of any factorials. In[4]:= ∂[n_][0] := 2n + 1

∂[n_][j_] := ∂[n][j] = Sum[If[V[n, k] === 0, 0, V[n, k] c[n][j - 1][k]], {k, n - 4, n + 4}] c[n_][j_][n_] := KroneckerDelta[j, 0] c[n_][0][k_] := KroneckerDelta[k, n] c[n_][j_][k_] := c[n][j][k] = (1/(∂[k][0] - ∂[n][0])* (Sum[∂[n][l] c[n][j - l][k], {l, 1, j - 1}] Sum[If[V[k, l] === 0, 0, V[k, l] c[n][j - 1][l]], {l, k - 4, k + 4}]))

Here are the first 10 values of the H0L¶ j . In[9]:= Table[∂[0][k], {k, 0, 10}] // Timing

3 21 333 30885 916731 65518401 4 16 64 1024 4096 32768 2723294673 1030495099053 54626982511455 6417007431590595   , −    ,   , −   == 131072 4194304 16777216 134217728

Out[9]= 90.05 Second, 91,  , −  ,  , −  ,  , −   ,

Analyzing the H0Lc j,k with nontrivial values shows that they fulfill the condition k § 4 i; we will use this fact later). In[10]:= cValues = ({{#[[1, 1, 1]], #[[1, 1, 0, 1]]},

Sign[Abs[#[[2]]]]}&) /@ Drop[SubValues[c], -4]; In[11]:= Show[Graphics[{If[#[[2]] === 0, GrayLevel[1/2], Hue[0]],

Rectangle[#[[1]] - 1/3, #[[1]] + 1/3]}& /@ cValues], AspectRatio -> 1, Frame -> True] 8 6 4 2 0

0

5

10 15

20 25 30

35

By temporarily redefining the KroneckerDelta function, we obtain the first few values of [160], [27], [237]. In[12]:= Unprotect[KroneckerDelta];

KroneckerDelta[ν + a_., ν + b_.] := 0 /; a =!= b In[14]:= Table[{i, ∂[ν][i] // Together // Expand}, {i, 0, 5}]

HnL

¶ j for symbolic n [167],

Solutions

947 3ν 3 ν2 21 59 ν 51 ν2 17 ν3 2 2 16 16 16 8 333 1041 ν 177 ν2 375 ν3 375 ν4 93,  +  +  +  +  =, 64 64 8 32 64 71305 ν3 53445 ν4 10689 ν5 30885 111697 ν 80235 ν2  −   −   −   =, 94, −  −   −  512 512 1024 512 1024 1024 916731 3569679 ν 3090693 ν2 2786805 ν3 3662295 ν4 262647 ν5 87549 ν6 95,  +   +   +   +   +   +   == 4096 4096 2048 2048 4096 1024 1024 3 4

Out[14]= 980, 1 + 2 ν 4i; c[i_, k_] := c[i, k] = (* use prescribed precision at each step *) SetPrecision[ (Sum[ε[j] c[i - j, k], {j, i - 1}] Sum[[k, n] c[i - 1, n], {n, k - 4, k + 4, 2}])/(2k), prec]) In[18]:= $RecursionLimit = Infinity;

Now let us calculate the first 100 and 200 values of the H0L¶ j [60], [61], [574]. In[19]:= makeDefinition[Infinity]

{Table[ε[i], {i, 0, 100}]; // Timing, MemoryInUse[]} Out[20]= 8810.04 Second, Null (* recursion relation for Hermite polynomials *) z^(m - 1)(n HermiteH[n - 1, z] + HermiteH[n + 1, z]/2)]&, expr] In[34]:= makeHill[V_, z_] := Sqrt[2^m m!]/Sqrt[2^n n!] Simplify[

reduceProducts[(2n + 1) HermiteH[n, z] - z^2 HermiteH[n, z] + (* the potential *) V HermiteH[n, z]] /. (* use orthogonality *) HermiteH[n_, z] -> KroneckerDelta[n, m]] In[35]:= hill[n_, m_] = makeHill[z^2 + z^4, z]; In[36]:= (* extract lowest eigenvalue *)

lowestEigenValue[p_, prec_] := Last[Eigenvalues[N[Table[hill[n, m], {n, 0, p, 2}, {m, 0, p, 2}], prec]]]

Solutions

949 In[38]:= Table[{o, SetPrecision[lowestEigenValue[o, 30], 15]},

{o, 20, 120, 20}] // TableForm 1.39235244305397 1.39235164153844 1.39235164153030 1.39235164153029 1.39235164153029 1.39235164153029

20 40 60 Out[38]//TableForm= 80 100 120

A quick method to obtain a rough approximation is the root approximant [630]. Taking only the first seven terms into account, we obtain the value of the lowest eigenvalue within 1%. In[39]:= Module[{o = 3, A, n, rootAnsatz, series, eqs, nAs, sols},

(* form kth-order root approximant ansatz *) step[{o_, k_}] := {(o + A[k] x^k)^n[k], k + 1}; rootAnsatz = Nest[step, {1, 1}, o][[1]]; (* series expansion for small x *) series = Series[rootAnsatz, {x, 0, 2 o}]; (* solve equations for the n[k] and A[k] *) eqs = Rest[CoefficientList[series, x]] - Table[∂[0][k], {k, 2o}]; nAs = Union[Cases[eqs, _A | _n, Infinity]]; sols = NSolve[eqs, nAs]; (* largest root approximant for x == 1 *) Max[Cases[rootAnsatz /. sols /. x -> 1, _Real]]] Out[39]= 1.37987

Now, we will try to determine the ak . To do this we need sufficiently many of the H0L¶ j to carry out a numerical fit. We calculate high-precision values for the first 500. Using 200 digits makes the calculation much faster than the exact one from above, mainly because no fractions have to be reduced. In[40]:= makeDefinition[200]

Table[ε[i], {i, 0, 500}]; // Timing Out[41]= 8620.24 Second, Null< In[42]:= ε[500] Out[42]= −5.317093881145884971799375679183193084386961628654137602204465809386378277638386073

3126097103777433147337213041167738956786365222283733141303020671280871877403327902 925724506477765109791092248803750625× 101220

After dividing out the exponentially growing prefactor and subtracting 1, we are left with a sequence that asymptotically approaches 0. In[43]:= α[k_] := -(-1)^k 2^(3/2 - k) 3^(k + 1/2) (k - 1/2)!/Pi^(3/2); In[44]:= ListPlot[Table[{k, Abs[ε[k]/α[k]] - 1}, {k, 100}],

PlotRange -> {-1, 1}, Frame -> True, Axes -> False] 1 0.75 0.5 0.25 0 -0.25 -0.5 -0.75 0

20

40

60

80

100

A numerical fit to this sequence yields the following result. We fit the sequence with the ansatz ⁄5j=1 a j k - j . In[45]:= data = Table[{k, Abs[ε[k]/α[k]] - 1}, {k, 200, 500}];

fit1 = Fit[SetPrecision[data, 40], {1/k, 1/k^2, 1/k^3, 1/k^4, 1/k^5}, k]

Classical Orthogonal Polynomials

950

360.98797738558960359265905452 k 39.723120868839670609533283744 6.888041024883053414090892710061     −     − k4 k3 1.31944444589537557592655148039271561 1.93855870875750162074182962402739         −  k k2

Out[46]= −     − 5

If a1 is a rational number (with a small denominator), then using the continued fraction form of 1.3194444458… will reveal it. The following data show that by taking five terms of the continued fraction approximation we get an excellent agreement with the numerical value, about 4 orders of magnitude better than we would get by taking only five terms. So, we naturally conjecture a1 = 95 ê 72 [60], [61]. In[47]:= ξ = -fit1[[-1, 1]];

cf = ContinuedFraction[Abs[ξ]]; δs = {#, N[# - ξ]}& /@ Table[FromContinuedFraction @ Take[cf, k], {k, 1, 6}] 4 29 Out[49]= 981, −0.319444 Identity], (* the borderline *) ParametricPlot3D[{Cos[ϕ], Sin[ϕ], 0, Thickness[0.02]}, {ϕ, 0, 2Pi}, DisplayFunction -> Identity]}, Boxed -> False, Axes -> False, DisplayFunction -> Identity]&, (* the to be displayed eigenfunctions *) {BesselJ[0, µ[0, 1] r], BesselJ[0, µ[0, 2] r], Cos[ϕ] BesselJ[1, µ[1, 1] r], Cos[2ϕ] BesselJ[1, µ[1, 2] r]}, {1}]]]

To visualize the oscillation modes, it is useful to generate a plot of the lines of equidistortion. For a round drum, ContourPlot is not immediately applicable. However, we can use ContourPlot to create an equipotential-line representation in the r,j-coordinates, and then use Graphics[ContourGraphics[…]] to turn this into a graphics object that consists of lines and polygons, and whose coordinates are transformed to an x,y-Cartesian coordinate system. Then, it is straightforward to create an equipotential-line plot of the oscillation of our drum. In[29]:=

Show[Graphics[{ Map[If[(* leave GrayLevel untouched *) Head[#] === List, (* transforming to Cartesian coordinates *) {#[[1]] Cos[#[[2]]], #[[1]] Sin[#[[2]]]}, #]&, (* converting ContourGraphics into Graphics for further manipulations on the 2D primitives *) Graphics[ (* making the ContourPlot in polar coordinates *) ContourPlot[Sin[3 ϕ] BesselJ[3, µ[3, 3] r], {r, 0, 1}, {ϕ, 0, 2Pi}, PlotPoints -> 45, DisplayFunction -> Identity]][[1]], {-2}], (* the boundary *) {Thickness[0.002], GrayLevel[1], Line[{{0, 0}, {1, 0}}]},

3.5 Bessel and Airy Functions

1029

{Thickness[0.01], Circle[{0, 0}, 1]}}], PlotRange -> All, AspectRatio -> Automatic]

We sidestep a moment and using the package NumericalMath`BesselZeros` have a look at the possible mk j for larger k and j . The left graphic shows the mk j as a function of †m§. The right graphic shows a logarithmic plot of a histogram of the sorted differences of the 30699 lowest neighboring mk j . The straight line indicates the complete integrability of the problem [139], [652]. In[30]:=

Needs["NumericalMath`BesselZeros`"]

In[31]:=

Show[GraphicsArray[ {(* the eigenvalues as a function of m *) Graphics[Table[{Point[{-m, #}], Point[{m, #}]}& /@ BesselJZeros[m, 35], {m, 0, 20}], Frame -> True, PlotRange -> {{-20, 20}, {0, 100}}], (* eigenvalue spacing distribution *) ListPlot[{First[#], Log[10, Length[#]]}& /@ Split[Sort[Round[1000 (-Subtract @@@ Partition[Sort[ Select[Flatten[Table[BesselJZeros[m, 200], {m, 0, 200}]], (# < 627)&]], 2, 1])]]], PlotJoined -> True, PlotRange -> {{0, 130}, All}, DisplayFunction -> Identity]}]] 100

3

80

2.5 2

60

1.5 40 1 20

0.5

-15

-10

-5

0

5

10

15

20

20

40

60

80

100

120

For time-dependent superpositions of such eigenfunctions, see [1069], [396]. For the visualization of the eigenmodes of an ellipse–shaped membrane, see below. For drums with radius-dependent phase velocity (this means mass density), see [834]; for drums with a circular hole, see [985]. Next, we will deal with the much more general case of an arbitrarily shaped membrane.

Physical Application: Oscillation of a General-Shaped Drum Above, we derived that the functions expHi m jL Jm Hk rL are solutions of the 2D Helmholtz equation DuHrL + k 2 uHrL = 0 (here, r = 8r, j< in polar coordinates). Because expHi m jL Jm Hk rL for a complete system in 2 [1280], [515], [1042], every solution of the Helmholtz equation can be represented as:

The Classical Special Functions

1030



uHr, jL = ‚ cm expHi m jL Jm Hk rL. m=-¶

Let the boundary of a general (compact, connected) drum be parametrized by rHsL and jHsL, where s is the curve length. If we keep the membrane fixed at the rim, we have uHrHsL, jHsLL = 0. Using the periodicity of uHrHsL, jHsLL, uHrHsL, jHsLL = uHrHs + L, jHs + LL ( is the length of the circumference of the drum), we decompose u along the boundary in its Fourier coefficients 

cn HkL = ‡ expH-2 p i n s ê L uHrHsL, jHsLL ds 0

[1119], [31], [1155], [1178], [320]. To ensure the Dirichlet boundary condition of the membrane, this expression should vanish. Substituting the Fourier–Bessel expansion of uHr, jL into the expression for the cn HkL, we obtain that the determinant of the matrix with entries 

cn m HkL = ‡ expH-2 p i n s ê L expHi m jHsLL Jm Hk rHsLL ds 0

should vanish. Truncating the m-basis yields a finite determinant that vanishes for certain k. For such values of k we can calculate the null space of the corresponding linear homogeneous system; this means the cm and, in this way, obtain a series representation of the eigenfunctions of the vibrating membrane. 1

Let us carry out the just-sketched program for one particular example: A very popular shape of a drum for physicists is a stadium-shaped drum [878], [734], [161], [1208], [366], [28], [1194], [30], [304], [581], [68], [268], [645], [942]. Let the diameter of the circular parts of the stadium be 2R and the length of the straight middle part be 2 a. (For R = a, this stadium is called the Bunimovich stadium [235].) Here is a parametrization of the boundary of the stadium (it can be obtained from elementary geometry). The parametrization starts in the lower right “corner”. Its first piece is the right arc, its second is the top straight piece, its third is the left arc, and its fourth is the lower straight part. In[32]:=

(* parametrizations for ϕ for the four segments *) ϕ[1][s_, {R_, a_}] = ArcTan[a + R Cos[s - Pi/2], R Sin[s - Pi/2]]; ϕ[2][s_, {R_, a_}] = ArcTan[R Pi + a - s, R]; ϕ[3][s_, {R_, a_}] = ArcTan[-a + R Cos[-((4 a + Pi R - 2 s)/(2 R))], R Sin[-((4 a + Pi R - 2 s)/(2 R))]]; ϕ[4][s_, {R_, a_}] = ArcTan[s - 2 Pi R - 3 a, -R];

In[37]:=

(* parametrizations for r for the four segments *) r[1][s_, {R_, a_}] = Sqrt[(a + R Cos[s - Pi/2])^2 + (R Sin[s - Pi/2])^2]; r[2][s_, {R_, a_}] = Sqrt[(R Pi + a - s)^ 2 + R^2]; r[3][s_, {R_, a_}] = Sqrt[(-a + R Cos[-((4 a + Pi R - 2 s)/(2 R))])^2 + (R Sin[-((4 a + Pi R - 2 s)/(2 R))])^2]; r[4][s_, {R_, a_}] = Sqrt[(s - 2 Pi R - 3 a)^2 + (-R)^2];

In[42]:=

(* curve lengths the 4 segments *) sLimit[1][{R_, a_}] = Pi R; sLimit[2][{R_, a_}] = Pi R + 2 a; sLimit[3][{R_, a_}] = 2 Pi R + 2 a; sLimit[4][{R_, a_}] = 2 Pi R + 4 a;

3.5 Bessel and Airy Functions

1031

(* lengths the circumference *) [{R_, a_}] = 2 Pi R + 4 a; In[49]:=

(* full parametrization for ϕ *) ϕ[s_, {R_, a_}] = Which @@ Flatten[ Table[{s True, PlotRange -> All, Axes -> False, AspectRatio -> Automatic]] 1

0.5

0

-0.5

-1 -2

-1

0

1

2

In the following discussion we will calculate some possible shapes of the vibrating Bunimovich stadium. To do this, we have to calculate the integrals cn m HkL. Instead of using the built-in function NIntegrate, we will implement a fast numerical integration based on a discretization of the boundary. Because of the periodicity of jHsL and rHsL, we use the trapezoidal integration rule. The precision we can achieve with this crude integration for the eigenvalues and eigenfunctions is sufficient for the purpose here—some graphics of the eigenfunctions. In[54]:=

sValues[n_, {R_, a_}] := Table[s, {s, 0, [{R, a}], [{R, a}]/n}] ϕValues[n_, {R_, a_}] := ϕ[#, {R, a}]& /@ sValues[n, {R, a}] rValues[n_, {R_, a_}] := r[#, {R, a}]& /@ sValues[n, {R, a}]

In[57]:=

(* a fast, specialized numerical integration *) TrapezoidalIntegrateC = Compile[{{data, _Complex, 1}, {h, _Real}}, Module[{sum = 0. + 0. I}, Do[sum = sum + data[[i]], {i, Length[data]}]; h (sum - (First[data] + Last[data])/2.)]];

To avoid the (time-consuming) calculation of Jm Hk rHsLL for each integer m, we use the following three-term recursion relation of Bessel functions. In[59]:= Out[59]=

BesselJ[ν, z] == 2 (ν - 1)/z BesselJ[ν - 1, z] - BesselJ[ν - 2, z] // FullSimplify True

The Classical Special Functions

1032

It is most effective to calculate the whole matrix cnm HkL -o § n, m § o at once to avoid the recalculation of the various quantities appearing in these expressions. The function fourierMatrix calculates the matrix of integrals cn m HkL. Here, -o § n, m § o, and for the numerical integration, pp points are taken into account. To speed up the calculation of the matrix, we will pack all lists. In[60]:=

fourierMatrix[k_, o_, {R_, a_}, pp_] := Module[{hδ = N[[{R, a}]/pp], rData, ϕData, sData, l1, l2, l3}, (* packed versions of the vectors needed *) {rData, ϕData, sData} = Developer`ToPackedArray[N[#[pp, {1, 1}]]]& /@ {rValues, ϕValues, sValues}; (* the two exponential functions *) Do[l1[m] = Exp[N[I] m ϕData], {m, -o, o}]; Do[l2[n] = Exp[N[-2Pi I n sData/[{R, a}]]], {n, -o, o}]; (* use stable recursion toward m==0 *) l3[-o] = Developer`ToPackedArray[BesselJ[-o, k rData]]; l3[-o + 1] = Developer`ToPackedArray[BesselJ[-o + 1, k rData]]; (* use recursion formulas for BesselJ *) Do[l3[m] = 2. (m - 1.)/(k rData) l3[m - 1] - l3[m - 2], {m, -o + 2, 0}]; l3[o] = Developer`ToPackedArray[BesselJ[o, k rData]]; l3[o - 1] = Developer`ToPackedArray[BesselJ[o - 1, k rData]]; (* use recursion formulas *) Do[l3[m] = 2. (m + 1.)/(k rData) l3[m + 1] - l3[m + 2], {m, o - 2, 1, -1}]; (* the table of integrals *) Table[TrapezoidalIntegrateC[l1[m] l2[n] l3[m], hδ], {m, -o, o}, {n, -o, o}]];

Here, we calculate a 61 µ 61 matrix of the above integrals. The calculation is about three orders of magnitude faster than the direct use of NIntegrate (which for each input would compile and sample the integrand). We display the matrix element c30 30 . The two results agree to at least six digits—surely enough for visualization purposes. In[61]:= Out[61]= In[62]:=

Out[62]=

fourierMatrix[16, 30, {1, 1}, 201][[-1, -1]] // Timing 81.45 Second, −0.0330124 + 0.0188618 < With[{k = 16, l = 30, n = 30, R = 1, a = 1}, NIntegrate[Evaluate[ Exp[-2 Pi I n s/[{R, a}]] Exp[I l ϕ[s, {R, a}]] * BesselJ[l, k r[s, {R, a}]]], {s, 0, Pi, Pi + 2, 2 Pi + 2, [{R, a}]}]] // Timing 80.67 Second, −0.0330124 + 0.0188618 
(Hue[0.8 #]&), Mesh -> False, MeshRange -> {{-o, o}, {-o, o}}]]

3.5 Bessel and Airy Functions

1033

40 20 0 -20 -40 -40

-20

0

20

40

Now, let us calculate some k such that †cnm HkL§ vanishes. In[64]:=

det[k_?NumericQ, o_, {R_, a_}, pp_] := Det[fourierMatrix[k, o, {R, a}, pp]]

To find eigenvalues k * , we have to search for zeros of the corresponding determinant. Because of the smooth shape of the stadium, we expect the main contribution of an eigenvalue k * to arise from Jm HxL, where 2 rHsL k * § †m§. We take o = 20 and try to find some eigenvalues near k º 10. We calculate a table of values for the determinant for 8 § k § 12. In[65]:= Out[65]=

Timing[mat = Table[{k, det[k, 20, {1, 1}, 301]}, {k, 8, 12, 1/30}];] 865.07 Second, Null
True, PlotStyle -> col, DisplayFunction -> Identity]], {{Re, {Hue[0]}}, {Im, {Hue[0.8], Dashing[{0.01, 0.01}]}}}, {1}], DisplayFunction -> $DisplayFunction, PlotRange -> {-1, 1}, Frame -> True, Axes -> False] 1 0.75 0.5 0.25 0 -0.25 -0.5 -0.75 8

9

10

11

12

We will select the three zeros from the interval H10.5, 11L for visualizing the eigenfunctions. To find precise values for the corresponding k’s we use FindRoot. The start values for the root-searching process can be extracted from mat by looking for adjacent values that change sign. In[67]:=

Out[67]=

startPairs = Map[First, Select[Partition[{#[[1]], Re[#[[2]]]}& /@ mat, 2, 1], 10.5 < #[[1, 1]] < 11.0 && (* sign change *) #[[1, 1]] > 4 && #[[1, 2]] #[[2, 2]] < 0 &], {2}] // N 8810.7, 10.7333 0.1][[-1]]& /@ fourierMatrices;

Now, we can visualize the vibrating stadium-shaped drum. The function Ψ calculates the elongation of the membrane. eigenfunctionPicture calculates and displays the eigenfunction belonging to the eigenvalue k and the null space v. boundary is a thick black line that represents the rim of the membrane. In[71]:=

Ψ[{r_, ϕ_}, k_, v_] := v.Table[BesselJ[l, k r] Exp[I l ϕ], {l, -(Length[v] - 1)/2, (Length[v] - 1)/2}]

In[72]:=

eigenfunctionPicture[k_, v_, {ppϕ_, ppr_}, col_, opts___] := Module[{points, polys, boundary}, (* the stadium boundary *) boundary = {Thickness[0.01], GrayLevel[0], Line[Table[1.006 r[s, {1, 1}]* {Cos[ϕ[s, {1, 1}]], Sin[ϕ[s, {1, 1}]], 0}, {s, 0, 2Pi + 4, (2Pi + 4)/501}]]}; (* the points *) points = Table[ρ = N[α r[s, {1, 1}]]; φ = N[ϕ[s, {1, 1}]]; {ρ Cos[φ], ρ Sin[φ], Re[Ψ[{α ρ, φ}, k, v]]}, {s, 0, [{1, 1}], [{1, 1}]/ppϕ}, {α, 0, 1, 1/ppr}]; (* make polygons *) polys = Table[Polygon[{#[[i, j]], #[[i, j + 1]], #[[i + 1, j + 1]], #[[i + 1, j]]}&[points]], {i, ppϕ}, {j, ppr}]; (* show graphics *) Show[Graphics3D[{boundary, EdgeForm[], col, polys}], opts, PlotRange -> All, Boxed -> False, BoxRatios -> {4, 2, 1}]]

Here are pictures of the three selected eigenoscillations. Because we have to calculate more than 20000 values of Bessel functions for each picture, the next calculation will take a few minutes. Because the corresponding classical system (a stadium shaped 2D billiard) is chaotic, the eigenfunctions exhibit a much more complicated structure than do the ones of the circular case [69], [823], [580], [1229], [786], [581], [732]. Analyzing the number of nodal domains allows to quantify this [166]. For an experimental realizations of such eigenoscillations of a metallic plate see [1186]. In[73]:=

Show[GraphicsArray[ Table[eigenfunctionPicture[kRoots[[k]], nontrivialHomogeneousSolutions[[k]], {201, 101}, SurfaceColor[Hue[k/4], Hue[k/4 + 0.4], 2.8], DisplayFunction -> Identity], {k, 3}]]]

3.5 Bessel and Airy Functions

1035

Using the above general ansatz for the solution of the Helmholtz equation in 2 , we could continue to investigate some more examples, numerically and symbolically. We leave it to the reader to, say, calculate the eigenvalues of a regular ngon in the limit of large n [155]. Now let us the Airy functions. The Airy functions AiHzL and BiHzL are linear combinations of Bessel functions: 2 1 z AiHzL = ÅÅÅÅÅÅ $%%%%%% ÅÅÅÅÅÅ % K1ê3 J ÅÅÅÅÅ z3ê2 N 3 p 3 z 2 2 BiHzL = $%%%%%% ÅÅÅÅÅÅ % JI-1ê3 J ÅÅÅÅÅÅ z3ê2 N + I1ê3 J ÅÅÅÅÅÅ z3ê2 NN. 3 3 3 Using FullSimplify with an appropriate option setting for the ComplexityFunction gives the following representations. In[74]:=

Out[74]=

FullSimplify[Airies[AiryAi[z], AiryBi[z]], ComplexityFunction -> (Count[#, _AiryAi | _AiryBi, Infinity]&)] 2ê3 1 2 z3ê2 1 2 z3ê2 BesselIA−   ,   E − z BesselIA   ,   E Hz3ê2 L 3 3 3 3  ,    AiriesA  1ê3 3ê2 3 Hz L 2ê3

3ê2

3ê2

1 2z 1 2z BesselIA−   ,   E + z BesselIA   ,   E Hz3ê2 L 3 3 3 3  E    è!!!!  1ê3 3ê2 3 Hz L

And here is the hypergeometric representation of the two Airy functions. In[75]:=

Out[75]=

FullSimplify[F[AiryAi[z], AiryBi[z]], ComplexityFunction -> (Count[#, _AiryAi | _AiryBi | _BesselI, Infinity]&)] 1 2 z3 FA− 2ê3  J−3 Hypergeometric0F1RegularizedA  ,  E + 3 9 33 4 z3 1ê3 3 z Hypergeometric0F1RegularizedA  ,  EN, 3 9 2 z3 1 2ê3 Hypergeometric0F1RegularizedA  ,  E +   J3 3 9 35ê6 4 z3 z Hypergeometric0F1RegularizedA  ,  ENE 9 3

AiryAi[z] represents the Airy function AiHzL. AiryBi[z] represents the Airy function BiHzL.

In view of their associated differential equation, the derivatives Ai£ HzL and Bi£ HzL are also of interest.

The Classical Special Functions

1036

AiryAiPrime[z] represents the derivative Ai£ HzL of the Airy function AiHzL. AiryBiPrime[z] represents the derivative Bi£ HzL of the Airy function BiHzL.

These functions have their own names because of their independent importance, and, because z3ê2 is involved in their analytic continuation for arbitrary complex arguments, they cannot immediately be expanded in terms of the Bessel functions using the above formulas. They satisfy the differential equation w££ HzL = z wHzL [614]. In[76]:= Out[76]=

DSolve[w''[z] == z w[z], w[z], z] 88w@zD → AiryAi@zD C@1D + AiryBi@zD C@2D Identity][[1]], {∂, 1/6, 5/6, 1/6}]; (* the potential *) pot = Plot[1/(1 + Exp[-x]), {x, -30, 10}, DisplayFunction -> Identity][[1]]; max = Max[Flatten[Abs[Table[Last /@ pic1[∂][[1, 1, 1]], {∂, 1/6, 5/6, 1/6}]]]]; (* rescale the exact solutions to fit in a picture together with the potential *) Do[pic2[∂] = Map[{0, ∂} + # {1, 0.9 1/12 /max}&, pic1[∂], {-2}], {∂, 1/6, 5/6, 1/6}]; Do[pic3[∂] = (* the approximate solutions *) Map[{0, ∂} + # {1, 0.9 1/12 /max}&, Plot[1/scaling[∂] uniformApproximationStep[∂, x], {x, -30, 10}, DisplayFunction -> Identity][[1]], {-2}], {∂, 1/6, 5/6, 1/6}]; (* show the wave functions and the potential *) Show[Graphics[ (* make potential a polygon *) {GrayLevel[0.5], Polygon[Join[pot[[1, 1, 1]], {{10, 0}, {10, -0.05}, {-30, -0.05}}]], {GrayLevel[0.5], Thickness[0.002], Table[Line[{{-30, ∂}, {10, ∂}}], {∂, 1/6, 5/6, 1/6}]}, {GrayLevel[0], Thickness[0.002], Table[pic2[∂], {∂, 1/6, 5/6, 1/6}]}, {Hue[0], Thickness[0.002], Table[pic3[∂], {∂, 1/6, 5/6, 1/6}]}}], PlotRange -> All, Frame -> True, FrameTicks -> None, AspectRatio -> 1/2]]

The Classical Special Functions

1044

To better see the difference between the exact solution and the approximate one, let us look at the square of their difference. (The bigger the difference, the lower ∂.) In[125]:=

(* turn off messages generated at x == Log[∂/(1 - ∂)] *) Off[Power::infy]; Off[Infinity::indet]; Off[Plot::plnr] Plot[Evaluate[Table[Abs[1/scaling[∂] uniformApproximationStep[∂, x] exactSolutionStep[∂, x]]^2, {∂, 1/6, 5/6, 1/6}]], {x, -8, 5}, PlotRange -> All, Frame -> True, Axes -> False, FrameLabel -> {"x", None}] On[Power::infy]; On[Infinity::indet]; On[Plot::plnr] 0.04

0.03

0.02

0.01

0 -8

-6

-4

-2

x

0

2

4

Comparing the absolute size of the error with the maximum value of the exact solution, we see that the approximation is quite good. In[130]:= Out[130]=

Table[Max[Abs[Last /@ pic1[∂][[1, 1, 1]]]], {∂, 1/6, 5/6, 1/6}] 85.00095, 2.18531, 1.26949, 0.854864, 0.655851
x^i y^j]]

The function calculateModularEquation[n, {x, y}] finally starts with d = n and increases d until a modular equation is found. In[28]:=

calculateModularEquation[n_, {x_, y_}] := Module[{d = n, modEq}, (* increase d (starting from n) until we find a modular equation *) While[(modEq = calculateModularEquation[n, d, {x, y}]) === {}, d = d + 1]; (* group terms *) modEq //. i_Integer b_ + i_Integer c_ :> i (b + c)]

Here are the first nine modular equations. The smaller ones take only seconds to generate, the larger ones minutes. In[29]:= Out[29]= In[30]:= Out[30]= In[31]:= Out[31]=

In[32]:= Out[32]=

In[33]:= Out[33]=

In[34]:= Out[34]=

In[35]:=

[ 2] = calculateModularEquation[ 2, {x, y}] −16 x + 16 x y + y2 − 2 x y2 + x2 y2 [ 3] = calculateModularEquation[ 3, {x, y}] x4 − 762 x2 y2 + y4 − 132 Hx3 y + x y3 L + 384 Hx2 y + x y2 + x3 y2 + x2 y3 L − 256 Hx y + x3 y3 L [ 4] = calculateModularEquation[ 4, {x, y}] −4096 Hx + x3 L − 16384 x2 y + 5632 x2 y2 + 2560 x2 y3 + y4 + 6 x2 y4 + x4 y4 + 8192 Hx2 + x y + x3 yL − 4864 Hx y2 + x3 y2 L + 768 Hx y3 + x3 y3 L − 4 Hx y4 + x3 y4 L [ 5] = calculateModularEquation[ 5, {x, y}] x6 + 691180 x3 y3 + y6 + 133135 Hx4 y2 + x2 y4 L − 207360 Hx3 y2 + x2 y3 + x4 y3 + x3 y4 L − 133120 Hx2 y2 + x4 y4 L − 3590 Hx5 y + x y5 L + 43520 Hx4 y + x5 y2 + x y4 + x2 y5 L − 138240 Hx3 y + x y3 + x5 y3 + x3 y5 L + 163840 Hx2 y + x y2 + x5 y4 + x4 y5 L − 65536 Hx y + x5 y5 L [ 6] = calculateModularEquation[ 6, {x, y}] 65536 x4 − 262144 x4 y + 425984 x4 y2 − 360448 x4 y3 + 59155456 x4 y4 − 118016000 x4 y5 + 59607296 x4 y6 − 615680 x4 y7 + y8 + 70 x4 y8 + x8 y8 − 540672 Hx3 y2 + x5 y2 L + 1572864 Hx2 y2 + x6 y2 L − 1048576 Hx y2 + x7 y2 L + 1622016 Hx3 y3 + x5 y3 L − 4718592 Hx2 y3 + x6 y3 L + 3145728 Hx y3 + x7 y3 L − 39868416 Hx3 y4 + x5 y4 L + 13764096 Hx2 y4 + x6 y4 L − 3440640 Hx y4 + x7 y4 L + 77033472 Hx3 y5 + x5 y5 L − 19663872 Hx2 y5 + x6 y5 L + 1638400 Hx y5 + x7 y5 L − 38331328 Hx3 y6 + x5 y6 L + 8836992 Hx2 y6 + x6 y6 L − 309312 Hx y6 + x7 y6 L + 84928 Hx3 y7 + x5 y7 L + 208512 Hx2 y7 + x6 y7 L + 14400 Hx y7 + x7 y7 L − 56 Hx3 y8 + x5 y8 L + 28 Hx2 y8 + x6 y8 L − 8 Hx y8 + x7 y8 L [ 7] = calculateModularEquation[ 7, {x, y}] x8 − 7639890874 x4 y4 + y8 − 1905600312 Hx5 y3 + x3 y5 L + 4686427648 Hx4 y3 + x3 y4 + x5 y4 + x4 y5 L − 3908889600 Hx3 y3 + x5 y5 L + 133672476 Hx6 y2 + x2 y6 L + 63926016 Hx5 y2 + x6 y3 + x2 y5 + x3 y6 L − 916944896 Hx4 y2 + x2 y4 + x6 y4 + x4 y6 L + 1158348800 Hx3 y2 + x2 y3 + x6 y5 + x5 y6 L − 499580928 Hx2 y2 + x6 y6 L − 51464 Hx7 y + x y7 L + 1858304 Hx6 y + x7 y2 + x y6 + x2 y7 L − 15307264 Hx5 y + x7 y3 + x y5 + x3 y7 L + 50462720 Hx4 y + x y4 + x7 y4 + x4 y7 L − 78905344 Hx3 y + x y3 + x7 y5 + x5 y7 L + 58720256 Hx2 y + x y2 + x7 y6 + x6 y7 L − 16777216 Hx y + x7 y7 L [ 8] = calculateModularEquation[ 8, {x, y}]

The Classical Special Functions

1070 Out[35]=

In[36]:= Out[36]=

In[37]:= Out[37]=

5368709120 x4 − 4026531840 Hx3 + x5 L + 1610612736 Hx2 + x6 L − 268435456 Hx + x7 L − 21474836480 x4 y + 94355062784 x4 y2 − 207903260672 x4 y3 + 229027610624 x4 y4 − 136603762688 x4 y5 + 37108924416 x4 y6 + 121552896 x4 y7 + y8 + 70 x4 y8 + x8 y8 + 16106127360 Hx3 y + x5 yL − 6442450944 Hx2 y + x6 yL + 1073741824 Hx y + x7 yL − 42849009664 Hx3 y2 + x5 y2 L − 2617245696 Hx2 y2 + x6 y2 L − 1711276032 Hx y2 + x7 y2 L + 72175583232 Hx3 y3 + x5 y3 L + 30400315392 Hx2 y3 + x6 y3 L + 1375731712 Hx y3 + x7 y3 L − 80637394944 Hx3 y4 + x5 y4 L − 33296351232 Hx2 y4 + x6 y4 L − 580059136 Hx y4 + x7 y4 L + 59772633088 Hx3 y5 + x5 y5 L + 8409317376 Hx2 y5 + x6 y5 L + 119930880 Hx y5 + x7 y5 L − 20606054400 Hx3 y6 + x5 y6 L + 1927176192 Hx2 y6 + x6 y6 L − 9801728 Hx y6 + x7 y6 L + 64647168 Hx3 y7 + x5 y7 L + 8626176 Hx2 y7 + x6 y7 L + 167936 Hx y7 + x7 y7 L − 56 Hx3 y8 + x5 y8 L + 28 Hx2 y8 + x6 y8 L − 8 Hx y8 + x7 y8 L [ 9] = calculateModularEquation[ 9, {x, y}] x12 − 215456569281636 x6 y6 + y12 − 149214551526168 Hx7 y5 + x5 y7 L + 151466682034176 Hx6 y5 + x5 y6 + x7 y6 + x6 y7 L − 70275008901120 Hx5 y5 + x7 y7 L − 47817388695057 Hx8 y4 + x4 y8 L + 72221649580032 Hx7 y4 + x8 y5 + x4 y7 + x5 y8 L − 48938555719680 Hx6 y4 + x4 y6 + x8 y6 + x6 y8 L + 8124308717568 Hx5 y4 + x4 y5 + x8 y7 + x7 y8 L + 5382109396992 Hx4 y4 + x8 y8 L − 4616302195932 Hx9 y3 + x3 y9 L + 13461347954688 Hx8 y3 + x9 y4 + x3 y8 + x4 y9 L − 14620704497664 Hx7 y3 + x9 y5 + x3 y7 + x5 y9 L + 4239280766976 Hx6 y3 + x3 y6 + x9 y6 + x6 y9 L + 2972205318144 Hx5 y3 + x3 y5 + x9 y7 + x7 y9 L − 1797645139968 Hx4 y3 + x3 y4 + x9 y8 + x8 y9 L + 28588376064 Hx3 y3 + x9 y9 L + 20502218818 Hx10 y2 + x2 y10 L + 293245873152 Hx9 y2 + x10 y3 + x2 y9 + x3 y10 L − 756142522368 Hx8 y2 + x10 y4 + x2 y8 + x4 y10 L + 119541399552 Hx7 y2 + x10 y5 + x2 y7 + x5 y10 L + 926350049280 Hx6 y2 + x2 y6 + x10 y6 + x6 y10 L − 739774562304 Hx5 y2 + x2 y5 + x10 y7 + x7 y10 L + 95428804608 Hx4 y2 + x2 y4 + x10 y8 + x8 y10 L + 45097156608 Hx3 y2 + x2 y3 + x10 y9 + x9 y10 L − 508940 Hx11 y + x y11 L + 46550016 Hx10 y + x11 y2 + x y10 + x2 y11 L − 818644992 Hx9 y + x11 y3 + x y9 + x3 y11 L + 5560270848 Hx8 y + x11 y4 + x y8 + x4 y11 L − 18712756224 Hx7 y + x11 y5 + x y7 + x5 y11 L + 34527510528 Hx6 y + x y6 + x11 y6 + x6 y11 L − 35634806784 Hx5 y + x y5 + x11 y7 + x7 y11 L + 19327352832 Hx4 y + x y4 + x11 y8 + x8 y11 L − 4294967296 Hx3 y + x2 y2 + x y3 + x11 y9 + x10 y10 + x9 y11 L [10] = calculateModularEquation[10, {x, y}] 16777216 x6 − 100663296 x6 y + 264241152 x6 y2 − 398458880 x6 y3 + 3418075615068160 x6 y4 − 13672301176815616 x6 y5 + 22231869734322176 x6 y6 − 18842555650342912 x6 y7 + 8822154915289600 x6 y8 − 2191068209689600 x6 y9 + 233847292688512 x6 y10 − 22302416512 x6 y11 + y12 + 924 x6 y12 + x12 y12 − 3764387840 Hx5 y2 + x7 y2 L + 45634027520 Hx4 y2 + x8 y2 L − 144955146240 Hx3 y2 + x9 y2 L + 171798691840 Hx2 y2 + x10 y2 L − 68719476736 Hx y2 + x11 y2 L + 18821939200 Hx5 y3 + x7 y3 L − 228170137600 Hx4 y3 + x8 y3 L + 724775731200 Hx3 y3 + x9 y3 L − 858993459200 Hx2 y3 + x10 y3 L + 343597383680 Hx y3 + x11 y3 L − 2592582416465920 Hx5 y4 + x7 y4 L + 1094046618419200 Hx4 y4 + x8 y4 L − 227018046177280 Hx3 y4 + x9 y4 L + 17235569541120 Hx2 y4 + x10 y4 L − 719407022080 Hx y4 + x11 y4 L + 10370216734228480 Hx5 y5 + x7 y5 L − 4374817452851200 Hx4 y5 + x8 y5 L + 903723530321920 Hx3 y5 + x9 y5 L − 63788317409280 Hx2 y5 + x10 y5 L + 816043786240 Hx y5 + x11 y5 L − 16876203371315200 Hx5 y6 + x7 y6 L + 7115470060748800 Hx4 y6 + x8 y6 L − 1442260797440000 Hx3 y6 + x9 y6 L + 87600712908800 Hx2 y6 + x10 y6 L − 541463674880 Hx y6 + x11 y6 L + 14332930596290560 Hx5 y7 + x7 y7 L − 6035507411845120 Hx4 y7 + x8 y7 L + 1166794094264320 Hx3 y7 + x9 y7 L − 43150800322560 Hx2 y7 + x10 y7 L + 211346784256 Hx y7 + x11 y7 L − 6723478886778880 Hx5 y8 + x7 y8 L + 2813719433651200 Hx4 y8 + x8 y8 L − 497891173611520 Hx3 y8 + x9 y8 L −

3.9 Elliptic Functions

1071

3380639166720 Hx2 y8 + x10 y8 L − 46191738880 Hx y8 + x11 y8 L + 1657288659128320 Hx5 y9 + x7 y9 L − 671757202278400 Hx4 y9 + x8 y9 L + 104020090695680 Hx3 y9 + x9 y9 L + 5977562145280 Hx2 y9 + x10 y9 L + 4995153920 Hx y9 + x11 y9 L − 168184172107456 Hx5 y10 + x7 y10 L + 59018375123200 Hx4 y10 + x8 y10 L − 7950567090400 Hx3 y10 + x9 y10 L + 192920376000 Hx2 y10 + x10 y10 L − 202645600 Hx y10 + x11 y10 L − 2200531264 Hx5 y11 + x7 y11 L + 10115142400 Hx4 y11 + x8 y11 L + 3048452320 Hx3 y11 + x9 y11 L + 186694720 Hx2 y11 + x10 y11 L + 1450080 Hx y11 + x11 y11 L − 792 Hx5 y12 + x7 y12 L + 495 Hx4 y12 + x8 y12 L − 220 Hx3 y12 + x9 y12 L + 66 Hx2 y12 + x10 y12 L − 12 Hx y12 + x11 y12 L

While we could continue to derive modular equations for larger n, because of the size of the results we will end here. Let us quickly check the correctness of the found modular equations. For a given x and a “randomly chosen” x, we solve the transcendental equation KH1 - xL ê KHxL = n KH1 - yL ê KHyL numerically to high precision with respect to y and calculate pn Hx, yL. In[38]:=

(* equation to be solved *) KRatios[n_, {ξ_?NumericQ, y_?NumberQ}, prec_:1000] := With[{η = SetPrecision[y, prec + 20], K = EllipticK}, K[1 - ξ]/K[ξ] - n K[1 - η]/K[η]]; (* solve the equation numerically *) Clear[ηN]; ηN[n_, ξ_, prec_:2000, opts___] := ηN[n, ξ, prec, opts] = (η /. FindRoot[KRatios[n, {ξ, η}], (* tight initial conditions for small n *) {η, 10^-(3n), 1 - 10^-(3n)}, opts, WorkingPrecision -> prec + 20, MaxIterations -> 100, AccuracyGoal -> prec] // SetPrecision[#, prec/2]&)

A 1000-digit check for the “random” value x = 1 ê e confirms the correctness of the found modular equations. In[44]:= Out[44]=

Table[Block[{n = ν, x = 1/E}, [ν] /. y -> ηN[ν, x]], {ν, 3, 10}] 80. × 10−997 , 0. × 10−996 , 0. × 10−995 , 0. × 10−992 , 0. × 10−991 , 0. × 10−989 , 0. × 10−987 , 0. × 10−985
1, Pi + ArcTan[Sqrt[3](1 + t)/(1 - t)]]; (* the above integral *) g[t_] := 2/3N[EllipticF[f[t], 8/9] - EllipticF[Pi/3, 8/9]]; (* the function h after inversion *) h[z_] := N[(Tan[#] - Sqrt[3])/(Tan[#] + Sqrt[3])&[ If[# < N[Pi/2], #, # - Pi]&[Chop[N[JacobiAmplitude[ 3/2z + EllipticF[Pi/3, 8/9], 8/9]], ∂]]]]; (* display graphics *) Show[Graphics3D[{EdgeForm[{Thickness[0.002], GrayLevel[0.9]}], Graphics3D[Plot3D[g[h[x] h[y]], (* starting and ending an ∂ away from the edges of the cube *)

3.9 Elliptic Functions {x, ∂, # - ∂}, {y, ∂, # - ∂}, PlotPoints -> pp, DisplayFunction -> Identity]][[1]], {Thickness[0.01], GrayLevel[0], (* the edges of the cube that are touched *) Line[{{0, 0, 0}, {#, 0, 0}}], Line[{{0, 0, 0}, {0, #, 0}}], Line[{{#, 0, #}, {#, #, #}}], Line[{{0, #, #}, {#, #, #}}], Line[{{#, 0, 0}, {#, 0, #}}], Line[{{0, #, 0}, {0, #, #}}]}, {Thickness[0.01], GrayLevel[0], Dashing[{0.02, 0.02}], (* the other edges of the cube dashed *) Line[{{0, 0, 0}, {0, 0, #}}], Line[{{#, #, 0}, {#, #, #}}], Line[{{#, 0, 0}, {#, #, 0}}], Line[{{0, #, 0}, {#, #, 0}}], Line[{{0, 0, #}, {#, 0, #}}], Line[{{0, 0, #}, {0, #, #}}]}}], Axes -> False, Boxed -> False, ViewPoint -> {1, -2, 0.9}, PlotRange -> All, BoxRatios -> {1, 1, 1}]&[ (* the boundary coordinates *) 2/3 (EllipticF[2Pi/3, 8/9] - EllipticF[Pi/3, 8/9]) // N]]

Here are five translated and rotated copies of the last surface. They fit together smoothly. In[2]:=

With[{L = 2/3 (EllipticF[2Pi/3, 8/9] - EllipticF[Pi/3, 8/9]) // N, pl = Cases[%, _Polygon | _Line, Infinity]}, Show[Graphics3D[{EdgeForm[], Hue[0], Thickness[0.006], pl, Apply[({#3, #1, #2} + {1, 0, 1} L)&, pl, {-2}], Apply[({#1, #3, #2} + {0, 1, 1} L)&, pl, {-2}], Apply[({#3, #1, #2} - {1, 0, 1} L)&, pl, {-2}], Apply[({#1, #3, #2} - {0, 1, 1} L)&, pl, {-2}]}], ViewPoint -> {-3, -3, 3}, Boxed -> False]]

(For more complicated triple periodic minimal surfaces, see [517], [107], [808], [699].)

1073

The Classical Special Functions

1074

Jacobipq[u, m] with p, q =S,C,D,N, p ∫ q represents the Jacobi elliptic function pqHu » mL.

We first examine the limit cases m = 0, 1. In[3]:=

allJacobis = {JacobiNS, JacobiNC, JacobiND, JacobiSN, JacobiSC, JacobiSD, JacobiCN, JacobiCS, JacobiCD, JacobiDN, JacobiDS, JacobiDC};

In[4]:=

TableForm[{allJacobis, #[u, 0]& /@ allJacobis, #[u, 1]& /@ allJacobis} // Transpose, TableHeadings -> {None, {" ", "m = 0", "m = 1"}}]

Out[4]//TableForm=

JacobiNS JacobiNC JacobiND JacobiSN JacobiSC JacobiSD JacobiCN JacobiCS JacobiCD JacobiDN JacobiDS JacobiDC

m = 0 Csc@uD Sec@uD 1 Sin@uD Tan@uD Sin@uD Cos@uD Cot@uD Cos@uD 1 Csc@uD Sec@uD

m = 1 Coth@uD Cosh@uD Cosh@uD Tanh@uD Sinh@uD Sinh@uD Sech@uD Csch@uD 1 Sech@uD Csch@uD 1

The elliptic functions satisfy equations analogous to sin2 x + cos2 x = 1. However, Mathematica does not recognize this. In[5]:= Out[5]=

FullSimplify[JacobiSN[u, m]^2 + JacobiCN[u, m]^2] JacobiCN@u, mD2 + JacobiSN@u, mD2

The correctness of the above identity can be checked numerically for an arbitrary argument. In[6]:= Out[6]=

Chop[Table[JacobiSN[#1, #2]^2 + JacobiCN[#1, #2]^2&[ Random[Complex], Random[Complex]], {12}]] 81., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.
pp, Mesh -> False, PlotLabel -> StyleForm["Re[" ToString[#] "[ux + I uy, 1/5]]", FontFamily -> "Courier", FontWeight -> "Bold"], DisplayFunction -> Identity]& /@ {JacobiAmplitude, JacobiDN}]]]

The Classical Special Functions

1076 Re@JacobiAmplitude@ux + I uy, 1ê5DD

Re@JacobiDN@ux + I uy, 1ê5DD

5 0

4

-5

2 0

-5

-2

0 5

4 2 0 -2 -4

4 2 0

-5

-2

0

-4

5

-4

Many computational rules for elliptic functions that are similar to those for trigonometric and hyperbolic functions. For example, we can find an explicit value for arguments of the form u = a ê 2 KHmL + i b ê 2 KH1 - mL, a, b œ . Here is an example. In[16]:=

Out[17]=

Off[Power::infy]; Table[JacobiCD[a EllipticK[m] + I b EllipticK[1 - m], m], {a, -1, 1, 1/2}, {b, -1, 1, 1/2}]   99ComplexInfinity, −   , 0,   , ComplexInfinity=, m1ê4 m1ê4 1− 1 1    ,   , 9   ,  "######################### "######################### "######################### è!!!!!!!!!!!! è!!!!!!!!!!!! è!!!!!!!!!!!! "######################### è!!!!!!!!!!!! 1+ 1−m 1− 1−m J− 1 − 1 − m + 1 + 1 − m N m1ê4 "################# è!!!! è!!!! "################# è!!!! 1−m 1ê4 2 J 1 − m + 1 + m N H   L m        , "######################### "######################### è!!!!!!!!!!!! "######################### è!!!!!!!!!!!! è!!!!!!!!!!!! "######################### è!!!!!!!!!!!! J− 1 − 1 − m + 1 + 1 − m N J 1 − 1 − m + 1 + 1 − m N H1 − mL1ê4 1 1 1 1 1 1  ,   =, 9   ,   =, 9   , 1,  è!!!! è!!!! ,  m1ê4 m1ê4 "######################### "######################### è!!!!!!!!!!!! è!!!!!!!!!!!! m m 1− 1−m 1− 1−m "################# è!!!! è!!!! "################# è!!!! 1−m 1ê4  L 2 J 1 − m + 1 + m N H  m        , "######################### "######################### è!!!!!!!!!!!! "######################### è!!!!!!!!!!!! è!!!!!!!!!!!! "######################### è!!!!!!!!!!!! J− 1 − 1 − m + 1 + 1 − m N J 1 − 1 − m + 1 + 1 − m N H1 − mL1ê4 1− 1 1    ,   =,   ,  "######################### "######################### "######################### è!!!!!!!!!!!! è!!!!!!!!!!!! "######################### è!!!!!!!!!!!! è!!!!!!!!!!!! 1ê4 1+ 1−m J− 1 − 1 − m + 1 + 1 − m N m 1− 1−m   9ComplexInfinity,   , 0, −   , ComplexInfinity== m1ê4 m1ê4

Elliptic functions play a major role in: † The analytical solution of gyrating motions of rigid and deformable bodies (see [1059], [566], [826], [750], [777], [848], [533], [766], [924], [1020], [440], [234], [740], [1323], [821], [1353], and [272]) † Celestial mechanics [224], [286], [563], [1332], [225], [483], [824], [349], [1288], [222], [223], [1318], [118] † Modelling chaotic systems [1248], [1249], [201], [202], [767], [632], [705], [685], [974], [932], [530] † Ordinary [862], [77], [714], [516], [208], [1269] and supersymmetric quantum mechanics [414], [416], [682], [661], [370], [662], [51], [456] † Electrodynamics [70] † Modeling double well systems [1053] † Semiclassical quantum mechanics [267], [1354] † Nonlinear quantum mechanics [262], [309], [576], [875], [263] † Quantum field theory [925], [388], [205] † Modelling traffic jams [575], [929]

3.9 Elliptic Functions

1077

† Modelling solids [787], [788], [424], [1135], [1361], [122], [1232], [683] † Statistical mechanics [1116] † Closed form solutions of nonlinear partial differential equations [307], [506], [863], [408], [1035], [370], [371], [372], [218], [203], [371], [308], [1005], [858], [1089], [902], [660], [930] † Writing the Painlevé equations in Hamiltonian form [836], [837], [1209], [1210] † Schwarz–Christoffel maps [966] † Quasiperiodic functions [353] † And many more fields [121], [240], [12] Here is an application of elliptic functions to numerical analysis. We construct an analytic functions that approximates the characteristic function of the interval @-1, 1D, namely c@-1,1D HzL = qHz + 1L qH1 - zL as m Ø 1 [1188]. In[18]:=

χApprox[z_, m_] := (1 + m JacobiSN[2 EllipticK[m]/(I Pi) Log[(z - 1)/(z + 1)] EllipticK[m] + I EllipticK[1 - m], m])/(1 + m)

In[19]:=

With[{pp = 24}, Plot[Evaluate[Table[χApprox[z, m], {m, 1/pp, 1 - 1/pp, 1/pp}]], {z, -2, 2}, PlotStyle -> Table[{Thickness[0.002], Hue[0.78 m]}, {m, 1/pp, 1 - 1/pp, 1/pp}], Frame -> True, Axes -> False, PlotRange -> All]] 1.2 1 0.8 0.6 0.4 0.2 0 -2

-1

0

1

2

One of the simplest applications of elliptic functions in this connection is the mathematical pendulum.

Physical Application: Mathematical Pendulum Newton’s law for the angle of deflection of a mathematical pendulum as a function of time can be derived from the torque operating on the body [46]: l j££ HtL = -g sinHjHtLL. Here, l is the length of the pendulum, and g is the acceleration of the earth’s gravity. Conservation of energy (which mathematically means that the independent variable t does not appear explicitly in the differential equation) makes it easy to find an analytic solution of this nonlinear differential equation. (Without loss of generality, let j£ H0L = 0, jH0L = j0 .) ij g ƒƒƒƒ ij j0 2 yzyz j0 ÅÅÅÅÅ % t§ƒ sinJ ÅÅÅÅÅÅÅÅÅ N zzzzzzzz jHtL = 2 arcsinjjjjsinJ ÅÅÅÅÅÅÅÅÅ N snjjjj$%%%%%% l ƒƒ 2 2 {{ k k ƒ

The Classical Special Functions

1078

This is the solution for the oscillating case; the case of overdeflection of the pendulum can be solved in a similar way. We do not go into this case here (see [1204] and [109]). Here, j0 is the maximum angle of deflection. For a detailed discussion of the mathematical pendulum, see [539], [1095], [234], [1358], and [998]. 1

Mathematica is not able to find an explicit solution for jHtL with initial conditions. In[20]:=

DSolve[{l ϕ''[t] == -g Sin[ϕ[t]], ϕ[0] == 0}, ϕ[t], t] Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… DSolve::bvfail : For some branches of the general solution, unable to solve the conditions. More… DSolve::bvfail : For some branches of the general solution, unable to solve the conditions. More…

Out[20]=

8
{GrayLevel[0], GrayLevel[1/2]}, PlotLabel -> StyleForm[ToString[InputForm[#]],

3.9 Elliptic Functions

1079

FontFamily -> "Courier", FontWeight -> "Bold"], DisplayFunction -> Identity]& /@ {Pi/20, Pi/2, 99/100 Pi}]] H99∗PiLê100

Piê2

Piê20

1.5

3

0.1

1

2

0.05

0.5

0.15

-0.05

0.5

1

1.5

2

-0.5

1 0.5

1

1.5

2

-1

-0.1

-1

-2

-0.15

-1.5

-3

0.5

1

1.5

2

The narrow admissible region of the harmonic approximation can be clearly seen. Jacobi’s elliptic function also plays an important role for the solution of electrostatic problems [766], [500], [446], [1058], [70], [1312], [797]. Here, we visualize the field distribution and the current flow through a rectangular metallic plate with electrodes attached to opposite corners. In[25]:=

With[{m = 0.3, n = 16}, Module[{(* the size of the plate *) xm = EllipticK[m], ym = EllipticK[1 - m], tab}, (* the values of the complex potential *) tab = Table[Log[JacobiCN[x + I y, m]], {x, 0, xm, 1/n}, {y, 0, ym, 1/n}]; (* the equipotential and current flow lines *) Show[Graphics /@ { (* real part *) ListContourPlot[Re[tab], ContourShading -> False, ContourStyle -> {Thickness[0.002]}, DisplayFunction -> Identity, Contours -> 16], (* imaginary part *) ListContourPlot[Im[tab], ContourShading -> False, ContourStyle -> {Dashing[{0.01, 0.01}], Thickness[0.002], GrayLevel[1/2]}, DisplayFunction -> Identity, Contours -> 18]}, DisplayFunction -> $DisplayFunction, PlotRange -> All, FrameTicks -> None, FrameStyle -> {Thickness[0.05]}, AspectRatio -> ym/xm]]]

The arithmetic–geometric mean plays an important role in connection with the numerical calculation of elliptic integrals and elliptic functions (see [259], [260], [334], [536], and [233]). The arithmetic–geometric mean of two numbers a and b is the limit value a¶ = b¶ of the following iteration (for a detailed discussion of which root to take in case of complex a and b, see [334]):

The Classical Special Functions

1080

ai bi a+b è!!!!!!!!! i = 1 a1 = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ b1 = a b 2 a1 + b1 è!!!!!!!!!!!! i = 2 a2 = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ b2 = a1 b1 2 a2 + b2 è!!!!!!!!!!!! i = 3 a3 = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ b3 = a2 b2 2 ª ª ArithmeticGeometricMean[a, b] gives the arithmetic–geometric mean of a and b.

We have the plot. In[26]:=

Plot3D[Re[ArithmeticGeometricMean[a, b]], {a, -3, 3}, {b, -3, 3}]

2 0

2

-2 0

-2 0

-2 2

The iterations leading to the arithmetic–geometric mean converge quite fast. Starting with a = 3, b = 1, we just need 18 steps to get 100000 correct digits of the arithmetic–geometric mean. The number of correct digits doubles roughly per step. (This fast convergence makes it possible to calculate many elliptic functions fast [183].) In[27]:=

fpl = With[{a = 3, b = 1}, Drop[ FixedPointList[{(#[[1]] + #[[2]])/2, Sqrt[#[[1]] #[[2]]]}&, N[{a, b}, 100000]], -1]];

In[28]:=

N[First /@ ((fpl[[-1]] - #)& /@ fpl), 4]

Out[28]=

8−1.136, −0.1364, −0.002409, −7.777 × 10−7 , −8.115 × 10−14 , −8.833 × 10−28 , −1.047 × 10−55 , −1.470 × 10−111, −2.897 × 10−223 , −1.126 × 10−446 , −1.700 × 10−893, −3.879 × 10−1787, −2.018 × 10−3574 , −5.465 × 10−7149 , −4.007 × 10−14298, −2.154 × 10−28596, −6.223 × 10−57193, 0. × 10−100000
b

Here is an example.

3.10 Product Log Function In[30]:=

Out[31]=

1081

Off[N::meprec]; With[{a = 3, b = 1}, Rest[NestList[Function[{a, b}, {(a + b)/2, Sqrt[a b]}] @@ #&, {b, a}, 4]] Table[AGMPair[{a, b}, n], {n, 0, 3}]] // N[#, 22]& 880. × 10−71 , 0. × 10−71 False] 88x → y y 40, PlotRange -> All, DisplayFunction -> Identity]& /@ {ProductLog, ProductLog[5, #]&}]]

1

1

0

0.5

-1 0

-1 1 -0.5

-0.5

0 0.5 1

-1

32

1

30

0.5

28 0

-1 1 -0.5

-0.5

0 0.5 1

-1

The Classical Special Functions

1084

Next, we generate some pictures of the Riemann surface of ProductLog. We show the real and imaginary parts of ProductLog[z]. In[21]:=

χ[reIm_, i_, {r_, ϕ_}] := {-1/2/E + 1/2/E Cos[ϕ] Cosh[r], 1/2/E Sin[ϕ] Sinh[r], reIm @ ProductLog[i, -1/2/E + 1/2/E Cos[ϕ] Cosh[r] + I 1/2/E Sin[ϕ] Sinh[r]]}

Making holes in the polygons shows better the structure of the whole surface. In[22]:=

In[23]:=

makeHole[Polygon[l_], α_] := Module[{λ = Function[p, (p + α (# - p))& /@ l][Plus @@ l/4]}, {MapThread[Polygon[Join[#1, Reverse[#2]]]&, Partition[Append[#, First[#]]&[#], 2, 1]& /@ {l, λ}], Line[Append[#, First[#]]]&[λ]}] With[{∂ = 10^-10}, Show[GraphicsArray[ Graphics3D[{EdgeForm[], Thickness[0.002], SurfaceColor[Hue[#2], Hue[#2], 2.4], makeHole[#, 0.78]& /@ Cases[Table[{ ParametricPlot3D[(* upper half *) Evaluate @ χ[#1, i, {r, ϕ}], {ϕ, ∂, Pi - ∂}, {r, ∂, 3}, DisplayFunction -> Identity], ParametricPlot3D[(* lower half *) Evaluate @ χ[#1, i + 1, {r, -ϕ}], {ϕ, ∂, Pi - ∂}, {r, ∂, 3}, DisplayFunction -> Identity]}, {i, -2, 2}], _Polygon, Infinity]}, BoxRatios -> {2, 1, 2}, Boxed -> False, PlotRange -> #3]& @@@ (* color and plotrange for real and imaginary part *) {{Re, 0.0, {-8, 2}}, {Im, 0.22, {-8, 8}}}]]]

Now let us consider the iterated application of the function Wn HzL=ProductLog[n, z]. Here is the Julia set of the unit circle under the map z Wn HzL. At each step, we use three of the infinitely many solutions.

Ø

In[24]:=

Show[Graphics[{PointSize[0.003], Table[{Hue[α], Point[{Im[#], Re[#]}]& /@ Flatten[NestList[ Flatten[(Table[ProductLog[k, #], {k, -1, 1}])& /@ #]&, {1. Exp[I 2 Pi α]}, 5]]}, {α, 0, 1, 1/120}]}], Frame -> True, PlotRange -> All, AspectRatio -> Automatic, FrameTicks -> None]

3.10 Product Log Function

1085

The ProductLog function arises in many applications, especially in problems related to combinatorics. Here is an example: The Stirling numbers of the second kind HmL n have a unique maximum with respect to m for a fixed n. The function mMaxStirlingS2 finds the m* , where for a given n this maximum occurs. In[25]:=

mMaxStirlingS2[n_] := Module[{m = 1, sOld = StirlingS2[n, 1], sNew}, While[(sNew = StirlingS2[n, m = m + 1]) > sOld, sOld = sNew]; m - 1]

We have the interesting relation limnض m* ê n = W HnL-1 [881], [1338], [256]. Using n < 103 , we clearly see how m* ê n approaches WHnL-1 . In[26]:=

mMaxData = Table[{n, mMaxStirlingS2[n]/n}, {n, 1000}];

In[27]:=

Plot[1/ProductLog[n], {n, 1, 1000}, Epilog -> {PointSize[0.002], Hue[0], Point /@ mMaxData}, PlotRange -> {0, 0.5}, Frame -> True] 0.5

0.4

0.3

0.2

0.1

0

200

400

600

800

1000

The ProductLog function also arises in the approximate solution of the equation ⁄nk=1 1 ê k = m with respect to m. The zeroth order solution for large m is n º expHm - gL and the first order solution is n º 1 ê H2 WH-expHg - mL ê 2LL. For many applications of the ProductLog function, see [1256], [495], [244], [644], [486], [100], [1016], [330], [1203], [551], [182], [991], [336], [1299], and [108]. For the properties of a function related to the ProductLog function, see [524]. For solutions of related equations of the form wHxL f HwHxLL = x, see [849].

The Classical Special Functions

1086

3.11 Mathieu Functions Mathieu functions are the solutions to the differential equation w≥ HzL + Ha - 2 q cosH2 zLL wHzL = 0 [868], [826], [59], [1197], [747], [879]. MathieuC[a, q, z] represents the even Mathieu solution Cea Hq, zL to the Mathieu differential equation. MathieuS[a, q, z] represents the odd Mathieu solution Sea Hq, zL to the Mathieu differential equation.

Because Mathieu functions are solutions to second-order differential equations, the derivatives are available too. MathieuCPrime[a, q, z] represents the derivative with respect to z of the Mathieu function Cea Hq, zL. MathieuSPrime[a, q, z] represents the derivative with respect to z of the Mathieu function Sea Hq, zL.

The parameter a is called the characteristic. The next picture shows a family of solutions for a fixed q. In[1]:=

Plot[Evaluate[Table[Re[MathieuC[a, 1, z]], {a, -2, 3, 1/4}]], {z, -10, 10}, PlotStyle -> Table[{Hue[i/30], Thickness[0.002]}, {i, 30}], PlotRange -> {-20, 20}, Frame -> True, Axes -> False] 20 15 10 5 0 -5 -10 -15 -10

-5

0

5

10

A numerical solution of the corresponding differential equation gives the same solution within the error bounds of NDSolve. In[2]:=

With[{a = 3, q = 1}, Plot[Evaluate[Abs[MathieuC[a, q, z] (w[z] /. NDSolve[{w''[z] + (a - 2q Cos[2z]) w[z] == 0, w[0] == MathieuC[a, q, 0], w'[0] == 0}, w, {z, 0, 10}])]], {z, 0, 10}]]

3.11 Mathieu Functions

1087

1 µ 10-7 8 µ 10-8 6 µ 10-8 4 µ 10-8 2 µ 10-8

2

4

6

8

10

Here, the equivalent family for the odd Mathieu functions is shown. In[3]:=

Plot[Evaluate[Table[Re[MathieuS[a, 1, z]], {a, -2, 3, 1/4}]], {z, -10, 10}, PlotStyle -> Table[{Hue[i/30], Thickness[0.002]}, {i, 30}], PlotRange -> {-20, 20}, Frame -> True, Axes -> False] 20 15 10 5 0 -5 -10 -15 -10

-5

0

5

10

Phase space-like trajectories 8Cea Hq, zL, ∑Cea Hq, zL ê ∑ z< can show interesting behavior [698]. In[4]:=

phaseSpaceMathieuGraphics[a_, q_, T_, opts___] := Module[{l, pp = ParametricPlot[ {MathieuC[a, q, t], MathieuCPrime[a, q, t]}, {t, 0, T}, PlotPoints -> 2000, DisplayFunction -> Identity]}, {points, l} = {#, Length[#]}&[Cases[pp, _Line, Infinity][[1, 1]]]; (* color curve *) Show[Graphics[{Thickness[0.002], MapIndexed[{Hue[0.8 #2[[1]]/l], Line[#]}&, Partition[points, 2, 1]]}], opts, AspectRatio -> 1, Frame -> True]]

In[5]:=

Show[GraphicsArray[{ phaseSpaceMathieuGraphics[8.49494, 5.60263, 300, DisplayFunction -> Identity], phaseSpaceMathieuGraphics[2.76108, 2.14745, 300, DisplayFunction -> Identity]}]]

The Classical Special Functions

1088 3 4 2 2

1 0

0

-1

-2

-2 -4 -3 -1

-0.5

0

0.5

1

-1

-0.5

0

0.5

1

Some of the solutions grow, whereas some stay bounded with increasing z. When the solutions stay bounded, they are of the form ei r z uHzL , where r is a real rational or integer called the characteristic exponent and uHzL is a periodic function of period 2p. For a given q, the value of a such that the Mathieu functions are bounded can be obtained with the following two functions. MathieuCharacteristicA[r, q] gives the value of a such that MathieuC[a, q, z] is of the form ei r z uHzL with periodic uHzL. MathieuCharacteristicB[r, q] gives the value of a such that MathieuS[a, q, z] is of the form ei r z uHzL with periodic uHzL.

Here, for q = 1, the value of the characteristic as a function of the characteristic exponent (assumed real here) is shown. In[6]:=

Plot[Re[MathieuCharacteristicA[r, 1]], {r, -3, 3}] 8

6

4

2

-3

-2

-1

1

2

3

We see jumps in the last picture that indicate the regions of a where the even Mathieu function is not bounded. For a d -q, we get purely imaginary characteristic exponents. In[7]:=

Plot[Re[MathieuCharacteristicA[I r, 1]], {r, -3, 3}]

3.11 Mathieu Functions

1089

-3

-2

-1

1

2

3

-2

-4

-6

-8

The regions in the a,q-plane that allow for bounded solutions are of particular practical importance because in many applications they correspond to stable oscillations (these are the so-called resonance tongues [216]). Here are these regions. In[8]:=

Show[Graphics[{#, Map[{-1, 1}#&, #, {-2}]}&[ (* form polygon from points *) Polygon[Join[#[[1]], Reverse[#[[2]]]]]& /@ Partition[First /@ Flatten[Plot[Evaluate @ (* table of points *) Transpose[{Table[MathieuCharacteristicA[i, q], {i, 0, 8}], Table[MathieuCharacteristicB[i, q], {i, 1, 9}]}], {q, 0, 60}, DisplayFunction -> Identity, PlotPoints -> 120][[1]]], 2]]], AspectRatio -> 1, Frame -> True, PlotRange -> {All, {-50, 100}}] 100 80 60 40 20 0 -20 -40 -60

-40

-20

0

20

40

60

The following graphics of Cea H2, zL and Sea H2, zL clearly shows the a-intervals where Cea H2, zL and Sea H2, zL stay bounded. In[9]:=

ppz = 200; ppa = 150; data = Table[MathieuC[a, 2, N[z]], {a, -3, 8, 11/ppa}, {z, -30, 30, 60/ppz}]; Show[GraphicsArray[ ListPlot3D[ArcTan @ #[data], Mesh -> False, MeshRange -> {{-30, 30}, {-3, 8}}, DisplayFunction -> Identity]& /@ {Re, Im, Abs}]]

The Classical Special Functions

1090

1 0 -1

1 0 -1

7.5 5 2.5

-20 20

5 2.5

-20

0

0

1.5 1 0.5 0

7.5

-2.5

2.5

-20

0

0

7.5 5

-2.5

20

-2.5

20

0

0

The next two graphics show Cea H2, zL and Sea H2, zL inside one of the a-intervals of the last graphic. In[12]:=

Module[{ab, ∂ = 10^-6}, Show[GraphicsArray[ ParametricPlot3D[{z, ab = #1[r, 2], #2[ab, 2, z], {EdgeForm[]}}, {z, -30, 30}, {r, 1 + ∂, 2 - ∂}, PlotPoints -> {200, 100}, BoxRatios -> {2, 1, 1/2}, PlotRange -> All, Compiled -> False, DisplayFunction -> Identity]& @@@ (* characteristics and functions *) {{MathieuCharacteristicA, MathieuC}, {MathieuCharacteristicB, MathieuS}}]]]

1

1

0

0 -1

-1 3.5

-20

3.5

-20

3

0 20

3

0 20

2.5

2.5

For small q, the term 2 q cosH2 zL wHzL can be considered as a small perturbation to the differential equation. This means that, for small q, one expects a ∂ r2 . This is indeed the case. In[13]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {Plot[MathieuCharacteristicA[r, 1], {r, 0, 3}], Plot[MathieuCharacteristicA[r, 1] - r^2, {r, 0, 3}]}]]] 8 0.5 6 0.5

4

1

1.5

-0.5

2

-1 0.5

1

1.5

2

2.5

3

(For larger q (and small z), a periodic version of a harmonic oscillator is obtained [152].) The following graphics show the even and odd Mathieu functions with period 2p, 4p, 6p and 8p.

2

2.5

3

3.11 Mathieu Functions In[14]:=

1091

Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, Plot[Evaluate[Table[Re[#1[#2[r, 1], 1, z]], {r, 1, 4}]], {z, 0, 3 2Pi}, PlotStyle -> Table[{Hue[i/7], Thickness[0.002]}, {i, 6}], PlotRange -> All, Frame -> True, Axes -> False]& @@@ (* functions and characteristics *) {{MathieuC, MathieuCharacteristicA}, {MathieuS, MathieuCharacteristicB}}]]] 1

1

0.5

0.5

0

0

-0.5

-0.5

-1

-1 0

2.5

5

7.5

10

12.5

15

17.5

0

2.5

5

7.5

10

12.5

15

17.5

The characteristic a as a function of q can be regarded as a multivalued function with the integer r in ar HqL labelling the sheets [164], [621]. Some of the branch points of aHqL appear on the imaginary axis. A plot of ar HqL shows the branch points nicely. The functions ar HqL, br HqL have a complicated branch cut structure as a function of q. The right graphic shows a10 HqL. In[15]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {Show[Plot[Evaluate[Table[Re[MathieuCharacteristicA[i, I q]], {i, 0, 6}]], {q, 0, 17}, PlotStyle -> Table[{Hue[i/9], Thickness[0.002]}, {i, 7}]] /. (* delete steep vertical lines *) Line[l_] :> Line /@ Select[Partition[l, 2, 1], (#[[2, 2]] - #[[1, 2]])/(#[[2, 1]] - #[[1, 1]]) < 100&]], ContourPlot[Abs @ MathieuCharacteristicA[10, qx + I qy], {qx, 0, 100}, {qy, 0, 120}, PlotPoints -> 200, PlotRange -> All, ColorFunction -> (Hue[0.8 #]&), Contours -> 50]}]]] 120 40

100

30

80 60

20 40 10

20

2.5

5

7.5

10

12.5

15

0

0

20

40

60

80

100

The branch cut structure of ar HqL, br HqL is not standardized. To obtain values from the appropriate sheet the functions MathieuCharacteristicA, MathieuCharacteristicB accept a third argument, which is the starting value for the numerical procedure that calculates ar HqL, br HqL. The following graphics show branches of the multivalued a40 HqL, once calculated using MathieuCharacteristicA with two arguments and once as a continuous function.

The Classical Special Functions

1092 In[16]:=

Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {ListPlot[Table[MathieuCharacteristicA[40, q], {q, 0, 820}] // N], ListPlot[FoldList[MathieuCharacteristicA[40, #2, N[#1]]&, (* use step size 1 *) MathieuCharacteristicA[40, 0] // N, Table[q, {q, 1, 820}]]] // N}]]] 1950 1800

1900 1850

1750

1800 1700

1750 1700

1650

1650 200

400

600

800

200

400

600

800

The above contour plot shows that a10 HqL has a branch point near q º 75 + 66 i. Encircling this branch point twice by using the three-argument version of MathieuCharacteristicA shows that this branch points is of square root-type [164]. In[17]:=

ListPlot[N[{#1, Re[#2]}]& @@@ FoldList[Function[{ϕa, ϕ}, {ϕ, MathieuCharacteristicA[10, N[75 + 66 I + 8 Exp[I ϕ]], ϕa[[2]]]}], {-Pi/2, N[MathieuCharacteristicA[10, 75 + 58 I]]}, Table[ϕ, {ϕ, -Pi/2, 7Pi/2, 2Pi/30}]], Frame -> True, Axes -> False, PlotJoined -> True] 200

190

180

170

0

2

4

6

8

10

The characteristic exponent as a function of a and q can be obtained from the function MathieuCharacter isticExponent: MathieuCharacteristicExponent[a, q] gives the characteristic exponent r for MathieuC[a, q, z] and MathieuS[a, q, z].

In the stability regions (bands) the characteristic exponent is purely real. Outside it has a nonvanishing imaginary and a constant real part. The following graphic shows the real and imaginary parts of r for q = 2. In[18]:=

Plot[{Re @ MathieuCharacteristicExponent[a, 2], Im @ MathieuCharacteristicExponent[a, 2]}, {a, -3, 12}, PlotStyle -> {Hue[0], Hue[0.78]}, Frame -> True, Axes -> False]

3.11 Mathieu Functions

1093

0.5 0.4 0.3 0.2 0.1 0 -2

0

2

4

6

8

10

12

Here, the characteristic exponent as a function of a and q is shown. In[19]:=

Plot3D[Re[MathieuCharacteristicExponent[a, q]], {a, -3, 3}, {q, -3, 3}, PlotPoints -> 40, ColorFunction -> (Hue[#/2]&)]

2 1

2

0

0

-2 0

-2 2

We see jumps in the last picture that indicate the regions of r, where the even Mathieu function is not bounded. The characteristic exponent as a function of a and q can be obtained from the function. The characteristic exponent can also be complex. In this case, the solutions are exponentially increasing or decreasing. Here is such a situation. In[20]:=

Plot[Re[MathieuS[MathieuCharacteristicB[0.2 I, 1], 1, z]], {z, -3 2Pi, 3 2Pi}] 15 10 5

-15

-10

-5

5

10

15

-5 -10 -15

As an example for the use of Mathieu functions, let us discuss the oscillations of an ellipsoidal drum. An ellipsoidal drum is the simplest generalization of the circular drum discussed in the above section about Bessel and Airy functions.

Physical Application: Oscillation of an Ellipsoidal Drum Let us consider a membrane inside an ellipse-shaped region with the membrane held fixed at the boundary [291], [1068]. Then the amplitude uHr, tL of the membrane is governed by the wave equation

The Classical Special Functions

1094

1 ∑2 uHr, tL DuHrL + ÅÅÅÅÅ2ÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ2ÅÅÅÅÅÅÅÅÅÅÅÅ = 0. ∑t c ph Here, D is the Laplace operator and c2ph (= tension per unit surface density) is the phase velocity. Assuming the solution is periodic in time, that is, uHr, tL = cosHwt + aL uHrL we are led to the Helmholtz equation w D uHrL + l2 uHrL = 0, l = ÅÅÅÅÅÅÅÅÅÅÅÅÅ . cph The Laplace operator separates in an elliptical coordinate system. An elliptical coordinate system is related to a Cartesian coordinate system by the following equations: x = c coshHrL cosHjL y = c sinhHrL sinHjL

0 § j § 2 p, 0 < r < ¶.

For a given ellipse, the relation between the half-axis a and b, the parameter c, and the maximal value r0 of r is given by a = c cosh r0 and b = c sinh r0 . Making a separation ansatz in the form uHrL = FHjL RHrL, we obtain the following two ordinary differential equations [908], [868]: Ha - 2 q coshH2 rLL RHrL + R≥ HrL = 0 Ha + 2 q cosH2 jLL FHjL + F≥ HjL = 0 2

l where q = ÅÅÅÅ ÅÅÅÅ and 2 a is the separation constant. 4c

The boundary conditions for F(j) are periodicity: FHj + k 2 pL = FHjL, k œ . Because of the Dirichlet boundary condition of the whole membrane, the boundary condition for RHrL is RHr0 L = 0. For a more detailed discussion of an ellipsoidal drum, see [868], [292], [291], [1068], [37], [1235], [559], [282], and [840]. 1

The following example follows [1236] closely. See this article for more details. In accordance with the symbols used in the literature, let us define the two functions cen Hq, zL and sen Hq, zL, which are the even and odd solutions of the Mathieu equation with periodicity 2 p n. In[21]:=

(* even functions *) ce[n_Integer?NonNegative][q_, z_] = MathieuC[MathieuCharacteristicA[n, q], q, z]; (* odd functions *) se[n_Integer?Positive][q_, z_] = MathieuS[MathieuCharacteristicB[n, q], q, z];

Now, the “radial” (r dependent) equation derived above must now be used to satisfy the Dirichlet boundary condition on the outer boundary. The solutions of the radial equation are again Mathieu functions, but this time with a purely imaginary argument. Using continuity of the elongation along the line connecting the two foci, this leads to the following form of the eigenfunctions: c c l o cen Hqn j , jL cen Hqn j , i rL n = 0, …, j = 1, ... ycs nj ∂m s o sen Hq , jL sen Hqs , i rL n = 1, …, j = 1, ... cs = c or s. nj nj n

3.11 Mathieu Functions

1095

"############## The corresponding eigenvalues are given by lcs qncsj ê c , cs = c or s. To fulfill the boundary condition nj =2 RHr0 L = 0 we must have cen Hqnc j , i r0 L = 0 or sen Hqns j , i r0 L = 0. For a given n and r0 , this implicitly defines a countable infinite number of values qnc j and qsn j . For the following let us fix the value of r0 to be 1/2. In[25]:=

r0Example = 1/2;

Next, we have to find the values qcs n j . Here, we will have to resort to numerical techniques. Plots show that for small values of n, the qcs n j are well separated. In[26]:= Out[26]= In[27]:=

se[1][1, I r0Example] // N 0. + 0.309619  Show[GraphicsArray[#]]& /@ Partition[ Block[{$DisplayFunction = Identity}, {Plot[Evaluate[I se[1][q, I r0Example]], {q, 0, 100}, PlotRange -> {-0.0001, 0.0001}], Plot[Evaluate[ce[3][q, I r0Example]], {q, 0, 100}, PlotRange -> {-0.0001, 0.0001}], Plot[Evaluate[I se[5][q, I r0Example]], {q, 0, 100}, PlotRange -> {-0.0001, 0.0001}], Plot[Evaluate[I se[12][q, I r0Example]], {q, 0, 100}, PlotRange -> {-1, 1}]}], 2] 0.0001

0.0001

0.000075

0.000075

0.00005

0.00005

0.000025

0.000025

-0.000025

20

40

60

80

100

-0.00005

-0.00005

-0.000075

-0.000075

-0.0001

-0.0001

0.00005

0.5

0.000025

0.25

-0.00005

-0.0001

60

80

100

0.75

0.000075

-0.000075

40

1

0.0001

-0.000025

20

-0.000025

20

40

60

80

100

-0.25

20

40

60

80

100

-0.5 -0.75 -1

Next, we have to find the values qcs n j . Here, we will have to resort to numerical techniques. Plots show that for are well separated. (We take into account that the functions are purely imaginary for an small values of n, the qcs nj imaginary argument.) In[28]:=

findQValues[f:ce | se, r0_, n_, {q0_, q1_}, pp_] := Module[{qData, zeroEnclosingIntervals}, (* a dense set of points *) qData = Table[N[{q, If[f === ce, 1, I] f[n][q, I r0]}], {q, q0, q1, (q1 - q0)/pp}]; (* intervals where a zero occurs *)

The Classical Special Functions

1096 zeroEnclosingIntervals = Map[First, Select[Partition[qData, 2, 1], Re[#[[1, 2]] #[[2, 2]]] < 0&], {2}]; (* finding accurate values for the zeros *) q /. Apply[FindRoot[Evaluate[f[n][q, I r0] == 0], {q, ##}]&, zeroEnclosingIntervals, {1}]]

For the first few n, we calculate the corresponding first few qncsj . In[29]:=

Table[MapIndexed[(qc[i][#2[[1]]] = #1)&, findQValues[ce, r0Example, i, {0, 100}, 100]], {i, 0, 6}];

In[30]:=

Short[SubValues[qc], 6]

Out[30]//Short=

8HoldPattern@qc@0D@1DD  3.17779, HoldPattern@qc@0D@3DD  60.4245, HoldPattern@qc@1D@2DD  27.5324, HoldPattern@qc@2D@1DD  8.39973, HoldPattern@qc@4D@2DD  46.2685, HoldPattern@qc@5D@1DD  22.6667, HoldPattern@qc@6D@1DD  29.2084,

HoldPattern@qc@0D@2DD  22.6941, HoldPattern@qc@1D@1DD  5.3837, HoldPattern@qc@1D@3DD  68.0215, 5, HoldPattern@qc@4D@1DD  17.0229, HoldPattern@qc@4D@3DD  94.8499, HoldPattern@qc@5D@2DD  54.0154, HoldPattern@qc@6D@2DD  62.552
Identity], _Polygon, Infinity], maxZ}, (* scale the elongation *) maxZ = Max[Abs[Transpose[Level[polys, {-2}]][[-1]]]]; Show[Graphics3D[{boundary3D[r0], {col, EdgeForm[], Apply[{#1, #2, #3/maxZ 0.5}&, polys, {-2}]}}], opts, PlotRange -> All, Boxed -> False]]

In[36]:=

boundary3D[r0_] := boundary3D[r0] = {Thickness[0.01], Line[Table[{Cosh[r0] Cos[ϕ], Sinh[r0] Sin[ϕ], 0}, {ϕ, 0., 2.Pi, 2Pi/200}]]}

3.11 Mathieu Functions

Here are some of the above-calculated eigenfunctions, starting with the ground state [511]. In[37]:=

randomColor := SurfaceColor[Hue[Random[]], Hue[Random[]], 3 Random[]];

In[38]:=

(* group into pairs *) efp3D[type_, {i1_, j1_}, {i2_, j2_}] := Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, Apply[EigenFunctionPlot3D[type[##][r, ϕ], r0Example, {r, ϕ}, randomColor]&, {{i1, j1}, {i2, j2}}, {1}]]]]

In[40]:=

efp3D[ψc, {0, 1}, {0, 2}]

In[41]:=

efp3D[ψc, {0, 3}, {1, 1}]

In[42]:=

efp3D[ψc, {1, 2}, {1, 3}]

Here are two of the higher states shown. In[43]:=

EigenFunctionPlot3D[ψc[4, 3][r, ϕ], r0Example, {r, ϕ}, randomColor, {60, 120}]

Next we display some of the ψs-functions.

1097

The Classical Special Functions

1098 In[44]:=

efp3D[ψs, {1, 1}, {1, 2}]

In[45]:=

efp3D[ψs, {1, 3}, {2, 1}]

In[46]:=

efp3D[ψs, {2, 2}, {2, 3}]

Here is again one of the higher states shown. In[47]:=

EigenFunctionPlot3D[ψs[6, 1][r, ϕ], r0Example, {r, ϕ}, randomColor, {60, 120}]

Here, two much higher state are shown. We use considerably more points to resolve the more complicated structure of the eigenfunctions. In[48]:= Out[48]= In[49]:=

{qs[12][1], qs[12][2]} = findQValues[se, r0Example, 12, {0, 180}, 200]

891.7035 + 0. , 147.933 + 0. < Show[GraphicsArray[ Block[{$DisplayFunction = Identity},

3.11 Mathieu Functions

1099

Table[EigenFunctionPlot3D[ψs[12, j][r, ϕ], r0Example, {r, ϕ}, randomColor, {160, 240}], {j, 2}]]]]

Now, we will construct contour plots of the membrane. Using ContourPlot, we will make a contour plot in the rectangular r,j-domain and then map the rectangle to the ellipse. The function addPoints refines the outlines of the polygons generated in the contour plot. This is necessary to get a smooth mapping. In[50]:=

addPoints[points_, δ∂_] := Module[{n, l}, Join @@ ( Function[segment, (* segment too short? *) If[(l = Sqrt[#. #]&[Subtract @@ segment]) < δ∂, segment, n = Floor[l/δ∂] + 1; (* form segments *) Table[# + i/n (#2 - #1), {i, 0, n - 1}]& @@ segment]] /@ Partition[Append[points, First[points]], 2, 1])]

In[51]:=

toEllipse[{r_, ϕ_}] = {Cosh[r] Cos[ϕ], Sinh[r] Sin[ϕ]};

In[52]:=

boundary2D[r0_] := boundary2D[r0] = {Thickness[0.01], Line[Table[{Cosh[r0] Cos[ϕ], Sinh[r0] Sin[ϕ]}, {ϕ, 0., 2.Pi, 2Pi/200}]]}

The function efPlotContour generates a contour plot of y within the ellipse. In[53]:=

EigenFunctionContourPlot[ψ_, r0_, {r_, ϕ_}, col_, pp_:{60, 100}, cts_:40, opts___] := Module[{cp = ContourPlot[ψ, {r, 0, r0}, {ϕ, 0, 2Pi}, PlotPoints -> pp, ColorFunction -> col, ContourLines -> False, DisplayFunction -> Identity], δ∂ = Cosh[r0] 2Pi/100, contourValues}, (* make homogeneously spaced contours *) cV = contourValues = #[[Round[(Times @@ pp)/cts/2]]]& /@ Partition[Sort[Flatten[Re[cp[[1]]]]], Round[(Times @@ pp)/cts]]; Show[Graphics[cp /. (Contours -> _) -> (Contours -> 20)] /. {p_Polygon :> (toEllipse /@ addPoints[#, δ∂]&) /@ p}, Frame -> False, AspectRatio -> Automatic, DisplayFunction -> $DisplayFunction, Epilog -> boundary2D[r0]]]

Here are the functions from above shown as contour plots. In[54]:=

(* group into pairs *) efcP[type_, {i1_, j1_}, {i2_, j2_}] := Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, Apply[EigenFunctionContourPlot[type[##][r, ϕ], r0Example,

The Classical Special Functions

1100 {r, ϕ}, Hue[0.8 #]&]&, {{i1, j1}, {i2, j2}}, {1}]]]] In[56]:=

efcP[ψc, {0, 1}, {0, 2}]

In[57]:=

efcP[ψc, {0, 3}, {1, 1}]

In[58]:=

efcP[ψc, {1, 2}, {1, 3}]

And here is again one of the higher states shown. In[59]:=

EigenFunctionContourPlot[ψc[4, 3][r, ϕ], r0Example, {r, ϕ}, Hue[0.8 #]&]

And here again some of the ψs-type functions. In[60]:=

efcP[ψs, {1, 1}, {1, 2}]

3.11 Mathieu Functions

In[61]:=

efcP[ψs, {1, 3}, {2, 1}]

In[62]:=

efcP[ψs, {2, 2}, {2, 3}]

In[63]:=

EigenFunctionContourPlot[ψs[6, 1][r, ϕ], r0Example, {r, ϕ}, Hue[0.8 #]&]

1101

In distinction to the circular membrane, the ellipse-shaped membrane has one free parameter; in our notation, c s this is r0 . Varying this parameter allows for degenerate eigenvalues. For r0 º 0.495, the two states y1, 3 and y5, 2 are degenerate. In[62]:=

Out[63]=

r0Degenerate = 0.49526836; {{qc[1][2]}, {qs[5][1]}} = {findQValues[ce, r0Degenerate, 1, {50, 80}, 10], findQValues[se, r0Degenerate, 5, {50, 80}, 10]} 8869.3274 False, MeshRange -> {{0, r0}, {0, 2Pi}}, ColorFunction -> col, DisplayFunction -> Identity]] /. (* map polygons to ellipse *) {p_Polygon :> (toEllipse /@ addPoints[#, δ∂]&) /@ p}, opts, Frame -> False, AspectRatio -> Automatic, DisplayFunction -> $DisplayFunction, Epilog -> boundary2D[r0]], {i, 0, frames}]];

In[68]:=

Show[GraphicsArray[#]]& /@ Partition[ DegenerateEigenFunctionContourPlot[ {ψc[1, 2][r, ϕ], ψs[5, 2][r, ϕ]}, r0Degenerate, {r, ϕ}, 20, Hue[0.8 #]&, {50, 100}, 15, DisplayFunction -> Identity], 3]

3.11 Mathieu Functions

1103

Make Input

DegenerateEigenFunctionContourPlot[{ψc[1, 2][r, ϕ], ψs[5, 2][r, ϕ]}, r0Degenerate, {r, ϕ}, 30, Hue[0.8 #]&]

For the corresponding quantum-mechanical eigenvalue problem, including a magnetic field, see [611] and [612]. For other applications of Mathieu functions, see [1088], [549], [434], and [787]. We will end this section with a solid-state physics view [1161], [65], [681], [513] on the Mathieu equation and functions. Because of the importance of crystalline materials, the study of periodic potentials V in the Schrödinger equation -Dy + V y = ¶ y is of great relevance. After 1D piecewise constant potentials (Kronig–Penney potential and its limiting cases) the potential V HzL ~ cosHzL is the next simple choice (the next complicated, but still exactly solvable one is the choice of a double-periodic elliptic function like the Weierstrass function [1211]). But this is just the Mathieu equation. Transforming VHzL ~ ƒHz; 8g2 .g3 Function[z, Evaluate[ψ[z] /. sol[[1]]]] // Simplify True sol = DSolve[-ψ''[z] + 0 V0 Cos[z] ψ[z] == ∂ ψ[z], ψ[z], z] è!!!! è!!!! 88ψ@zD → C@1D Cos@z ∂ D + C@2D Sin@z ∂ D Line[{-1, 1}#& /@ l]}&[ (* the curves *) Table[ParametricPlot[f, {κ, j + ε, j + 1 - ε}, DisplayFunction -> Identity, Compiled -> False], {j, 0, 3}]], Frame -> True, Axes -> False], HoldAll] /@ Unevaluated[{{κ, MathieuCharacteristicA[κ, 2 V0]/4}, (* fold in *) {κ - Floor[κ], MathieuCharacteristicA[ If[EvenQ[Floor[κ]], κ, 2 Floor[κ] + 1 - κ], 2 V0]/4}}]]]] 4

4

3

3

2

2

1

1

0

0 -4

-2

0

2

4

-1

-0.5

The width of the lowest energy bands depends exponentially on the potential strength V0 . In[73]:=

∆[n_, V0_] := With[{ε = 10^-10}, MathieuCharacteristicA[n + 1 - ε, 2V0] MathieuCharacteristicA[n + ε, 2V0]]

In[74]:=

Plot[Evaluate[Table[Log[10, ∆[j, V0]], {j, 0, 6}]], {V0, -30, 0}, Frame -> True, Axes -> False]

0

0.5

1

3.11 Mathieu Functions

1105

0 -2 -4 -6 -8 -10 -30

-25

-20

-15

-10

-5

0

The well known Bloch theorem states that inside an allowed energy band (meaning the corresponding wave functions stay bounded as †z§ Ø ¶) the wave functions can be written in the form yn  HzL = ei  z un  HzL where un  HzL is periodic with the periodicity of the underlying potential and  is again the quasi-wave vector [702], [757], [653]. This means that the Bloch wave vector  is the characteristic exponent. In the free particle limit HV0 = 0L, the Mathieu functions reduce to trigonometric functions. In[75]:=

Out[75]=

{MathieuC[MathieuCharacteristicA[κ, 0], 0, z], MathieuS[MathieuCharacteristicB[κ, 0], 0, z]} è!!!!!! è!!!!!! 9CosAz κ2 E, SinAz κ2 E=

Compensating for the square root in the last expression, we have the following definition for the Bloch functions p yn  HzL and their periodic parts un  HzL. These functions are normalized [245] to Ÿ-p †yn  HzL§ dz = 2 p with respect to z and orthogonal ¶

‡ In[76]:=



êêêêêêêêêêêê yn  HzL yn£  £ HzL dz = 2 p dn,n£ dH -  £ L.

BlochΚ[κ_, V0_, z_] := MathieuC[MathieuCharacteristicA[κ, 2 V0], 2 V0, z/2] + Sign[κ] I MathieuS[MathieuCharacteristicB[κ, 2 V0], 2 V0, z/2] periodic[κ_, V0_, z_] := BlochΚ[κ, V0, z]/Exp[I κ z/2]

The following graphics show the absolute value and the argument of the periodic Bloch functions and their periodic parts. The 2 p-periodicity and the shape-change of behavior at the band edges are clearly visible. In[79]:=

Show[GraphicsArray[ ContourPlot[# @ periodic[κ, -1, z], {z, -5/2Pi, 5/2Pi}, {κ, -4, 4}, PlotPoints -> 100, DisplayFunction -> Identity, PlotRange -> All, ColorFunction -> (Hue[0.8 #]&)]& /@ {Abs, Arg[#]^2&}]] 4

4

2

2

0

0

-2

-2

-4

-7.5

-5

-2.5

0

2.5

5

7.5

-4

-7.5

-5

-2.5

0

2.5

5

7.5

The Classical Special Functions

1106

Within a band, the quasiperiodicity of the Bloch functions yields a complicated behavior when viewed over many periods. The following two graphics show the real part of the Bloch functions of the lowest two energy bands over 24 periods. In[80]:=

With[{ε = 10^-3}, Show[GraphicsArray[ Plot3D[Evaluate[Re[BlochΚ[κ, -3, z]]], {z, -24 Pi, 24 Pi}, {κ, # + ε, # + 1 - ε}, PlotPoints -> 180, Mesh -> False, PlotRange -> All, DisplayFunction -> Identity, Axes -> False]& /@ {0, 1}]]]

This complicated structure can be interpreted in the following way: For large V0 , the periodic potential becomes a series of independent potential wells (at least for the low lying energy states). Instead of having infinitely many wells, we look now at the situation of a finite number (d = 24 in the following) of wells. We use periodic boundary conditions, meaning, we identify the first with the d + 1 well. The overlap integrals between the localized wave functions of the wells depend exponentially on the distances between the wells. This leads to the following simple model for  extended states out of  states localized in the wells (a circulant matrix [26], [360]). In[81]:=

 = 24; Module[{(* small overlap constant *) α = 10^-2}, H = Table[α^Min[Abs[i - j],  - Abs[i - j]], {i, }, {j, }]; {evals, evecs} = Eigensystem[N[H]]];

The eigenvalues show already the typical dispersion relation of periodic potentials in 1D. (Because of the symmetry of H, the eigenvalues appear in pairs.) In[83]:=

ListPlot[evals, PlotJoined -> True, Frame -> True] 1.02

1.01

1

0.99

0.98 0

5

10

15

20

We now model the kth state inside each well with the kth state of a harmonic oscillator φ[k, x]. Using the eigenvectors from above we form the eigenfunctions extending over all d wells. We use the ground-state and the

3.11 Mathieu Functions

1107

first excited state, as the well functions. Similar to the above graphics of the Bloch functions, we easily recognize the totally symmetric and totally antisymmetric states as the first and last state for finite d, or as the sates at the band edges respectively. In[84]:=

φ[k_, x_] := HermiteH[k, x] Exp[-x^2] Function[, Show[GraphicsArray[ Plot[Evaluate[(* form extended states *) Sum[φ[, x - 5 k] evecs[[#, k]], {k, }]], {x, 0, ( + 1) 5}, PlotRange -> All, Axes -> False, DisplayFunction -> Identity, Frame -> True, FrameTicks -> False, PlotPoints -> 300, PlotStyle -> {Thickness[0.002]}]& /@ (* five selected states *) {1, 6, 12, 18, 24}]]] /@ {0, 1}

Bloch functions yn  HzL are extended states. Often one wants localized states. A natural choice for real-valued states in a periodic potential localized near z º Z are the so called Wannier functions p Wn Hz - ZL = Ÿ-p yn  HzL e-i  z dz [1298]. (The choice of a possible -dependent phase of yn  HzL is determined by yn 0 H0L and yn 1 H0L [1004], [859], [1166], [1167], [226]). (Wannier functions can be thought of as special eigendifferentials for the continuous spectrum of the allowed energy bands [882], [737], [738], [739]; for Wannier functions constructed from Gaussians, see [648].) In[86]:=

WannierW[n_, V0_, Z_, z_, nIntOpts___] := With[{ε = 10^-8}, NIntegrate[Evaluate[Exp[-I κ Z] BlochΚ[+κ, V0, z + Z] + Exp[+I κ Z] BlochΚ[-κ, V0, z + Z]], {κ, n + ε, n + 1 - ε}, (* numerical integration options *) nIntOpts]]

The 0th Wannier functions is a localized bump that quickly goes to zero. In[87]:=

wData = Table[{z, WannierW[0, -1, 0, z, PrecisionGoal -> 4, MaxRecursion -> 10]}, {z, 0, 9Pi, 9Pi/120}];

In[88]:=

WannierListGraphic[wData_] := With[{wDataAll = Join[Reverse[{-1, 1}#& /@ #], #]&[wData]}, Show[GraphicsArray[ListPlot[#, PlotRange -> All, Frame -> True, Axes -> False, PlotJoined -> True, DisplayFunction -> Identity]& /@ {{#1, #2}& @@@ wDataAll, {#1, Log @ Abs[#2]}& @@@ wDataAll}]]]

In[89]:=

WannierListGraphic[wData // N]

The Classical Special Functions

1108

3

0

2.5

-2.5 -5

2

-7.5

1.5

-10

1

-12.5

0.5

-15

0

-17.5 -20

-10

0

10

20

-20

-10

0

10

20

Qualitatively we have †Wn Hz - ZL§ ∂ expH-l †z - Z§L as †z - Z§ Ø ¶ where the decay length l is equal to the distance of the nearest branch point of ¶n  from the real -axis [702]. For the above data wData, we can approximate l numerically as l º -0.5. In[90]:= Out[90]=

Fit[{#1, Log @ Abs[#2]}& @@@ wData, {1, x}, x] 0.0614477 − 0.530262 x

The branch points of ¶n  are located at j ≤ i z, j œ . The branch point of relevance for the lowest Wannier function is located at  º 1 + 0.48035 i, which is in good agreement with the above estimate. In[91]:=

Show[GraphicsArray[ Plot[Evaluate[{Re[#], Im[#]}&[MathieuCharacteristicA[# + I r, -1]/4]], {r, -1, 1}, PlotStyle -> {GrayLevel[0], Hue[0]}, PlotRange -> All, DisplayFunction -> Identity]& /@ {0, 1}]] -1

-0.5

0.5

0.4

1

-0.05 0.2

-0.1 -0.15 -1

-0.5

0.5

1

-0.2 -0.2 -0.25 -0.3

-0.4

(A more detailed analysis shows that the decay is †z§-3ê4 expH-l †z§L [577], [317].) Higher Wannier functions are still exponentially localized, but typically show a more complicated structure. Here is W1 HzL shown. In[92]:=

(* slightly more efficient version of WannierW *) WannierW[n_, V0_, Z_, z_, nIntOpts___] := With[{ε = 10^-8}, NIntegrate[2 Re[Exp[-I κ Z] BlochΚ[+κ, V0, z + Z]], {κ, n + ε, n + 1 - ε}, nIntOpts]]

In[94]:=

wData = Table[{z, WannierW[1, -1, 0, z, PrecisionGoal -> 4, MaxRecursion -> 10]}, {z, 0, 9Pi, 9Pi/120}]; WannierListGraphic[wData // N]

3.12 Additional Special Functions

1109

1.5

0

1 -1

0.5

-2

0 -0.5

-3

-1

-4

-1.5

-5 -20

-10

0

10

20

-20

-10

0

10

20

In the limit v0 Ø 0, we have Wn Hz - ZL Ø 4 sinHHz - ZL ê 2L ê Hz - ZL. For V0 = -0.1 the Wannier function W1 HzL resembles 4 sinHz ê 2L ê z quite well. In[97]:=

wData = Table[{z, WannierW[0, -0.1, 0, z]}, {z, 0, 6Pi, 6Pi/60}]; WannierListGraphic[wData]; 1 2

0 -1

1.5

-2

1

-3 0.5

-4

0

-5 -15

-10

-5

0

5

10

15

-15

-10

-5

0

5

10

15

For an interpretation of -y≥ HzL + V0 cosHzL yHzL = ¶ yHz L as a quantum mechanical pendulum, see [25], [1032], [397], [703], [82], [18], and [399]; for a semiclassical treatment, see [89], [950]; for the double pendulum, see [1010].

3.12 Additional Special Functions Not all special functions mentioned in the above references are implemented in Version 4. However, most of the functions that are not implemented can be expressed relatively easily in terms of other functions that are available in Mathematica. These include Weber functions En HzL, Anger functions Jn HzL, Lommel functions sm,n HzL, Sm,n HzL, and Kelvin functions bern HzL, bein HzL, kern HzL, kein HzL. However, a few functions are definitely not available (in Mathematica Version 4), including the hypergeometric functions of several variables, that is, in two variables the Kampé de Fériet function (see, for instance, [50], [958]) and Lauricella functions in more variables, Epstein Zeta functions for arbitrarily many variables, and so on. Some of the special functions implemented in Mathematica and not discussed here are the following: † Elliptic theta functions J1 Hu » qL, J2 Hu » qL, J3 Hu » qL, J4 Hu » qL

The Classical Special Functions

1110

These are solutions of partial differential equations similar to the heat equation (see [421], [1047], and [120]). † Weierstrass functions ƒHu; g2 , g3 L and their derivatives ƒ£ Hu; g2 , g3 L. These are also inverse functions for elliptic integrals and permit the solution of differential equations of the form: x££ HtL + a xHtL + b xHtL2 + c = 0 which is Newton’s law of motion for a force ~ a x + b x2 + c. As an elliptic function a lot of other interesting problems from classical mechanics can also be expressed using Weierstrass functions; see the listing in Section 3.9 and [1310]. The Weierstrass function is also very useful for the construction of closed-form solutions of 1D chaotic maps [221]. † Polylogarithm Lin HzL. † Zeta functions zHs, aL. These frequently arise in summation problems and are of particular interest for solving number-theoretic problems. † Lerch functions FHz, s, aL. These, too, are of great interest in number theory. In addition, they allow closed-form expressions of Fermi integrals [315] ¶



0

xs ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ dx = em GHs + 1L FH-em , s + 1, 1L. x-m e +1

Although not discussed in the main part of this chapter, we will meet some of the mentioned functions in the exercises. To conclude this section, we state the following warning: In rare cases (in general for large complex values of the variables and the parameters), the values of the special functions will be incorrectly computed when using machine accuracy. For such arguments, one should make use of Mathematica’s bignum arithmetic capability in the form N[specialFunction(complexNumber), numberGreaterThan$MachinePrecision] to compare results.

3.13 Solution of Quintic Polynomials In this section, we treat a subject that is relatively unknown, but nevertheless very interesting: The roots of a generic fifth-degree polynomial can be expressed in closed form by using hypergeometric functions. After the proofs of Abel, Ruffini, and Galois showing that it is impossible to solve a generic quintic in radicals (for a review of these early investigations, see [1018], [668], [67], [1223], and [496]), Brioschi [214], Hermite [586], and Kronecker [728] gave solutions of the quintic in closed form using elliptic modular functions, which can be expressed through elliptic theta functions. (For a modernized rephrasing of these approaches, see [1364], [667], [1017], [941], [359], [676], [677], [45], and [191], and the material from the poster “Solving the Quintic with Mathematica” MathSource 0207-122. For a solution in Poisson-type series, see [62].) Later, Felix Klein in his book Lectures on the Icosahedron [689] and in his article Further Investigations on the Icosahedron [688] expressed the roots using hypergeometric functions [590], [591], [748], [749], [1009]. Because we have discussed hypergeometric functions but not elliptic theta functions, we will outline Klein’s approach. We do not follow Klein directly, because his treatment has been simplified (see [688], [692], [518], [806], [393], [1165], and [620]). The complete theory and motivation behind Klein’s solution is outside the scope of this book on Mathematica; for details, see [322], [441], [1320], [1277], [1279], [1278], [1112], [690], [692], [544], [691], and [207]). We will discuss here only the construction of an explicit solution of a quintic

3.13 Solution of Quintic Polynomials

1111

equation by itself. A couple of other methods also explicitly express the roots of a quintic (see, for instance, [791], [117], [1143], [675], [1246], [407], and [1002]). A basic sketch of Klein’s approach for solving polynomials of degree five is the following: Klein, observing that the symmetry group of an icosahedron is just the alternating group of five letters, expressed the five roots of a quintic through a single root of a polynomial of degree sixty. Setting this polynomial to zero gives a special equation, the icosahedral equation. By looking at the possible monodromy groups of the hypergeometric differential equation or by analyzing the stereographic projection of an icosahedron into a half-plane, this root of the degree sixty polynomial can be expressed as the ratio of two hypergeometric functions. So the roots of a general degree five polynomial can be expressed in closed form. Let us start with a general quintic of the form x5 + A x4 + B x3 + C x2 + D x + E = 0 where A, B, C, D, E œ . With a Tschirnhaus transformation (see [1240], [571], and [271], or illustrated in more modern terms in [519], [537], [723], [1305], [1], [2], [722], and [1193]), we can transform this general quintic into a so-called principal quintic of the form z5 + 5 a z2 + 5 b z + c = 0. (The coefficients 5 has historical origin and a, b, and c are functions of A, B, C, D, and E.) The idea of the Tschirnhaus transformation is the following. We are looking for a new equation in which the coefficients of the degree 3 and degree 4 terms are 0. To achieve this, we make the following transformation with the roots xi of the original equation zi Hxi L = x2i + a xi + b. Now, by requiring that the roots zi of the transformed equation obey ⁄4i=0 zi = 0 and ⁄4i=0 z2i = 0, we force the coefficients of z4 and z3 to vanish (this can be seen immediately by Vieta’s relations). The transformed roots zi are, of course, still unknown, but because of Newton’s relations (see Exercise 5 in Chapter 2), we can sum the roots of the transformed quintic to get its coefficients. Because we can express the sum of the old roots through the coefficients of the old equation via Newton’s relations, we can express the coefficient of the new principal quintic in closed form through the coefficients of the old quintic. The two parameters a and b are determined so that the above two sums vanish. A quintic with missing degree 4 and 3 terms is called a principal quintic. This elimination of the quartic and cubic term is implemented next. The first argument of ReduceToPrinci palQuintic is the general quintic, the second is the variable in which quintic is supposed to be a quintic, and the third argument is the variable of the transformed equation. The result of ReduceToPrincipalQuintic is a list with the Tschirnhaus transformation as its first argument (in the form of a pure function) and the transformed equation as its second. (We only check if the equation is a quintic. We do not check to see if it is already in principal form or in an even more reduced form. The restriction of the polynomial variables to symbols can, of course, be relaxed, but it is sufficient for our purposes here.) In[1]:=

ReduceToPrincipalQuintic[quintic_Equal, oldVar_Symbol, newVar_Symbol] := Module[{leftHandSide, oldCoefficient, , α, β, x}, leftHandSide = Cancel[#/Coefficient[#, oldVar, 5] ]&[Subtract @@ quintic]; (* set nonexistent coefficients to 0 *) Do[oldCoefficient[i] = If[Evaluate[i > 5], 0, Coefficient[leftHandSide, oldVar, 5 - i]], {i, 10}]; (* the recursive definition of powersums *) [k_] := [k] = -Expand[(Sum[[k - j]*

The Classical Special Functions

1112

oldCoefficient[j], {j, 1, k - 1}] + k oldCoefficient[k])]; (* α and β from the transformation x^2 + α x + β *) α = (-[1] [2] + 5 [3] + Sqrt[5] Sqrt[[2]^3 2 [1] [2] [3] + 5 [3]^2 + [1]^2 [4] 5 [2] [4]])/([1]^2 - 5 [2]); β = (-5 [2]^2 + 5 [1] [3] + Sqrt[5] [1] Sqrt[[2]^3 2 [1] [2] [3] + 5 [3]^2 + [1]^2 [4] 5 [2 ][4]])/(5(-[1]^2 + 5 [2])); (* do the transformation; calculation of the new coefficients *) {Function @@ {{1, α, β}.{#^2, #, 1}}, Collect[newVar^5 + {-newVar^2/3, -newVar/4, -1/5}.(Table[Collect[ (x^2 + α x + β)^i + 4β^i, x], {i, 3, 5}] /. x^n_. :> [n]), newVar] == 0}] /; (* test if quintic is really a quintic *) With[{diff = Subtract @@ quintic}, PolynomialQ[diff] && Length[CoefficientList[diff, oldVar]] === 6]

Let us look at an example. We start with a quintic whose coefficients are nonzero. In[2]:=

oldQuintic = x^5 + 5I x^4 - 5 x^3 + (5 + I) x^2 + 3 x - 4 == 0;

Here is the Tschirnhaus transformed equation. In[3]:=

Out[3]=

{trafo, newQuintic} = ReduceToPrincipalQuintic[oldQuintic, x, z] // Simplify 1 1 è!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!! 9  IH−50 − 375 L + 25  181 + 40  M +  IH−75 + 160 L + 5 181 + 40  M #1 + #12 &, 250 50 è!!!!!!!!!!!!!!!!!!!!!!!! H3214585 − 2403013 L − H310249 − 204125 L 181 + 40  + è!!!!!!!!!!!!!!!!!!!!!!!! H100 + 75 L IH−6995 − 37308 L + H771 + 2630 L 181 + 40  M z + è!!!!!!!!!!!!!!!!!!!!!!!! 25  IH−25985 + 4662 L + H1351 + 110 L 181 + 40  M z2 + 6250 z5 0=

After applying Tschirnhaus’s transformation, the resulting equation typically has quite complicated coefficients, and this is true even in the case in which the original equation has integer coefficients. Let us make a numerical check of the transformation by looking at the transformed roots of the old equation. In[4]:= Out[4]=

In[5]:= Out[5]=

Last /@ List @@ NRoots[oldQuintic, x] 8−1.10162 − 1.94615 , −0.770325 + 0.158724 , 0.606354 + 0.674669 , 0.624501 − 3.69754 , 0.641091 − 0.189709 < Sort[trafo /@ % // N] 8−2.78278 + 2.60269 , −1.34256 − 2.13223 , −0.198047 − 2.99322 , 0.56839 + 1.78424 , 3.755 + 0.738514 
All]

3.13 Solution of Quintic Polynomials

1115

1 0.5 2

0 -0.5

1

-1 0

-2 -1

-1

0 1 2

-2

Up to a factor, H is the Hessian of f (the definition of the Hessian is immediately visible in the following input). T is the functional determinant of f and H. In[22]:=

Out[22]=

{Det[{{D[f[u, {D[f[u, Det[{{D[f[u, {D[H[u, 8121, 20
Exp[2Pi I/5]) == 0, z]), {k, 0, 4}] // Flatten // Union) // Chop // Union 80
5&) = ε^Mod[n, 5]; ε /: 1 + ε + ε^2 + ε^3 + ε^4 = 0; ε /: ε^5 = 1;

The Classical Special Functions

1116

(* plugInAnsatz expects products as arguments *) plugInAnsatz[expr_] := Module[{poly, rest, i, uInsideQ}, If[FreeQ[expr, W[k], {0, Infinity}] && FreeQ[expr, t[k], {0, Infinity}], (* nothing to do, just five times the original expression *)5 expr, (* the powersum *) poly = Sum[Evaluate[expr /. {t[k] :> t[k, u, v], W[k] :> W[k, u, v]}], {k, 0, 4}]; If[Max[Exponent[expr, #]& /@ {t[k], W[k]}] T^2 Z, f^10 -> T^4 Z^2, f^15 -> T^6 Z^3}) // Simplify) /. T^2 Z/H^3 -> 1/V 15 H8 λ3 + λ2 µ + 72 Z λ µ2 + Z µ3 L   , 90, 0, −  V 20 H−λ4 + 18 Z λ2 µ2 + Z λ µ3 + 27 Z2 µ4 L 5 Hλ5 − 10 Z λ3 µ2 + 45 Z2 λ µ4 + Z2 µ5 L −     , −     = V V

Using Newton’s relations, we compare the power sums with the coefficients of the principal quintic in the form

3.13 Solution of Quintic Polynomials

1117

z5 + 5 a z2 + 5 b z + c = 0. In[32]:=

Out[32]=

(Clear[powerSum, coefficient]; (* the coefficients of the above polynomial in z *) Evaluate[coefficient /@ {1, 2, 3, 4, 5}] = {0, 0, 5 a, 5 b, c}; (* the general definition of power sums *) powerSum[k_] := powerSum[k] = -Expand[(Sum[powerSum[k - j] coefficient[j], {j, 1, k - 1}] + k coefficient[k])]; Array[powerSum, 5]) 80, 0, −15 a, −20 b, −5 c
Function[Z, 11/(3600 Z^2 (1728 Z - 1))]} H−5 + 15552 zL2 11 i j  −  +  j−  2 H−1 + 1728 zL 1800 z 2 H−6 z + 10368 z2 L2 k H−5 + 15552 zL H−6 + 20736 zL 15552 3  z w @zD2 −     +    y w @zD2 + w @zD wH3L @zD z −6 z + 10368 z2 { 2 H−6 z + 10368 z2 L2 ode1 = Numerator[Together[ode1]] −24 w @zD2 + 35472 z w @zD2 − 55987200 z2 w @zD2 − 75 z2 w @zD2 + 259200 z3 w @zD2 − 223948800 z4 w @zD2 + 50 z2 w @zD wH3L @zD − 172800 z3 w @zD wH3L @zD + 149299200 z4 w @zD wH3L @zD

On the other hand, the icosahedral equation defines wHZL and we can differentiate the equation three times with respect to Z. In[43]:=

IcosahedralEquation[w[z], z]

Out[43]=

w@zD5 H−1 + 11 w@zD5 + w@zD10 L −

5

z H1 + w@zD30 − 10005 Hw@zD10 + w@zD20 L + 522 H−w@zD5 + w@zD25 LL In[44]:=

2

Table[ruleD[i] = Solve[D[IcosahedralEquation[w[z], z], {z, i}] == 0, Derivative[i][w][z]][[1]], {i, 3}];

Substituting now these derivatives into the Schwarz differential equation, we obtain a large polynomial in wHzL and z. (The following is a trivial, but again, large calculation.

3.13 Solution of Quintic Polynomials In[45]:=

odePoly = Numerator[Together[ode1 /. ruleD[3] /. ruleD[2] /. ruleD[1]]];

In[46]:=

{Length[odePoly], Exponent[odePoly, {w[z], z}]}

Out[46]=

1119

82, 8350, 6 {{-5, 5}, {-5, 5}}, AspectRatio -> Automatic, Frame -> True]][(* the points to be mapped *) N @ Join[Table[10^-i/1728, {i, 52, 2, -4}], Table[10^-i/1728, {i, 3, 0, -1/10}], Table[10^-i/1728, {i, 0, -1, -4/100}], Table[10^-i/1728, {i, -1, -51, -5}]]]

The Classical Special Functions

1120

4

2

0

-2

-4 -4

-2

0

2

4

We can also look at the way the roots depend on Z varying on the 3D icosahedron by going back to the sphere from the complex plane. In[50]:=

InverseStereographicProjection[{x_, y_}] := {2 x, 2 y, 1 - x^2 - y^2}/(1 + x^2 + y^2); Show[Graphics3D[{{EdgeForm[], myIco}, Map[InverseStereographicProjection, projected, {-2}]}], Boxed -> False]

As is obvious from the IcosahedralEquation and the above discussion of the zeros of f, T, and H, the zeros of the IcosahedralEquation for Z = 0 are the stereographic projections of the vertices of the icosahedra. For Z = ¶, the zeros of the IcosahedralEquation are the stereographic projections of the midpoints of the edges. We observe that 1728 f 5 - T 2 = H 3 . In[52]:= Out[52]=

1728 f[u, v]^5 - T[u, v]^2 == H[u, v]^3 // ExpandAll True

So for Z = 1 ê 1728, the zeros of the icosahedra equation are the centers of the 20 faces of an icosahedron. Now, let us check numerically that we really have all 60 roots after applying AllRoots to one root. In[53]:=

firstRoot = N[#, 40]& @ (SolutionIcosahedralEquation[1, 34/10]/ SolutionIcosahedralEquation[2, 34/10]); allRoots = AllRoots[firstRoot, N[#, 40]&];

Out[55]=

Union[Chop[N[IcosahedralEquation[#, 1, 80, 0. × 10−3 + 0. × 10−3 , 0. × 10−3 + 0. × 10−4 0. × 10−3 + 0. × 10−4 , 0. × 10−4 + 0. × 10−4 , 0. × 10−4 + 0. × 10−5 , 0. × 10−5 + 0. × 10−5 ,

34/10]& /@ allRoots, 40]]] , 0. × 10−3 + 0. × 10−4 , 0. × 10−4 + 0. × 10−5 , 0. × 10−5 + 0. × 10−6 , 0. × 10−5 + 0. × 10−6 
250, Contours -> {0}]; r) Let gn be the geometric mean of all irreducible fractions from the unit interval with maximal denominator n [888]:

1 2 n n ÅÅÅÅÅÅ µ ÅÅÅÅÅÅ µ ∫ µ ÅÅÅÅÅÅ % . gn = $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% n n n Calculate the limit of gn as n tends to infinity and the first correction term. Calculate the following infinite product (known as the Wallis product [1022]) and the first correction term. 2 2 4 4 6 6 8 8 10 10 ÅÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅÅÅÅ ÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅ ∫. 1 3 3 5 5 7 7 9 9 11 Calculate the following limit and the first correction term for large n: Hn + 1L!4 24 n+2 lim ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ3Å ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ2ÅÅ . nض Hn + 1L H2 n + 1L! 2

Calculate the following limit and the first correction term for large n: limnض ⁄nk=1 n ê Hk 2 + n2 L [527]. s) Consider the following generalization Gk HzL of the classical Gamma function GHzL: Gk HzL = k zêk-1 GHz ê kL [392].

Derive polynomial partial differential equations that are fulfilled by Gk HzL. t) The generalized Bell numbers Bk HnL are defined by [64], [323] ¶

Bk HnL k expHexpH∫HexpHzLLLL ÅÅÅÅÅÅÅÅÅÅ z . ´¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨≠¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨Æ = ‚ ÅÅÅÅÅÅÅÅ n! k exp s

k=0

Show by explicit calculation for 1 § m, n § 6 that the following identity holds: ¶

Bm Hn + 1L =

m

„ k1 ,k2 ,…,km =0

n! d⁄mj=1 k j ,n ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ m ÅÅÅÅÅÅÅÅÅÅÅÅ ‰ B j Hk j L. ¤ j=1 k j ! j=1

u) Predict if 1 - Erfc[66.66] will be a machine number. v) For factorially divergent sums, Borel summation means expressing the factorial function through its integral

representation and then exchanging summation and integration: ¶



‚ f HkL Ha + b kL! = ‚ f HkL ‡ k=1

k=1

¶ 0

e-t ta+b k dt = ‡ 

¶ 0

ij ¶ yz e-t jjj‚ f HkL ta+b k zzz dt k k=1 {

k -j Hk - 1 ê 2L! , k = 0, 1, … occur in the perturbation expansion of the quartic Sums of the form s j = ⁄¶ k=1 H-3L k anharmonic oscillator [713], [528]. Calculate the first few of these sums. The summands of these sums decrease with increasing j, do the sums decrease too? Conjecture a closed form for lim jض s j .

Exercises

1129

w) Calculate the normalized ground-state y HzL of the Hamiltonian [952], [953], [954]

` ∑2 H = - ÅÅÅÅÅÅÅÅÅ2ÅÅÅ + VHzL ∑z è!!!! 19 z2 ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ - I 5 - ÅÅÅÅ12 M 4 V HzL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . Hz2 + 1L2 Calculate z* , such that VHz* L = y Hz* L. X

X

x) Consider the two integrals Ÿ-X H1 HxL H3ê2 HxL expH-x2 ê 2L dx and Ÿ0 L1 HxL L3ê2 HxL e-x dx involving Laguerre

functions Ln HxL and Hermite functions Hn HxL . Find the leading terms of these integrals for large real X . Laguerre and Hermite functions are orthogonal for nonnegative integer indices. Does orthogonality still hold for these fractional indices? y) Evaluate the following integral [1303], [512], [907]: p p p 1 1 ÅÅÅÅÅ3Å Å ‡ ‡ ‡ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ dx d y dz. p 0 0 0 1 - cosHxL cosHyL cosHzL

z) The function LHzL = Li2 HzL + 1 ê 2 lnHzL lnH1 - zL fulfills the two identities LHzL + LH1 - zL = p2 ê 6 and

LHzL = LHz ê Hz - 1LL + LHz2 L ê 2. In addition, for special arguments identities like [810] 1 1 p2 6 LJ ÅÅÅÅÅÅ N - LJ ÅÅÅÅÅ N = ÅÅÅÅÅÅÅÅÅ 3 9 3 2 3 3 4 i y 2 LJ2 cosJ ÅÅÅÅÅÅ pNN + LjjJ2 cosJ ÅÅÅÅÅÅ pNN zz = ÅÅÅÅÅÅÅÅÅ p2 7 7 k { 21 2

1 1 yz yz i jiij 3 Ljjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z + 3 Ljjjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z p ÅÅÅÅÅ z p ÅÅÅÅÅ z ÅÅÅÅ Å L 2 cosH ÅÅÅÅ Å L 2 cosH 9 { 9 { kk k

3 1 7 2 yz zy zyz - Ljijijj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ p zz jjj z zzz = ÅÅÅÅ p ÅÅÅÅÅ z 18 ÅÅÅÅ Å L 2 cosH 9 { { { kk

hold. Write a program that searches for (and finds) such identities. 2.L2 Elliptic Integrals The incomplete elliptic integral of the third kind is defined by the following integral representation: f

1 PHn; f » mL = ‡ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ dj. è!!!!!!!!!!!!!!!!!!!!!!!!!!! H1 - n sinHjLL 1 - m sinHjL 0

∑P Hn;f»mL

a) Derive an inhomogeneous, linear, third-order differential equation for ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ [242]. (The coefficients will ∑m

be polynomials in n and m.) ∑P Hn;f»mL

b) Derive an inhomogeneous, linear, third-order differential equation for ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ . (The coefficients will again ∑n

be polynomials in n and m.) ∑P Hn;f»mL

c) Starting from the integral representation, derive a nonlinear, third-order differential equation for ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ . ∑f d) Calculate a “nice” result for the following integral:

The Classical Special Functions

1130

1ê12



è!!!!! I3-2 3 Më12

3 - 12 x $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å % dx. H12 x - 1L H48 x2 - 24 x - 1L

e) Show that in the addition theorem for elliptic integrals of the first kind x y zHx,yL 1 1 1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ!ÅÅ dt + ‡ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ!ÅÅ dt = ‡ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ!ÅÅ dt ‡ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0 0 0 H1 - t2 L H1 - k t2 L H1 - t2 L H1 - k t2 L H1 - t2 L H1 - k t2 L

the z on the right-hand side as a function of x and y fulfills [96] 2

2

Hk y2 z2 - 1L x4 - 2 HHHk Hy2 + z2 - 2L - 2L z2 + 1L y2 + z2 L x2 + Hy2 - z2 L = 0. f) Determine the magnetic field of a circular current (also beyond the axis), and examine it graphically. Then, investigate the magnetic field of a Helmholtz coil [247] in the neighborhood of a symmetry point. In which direction is the field more inhomogeneous: in the radial or in the perpendicular direction?

3.L2 Weierstrass Function a) Visualize the following two Weierstrass functions:

8 8 8 8 ƒJz; ÅÅÅÅÅÅ , ÅÅÅÅÅ N and ƒ£ Jz; ÅÅÅÅÅÅ , ÅÅÅÅÅÅ N 3 3 3 3 in the complex z-plane. What is an appropriate z-domain? In Mathematica, the Weierstrass ƒHz; g2 , g3 L is WeierstrassP[z, {g2 , g3 }] and its derivative ƒ£ Hz; g2 , g3 L (with respect to z) is Weierstrass PPrime[z, {g2 , g3 }]. b) Make a picture of the function ƒ£ Hz; g2 , g3 L over the Riemann z-sphere. Use appropriate values for g2 and g3 . c) The function ƒHz; g2 , g3 L has the following series expansion around z = 0:

1 g2 g3 ƒHz; g2 , g3 L = ÅÅÅÅ2ÅÅÅÅ + ÅÅÅÅÅÅ ÅÅ z2 + ÅÅÅÅÅÅÅÅÅ z4 + c6 z6 + c8 z8 + ∫. z 20 28 By using the differential equation of the Weierstrass function: ƒ£ 2 Hz; g2 , g3 L = 4 ƒ3 Hz; g2 , g3 L + g2 ƒ£ 2 Hz; g2 , g3 L + g3 (where the derivative is with respect to z), find the coefficients c6 to c20 . d) The Weierstrass function ƒHu; g2 , g3 L fulfills the differential equation (differentiation with respect to u):

ƒ£ Hu; g2 , g3 L2 = 4 ƒHu; g2 , g3 L3 - g2 ƒHu; g2 , g3 L - g3 . In [3], formula 18.4.1, the following addition theorem is given: 1 ƒ£ Hu; g2 , g3 L - ƒ£ Hv; g2 , g3 L 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N - ƒHu; g2 , g3 L - ƒHv; g2 , g3 L. ƒHu + v; g2 , g3 L = ÅÅÅÅÅÅ J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 4 ƒHu; g2 , g3 L - ƒHv; g2 , g3 L Derive a polynomial form of the addition theorem pHƒHu + v; g2 , g3 L, ƒHu; g2 , g3 L, ƒHv; g2 , g3 LL (this means pHx, y, zL being a polynomial in x, y, and z, symmetric in y and z) by eliminating the derivative terms. Derive the corresponding double argument formula that expresses ƒH2 v; g2 , g3 L polynomially in ƒHv; g2 , g3 L.

Exercises

1131

e) In [3] formula 18.4.2, the following addition theorem for the derivative of the Weierstrass function ģ Hu; g2 , g3 L is given:

ƒ£ Hu + v; g2 , g3 L = -HƒHu + v; g2 , g3 L Hƒ£ Hu; g2 , g3 L - ƒ£ Hv; g2 , g3 LL + ƒHu; g2 , g3 L ƒ£ Hv; g2 , g3 L - ƒ£ Hu; g2 , g3 L ƒHv; g2 , g3 LL ê HƒHu; g2 , g3 L - ƒHv; g2 , g3 LL. Derive a polynomial form of the addition theorem qHƒ£ Hu + v; g2 , g3 L, ƒ£ Hu; g2 , g3 L, ƒ£ Hv; g2 , g3 LL (this means qHx, y, zL is a polynomial in x, y, and z, symmetric in y and z) by eliminating the nondifferentiated terms. Derive the corresponding double argument formula that expresses ƒ£ H2 v; g2 , g3 L polynomially in ƒ£ Hv; g2 , g3 L. f) The general solution of the functional equation (Sutherland–Calogero model [249], [1202], [248], [204],

[1262], [759], [241], [206]) jHxL jHyL + jHxL jHzL + jHyL jHzL = f HxL + f HyL + f HzL for z = x + y is given by jHxL = a zHx; g2 , g3 L + b x ∑ zHx; g2 , g3 L 1 f HxL = - ÅÅÅÅÅ Ja2 zHx; g2 , g3 L2 + a2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + 2 b x zHx; g2 , g3 L a + b2 x2 N 2 ∑x jHxL jHyL + jHxL jHzL + jHyL jHzL = f HxL + f HyL + f HzL. Here, zHx; g2 , g3 L is the Weierstrass Zeta function (in Mathematica, WeierstrassZeta[x, {g2 , g3 }]): x 1 1 ∑zHx; g2 , g3 L zHx; g2 , g3 L = ÅÅÅÅÅÅ + ‡ J ÅÅÅÅÅ2ÅÅÅ - ƒHx; g2 , g3 LN dx or ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å = -ƒHx; g2 , g3 L. x x ∑x 0

Use the above addition formula for ƒHu + v; g2 , g3 L to show that jHxL and f HxL fulfill the above functional equation. g) Use the above addition formula for ƒHu + v; g2 , g3 L to show that the following identity holds for z = x + y [395]:

zHx; g2 , g3 L + zHy; g2 , g3 L + zHz; g2 , g3 L =

è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ƒHx; g2 , g3 L + ƒHy; g2 , g3 L + ƒHz; g2 , g3 L .

h) The n-argument multiplication formula for Weierstrass function can be expressed in the following form

(n œ ) [476], [1001], [477]: yn-1 yn+1 ÅÅÅÅÅÅ ƒHn z; g2 , g3 L = ƒHz; g2 , g3 L - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ y2n y1 = 1 y2 = -ƒ£ Hz; g2 , g3 L 3 g2 y3 = 3 ƒHz; g2 , g3 L4 - ÅÅÅÅÅÅ g2 ƒHz; g2 , g3 L2 - 3 g3 ƒHz; g2 , g3 L - ÅÅÅÅÅ2ÅÅÅÅ 2 16 5 g i 2 y4 = ƒ£ Hz; g2 , g3 L jj-2 ƒHz; g2 , g3 L6 + ÅÅÅÅÅÅÅÅÅÅÅÅÅ ƒHz; g2 , g3 L4 + 10 g3 ƒHz; g2 , g3 L3 + 2 k 2 g2 g3 g3 5g y ÅÅÅÅÅÅÅÅÅÅÅÅ2ÅÅ ƒHz; g2 , g3 L2 + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ƒHz; g2 , g3 L - ÅÅÅÅÅ2Å ÅÅ + g32 zz 8 2 32 {

The Classical Special Functions

1132

2 2 £ l n n n o o -y ÅÅ2ÅÅ Iy ÅÅ2ÅÅ +2 y ÅÅn2ÅÅ -1 - y ÅÅ2ÅÅ -2 y ÅÅn2ÅÅ +1 M ë ƒ Hz; g2 , g3 L yn = m o 3 o y ÅÅÅÅn-1 y3 ÅÅÅÅÅÅÅ - y ÅÅÅÅn-1 n-1 Å2ÅÅÅÅÅÅ -1 y ÅÅÅÅ Å2ÅÅÅÅÅÅ n Å2ÅÅÅÅÅÅ +2 ÅÅÅÅn-1 2

if n is even if n is odd.

Use this formula to derive ƒH5 v; g2 , g3 L = RHƒHv; g2 , g3 LL, where R is a rational function. i) Show that the function yl HxL [729], [1087], [727], [210], [22], [506], [977]

sHl - x; g2 , g3 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ex zHl;g2 ,g3 L yl HxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ sHx; g2 , g3 L sHl; g2 , g3 L is a solution of the Lamé equation [1297], [1197]: -y≥l HxL + 2 ƒHx; g2 , g3 L yl HxL = -ƒHl; g2 , g3 L yl HxL. Here sHx; g2 , g3 L is the Weierstrass sigma function (in Mathematica WeierstrassSigma[z, {g2 , g3 }]): x 1 ∑ sHx; g2 , g3 L i y sHx; g2 , g3 L = expj‡ JzHx; g2 , g3 L - ÅÅÅÅÅÅ N dxz or ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = sHx; g2 , g3 L zHx; g2 , g3 L. x ∑x k 0 {

j) Visualize the Riemann surface of the inverse Weierstrass function ƒH-1L Hz; 1 + i, 1 - 2 iL. k) The Weierstrass sigma function sHz; g2 , g3 L fulfills a partial differential equation of the form

∑2 sHz; g2 , g3 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅ = ∑ z2 ∑sHz; g2 , g3 L ∑ sHz; g2 , g3 L G2 Hz, g2 , g3 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + G3 Hz, g2 , g3 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + GC Hz, g2 , g3 L sHz; g2 , g3 L. ∑ g2 ∑ g3 The functions G2 Hz, g2 , g3 L, G3 Hz, g2 , g3 L, and GC Hz, g2 , g3 L are total degree two polynomials of g2 , g3 , and z. Use the series representation: ¶



m=0

n=0

m

g2 H ÅÅÅÅ ÅÅ L H2 g3 Ln 4 m+6 n+1 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z sHz; g2 , g3 L = „ „ am,n ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H4 m + 6 n + 1L!

a0,0 = 1 16 1 am,n = ÅÅÅÅÅÅÅÅÅ Hn + 1L am-2,n+1 - ÅÅÅÅÅÅ H2 m + 3 n - 1L H4 m + 6 n - 1L am-1,n + 3 Hm + 1L am+1,n-1 if n, m ¥ 0 3 3 am,n = 0 else to find the polynomials G2 , G3 , and GC . l) The function

Exercises

1133

5 2 SHtL = sJ ÅÅÅÅÅÅ t; g2 Hw1 H1, tL, w2 H1, tLL, g3 Hw1 H1, tL, w2 H1, tLLN ì 3 4 ij 1 jsJ ÅÅÅÅÅ t; g2 Hw1 H1, tL, w2 H1, tLL, g3 Hw1 H1, tL, w2 H1, tLLN k 3 4 y sJ ÅÅÅÅÅÅ t; g2 Hw1 H1, tL, w2 H1, tLL, g3 Hw1 H1, tL, w2 H1, tLLNzz 3 {

è!!!! takes on algebraic values for certain t = i n , n œ  [671]. Conjecture at least 10 such values for t and express the corresponding values SHtL in radicals. (8w1 Hg2 , g3 L, w2 Hg2 , g3 L< are the half periods corresponding to the invariants 8g2 , g3 0 is assumed) can be obtained in closed form by equating coefficients of sn in the following identity [1285], [1286], [319], [1287]: ¶

ZHkL ‚ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Hs H1 - sLLk = k k=1

¶ ¶ ij jj g HH1 - 2-k L zHkL - 1L k 1 è!!!! j - jjJlogI2 p M + ÅÅÅÅÅ - 1N s + „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ s - „ ÅÅÅÅÅÅ jj k l 2 k=2 l=1 k

l yz yzz ij ¶ gk-1 zz zz jj k jj„ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ s zz zz. jj Hk - 1L ! zz zz {{ k k=1

Here gk are the Stieltjes constants (in Mathematica StieltjesGamma[k]). Calculate the exact values for ZH1L, …, ZH5L and compare the values with the ones obtained by summing over the first 1000 nontrivial zeros explicitly. d) The harmonic polylogarithm functions HHa1 , a2 , …, an ; zL are defined recursively through [1055], [504],

[901], [505], [167], [361], [1282] z

HHa1 , a2 , …, an ; zL = ‡ f Ha1 ; zL HHa2 , …, an ; zL dz 0

The Classical Special Functions

1148

f H-1, zL = 1 ê H1 + zL f H≤0, zL = 1 ê z f H-1, zL = 1 ê H1 - zL

HH-1; zL = +lnH1 + zL HH≤0; zL = +lnHzL HH+1; zL = -lnH1 - zL.

For which ak = -1, 0, 1 can Mathematica find exact finite values of HHa1 , a2 ; 1L, HHa1 , a2 , a3 ; 1L, and HHa1 , a2 , a3 , a4 ; 1L? e) Sums (especially infinite sums) whose summands contain special functions can often be calculated by using an integral representation for the special function, then interchanging summation and integration (assuming the conditions to do this are fulfilled) [1181], [841]. Use the integral representation 1 ∑n i 1 - tz-1 y yHnL HzL = ÅÅÅÅÅÅÅÅnÅÅÅÅ jjg + ‡ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ dtzz ∑t k 1-t { 0

for the nth derivative of the digamma function yHzL to calculate some sums of the form [970], [971], [972] ¶

‚ RHkL PHyHzL, yH1L HzL, …L. k=1

Here RHkL is a rational function in k and PHx, y, …L is a polynomial. Can one calculate some sums that the built-in Sum cannot find? è!!!!!!!! f) Motivate the finite result for the following divergent product: 1 µ 2 µ 3 µ ∫ = 2 p . 16.L2 Riemann Surface of Gauss Hypergeometric Function, KHzL ê KH1 - zL, erfH-1L a) Carry out the analytical continuation by using Kummer relations [1028], [3], [23], [674], [1037], [38], that

are relevant to the analytical continuation (1 - c, b - a, c - a - b not integers in all of the following formulas): 2 F1 Ha;

b, c; zL = = = =

=

=

H1 - zLc-a-b 2 F1 Hc - a; c - b, c; zL z H1 - zL-a 2 F1 Ja; c - b, c; ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N z-1 z H1 - zL-b 2 F1 Jb; c - a, c; ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N z-1 GHcL GHc - a - bL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 F1 Ha; b, a + b - c + 1; 1 - zL GHc - aL GHc - bL GHcL GHa + b - cL + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H1 - zLc-a-b 2 F1 Hc - a; c - b, c - a - b + 1; 1 - zL GHaL GHbL if †argH1 - zL§ < p 1 GHcL GHb - aL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H-zL-a 2 F1 Ja; 1 - c + a, 1 - b + a; ÅÅÅÅÅ N z GHbL GHc - aL GHcL GHa - bL 1 + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H-zL-b 2 F1 Jb; 1 - c + b, b - a + 1; ÅÅÅÅÅÅ N z GHaL GHc - bL if †argH-zL§ < p 1 GHcL GHb - aL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H1 - zL-a 2 F1 Ja; c - b, a - b + 1; ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N 1-z GHbL GHc - aL GHcL GHa - bL 1 -b + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H1 - zL 2 F1 Jb; c - a, b - a + 1; ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N GHaL GHc - bL 1-z

Exercises

1149

=

if †argH1 - zL§ < p 1 GHcL GHc - a - bL -a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z 2 F1 Ja; a - c + 1, a + b - c + 1; 1 - ÅÅÅÅÅÅ N z GHc - aL GHc - bL 1 GHcL GHa + b - cL c-a-b + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H1 - zL 2 F1 Jc - a; 1 - a, c - a - b + 1; 1 - ÅÅÅÅÅ N z GHaL GHbL if †argHzL§ < p.

b) Construct pictures of the sheets of the Riemann surface of 2 F1 H1 ê 3; 1 ê 2, 1 ê 6; zL that are directly connected with the principal sheet. Carry out the analytical continuation by solving the differential equation for wHzL = 2F1 Ha; b, c; zL:

zH1 - zL w££ HzL + Hc - Ha + b + 1L zL w£ HzL - a b wHzL = 0. c) Construct pictures of the sheets of the Riemann surface of wHzL = KHzL ê KH1 - zL [1346] that are neighboring the principal sheet. Carry out the analytical continuation by solving the Schwarz differential equation for KHzL ê KH1 - zL. Find symbolic expressions for the neighboring sheets. d) Construct a picture of some sheets of the Riemann surface of wHzL = erfH-1L HzL in the neighborhood of the point

z = 1. 17.L2 Kummer’s 24 Solutions of the Gauss Hypergeometric Differential Equation, Appell Differential Equation a) The Liouville transformation z 1 yHzL = expJ- ÅÅÅÅÅ ‡ pHxL dxN uHzL 2

transforms the differential equation y££ HzL + pHzL y£ HzL + qHzL yHzL = 0 into the normal form u££ HzL + gHzL uHzL = 0. (See also Exercise 11 of Chapter 1) Use the Liouville transformation to transform the hypergeometric differential equation z H1 - zL y££ HzL + Hc - Ha + b + 1L zL y£ HzL - a b yHzL = 0 into normal form. Then, apply a change of the independent variable from z to x of the form [619] a+ b x zHxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ g+d x and transform the resulting differential equation again to normal form w££ HxL + hHxL wHxL = 0. One particular solution of the hypergeometric differential equation is yHzL = 2 F1 Ha, b; c; zL. Determine all aHa, b, cL, bHa, b, cL, gHa, b, cL, and dHa, b, cL that leave the above gHzL form invariant (meaning that hHxL = z£ HxL2 gHzHxLL U gHxL holds) so that the solution of w££ HxL + hHxL wHxL = 0 can again be expressed as a hypergeometric function 2 F1 Ha£ , b£ ; c£ ; zL, where a£ = a£ Ha, b, cL, b£ = b£ Ha, b, cL and c£ = c£ Ha, b, cL. Finally, transform the resulting solution back to the original function yHzL to get a new form of the solution of the hypergeometric differential equation (see [1028], [3], [258], [23], [598], [674], [1037], and [38]).

The Classical Special Functions

1150

b) The bivariate hypergeometric function wHz1 , z2 L = F1 Ha; b1 , b2 ; c; z1 , z2 L fulfills the following coupled system of partial differential equations.

∑2 wHz1 , z2 L ∑2 wHz1 , z2 L H1 - z1 L z1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅ + H1 - z1 L z2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + 2 ∑ z1 ∑ z2 ∑ z1 ∑wHz1 , z2 L ∑wHz1 , z2 L Hc - Ha + b1 + 1L z1 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - b1 z2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - a b1 wHz1 , z2 L = 0 ∑ z1 ∑ z2 ∑2 wHz1 , z2 L ∑2 wHz1 , z2 L Å ÅÅÅÅÅÅÅ Å ÅÅ Å ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + + H1 z L z H1 - z2 L z2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 1 ∑ z1 ∑ z2 ∑ z22 ∑wHz1 , z2 L ∑wHz1 , z2 L Hc - Ha + b2 + 1L z2 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - b2 z1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - a b2 wHz1 , z2 L = 0 ∑ z2 ∑ z1 For fixed z2 , derive an ordinary differential equation of F1 Ha; b1 , b2 ; c; z1 , z2 L with respect to z1 [236], [364]. 18.L2 Roots of Differentiated Polynomials a) Visualize the following theorem: Given a polynomial f HzL of arbitrary degree over the complex (or real)

numbers, all roots of the polynomial f £ HzL lie in the convex hull of the roots of f HzL. (This is the so-called Gauss–Lucas theorem; see [806], [844], [843], [1176], [188], [94], [1044], [583], [1142], [842], and [898]; for a sharpening of this theorem, see [345].) Look in the standard packages for calculating the convex hull. b) Take a random polynomial over the real or complex numbers of degree greater than 10 and show graphically

its roots and all of the roots of the polynomial differentiated m times. The picture suggests that the roots lie on some curves. Try to connect the roots in the “right” order by building a (the “obvious”) continuous version (as a function of a) of d axn ê dxa [761], [871], [872], [873], [1024], [874]. Visualize this generalization of differentiation by itself. 19.L2 Coinciding Bessel Zeros, p-Formulas a) For m and n nonintegers, it is possible that Jn HxL and J m HxL have two (or more) zeros in common. Find numeri-

cally real values n, m, x, z, such that Jn HxL = J m HxL = 0 and simultaneously Jn HzL = J m HzL = 0 [128], [1013]. b) Ramanujan-like series for 1 ê p ¶

1 2 1 a+bk 1 ÅÅÅÅÅÅ = ‚ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ J ÅÅÅÅÅÅ N J ÅÅÅÅÅÅ N J ÅÅÅÅÅÅ N ck 3 2 3 p k k 3 k k! k=0

can be generated based on algebraic solutions an (an is expressable in radicals) of the following transcendental equation for integer n > 1 : 1 2 , ÅÅÅÅ ; 1; 1 - an L è!!!! 2 F1 H ÅÅÅÅ 3 3 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = n . 1 2 , ÅÅÅÅ ; 1; an L 2 F1 H ÅÅÅÅ 3 3

The parameters a, b, and c algebraic numbers dependent on n and are defined through an by [275], [135], [277], [278]

Exercises

1151

4 5 , ÅÅÅÅ ; 2; an L 8 n 1 2 F1 H ÅÅÅÅ 3 3 an = ÅÅÅÅÅÅ $%%%%%% ÅÅÅÅÅÅ % an Han - 1L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ2ÅÅ 1 2 1 9 3 , ÅÅÅÅ ; 1; an L 2 F1 H ÅÅÅÅ p 2 F1 H ÅÅ3ÅÅ , ÅÅ23ÅÅ ; 1; an L 3 3

2 è!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! bn = ÅÅÅÅÅÅ 3 n 1 - 4 an H1 - an L 3 cn = 4 an H1 - an L. (The appearance of p is the formula for a does not make this a circular definition, the resulting series contains only integers, rationals, and algebraic numbers.) Use numerical techniques to calculate explicit forms of such p-series for 2 § n § 20. 20.L1 Force-Free Magnetic Fields, Bessel Beams, Gauge Transformation a) Calculate x in

Bz = x e-l z J0 Hr xL Bj = a e-l z J1 Hr xL Br = l e-l z J1 Hr xL. ÷” (Bz , Bj , Br are the components of the magnetic field in a cylindrical coordinate system) such that B is a ÷” ÷” ÷” force-free magnetic field. This means that div B = 0 and curl B= a B hold simultaneously [851], [129], [1351], [1319]. b) Consider an electromagnetic wave in vacuum with the magnetic field components (in a cylindrical coordinate system) [866], [869], [1128], [917], [820], [1074], [1107], [383], [1097], [192]

Bz = 0 Bj = J1 Hk sinHaL rL expHiHk cosHaL z - w tLL Br = 0. Calculate the corresponding electric field 8Ez , Ej , Er < of this wave. c) A vector potential A0 Hr, jL of a homogeneous magnetic field of strength H in ez -direction can be chosen in cylindrical coordinates as Aj Hr, jL = H r ê 2, Ar Hr, jL = 0, Az Hr, jL = 0. (Here Aj Hr, jL is the azimuthal part of the vector potential in cylindrical coordinates and r is the radius. For domains with polygonal symmetry, it is often useful to have vanishing normal components of the vector potential along the polygon edges [298]. After a gauge transformation A0 Hr, jL Ø AHr, jL = A0 Hr, jL + GHr, jL this can be achieved. For a square centered at the origin, with edges parallel to the coordinate axes and edge length a, the gauge transformation is [297]

r3 Gr Hr, jL = H ÅÅÅÅÅ6ÅÅÅÅ a

2 r2 y i 2 r2 ij 2 2 2 i yy ja Ha - r L + Ha4 - 4 r2 a2 + 2 r4 L expjj1 - ÅÅÅÅÅÅÅÅ2ÅÅÅÅÅ zz Eijj ÅÅÅÅÅÅÅÅ2ÅÅÅÅÅ - 1zzzz sinH4 jL a a k { k k {{ 2 2 2 r 2 r ij r3 ij 2 i y y y y i Gj Hr, jL = H j ÅÅÅÅÅ4Å Å ja + Ha2 - 2 r2 L expjj1 - ÅÅÅÅÅÅÅÅ2ÅÅ Å zz Eijj ÅÅÅÅÅÅÅÅ2ÅÅÅÅÅ - 1zzzz cosH4 jL zz a { k a ka k k {{ { Gz Hr, jL = 0. Verify by explicit calculation that the vector potential AHr, jL fulfills the stated properties. Visualize the flowlines of this vector potential and its equicontour lines.

The Classical Special Functions

1152

21.L2 Riemann Surface of the Bootstrap Equation Visualize the Riemann surface of the function wHzL that is implicitly defined by the equation z = 2 w - ew + 1. 22.L1 Differential Equation of Powers of Airy Functions, Map Airy Distribution, Zeros of Airy Function a) Find the (linear) differential equation that is obeyed by Ai HzLn for 1 § n § 10, n integer. b) Starting from the series expansion of AiHzL for large negative z, derive the first terms of the expansion of the

zeros zHiL of AiHzL (AiHzHiL L = 0, i = 0, 1, 2, …) for large i in terms of descending powers of 3 p ê 8 H4 i - 1L. c) In [90], the “map-Airy ” distribution pHxL was introduced. 2 x3

pHxL = 2 e- ÅÅÅÅÅ3ÅÅÅÅÅ Å Hx AiHx2 L - Ai£ Hx2 LL It is a probability distribution. Calculate its asymptotics as x Ø ≤¶, the corresponding cumulative distribution ¶ function, and its first moment. Calculate Ÿ0 x2 pHxL dx. 23.L2 Differential Equation for Dedekind h Function, Darboux–Halphen System a) The Dedekind Eta function hHzL [775], [49], [1145], [148], [627] has the Fourier product representation Âpz



hHzL = e ÅÅÅÅ12ÅÅÅÅÅÅÅ ‰ H1 - e2 Â k p z L, k=1

where ImHzL > 0. The function hHzL obeys a fourth-order, nonlinear differential equation [149] pHhHzL, h£ HzL, h≥ HzL, h£££ HzL, h££££ HzLL = 0, where p is a multivariate polynomial of total degree 4. Find the polynomial p. b) Show that the functions £

£

£

l HtL l HtL l HtL ÅÅÅÅ M ÅÅÅÅÅÅÅÅ M ÅÅÅÅÅÅÅÅÅÅÅÅÅ M 1 ∑lnI ÅÅÅÅÅÅÅÅ 1 ∑lnI ÅÅÅÅÅÅÅÅ 1 ∑lnI ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ lHtL lHtL-1 lHtL HlHtL-1L w1 HtL = ÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , w2 HtL = ÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , w3 HtL = ÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 2 2 ∑t ∑t ∑t

where lHtL = qH-1L Hei p t L are solutions of the Darboux–Halphen system [572]: w£1 HzL = w1 HzL Hw2 HzL + w3 HzLL + w2 HzL w3 HzL w£2 HzL = w2 HzL Hw1 HzL + w3 HzLL + w1 HzL w3 HzL w£3 HzL = w3 HzL Hw1 HzL + w2 HzLL + w1 HzL w2 HzL. Here qH-1L is the inverse of the elliptic nome q (in Mathematica InverseEllipticNomeQ). How could one calculate qH-1L £ ? 24.L1 Ramanujan Identities for j and l Function a) For many positive integers p, q, r, the expression ¶

r

ij ⁄ expH-k 2 p pL yz jj zz J3 H0, expH- p pLL j k=-¶ z ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zzzz J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N = jjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ¶ J3 H0, expH-q pLL jj z j ⁄ expH-k 2 q pL zz k k=-¶ { r

Exercises

1153

is an algebraic number [132], [274], [133]. (Here, J3 Hz, qL is the function EllipticTheta[3, z, q].) Use Mathematica’s high-precision numerics to find some such integers p, q, r and the corresponding algebraic numbers. b) For positive integer n the expression 6

1 ln = ÅÅÅÅÅÅÅÅè!!!! ÅÅÅÅÅÅÅÅÅÅ 3 3

ÅÅÅÅn3 # M ë 2M zyz jij hI I1 + i "##### z jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ jj ! ÅÅÅÅÅÅÅÅÅÅ zz j hI I1 + i è!!!!!!! 3 n M ë 2M zz { k

is an algebraic number [1046], [136]. (Here, hHtL is the function DedekindEta[t].) Use Mathematica’s high-precision numerics to find the algebraic values for 1 § n § 10. Find all n § 100 such that ln is the root of a polynomial of degree four or less. 25.L3 Identities for Gamma Function Values, Identities for Dedekind h Function a) Gamma functions fulfill many identities of the form n

¤ GHrk Lak k=1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å = p p a. m ¤ GHsk Lck k=1

Here, the rk and sk are rational numbers, ak , ck , and p are small integers, and a is an algebraic number. Examples of such identities are [258], [185]: 2

5 ÅÅ L GH ÅÅÅÅ 1 "######################### è!!!! 12 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ Å = ÅÅÅÅÅÅÅÅÅÅ -9 + 6 3 1 2 2 2 2 p GH ÅÅÅÅ4 L GH ÅÅ3ÅÅ L 2 è!!!! "######################### 8 2 2 I5 + 5 M GH ÅÅÅÅ25 L GH ÅÅÅÅ ÅÅ L 37ê10 2 è!!!! è!!!! 15 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ Å ÅÅ Å = ÅÅÅÅÅÅÅÅ Å ÅÅÅ Å ÅÅ Å 3 I 5 1M + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅ Å Å ÅÅ Å $%%%%%%%%%%%%%%%%%%%% % 6 è!!!! 2 è!!!! 4 2 "######################## è!!!!# è!!!! è!!!!!!! 5+ 5 5 GH ÅÅÅÅ ÅÅ L GH ÅÅÅÅ23 L 10 - 2 5 + 3 + 15 15

Using the functional equations obeyed by the Gamma functions (n being a positive integer) k k k GJ ÅÅÅÅÅ N GJ1 - ÅÅÅÅÅÅ N = p cscJp ÅÅÅÅÅÅ N n n n n

GHn zL = nn z-1ê2 H2 pL

H1-nLê2

k ‰ GJz + ÅÅÅÅÅ N n k=0

write a program that generates such identities. b) The Dedekind Eta function (defined for ImHtL > 0) ipt



ipt



hHtL = e ÅÅÅÅ12ÅÅÅÅÅÅÅ ‰ H1 - e2 i p t L = e ÅÅÅÅ12ÅÅÅÅÅÅÅ ‚ H-1Lk e k H3 k-1L i p t k=1

k=-¶

fulfills many functional equations of the form [700], [154], [131], [134], [853], [520], [1267], [1342], [157], [938], [158]

The Classical Special Functions

1154

PHhHc1 tL, …, hHcn tLL = 0. Here P is a multivariate polynomial over the integers and the ci are positive integers. Examples of such functional identities are: hH6 tL4 hHtL9 - 9 hH2 tL4 hH3 tL8 hHtL + 8 hH2 tL9 hH3 tL3 hH6 tL = 0 hH8 tL4 hH2 tL14 + hHtL8 hH4 tL4 hH8 tL4 hH2 tL2 - 2 hHtL4 hH4 tL14 = 0 hH10 tL2 hHtL5 - 5 hH2 tL2 hH5 tL4 hHtL + 4 hH2 tL5 hH5 tL hH10 tL = 0 hH4 tL2 hH12 tL2 hHtL8 - 4 hH3 tL2 hH4 tL8 hHtL2 + 3 hH2 tL8 hH6 tL4 = 0 hHtL4 hH2 tL hH3 tL2 hH12 tL3 hH6 tL2 + hH2 tL3 hH3 tL6 hH12 tL3 - 2 hHtL2 hH4 tL hH6 tL9 = 0 Conjecture at least 25 more relations of this kind.

Solutions

1155

Solutions 1. Asymptotic Series, Carlitz Expansion, Contour Lines of Gamma Function, Bessel Zeros, Asymptotic Expansion of Gamma Function Ratio, Integrals of Function Compositions, W1+i H1 + iL a) Here is the recursive definition of the asymptotic formula for the Bessel function J0 HzL. In[1]:= myBessel0[z_, 0] := myBessel0[z, 0] = 1/(Pi Sqrt[2Pi z]) Gamma[1/2]^2 *

(Exp[-I(z - Pi/4)] + Exp[+I(z - Pi/4)]) // N; myBessel0[z_, ord_] := (* remember terms *) myBessel0[z, ord] = myBessel0[z, ord - 1] + (* new term *) 1/(Pi Sqrt[2Pi z]) Gamma[ord + 1/2]^2 * (Exp[-I(z - Pi/4)]/(-2I z)^ord/ord! + Exp[+I(z - Pi/4)]/(+2I z)^ord/ord!) // N

Here is a list of the successive approximations for z = 2 + 3 i and a graph showing the convergence behavior in the complex plane. In addition, we show a magnified version of the part of the graph containing the most interesting point. In[3]:= Function[ta,

Show[GraphicsArray[{ (* rough sketch *) Graphics[Line[{Re[#], Im[#]}& /@ ta], Axes -> True, DisplayFunction -> Identity], (* the microscopic view *) Graphics[{{PointSize[0.02], (* the exact value *) Point[{Re[#], Im[#]}&[BesselJ[0, 2 + 3I] // N]]}, {MapIndexed[{Hue[#2[[1]]/21], Line[#1]}&, Partition[{Re[#], Im[#]}& /@ ta, 2, 1]]}}, Axes -> True, (* appropriate plot range *) PlotRange -> {{-0.455, -0.48}, {-4.31, -4.32}}]}]]][ Table[myBessel0[2 + 3I, o], {o, 0, 20}]] -4.31

-4.15 -4.2

-4.312

-4.25

-4.314

-4.3

-4.316

-4.35

-4.318 -4.45

-0.65

-0.6

-0.55

-0.5

-0.45 -0.475

-0.47

-0.465

-0.46

-0.455

For comparison, here is the exact value. In[4]:= BesselJ[0, 2 + 3I] // N Out[4]= −0.469517 − 4.31379 

Let us make the calculation for the Airy function more automatic. These are the coefficients in the sum. In[5]:= c[k_] := c[k] = Gamma[3k + 1/2]/(2^k 3^(3k) Gamma[k + 1/2] Gamma[k + 1])

lim calculates how many terms of the series must be taken into account by looking at c[k] as a continuous function of k. In[6]:= lim[z_] := lim[z] = Floor @

FindMinimum[Abs[Gamma[3k + 1/2] (2/3 z^(3/2))^(-k)/ (2^k 3^(3k) Gamma[k + 1/2] Gamma[k + 1])], (* appropriate for the following *) {k, 12, 100}][[2, 1, 2]]

The following graphic gives an idea about the size of lim along the positive real axis. In[7]:= ListPlot[Table[lim[n], {n, 100}]]

The Classical Special Functions

1156 1200 1000 800 600 400 200 20

40

60

80

100

AiryAiSumList gives the list of the partial sums. In[8]:= AiryAiSumList[z_] :=

N[1/(2 Sqrt[Pi]) z^(-1/4) Exp[-2/3 z^(3/2)] FoldList[Plus, 0, Table[(-1)^k c[N[k]] (2/3 z^(3/2))^-k, {k, 0, lim[Abs[z]] + 5}]]]

Here is the behavior of 25 values in the complex plane. In[9]:= Show[Graphics[{{Thickness[0.002], Hue[0],

(* the partial sums of the asymptotic series *) Table[Line[{Re[#], Im[#]}& /@ Take[AiryAiSumList[x + I y], -10]], {x, 2.222, 2.223, 0.0002}, {y, 2.222, 2.223, 0.0002}]}, {PointSize[0.005], (* the exact values *) Table[Point[{Re[#], Im[#]}]&[AiryAi[x + I y]], {x, 2.222, 2.223, 0.0002}, {y, 2.222, 2.223, 0.0002}]}}], Frame -> True] 0.02308 0.02306 0.02304 0.02302 0.023 0.02298 -0.04522-0.0452-0.04518-0.04516-0.04514-0.04512

Near the negative real axis, the given asymptotic series breaks down [143]. The following picture demonstrates this clearly. We show the relative error as a function of the argument. In[10]:= AiryAiSum[z_] :=

1/(2 Sqrt[Pi]) z^(-1/4) Exp[-2/3 z^(3/2)] * (* cumulative sums *) Fold[Plus, 0, Table[(-1)^k c[k] (2/3 z^(3/2))^-k, {k, 0, lim[Abs[z]]}]] In[11]:= (* relative error *) δ[z_] := AiryAiSum[z]/AiryAi[z] - 1 In[13]:= (* |z| == 3; δ as a function of Arg[z] *)

Plot[Abs[δ[4 Exp[I ϕ]]], {ϕ, -Pi, Pi}, Frame -> True, Axes -> False, PlotRange -> All] 2.5 2 1.5 1 0.5 0 -3

-2

-1

0

1

2

3

Solutions

1157

Here is the number of terms until the minimal size element is reached in dependence of z in the complex plane, calculated and then shown. (For an optimal truncation, one should sum until the smallest element occurs, but not taking the smallest element itself into account.) In[15]:= numberOfTerms[z_] :=

Module[{k = 0, old, new}, old = N[(-1)^k c[N[k]] z^(-3/2k)]; (* as long as terms are decreasing *) While[k = k + 1.; Abs[new = N[(-1)^k c[N[k]] (2/3 z^(3/2))^-k]] < Abs[old], old = new]; k] In[16]:= pp = 61;

data = Table[numberOfTerms[N[x + I y]], {x, -5, 5, 10/pp}, {y, -5, 5, 10/pp}]; In[18]:= {Min[#], Max[#]}&[data] Out[18]= 81., 27.< In[19]:= ListContourPlot[data, MeshRange -> {{-5, 5}, {-5, 5}},

Contours -> Range[Max[data]], ContourShading -> False] 4 2 0 -2 -4 -4

-2

0

2

4

For more on the properties of asymptotic expansions, see [439], [394], [979], [217], [88], and [935]; for some numerical investigations on asymptotic expansions, see [190]. As discussed in Section 1.7, Sum will sum many mildly divergent sums. In[20]:= SymbolicSum`SymbolicSum[Gamma[3k + 1/2]/(2^k 3^(3k) Gamma[k + 1/2]*

Gamma[k + 1]) (-1)^k (2/3 z^(3/2))^-k, {k, 0, Infinity}, GenerateConditions -> False] Out[20]=

2 z3ê2 è!!!!!!!!!!! ! 2 z3ê2 3  2   z3ê2 BesselKA 13 ,   E 3      è!!!!!!!!! 3π

The last result is actually the function AiHzL for z > 0 [482], [1150], [1151]. Here is a random numerical check. In[21]:= Table[1/(2 Sqrt[Pi]) z^(-1/4) Exp[-2/3 z^(3/2)] % - AiryAi[z] /.

z -> Random[Real, {0, 1}], {10}] // Chop Out[21]= 80, 0, 0, 0, 0, 0, 0, 0, 0, 0
Identity], {k, 9}], DisplayFunction -> $DisplayFunction, PlotRange -> All, Frame -> True, Axes -> False] 2 0 -2 -4 -6 -8 -10 1

2

3

4

⁄k=0 ak+1 HzL ê Hk 3ê2

Now we will compare the as a Laurent series in 2 ê 3 z .

5

6

7

+ 1L with the exact values. These are the exact values of the asymptotic expansion

In[8]:= Off[Series::esss];

seriesAi = Series[Normal[Series[AiryAi[z], {z, Infinity, 20}]/ (Exp[-2/3 z^(3/2)] (z)^(-1/4)/(2 Sqrt[Pi])) /. z -> (3/2 ζ)^(2/3)], {ζ, Infinity, 10}] 2 3 5 1 4 385 I 1ζ M 85085 I 1ζ M 37182145 I  5391411025 I 1ζ M M 5 ζ Out[9]= 1 −  +   −   +    −   + 72 ζ 10368 2239488 644972544 46438023168 6

7

8

1267709431363375 I 1ζ M 2562040760785380875 I 1ζ M 5849680962125 I 1ζ M    −    +     − 20061226008576 1444408272617472 831979165027663872 9

10

4318199286388002551911375 I 1ζ M 6653619855759634132375 I 1ζ M 1 11    +     + OA  E 539122498937926189056 77633639847061371224064 ζ

Solutions

1159

The next graphic shows the relative error and its logarithm as a function of the number of coefficients ak HzL. In[10]:= exactCoeff[d_] := SeriesCoefficient[seriesAi, d] In[11]:= Show[GraphicsArray[Function[idLog,

Show[Table[ListPlot[(* function of the relative error *) N @ idLog[1 - Rest[FoldList[Plus, 0, (#2/#1)& @@@ coeffs[[k]]]]/exactCoeff[k + 1]], PlotStyle -> {PointSize[0.003], Hue[(k - 1)/10]}, DisplayFunction -> Identity], {k, 9}]]] /@ (* identity and logarithm *) {Identity, Log[10, #]&}]] 1 200

400

600

800

1000

-0.5

0.8

-1

0.6

-1.5

0.4

-2

0.2

-2.5 200

400

600

800

1000

-3

c) Because the following expressions are sometimes quite big, we suppress the output. Here is the definition of sk . In[1]:= s[-1, n_, m_] = 0; s[-2, n_, m_] = 0;

s[k_, n_, m_] := Gamma[n + k + 1] Gamma[m + 1]/k! (a/b)^k * Hypergeometric2F1[-k, m + 1, -n - k, (b/a)^2]

This is the implementation of the terms of the series. In[3]:= term[k_] = (* use power series at generic points *)

PowerExpand @ Assuming[a > 0 && b > 0 && z > 0, Normal[Series[(s[k, n, m] - s[k - 2, n, m]) * BesselJ[m + k, a z] BesselJ[n + k, b z], {z, 0, 12}]] ];

We calculate explicitly the first summands. In[4]:= sum = Expand[Sum[term[k], {k, 0, 6}]];

These are the ones involving the lowest powers in z. In[5]:= powers = Union[Cases[sum, z^_, {0, Infinity}]] Out[5]= 8zm+n , z2+m+n , z4+m+n , z6+m+n , z8+m+n , z10+m+n ,

z12+m+n , z14+m+n , z16+m+n , z18+m+n , z20+m+n , z22+m+n , z24+m+n < In[6]:= terms = Apply[Plus, Cases[sum, _ #]/#& /@ Take[powers, 5], {1}];

Using FullSimplify, we see that all higher powers vanish identically and that the lowest power has the correct prefactor. In[7]:= FullSimplify /@ Take[terms, 2] Out[7]= 82−m−n am bn , 0
Γ, 4] Out[8]//Short=

2−5−m−n a4+m bn 2−4−m−n a2+m b2+n 2−4−m−n a2+m b2+n n Γ@1 + mD   +    +    + 24 +  H1 + nL H2 + nL Γ@3 + mD H1 + mL H2 + mL H1 + mL H1 + nL 2−4−m−n a2+m b2+n m n Γ@1 + mD 2−5−m−n a4+m bn n2 Γ@1 + mD 2−4−m−n a2+m b2+n Γ@1 + mD Γ@1 + nD     +    −    H1 + nL H2 + nL Γ@3 + mD H1 + nL H2 + nL Γ@3 + mD Γ@3 + mD Γ@3 + nD

If we canonicalize the arguments of the Gamma functions by hand, it is easy to establish the identity we are looking for. In[9]:= Together[# //. (* rewrite shifted Gamma functions *)

{Gamma[n + i_Integer] -> (n + i - 1) Gamma[n + i - 1], Gamma[m + i_Integer] -> (m + i - 1) Gamma[m + i - 1]}]& /@ terms

The Classical Special Functions

1160 Out[9]= 82−m−n am bn , 0, 0, 0, 0
100, Contours -> {0}, ContourShading -> False, DisplayFunction -> Identity]& /@ {Im, Re}; (* keeping only the lines *) {grRe, grIm} = Flatten[DeleteCases[Graphics[#][[1]], AbsoluteThickness[_] | Thickness[_] | GrayLevel[_], {0, Infinity}]]& /@ {gr1, gr2}; (* lines of vanishing real and imaginary parts *) Show[Graphics[{(* real part *) {Thickness[0.002], grRe, Map[#{1, -1}&, grRe, {-2}], Line[{{-7 + ∂, 0}, {7, 0}}]}, (* imaginary part *) {Dashing[{0.015, 0.015}], Thickness[0.002], grIm, Map[#{1, -1}&, grIm, {-2}]}}], Frame -> True, AspectRatio -> Automatic, PlotLabel -> StyleForm["Re[Gamma[z]] == 0, Im[Gamma[z]] == 0", FontFamily -> "Courier", FontSize -> 7]]] a@zDD == 0, Im@Gamma@z 6 4 2 0 -2 -4 -6 -6 -4 -2

0

2

4

6

For a detailed discussion of these lines, see [1252], [174]. e) For a rough estimation of the zeros, let us have a look at the plot of Jn H2L. In[1]:= Plot[BesselJ[ν, 2], {ν, -10, 5}, PlotRange -> {-5, 5}] 4 2

-10

-8

-6

-4

-2

2

4

-2 -4

The plot shows that ni = -i is a reasonable starting value. Because Mathematica cannot differentiate Bessel functions with respect to the order in closed form, we give FindRoot two starting values to calculate the zeros. In[2]:= Table[N[#, 15]& @

FindRoot[BesselJ[ν, 2], {ν, ν0 + 2/10, ν0 - 2/10}, AccuracyGoal -> 20, WorkingPrecision -> 50], {ν0, -2, -10, -1}] Out[2]= 88ν → −1.78932135266695 Infinity] Out[7]= 8dim → 5.256946404860576780132838388690769236619
volume[6] Out[8]= True

This critical dimension depends on the radius of the hyperspheres. For non-unit spheres the critical dimension increases quickly with the radius. In[9]:= (* condition for extrema; ρ is the hypersphere radius *)

radiusAV[dim_, ρ_] = D[ρ^dim {area[dim], 1/ρ volume[dim]}, dim]; Show[GraphicsArray[ ContourPlot[#, {ρ, 1/10, 2}, {dim, 1/2, 20}, Contours -> {0}, ContourShading -> False, DisplayFunction -> Identity, PlotPoints -> 40]& /@ radiusAV[dim, ρ]]] 20

20

15

15

10

10

5

5

0.25 0.5 0.75 1 1.25 1.5 1.75 2

0.25 0.5 0.75 1 1.25 1.5 1.75 2

If we allow negative dimensions, we can find more maxima. In[12]:= Show[GraphicsArray[

Plot[#[dim], {dim, -20, 0}, Frame -> True, Axes -> True, PlotLabel -> ToString[#], PlotRange -> All, DisplayFunction -> Identity]& /@ {area, volume}]]

The Classical Special Functions

1164 area

15

0.75

10

0.5 0.25

5

0 -0.25

0 -5

volume

1

-0.5 -0.75 -20

-15

-10

-5

0

-20

-15

-10

-5

0

In the complex dimension plane, the area and the volume function look similar. In[13]:= Show[GraphicsArray[

ContourPlot[Abs[Evaluate[#[redim + I imdim]]], {redim, -10, 10}, {imdim, -3, 3}, Contours -> 50, PlotPoints -> 120, ContourLines -> False, ColorFunction -> (Hue[0.8 #]&), PlotLabel -> ToString[#], DisplayFunction -> Identity]& /@ (* display are and volume *) {area, volume}]] area

3 2

2

1

1

0

0

-1

-1

-2

-2

-3 -10

-5

0

volume

3

5

10

-3 -10

-5

0

5

10

The sums of the volumes and areas of all even- and odd-dimensional unit spheres have the following values [56]. In[14]:= Sum[volume[dim], {dim, #, Infinity, 2}]& /@ {0, 1}

è!!!!!

Out[14]= 8π , π Erf@ π D< In[15]:= Sum[area[dim], {dim, #, Infinity, 2}]& /@ {0, 1}

è!!!!!

Out[15]= 82 π π, 2 I1 + π π Erf@ π DM
Infinity] π 2

 Out[18]= $%%%%%%%%%%%%

For volumes of other compact manifolds, see [195]. Here is the probability density for the distance r of two points chosen at random in a d-dimensional unit sphere. In[19]:= p[d_, ρ_] := 2 d/Beta[d/2 + 1/2, 1/2]*

(Hypergeometric2F1[1/2, 1/2 - d/2, 3/2, 1] ρ/2 Hypergeometric2F1[1/2, 1/2 - d/2, 3/2, ρ^2/4])ρ^(d - 1)

Integrating pd HrL yields the probability distribution. In[20]:= (P[d_, ρ_] = Integrate[p[d, ], {, 0, ρ}, Assumptions -> 0 < ρ < 2 && d > 0] //

FullSimplify) // TraditionalForm Out[20]//TraditionalForm= d+1 d+1 d+1 Å2ÅÅÅÅÅ , ÅÅÅÅÅ2ÅÅÅÅÅ M - rd B r2 I ÅÅÅÅ12 , ÅÅÅÅ Å2ÅÅÅÅÅ M 2d B r2 I ÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ

ÅÅÅÅÅÅÅÅÅÅÅ

4 4 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ r + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ d+1 1 BI ÅÅÅÅ Å2ÅÅÅÅÅ , ÅÅ2ÅÅ M d

Solutions

1165

The following graphic shows the distributions for 1 § d § 30. The maximum of pd HrL seems to shift right towards a limit of r º 1.4 and to become narrower at the same time. In[21]:= Show[GraphicsArray[

Plot[Evaluate[Table[#[d, ρ], {d, 30}]], {ρ, 0, 2}, PlotRange -> All, PlotStyle -> Table[Hue[0.8 d/30], {d, 30}], DisplayFunction -> Identity]& /@ {p, P}]] 3

1

2.5

0.8

2

0.6

1.5 0.4

1

0.2

0.5 0.5

1

1.5

2

0.5

1

1.5

2

A natural conjecture (see below) is that the maximum occurs at r = 21ê2 . The value p1000 H21ê2 L º 17.81 suggests (keeping the è!!!! normalization of pd HrL in mind) that limdض pd HrL = dIr - 2 M. In[22]:= p[1000, N[Sqrt[2], 200]] // N Out[22]= 17.8102

The average distance is given by the following expression. In[23]:= ρAv[d_] = Integrate[ρ p[d, ρ], {ρ, 0, 2},

Out[23]=

Assumptions -> d > 0] // FullSimplify 2d d2 Gamma@1 + d2 D Gamma@ d2 D    π! Gamma@ 32 + dD H1 + dL è!!!!

In the limit d Ø ¶ the average distance becomes 21ê2 . In[24]:= Limit[ρAv[d] /. Gamma[ξ_] :> Sqrt[2Pi] Sqrt[1/ξ] Exp[-ξ] ξ^ξ, Out[24]=

è!!!!! 2

d -> Infinity]

The maximum of pd HrL is also at rmax = 21ê2 in the limit d Ø ¶. For d = 100, the difference is only 1% and for d = 1000 the difference is only 10-16 . In[25]:= pD[d_, ρ_] = D[p[d, ρ], ρ] // FullSimplify;

pDN[d_, ρ_?NumericQ] := pD[SetPrecision[d, 50], SetPrecision[ρ, 50]] zeroD[d_, ρ0_] := FindRoot[pDN[d, ρ] == 0, {ρ, ρ0, ρ0 (1 - 10^-3)}, (* use high-precision *) WorkingPrecision -> 30] In[28]:= Sqrt[2] - ρ /. zeroD[100, Sqrt[2]] Out[28]= 0.01056368702059049307204635507

è!!!! The result êêêê r¶ê = 2 is easily understood: It is the distance between two unit vectors in l2 . In the limit d Ø ¶, we get more and more dimensions and probabilistically two random vectors will be orthogonal. In addition, because of the radial Jacobian rd-1 for large d, most of the volume of a d-dimensional unit sphere is concentrated in a thin shell near the surface. è!!!! This means most randomly chosen vectors will have norm 1, and this, in turn, means limdض êê r= 2. For the average distance of to the nth neighbor of uniformly distributed points, see [273], [156]. For the average size of the smallest component of a vector on a dD sphere, see [1063]. For further properties of higher dimensional spheres, see [1070]. For the grazing goat problem in dD, see [473]. i) Without loss of generality, we set y = 0 and denote †x§ by x. The convolution integral can be written in a compact way using a beta function. In[1]:= FullSimplify[#, r > 0]& @

(UnitStep[2r - x] 1/Gamma[(n + 1)/2] (Pi/4)^((n - 1)/2) *

The Classical Special Functions

1166

Out[1]= πnê2

Integrate[(4r^2 - y^2)^((n - 1)/2), {y, x, 2r}, Assumptions -> n > 0 && x > 0 && 2r > x]) x2 1+n i x BetaA   , 12 ,   E y j 1 z n j 4 r2  2  z z  r j  j z UnitStep@2 r − xD n  −  è!!!!!!! è!!!! ! j  1+n 2 Gamma@  Gamma@1 + 2 D π x   D z 2 k {

In[2]:= (* use hypergeometric form versus Beta function for autoevaluation *)

χConvolution[n_, r_, x_] = Pi^((n - 1)/2) r^(n - 1)* (-x Gamma[1 + n/2] Hypergeometric2F1[1/2, 1/2 - n/2, 3/2, x^2/(4 r^2)] + Sqrt[Pi] r Gamma[(1 + n)/2] Sign[r]* UnitStep[2 r - x])/(Gamma[1 + n/2] Gamma[(1 + n)/2]) 1 H−1+nL n 1 1 n 3 x2 i i  −1+n j j 2 Out[3]= jπ r E+ j−x GammaA1 +  E Hypergeometric2F1A  ,  −  ,  ,  4 r2 2 2 2 2 2 k k

n 1+n 1+n è!!!!! yy ì JGammaA1 +   E GammaA  EN π r GammaA  E Sign@rD UnitStep@2 r − xDz zz z 2 2 2 {{

This is the general formula for calculating gd HrL. In[4]:= g[n_, V_, r_, intAssumptions___] :=

2(-1)^(n + 1)/(Gamma[(n - 1)/2] (Pi r^2)^((n - 1)/2))* Integrate[(D[V, {r, n + 1}] /. r -> ρ) ρ (ρ^2 - r^2)^((n - 3)/2), {ρ, r, Infinity}, Assumptions -> And[r > 0, intAssumptions]]

For a Coulomb potential V ~ †x§-1 , we have gd HrL ~ r-d-2 . In[5]:= Table[g[d, 1/r, r], {d, 2, 5}] // Simplify[#, r > 0]&

3

16

30

192

Out[5]= 9 4 , 5 ,  ,   = r πr π r6 π2 r7

Here are the functions g3 HrL for a Yukawa, another exponential and an oscillating potential. (For the case sinHrL ê r we add a convergence-achieving factor.) In[6]:= (* for Sin[r] 1/r potential, use non-Riemann integral

Integrate[Sin[ρ], {ρ, r, Infinity}, GenerateConditions -> False] ==> Cos[r] or Series[g[3, Exp[-∂ r] Sin[r] 1/r, r] /. If[_, a_, _] :> a, {∂, 0, 0}] // Normal *) {g[3, Exp[-r] 1/r, r], g[3, Exp[-r^2] 1/r, r], Normal[Series[g[3, Exp[-∂ r] Sin[r] 1/r, r, ∂ > 0], {∂, 0, 0}]]} // FullSimplify[#, r > 0]& 2

2 −r H2 + rL H4 + r H2 + rLL 8 −r H2 + 2 r2 + r4 + 2 r6 L πr πr 2 Hr H−8 + r2 L Cos@rD − 4 H−2 + r2 L Sin@rDL       = π r5

   ,    , Out[7]= 9  5 5

Using the original decomposition, we recover the first two potentials immediately. The third integral In[8]:= Integrate[χConvolution[3, r/2, x] #, {r, x, Infinity},

Assumptions -> x > 0]& /@ Take[%, 3] // FullSimplify 2

−x −x 1 Out[8]= 9  ,  ,  x x 360 x i i j j−360 x CosIntegral@xD + j−20 H30 x + H19 − 18 EulerGammaL x3 + 18 x Cos@xD − 66 Sin@xDL + x2 j k k 2 5 x 3 i j x j−35 HypergeometricPFQA81, 1 0};

Here are the resulting integration-free formulas for gd HrL. In[11]:= Table[Factor[g[d, V[r], r] //. partialIntegrateRules], {d, 3, 11, 2}]

2 H−V @rD + r VH3L @rDL 4 H3 V @rD − 3 r VH3L @rD + r2 VH4L @rDL πr π r 8 H−15 V @rD + 15 r VH3L @rD − 6 r2 VH4L @rD + r3 VH5L @rDL     , −  π3 r6  H3L 2 H4L 3 16 H105 V @rD − 105 r V @rD + 45 r V @rD − 10 r VH5L @rD + r4 VH6L @rDL        , π4 r8 32 H−945 V @rD + 945 r VH3L @rD − 420 r2 VH4L @rD + 105 r3 VH5L @rD − 15 r4 VH6L @rD + r5 VH7L @rDL −         = π5 r10

  ,     , Out[11]= 9−  2 2 4

j) A direct calculation of Jn HnL becomes time-consuming for larger n. In[1]:= Table[Timing[N[BesselJ[10^k, 10^k]]], {k, 4}] Out[1]= 881.66696 × 10−18 Second, 0.207486 10^-20, n = n + 1]; n) // Timing Out[3]= 84.35 Second, 41
1) > 10^-100, n = n + 1]; {n, N[Sqrt[σ[n, ν]/σ[n + 1, ν]], 100]}] // Timing Out[5]= 85.9 Second, 8191, 3.83170597020751231561443588630816076656454527428780192876229898991883930951901147 0214112874757423127 1) > 10^-100, n = n + 1]; (* return result *) {n, N[Sqrt[σ[n, ν]/σ[n + 1, ν]], 100]}] // Timing Out[7]= 80.2 Second, 8191, 3.83170597020751231561443588630816076656454527428780192876229898991883930951901147 0214112874757423127 1) > 10^-100, n = n + 1]; (* return result *) {n, N[Sqrt[σ1[n, ν]/σ1[n + 1, ν]], 100]}] // Timing

Solutions

1169 Out[11]= 80.16 Second, 8191,

3.83170597020751231561443588630816076656454527428780192876229898991883930951901147 0214112874757423127 200]) - %[[2, 2]] Out[12]= 0. × 10−100

For coupled equations for the zeros of Bessel functions, see [1091], [919]. l) A graph of KH1 - xL ê KHxL shows that the x will be near to 0. In[1]:= Plot[EllipticK[1 - x]/EllipticK[x], {x, 0, 1},

Frame -> True, Axes -> False] 6 5 4 3 2 1 0 0

0.2

0.4

0.6

0.8

1

To find an exact expression for x, we start by numerically computing a high-precision value for x. In[2]:= g[x_?NumberQ, prec_] :=

With[{ξ = SetPrecision[x, prec]}, EllipticK[1 - ξ]/EllipticK[ξ]] In[3]:= ∂ = 10^-10;

x = ξ /. FindRoot[g[ξ, 200] == Sqrt[10], {ξ, ∂, 1 - ∂}, AccuracyGoal -> 100, WorkingPrecision -> 200, MaxIterations -> 200] // Re // SetPrecision[#, 100]& Out[4]= 0.0007752017293532922488376453553255501692319869434272712607280923833754612812020806 740099251537389029166

Using the package NumberTheory`Recognize`, we can get the polynomial of which x is a root. In[5]:= Needs["NumberTheory`Recognize`"] In[6]:= poly = Recognize[x, 20, t] // Factor Out[6]= H1 + tL H1 − 1292 t + 2598 t2 − 1292 t3 + t4 L

This is the algebraic form of x. In[7]:= xAlgebraic = t /. Select[{ToRules[Roots[poly == 0, t]]}, Out[7]= 323 − 228

N[(t /. #), 22] - N[x] è!!!!! è!!!!! è!!!!!!!! 2 + 144 5 − 102 10

== 0&][[1]] // FullSimplify

To make sure the result is correct, we check the identity to 1000 digits. In[8]:= g[N[xAlgebraic, 1000], 1000] - Sqrt[10] Out[8]= 0. × 10−1000

m) These are the 24 functions under consideration. In[1]:=  = {(* trigonometric functions *)

Sin, Cos, Tan, Cot, Sec, Csc, (* hyperbolic functions *) Sinh, Cosh, Tanh, Coth, Sech, Csch, (* inverse trigonometric functions *) ArcSin, ArcCos, ArcTan, ArcCot, ArcSec, ArcCsc, (* inverse hyperbolic functions *) ArcSinh, ArcCosh, ArcTanh, ArcCoth, ArcSech, ArcCsch};

The Classical Special Functions

1170

l = Length[];

We define the integrands and the integrals by referring to their position in the list . In[4]:= integrand[{i_, j_, k_}, x_] := [[i]][[[j]][[[k]][x]]];

tripleIntegral[{i_, j_, k_}, x_] := Integrate[integrand[{i, j, k}, x], x];

When Mathematica was able to carry out the integration, the function containedSpecialFunction returns a list of the special functions present in the result. In[6]:= containedSpecialFunction[int_] :=

DeleteCases[Complement[Level[int, {-1}, Heads -> True], Level[int, {-1}, Heads -> False]], (* take out elementary functions *) List | Plus | Times | Power | Log | Sequence @@ ]

Now, we carry out all 13824 calls to Integrate. This calculation takes about 1 ÅÅ12ÅÅ hours on a 2 GHz computer. If the integration succeeds, we store the result in the list bag. In[7]:= (* results *)

bag = Table[Null, {i, l}, {j, l}, {k, l}]; Off[Power::infy]; Off[Sum::div]; Off[Infinity::indet]; Do[(* to see some progress while waiting CellPrint[Cell[TextData[{"Î Now integrating integral number ", ToString[(i - 1)^2 l + (j - 1) l + k], ": ", Cell[BoxData[FormBox[MakeBoxes[#, TraditionalForm]&[ integrand[{i, j, k}, x]], TraditionalForm]]]}], "Text", CellTags -> "currentIntegral"]]; NotebookLocate["currentIntegral"]; NotebookDelete[EvaluationNotebook[]]; *) (* try to do the integration *) int = tripleIntegral[{i, j, k}, x]; (* was the integral done? *) If[FreeQ[int, _Integrate], bag[[i, j, k]] = int], {i, l}, {j, l}, {k, l}]; // Timing Out[10]= 837873.7 Second, Null
b < 0 && a > 0] a−a c Gamma@aD Hb ξ − Log@aD + PolyGamma@0, aDL b

    Out[3]= −  2

In[4]:= m2 = Integrate[(x + ξ)^2 [x + ξ], {x, -Infinity, Infinity}, Out[4]=

Assumptions -> b < 0 && a > 0] a−a c Gamma@aD H−Hb ξ − Log@aD + PolyGamma@0, aDL2 − PolyGamma@1, aDL        b3

In[5]:= eqs = ({m0, m1, m2} /. If[cond_, res_, _] :> res) // FullSimplify

a−a c Gamma@aD Hb ξ − Log@aD + PolyGamma@0, aDL a−a c Gamma@aD b b a−a c Gamma@aD H−Hb ξ − Log@aD + PolyGamma@0, aDL2 − PolyGamma@1, aDL        = b3

  , −      , Out[5]= 9−  2

The conditions on the first moments to be 0, 1, and 0 result in three equations for the three variables c, b, and x. In[6]:= (sol = Solve[Thread[eqs == {1, 0, 1}], {b, ξ, c}]) // TraditionalForm

logHaL - yH0L HaL

aa

è!!!!!!!!!!!!!!!!! yH1L HaL GHaL

Out[6]//TraditionalForm= ::x Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , c Ø - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , b Ø è!!!!!!!!!!!!!!!!!

yH1L HaL

è!!!!!!!!!!!!!!!!! yH0L HaL - logHaL aa yH1L HaL è!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!! yH1L HaL >, :x Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , c Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , b Ø - yH1L HaL >> è!!!!!!!!!!!!!!!!! GHaL yH1L HaL

The resulting distribution contains Gamma and Polygamma functions of a. In[7]:= (p[a_, x_] = [x] /. sol[[1]] // FullSimplify) // TraditionalForm a

# ij "###################### ‰"##################### yz yH1L HaL x+yH0L HaL jj yH1L HaL x- ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ +yH0L HaL z zz è!!!!!!!!!!!!!!!!! j‰ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz yH1L HaL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅÅ Å Å aa jjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz a jjj zzz k { ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅ Out[7]//TraditionalForm= - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ GHaL

Here is a plot of a family parametrized by a. In[8]:= Plot[Evaluate[Table[p[a, x], {a, 1/2, 5/2, 5/2/20}]], {x, -4, 4},

PlotRange -> All, Frame -> True, Axes -> False, PlotStyle -> {Thickness[0.002]}] 0 -0.1 -0.2 -0.3 -0.4 -0.5 -4

-2

0

2

4

For the application of the Gumbel distribution to football game results, see [545]. p) Expressing the Binomial functions through Gamma functions shows singular denominators for negative integer x and y. In[1]:= Binomial[x, y] // FunctionExpand

Solutions

1173 Out[1]=

Gamma@1 + xD    Gamma@1 + x − yD Gamma@1 + yD

For x ¥ y as a function of two complex variables, we do not have a removable singularity at negative integers. Depending on how the point 8x, y< is approached, different values result. In[2]:= Table[ := Random[Complex, 10^-19 {-1 - I, 1 + I}, 30];

Binomial[-5 + , -8 + ] // N, {5}]

Out[2]= 8−152.334 + 67.5158 , 39.0447 + 6.03727 ,

71.9376 − 18.0395 , −19.781 + 15.6696 , −19.4786 + 5.14629 
200, Contours -> Table[k Pi, {k, -15, 15}]]

The Classical Special Functions

1174 7.5 5 2.5 0 -2.5 -5 -7.5 -7.5 -5 -2.5 0

2.5

5

7.5

H jL

Solving z lnHzL = x yields zk = Hi k p + xL ê W j Hi k p + xL as a parametric description for the curves. Here x is the real parameter along a curve and the integers j and k count the curves. In[3]:= Off[InverseFunction::ifun]; Off[Solve::ifun];

Solve[z Log[z] == x, z] x ProductLog@xD

Out[4]= 99z →    ==

Due to the branch cut structure of lnHzL and W j HzL only the branches j = 0, ≤ 1 are needed. The following graphic overlays the parametrized curves on the original contour plot. In[5]:= cLines[n_, {kMin_, kMax_}, col_] :=

ParametricPlot[Evaluate[Table[{Re[#], Im[#]}& @ (* the parametrizations *) (Function[x, x/ProductLog[n, x]][N[k I Pi + x]]), {k, kMin, kMax}]], {x, -50, 50}, (* use enough plotpoints *) PlotPoints -> 500, Frame -> True, Axes -> False, AspectRatio -> Automatic, Compiled -> False, PlotStyle -> {{Thickness[0.01], col}}, DisplayFunction -> Identity, PlotRange -> {{-10, 10}, {-10, 10}}]; In[6]:= (* lines from three branches *)

cl1 = cLines[ 0, {-10, 10}, RGBColor[1, 0, 0]]; cl2 = cLines[ 1, {-10, -1}, RGBColor[0, 1, 0]]; cl3 = cLines[-1, { 0, 10}, RGBColor[0, 0, 1]]; In[10]:= Show[{cp, cl1, Graphics[{Hue[0.12], Line[{{0, 0}, {-10, 0}}]}],

(* make curves fit *) cl2 /. Line[l_] :> Line /@ DeleteCases[Partition[l, 2, 1], {{_, _?Negative}, {_, _?Negative}}], cl3 /. Line[l_] :> Line /@ DeleteCases[Partition[l, 2, 1], {{_, _?Positive}, {_, _?Positive}}], (* straight lines *) Graphics[{GrayLevel[0.5], Thickness[0.01], Line[{{-10, -10}, {10, -10}, {10, 10}, {-10, 10}, {-10, -10}}]}]}, PlotRange -> {{-10, 10}, {-10, 10}}] 10 7.5 5 2.5 0 -2.5 -5 -7.5 -7.5-5-2.5 0 2.5 5 7.5 10

r) A quick numerical experiment shows that the limit probably exists. In[1]:= cf = Compile[{{n, _Integer}}, 1/n Product[k^(1/n), {k, n}]]; In[2]:= ListPlot[Table[cf[k], {k, 1000}], PlotRange -> All]

Solutions

1175

200

400

600

800

1000

0.9 0.8 0.7 0.6 0.5 0.4

In[3]:= cf[10^6] // Timing Out[3]= 80.7 Second, 0.367882
N[1000, 20], 8] Out[13]= 81.5704039, 1.5704036
Infinity] Out[15]= π

To calculate the limit we first use the Stirling expansion for n!. In[16]:= Simplify[pi[n] /. (n_)! -> Normal[Series[n!, {n, Infinity, 3}]]] Out[16]=

2−7+4 n H1 + nL−5+4 n H1 + 2 nL1−4 n H313 + 600 n + 288 n2 L4 π      81 2 H313 + 1200 n + 1152 n2 L2

To avoid constructs of the form f HnLgHnL we take the logarithm of the last expression and calculate its limit. Exponentiating the result gives the limit p and the first terms of the series in 1 ê n. In[17]:= Exp @ Simplify[Series[Log[%], {n, Infinity, 3}]]

π 4n

7 32

1 n

2

3

2623 π H 1 L 13824

1 n

4

n + OA  E Out[17]= π +  −  π J  N +  

The first two correction terms reproduce well the difference from above. In[18]:= Pi/(4 n) - 7/32 Pi /n^2 /. n -> SetPrecision[10^6, 7] Out[18]= 7.853975 × 10−7

We continue with the sum. Mathematica can carry out the sum, and the limit. In[19]:= sum = Sum[n/(n^2 + k^2), {k, n^2}]

i −1 + n π Coth@n πD 2n k

 HPolyGamma@0, 1 −  n + n2 D − PolyGamma@0, 1 +  n + n2 DL y 2n {

Out[19]= n j      z j  z 2  −  In[20]:= Limit[%, n -> Infinity] Out[20]=

π  2

For large n, we have the following expansion. In[21]:= Series[sum, {n, Infinity, 2}] Out[21]=

3 1 3 yz 1 j i  y  i j−  + OA  E z zz jπ Coth@n πD + j n {{ 2 k k n

Taking into account that limxض cothHxL = 1 and the value is approached exponentially fast, we have for the limit and its first correction term: p ê 2 - 3 ê 2 ê n. This results agrees favorable with a numerical value for large n. In[22]:= Block[{n = N[1000, 10]},

{sum, Pi/2 - 3/2/n}] Out[22]= 81.569296328 + 0. × 10−12 , 1.569296326795
EliminationOrder] // Factor,

Solutions

1177 _Plus?(MemberQ[#, w, Infinity]&), Infinity]] // Simplify Out[4]= 8w Hk − zL + k2 wk + k z wz < In[6]:= (k - z) Γ[k, z] + k^2 D[Γ[k, z], k] + k z D[Γ[k, z] , z] // Simplify Out[6]= 0

To derive more PDEs fulfilled by the generalized Gamma function, we start by forming all partial derivatives up to order two. In[7]:= (eqs =

{w - Γ[k, z], Subscript[w, z] - D[Γ[k, z], z], Subscript[w, k] - D[Γ[k, z], k], Subscript[w, z, z] - D[Γ[k, z], z, z], Subscript[w, k, k] - D[Γ[k, z], k, k], Subscript[w, k, z] - D[Γ[k, z], k, z]}) // TraditionalForm z z z z logHkL yzz ÅÅzÅÅÅ -1 z z z z ÅÅzÅÅÅ -2 z z ÅÅzÅÅÅ -3 z ij ÅÅÅÅk - 1 ÅÅÅÅÅ -1 ÅÅÅÅÅ -2 ÅÅÅÅÅÅÅ z k k + wk , Out[7]//TraditionalForm= :w - k k GJ ÅÅÅÅÅ N, -GJ ÅÅÅÅÅ N logHkL k k - GJ ÅÅÅÅÅ N yH0L J ÅÅÅÅ N k k + wz , z GJ ÅÅÅÅÅ N yH0L J ÅÅÅÅÅ N k k - GJ ÅÅÅÅÅ N jjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ k2 z{ k k k k k k k k k z z z z z z 2 z z z z z -GJ ÅÅÅÅ N log2 HkL k ÅÅkÅÅÅ -3 - GJ ÅÅÅÅ N yH0L J ÅÅÅÅÅ N k ÅÅkÅÅÅ -3 - 2 GJ ÅÅÅÅÅ N logHkL yH0L J ÅÅÅÅ N k ÅÅkÅÅÅ -3 - GJ ÅÅÅÅÅ N yH1L J ÅÅÅÅÅ N k ÅÅkÅÅÅ -3 + wz,z , k k k k k k k z z z logHkL zyz H0L z ÅÅzÅÅÅ -3 z z 2 z z z z ji ÅÅÅÅk - 3 -z2 GJ ÅÅÅÅÅ N yH0L J ÅÅÅÅÅ N k ÅÅkÅÅÅ -5 - z2 GJ ÅÅÅÅÅ N yH1L J ÅÅÅÅÅ N k ÅÅkÅÅÅ -5 + z GJ ÅÅÅÅÅ N jjj ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ z y J ÅÅÅÅÅ N k k + k2 z{ k k k k k k k k

z z 2 ÅÅÅÅkz - 1 yz ÅÅzÅÅÅ -1 z logHkL yzz H0L z ÅÅzÅÅÅ -3 z logHkL yzz ÅÅzÅÅÅ -1 z ijj ÅÅkÅÅ - 1 z ijj 2 logHkL z 2z z ij ÅÅkÅÅ - 1 k k ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅÅ Å ÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ zz k k + z y z J ÅÅÅÅ Å N k GJ ÅÅ Å Å N j k GJ ÅÅÅÅ Å N j ÅÅÅÅ Å Å ÅÅ Å z GJ ÅÅÅÅ N jjj ÅÅÅÅÅÅÅÅ z z j j k3 k2 { k2 { k 2 z{ k3 k k k k k k k k k z z z z z 2 z z z z z z z wk,k , z GJ ÅÅÅÅÅ N yH0L J ÅÅÅÅÅ N k ÅÅkÅÅÅ -4 + z GJ ÅÅÅÅÅ N logHkL yH0L J ÅÅÅÅ N k ÅÅkÅÅÅ -4 + z GJ ÅÅÅÅÅ N yH1L J ÅÅÅÅ N k ÅÅkÅÅÅ -4 + GJ ÅÅÅÅÅ N yH0L J ÅÅÅÅÅ N k ÅÅkÅÅÅ -3 k k k k k k k k z z z z logHkL zyz ÅÅzÅÅÅ -2 z logHkL zyz H0L z ÅÅzÅÅÅ -2 z ji ÅÅkÅÅ - 1 z i 1 logHkL y z ji ÅÅÅÅk - 1 GJ ÅÅÅÅÅ N logHkL jjj ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ zz k k - GJ ÅÅÅÅ N jjj ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ z y J ÅÅÅÅÅ N k k - GJ ÅÅÅÅ N jj ÅÅÅÅÅ2ÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅ2ÅÅÅÅÅÅÅ zz k ÅÅkÅÅÅ -1 + wk,z > 2 k k 2 z{ k { k k k k k k kk k k {

To obtain polynomial PDEs, we have to eliminate the Gamma and polygamma functions. In[8]:= gb = GroebnerBasis[(* form numerators *)

Numerator[Factor[Together[Rest[eqs] /. (* eliminate gamma function *) Solve[eqs[[1]] == 0, Gamma[z/k]][[1]]]]], {}, {PolyGamma[0, z/k], PolyGamma[1, z/k]}, MonomialOrder -> EliminationOrder] // Factor; In[9]:= candidatePDEs = Sort[Union[Cases[gb, _Plus, Infinity]], (Length[#1] < Length[#2])&];

Length[candidatePDEs] Out[10]= 23

Here are some of the so-obtained PDEs. In[11]:= (selectedPDEs = Collect[#, {w, Subscript[w, z], Subscript[w, k], Subscript[w, z, z],

Subscript[w, k, k], Subscript[w, k, z]}, Factor]& /@ Take[candidatePDEs, 12]) // TraditionalForm Out[11]//TraditionalForm=

8wk k2 + z wz k + w Hk - zL, wk,z k3 + wk k2 + 2 wz k2 + z wz,z k 2 - w z, wk,k k 3 + z wk,z k2 + H2 k - zL wk k + w z, -2 wk k 2 + z wk,z k2 + z2 wz,z k + w Hz - 2 kL - z2 wz , wk,k k 2 + z wk,z k + w + H3 k - zL wk + z wz , wk wz,z k3 - 2 w2z k 2 + wz H-wk,z k3 - wk k2 L + w Hz wz + k Hk - zL wz,z L, wk,k k 2 + 2 wz k + Hk + zL wk,z k + z wz,z k + H3 k - zL wk , k 2 w2k - z2 w2z + w Hwk,k k2 + 2 z wk,z k + H3 k - 2 zL wk + z wz + z2 wz,z L, -k w2k - z wz wk + w H2 wk + 2 wz + k wk,k + Hk + zL wk,z + z wz,z L, w Hz wk,k + 2 k wk,z + z wz,z L + wk H-wk,k k 2 + H4 k - zL wk,z k + H3 k - zL z wz,z L + wz H-2 wk,k k 2 + z2 wk,z + z2 wz,z L, H7 k - 2 zL w2k + H2 k2 wk,k - 2 k Hk - zL wk,z L wk + 2 z w2z + wz H2 wk,k k 2 + H6 k + zL wk L + w H-k wk,k + Hz - 3 kL wk,z - z wz,z L, H7 k - 2 zL w2k + H2 wk,k k 2 + 2 wz,z k2 + 2 z wk,z kL wk - 2 H2 k - zL w2z + wz H3 z wk - 2 k 2 wk,z L + w H-k wk,k + H-k - zL wk,z + H2 k - 3 zL wz,z L
D[Γ[k, z], kz] /. w -> Γ[k, z]] Out[12]= 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
γ /.  -> L, 22]] In[19]:= Off[N::meprec];

checkIdentity /@ idList

The Classical Special Functions

1186 Out[20]= 80. × 10−121 , 0, 0. × 10−121 + 0. × 10−121 , 0. × 10−121 + 0. × 10−121 , 0, 0, 0,

0. × 10−121 , 0. × 10−120 , 0. × 10−119 + 0. × 10−119 , 0. × 10−120 , 0. × 10−120 + 0. × 10−120 , 0. × 10−120 , 0. × 10−120 , 0. × 10−120 , 0. × 10−120 + 0. × 10−120 , 0. × 10−119 + 0. × 10−119 , 0. × 10−119 + 0. × 10−120 , 0. × 10−111 + 0. × 10−111 , 0. × 10−111 + 0. × 10−111 , 0. × 10−119 + 0. × 10−120 , 0. × 10−119 + 0. × 10−119 , 0. × 10−119 , 0. × 10−120 , 0. × 10−120 , 0. × 10−120 , 0. × 10−119 , 0. × 10−119 + 0. × 10−119 , 0. × 10−120 , 0. × 10−120 , 0. × 10−121 , 0. × 10−120 , 0. × 10−121 , 0. × 10−120 + 0. × 10−120 , 0. × 10−120 + 0. × 10−120 , 0. × 10−120 , 0. × 10−120 , 0. × 10−120 , 0. × 10−120 + 0. × 10−120 , 0. × 10−120
1, α2 -> 1, α1 -> 1, α0 -> 1, αC -> 1} /. a_Integer n^_. r_ -> r /. m^_. r_ -> r /. a_Integer r_ -> r] "########################### "########################### "################################ "################################ Out[5]//TraditionalForm= :sinHfL, sin3 HfL, sin5 HfL, EHf » mL sin2 HfL + 1 , FHf » mL sin2 HfL + 1 , 1 - m sin2 HfL , EHf » mL 1 - m sin2 HfL , FHf » mL

"################################ "################################ "################################ "################################ 1 - m sin2 HfL , PHn; f » mL 1 - m sin2 HfL , sin2 HfL 1 - m sin2 HfL , EHf » mL sin2 HfL 1 - m sin2 HfL ,

FHf » mL sin2 HfL

"################################ "################################ "################################ 1 - m sin2 HfL , PHn; f » mL sin2 HfL 1 - m sin2 HfL , sin4 HfL 1 - m sin2 HfL ,

EHf » mL sin4 HfL

"################################ "################################ "################################ 1 - m sin2 HfL , FHf » mL sin4 HfL 1 - m sin2 HfL , PHn; f » mL sin4 HfL 1 - m sin2 HfL ,

"################################ "################################ "################################ "################################ m sin2 HfL + 1 , EHf » mL m sin2 HfL + 1 , FHf » mL m sin2 HfL + 1 , PHn; f » mL m sin2 HfL + 1 , sin2 HfL

"################################ "################################ "################################ m sin2 HfL + 1 , EHf » mL sin2 HfL m sin2 HfL + 1 , FHf » mL sin2 HfL m sin2 HfL + 1 ,

PHn; f » mL sin2 HfL

"################################ "################################ "################################ m sin2 HfL + 1 , sin4 HfL m sin2 HfL + 1 , EHf » mL sin4 HfL m sin2 HfL + 1 ,

"################################ "################################ FHf » mL sin4 HfL m sin2 HfL + 1 , PHn; f » mL sin4 HfL m sin2 HfL + 1 , sinH2 fL, sin2 HfL sinH2 fL, sin4 HfL sinH2 fL>

Assuming that for generic n, m, and f, the three terms EllipticE[φ, m] Sqrt[1 - m Sin[φ]^2] , EllipticF[φ, m] Sqrt[1 - m Sin[φ]^2] , and EllipticPi[n, φ, m] Sqrt[1 - m Sin[φ]^2] are linearly independent, we replace them with new variables. In[6]:= eqs2 = eqs1 /. {EllipticE[φ, m] Sqrt[1 - m Sin[φ]^2] -> we,

EllipticF[φ, m] Sqrt[1 - m Sin[φ]^2] -> wf, EllipticPi[n, φ, m] Sqrt[1 - m Sin[φ]^2] -> wp};

Based on the linear independence, we extract the coefficients of we, wf, and wp from eqs2. ce, cf, and cp are these coefficients; c0 are the remaining terms. In[7]:= {ce, cf, cp} = Coefficient[eqs2, (* variables *) {we, wf, wp}];

c0 = Expand[eqs2 - (ce we + cf wf + cp wp)];

Solving the resulting system of four equations for the five unknowns α3, α2, α1, α0, and αC gives the following result. In[9]:= sol = Factor //@ Solve[{ce == 0, cf == 0, cp == 0, c0 == 0},

{α3, α2, α1, α0, αC}] Solve::svars : Equations may not give solutions for all "solve" variables. More…

Solutions

1187 3 α2 4 H−7 m + 11 m + 2 n − 6 m nL 3 α2 Sin@2 φD αC → −       , ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 8 H−7 m + 11 m2 + 2 n − 6 m nL 1 − m Sin@φD2 H−1 + m Sin@φD2 L2 3 H−2 + 7 m − nL α2 2 H−1 + mL m Hm − nL α2 α1 →     , α3 →    == 2 H−7 m + 11 m2 + 2 n − 6 m nL −7 m + 11 m2 + 2 n − 6 m n

Out[9]= 99α0 →     , 2

The last result suggests the choice a2Ø4 H11 m2 - 7 m + 2 n - 6 m nL to make the formulas as simple as possible. In[10]:= res = With[{α2T = 2 (-7 m + 11 m^2 + 2 n - 6 m n)},

Append[sol[[1]] /. α2 -> α2T, α2 -> α2T]] 3 Sin@2 φD 4 1 − m Sin@φD2 H−1 + m Sin@φD2 L α1 → 3 H−2 + 7 m − nL, α3 → 4 H−1 + mL m Hm − nL, α2 → 2 H−7 m + 11 m2 + 2 n − 6 m nL= 3 2

Out[10]= 9α0 →  , αC → −     , ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2

So we finally obtain the following differential equation. ∑2 PHn; f » mL ∑3 PHn; f » mL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + 2 H-7 m + 11 m2 + 2 n - 6 m nL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + 4 H-1 + mL m Hm - nL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ∑m3 ∑m2 ∑PHn; f » mL 3 3 sinH2 fL 3 H-2 + 7 m - nL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅ PHn; f » mL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ∑m 2 "#################################### 5# 4 H1 - m sin2 HfLL A check shows that the differential equation is correct. In[11]:= (ansatz /. res) // Simplify Out[11]= 0

b) We more or less repeat the calculation from Part a) of this exercise, but this time we differentiate with respect to n. So again we start by making an ansatz for the differential equation under consideration. In[1]:= w = EllipticPi[n, φ, m];

ansatz = α3 D[w, {n, 3}] + α2 D[w, {n, 2}] + α1 D[w, {n, 1}] + α0 w + αC;

For determining the coefficients α3, α2, α1, α0, and αC, we clear denominators in ansatz. In[3]:= eqs1 = Numerator[Together[ansatz]];

The resulting polynomial has even more terms than the equivalent polynomial in Part a). In[4]:= Length[eqs1] Out[4]= 588

To get an impression of the form of the resulting equation, we set all n and m in the prefactors to 1. In[5]:= Union[(List @@ eqs1) /.

{α3 -> 1, α2 -> 1, α1 -> 1, α0 -> 1, αC -> 1} /. a_Integer n^_. r_ -> r /. m^_. r_ -> r /. a_Integer r_ -> r] Out[5]= 9m, m2 , m3 , n6 , n7 , n8 , n9 , EllipticE@φ, mD, EllipticF@φ, mD, EllipticPi@n, φ, mD, Sin@φD2 , EllipticE@φ, mD Sin@φD2 , EllipticF@φ, mD Sin@φD2 , EllipticPi@n, φ, mD Sin@φD2 , Sin@φD4 , EllipticE@φ, mD Sin@φD4 , EllipticF@φ, mD Sin@φD4 , EllipticPi@n, φ, mD Sin@φD4 , Sin@φD6 , EllipticE@φ, mD Sin@φD6 , EllipticF@φ, mD Sin@φD6 , EllipticPi@n, φ, mD Sin@φD6 , è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Sin@φD 1 + Sin@φD2 , Sin@φD3 1 + Sin@φD2 , Sin@φD5 1 + Sin@φD2 , è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Sin@φD 1 + m Sin@φD2 , Sin@φD3 1 + m Sin@φD2 , Sin@φD5 1 + m Sin@φD2 =

Assuming that for generic n, m, and f, the three terms EllipticE[φ, m], EllipticF[φ, m], and EllipticPi[n, φ, m] are linear independent, we replace them by new variables. In[6]:= eqs2 = eqs1 /. {EllipticE[φ, m] -> we, EllipticF[φ, m] -> wf,

EllipticPi[n, φ, m] -> wp};

Based on the linear independence, we extract the coefficients of we, wf, and wp from eqs2. In[7]:= {ce, cf, cp} = Coefficient[eqs2, #]& /@ {we, wf, wp};

c0 = Expand[eqs2 - (ce we + cf wf + cp wp)];

Solving the resulting system of four equations for the five unknowns α3, α2, α1, α0, and αC gives the following result.

The Classical Special Functions

1188 In[9]:= sol = Factor //@ Solve[{ce == 0, cf == 0, cp == 0, c0 == 0},

{α3, α2, α1, α0, αC}] Solve::svars : Equations may not give solutions for all "solve" variables. More… α1 2 H1 + m − 4 nL

è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! α1 1 − m Sin@φD2 Sin@2 φD 4 H1 + m − 4 nL H−1 + n Sin@φD2 L

 3 , Out[9]= 99α0 → −   , αC → −  Hm − nL H−1 + nL n α1 H−3 m + 8 n + 8 m n − 13 n2 L α1    == α3 →   , α2 →  4 H1 + m − 4 nL 2 H1 + m − 4 nL

The last result suggests the chosen a1Ø4 Hm - 4 n + 1L. In[10]:= res = With[{α1T = 4 (m - 4 n + 1)},

Append[(sol[[1]] /. α1 -> α1T), α1 -> α1T]] ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 − m Sin@φD2 Sin@2 φD H−1 + n Sin@φD2 L

  Out[10]= 9α0 → −2, αC → −  3  ,

α3 → 2 Hm − nL H−1 + nL n, α2 → −3 m + 8 n + 8 m n − 13 n2 , α1 → 4 H1 + m − 4 nL=

So we finally obtain the following differential equation. ∑2 PHn; f » mL ∑3 PHn; f » mL 2 Hm - nL Hn - 1L n ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + H-3 m + 8 n + 8 m n - 13 n2 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + 3 ∑n ∑ n2 "############################## # 1 - m sin2 HfL sinH2 fL ∑PHn; f » mL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ 4 H1 + m - 4 nL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - 2 PHn; f » mL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 3 ∑n Hn sin2 HfL - 1L A quick check shows that the differential equation is correct. In[11]:= (ansatz /. res) // Simplify Out[11]= 0

c) Looking at the derivative of PHn; f » mL with respect to f, one obvious possibility to derive a nonlinear differential equation is the following: Differentiate PHn; f » mL twice with respect to f, and eliminate the trigonometric terms in f. Here are the first two derivatives. In[1]:= {d1 = D[EllipticPi[n, φ, m], φ], d2 = D[d1, φ]}

1 1 − m Sin@φD2 H1 − n Sin@φD2 L 2 n Cos@φD Sin@φD m Cos@φD Sin@φD    +     = è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! H1 − m Sin@φD2 L3ê2 H1 − n Sin@φD2 L 1 − m Sin@φD2 H1 − n Sin@φD2 L2

Out[1]= 9    , ! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Let D1 stand for ∑PHn; f » mL ê ∑ f and D2 for ∑2 PHn; f » mL ê ∑ f2 . Then we have the following set of equations. In[2]:= eqs = Factor[Numerator[Together[

{D1^2 - d1^2, D2^2 - d2^2, Cos[φ]^2 + Sin[φ]^2 - 1}]]] Out[2]= 81 − D12 + D12 m Sin@φD2 + 2 D12 n Sin@φD2 − 2 D12 m n Sin@φD4 − D12 n2 Sin@φD4 + D12 m n2 Sin@φD6 ,

−D22 + 3 D22 m Sin@φD2 + 4 D22 n Sin@φD2 + m2 Cos@φD2 Sin@φD2 + 4 m n Cos@φD2 Sin@φD2 + 4 n2 Cos@φD2 Sin@φD2 − 3 D22 m2 Sin@φD4 − 12 D22 m n Sin@φD4 − 6 D22 n2 Sin@φD4 − 6 m2 n Cos@φD2 Sin@φD4 − 12 m n2 Cos@φD2 Sin@φD4 + D22 m3 Sin@φD6 + 12 D22 m2 n Sin@φD6 + 18 D22 m n2 Sin@φD6 + 4 D22 n3 Sin@φD6 + 9 m2 n2 Cos@φD2 Sin@φD6 − 4 D22 m3 n Sin@φD8 − 18 D22 m2 n2 Sin@φD8 − 12 D22 m n3 Sin@φD8 − D22 n4 Sin@φD8 + 6 D22 m3 n2 Sin@φD10 + 12 D22 m2 n3 Sin@φD10 + 3 D22 m n4 Sin@φD10 − 4 D22 m3 n3 Sin@φD12 − 3 D22 m2 n4 Sin@φD12 + D22 m3 n4 Sin@φD14 , −1 + Cos@φD2 + Sin@φD2
c^(e/2) Out[5]= −1 + D12 − D12 m + c D12 m − 2 D12 n + 2 c D12 n + 2 D12 m n − 4 c D12 m n + 2 c2 D12 m n +

D12 n2 − 2 c D12 n2 + c2 D12 n2 − D12 m n2 + 3 c D12 m n2 − 3 c2 D12 m n2 + c3 D12 m n2 In[6]:= res2a = res2[[1]] /. Cos[φ]^e_ -> c^(e/2) Out[6]= D22 − 3 D22 m + 3 c D22 m − c m2 + c2 m2 + 3 D22 m2 − 6 c D22 m2 + 3 c2 D22 m2 − D22 m3 + 3 c D22 m3 −

3 c2 D22 m3 + c3 D22 m3 − 4 D22 n + 4 c D22 n − 4 c m n + 4 c2 m n + 12 D22 m n − 24 c D22 m n + 12 c2 D22 m n + 6 c m2 n − 12 c2 m2 n + 6 c3 m2 n − 12 D22 m2 n + 36 c D22 m2 n − 36 c2 D22 m2 n + 12 c3 D22 m2 n + 4 D22 m3 n − 16 c D22 m3 n + 24 c2 D22 m3 n − 16 c3 D22 m3 n + 4 c4 D22 m3 n − 4 c n2 + 4 c2 n2 + 6 D22 n2 − 12 c D22 n2 + 6 c2 D22 n2 + 12 c m n2 − 24 c2 m n2 + 12 c3 m n2 − 18 D22 m n2 + 54 c D22 m n2 − 54 c2 D22 m n2 + 18 c3 D22 m n2 − 9 c m2 n2 + 27 c2 m2 n2 − 27 c3 m2 n2 + 9 c4 m2 n2 + 18 D22 m2 n2 − 72 c D22 m2 n2 + 108 c2 D22 m2 n2 − 72 c3 D22 m2 n2 + 18 c4 D22 m2 n2 − 6 D22 m3 n2 + 30 c D22 m3 n2 − 60 c2 D22 m3 n2 + 60 c3 D22 m3 n2 − 30 c4 D22 m3 n2 + 6 c5 D22 m3 n2 − 4 D22 n3 + 12 c D22 n3 − 12 c2 D22 n3 + 4 c3 D22 n3 + 12 D22 m n3 − 48 c D22 m n3 + 72 c2 D22 m n3 − 48 c3 D22 m n3 + 12 c4 D22 m n3 − 12 D22 m2 n3 + 60 c D22 m2 n3 − 120 c2 D22 m2 n3 + 120 c3 D22 m2 n3 − 60 c4 D22 m2 n3 + 12 c5 D22 m2 n3 + 4 D22 m3 n3 − 24 c D22 m3 n3 + 60 c2 D22 m3 n3 − 80 c3 D22 m3 n3 + 60 c4 D22 m3 n3 − 24 c5 D22 m3 n3 + 4 c6 D22 m3 n3 + D22 n4 − 4 c D22 n4 + 6 c2 D22 n4 − 4 c3 D22 n4 + c4 D22 n4 − 3 D22 m n4 + 15 c D22 m n4 − 30 c2 D22 m n4 + 30 c3 D22 m n4 − 15 c4 D22 m n4 + 3 c5 D22 m n4 + 3 D22 m2 n4 − 18 c D22 m2 n4 + 45 c2 D22 m2 n4 − 60 c3 D22 m2 n4 + 45 c4 D22 m2 n4 − 18 c5 D22 m2 n4 + 3 c6 D22 m2 n4 − D22 m3 n4 + 7 c D22 m3 n4 − 21 c2 D22 m3 n4 + 35 c3 D22 m3 n4 − 35 c4 D22 m3 n4 + 21 c5 D22 m3 n4 − 7 c6 D22 m3 n4 + c7 D22 m3 n4

So the final differential equation is given by the sum (head Plus) term of the following resultant. In[7]:= res3 = Factor[Resultant[res1a, res2a, c]] // Simplify Out[7]= −m5 n10 H16 D114 H−1 + mL Hm − nL6 H−1 + nL2 −

27 D12 D24 m4 n2 − D26 m4 n2 − 8 D112 Hm − nL3 H2 m4 H−1 + nL2 + 2 n3 H2 − 2 n + n2 L − 2 m n2 H6 − 5 n + n2 + n3 L + 3 m2 n H13 − 20 n + 7 n2 + 2 n3 L − m3 H4 + 29 n − 64 n2 + 33 n3 LL − 4 D1 D22 m2 n H243 m2 n + D22 Hm − nL2 H−10 n + m H−8 + 9 nLLL + D16 n H−729 m4 n + D24 H−1 + mL Hm − nL4 n − 9 D22 m2 H−3 m H−12 + nL n2 − 10 n3 + 3 m2 n H4 − 16 n + 3 n2 L + 2 m3 H8 − 15 n + 9 n2 LLL − D18 H2 D22 Hm − nL2 H2 m H−10 + nL n3 + 4 n4 + m3 n H8 + 15 n − 33 n2 L − 3 m2 n2 H9 − 19 n + 2 n2 L + 4 m4 H2 − 5 n + 3 n2 LL +

The Classical Special Functions

1190

27 m2 n H24 m n2 − 8 n3 − 3 m2 n H26 − 18 n + 9 n2 L + m3 H8 + 27 n − 54 n2 + 27 n3 LLL + D110 H8 H−2 + D22 H−1 + nLL n6 − 8 m6 H2 + H27 + D22 L n − H54 + D22 L n2 + 27 n3 L + 8 m3 n3 H202 − 135 n + 27 n2 + 27 n3 − 10 D22 H−1 + n2 LL + 8 m2 n4 H−84 + 54 n − 27 n2 + 5 D22 H−2 + n + n2 LL − 8 m n5 H−12 + D22 H−5 + 4 n + n2 LL − m4 n2 H40 D22 H1 + n − 2 n2 L + 3 H755 − 702 n + 27 n2 + 216 n3 LL + m5 n HD22 H8 + 32 n − 40 n2 L + 3 H176 + 315 n − 846 n2 + 459 n3 LLLL

So we finally obtain the following differential equation. 14

∑PHn; f » mL y ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz 16 Hm - 1L Hm - nL6 Hn - 1L2 ijj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ∑f k { 8 Hm - nL3 H2 Hn - 1L2 m4 - Hn Hn H33 n - 64L + 29L + 4L m3 + 3 n Hn Hn H2 n + 7L - 20L + 13L m2 12

i ∑ PHn; f » mL yz 2 n2 Hn Hn2 + n - 5L + 6L m + 2 n3 HHn - 2L n + 2LL jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z + ∑f k { i ∑2 PHn; f » mL zy2 y ij ij y jj-8 jj2 - jjjjij ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z - 27 n + 27zzzz Hn - 1L nzzzz m6 + j j j 2 ∑f { kk k k { { 2 i y i ∑2 PHn; f » mL yz ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z Hn - 1L H5 n + 1Lzzzz m5 n jjjj3 H9 n Hn H51 n - 94L + 35L + 176L - 8 jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 ∑f k { k { 2 y i i ∑2 PHn; f » mL yz ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z + 3 H27 n H8 n2 + n - 26L + 755Lzzzz m4 + n2 jjjj40 H-2 n2 + n + 1L jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 ∑f k { k { 2 y i i ∑2 PHn; f » mL yz 8 n3 jjjj-10 Hn2 - 1L jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z + 27 n Hn2 + n - 5L + 202zzzz m3 + 2 f ∑ f k { k { 2 y i i ∑2 PHn; f » mL yz 8 n4 jjjj5 Hn2 + n - 2L jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z - 27 Hn - 2L n - 84zzzz m2 2 ∑ f k { k {

y ii ∑2 PHn; f » mL yz2 y y ii ∑2 PHn; f » mL yz2 8 n5 jjjjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z Hn - 1L Hn + 5L - 12zzzz m + 8 jjjjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z Hn - 1L - 2zzzz n6 zzzz 2 2 ∑ f ∑ f k k { { k k { { { 10

ij ∑PHn; f » mL yz ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ∑f { k ij jj27 n HH27 n Hn - 1L2 + 8L m3 - 3 n H9 Hn - 2L n + 26L m2 + 24 n2 m - 8 n3 L m2 + 2 Hm - nL2 j k H4 Hn - 1L H3 n - 2L m4 + n H3 n H5 - 11 nL + 8L m3 - 3 Hn - 9L n2 H2 n - 1L m2 + 2 Hn - 10L n3 m + 4 n4 L 2

ij ∑2 PHn; f » mL yz j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z ∑ f2 k {

yz i ∑PHn; f » mL y8 zz jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz + zk ∑f { {

i n jjjj-729 n m4 + 9 H-2 H3 n H3 n - 5L + 8L m3 - 3 n Hn H3 n - 16L + 4L m2 + 3 Hn - 12L n2 m + 10 n3 L k 2

4

i ∑2 PHn; f » mL yz ij ∑2 PHn; f » mL yz 2 j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z m + Hm - 1L Hm - nL4 n jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z 2 ∑f ∑ f2 k k { {

∑PHn; f » mL y6 zyz ij ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz zz j ∑f { {k

2 2 ij ∑2 PHn; f » mL yz 2 ijj i ∑2 PHn; f » mL yz yzz ij ∑ PHn; f » mL yz4 j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z m n jj243 n m2 + Hm - nL2 Hm H9 n - 8L - 10 nL jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z zz j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 2 ∑f ∑f ∑f { k k { { {k k 4

6

i ∑2 PHn; f » mL yz 4 2 ji ∑PHn; f » mL zy2 ij ∑2 PHn; f » mL yz 4 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z m n j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z m n = 0 27 jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ∑f2 ∑f2 ∑f k { k k { { Here is a quick numerical check that the derived differential equation is correct. (A symbolic check would be much more expensive because of the high powers in res3.)

Solutions

1191 In[8]:= res3[[-1]] /. {D1 -> D[EllipticPi[n, φ, m], φ],

D2 -> D[EllipticPi[n, φ, m], φ, φ]} /. {n -> 1/2, m -> 1/3, φ -> N[3/7, 32]}

Out[8]= 0. × 10−31

d) This is the integrand. In[1]:= f[x_] = Sqrt[3 - 12 x]/Sqrt[(-1 + 12 x)(-1 - 24 x + 48 x^2)];

Unfortunately, just using Integrate to get the definite integral fails. (If this had worked, this would not be an exercise of the GuideBooks.) In[2]:= lowerLimit = (3 - 2 Sqrt[3])/12;

upperLimit = 1/12; ∂ = 10^-40; Integrate[f[x], {x, lowerLimit, upperLimit}] 1 è!!!!!!!!!!!!!!!!!!!!!  12 3 − 12 x   !  x Out[5]= ‡ è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 H−1 + 12 xL H−1 − 24 x + 48 x2 L   I3−2 3 M 12

The integrand has three singularities. In[6]:= singularities = x /. NSolve[(-1 + 12 x)(-1 - 24 x + 48 x^2) == 0, x] Out[6]= 8−0.0386751, 0.0833333, 0.538675
Identity, PlotStyle -> {{Thickness[0.002]}, {Thickness[0.002], Dashing[{0.02, 0.01}]}}]& @@@ (* domains for continuous curve parts *) Partition[Flatten[{-3/4, singularities, 3/4}], 2, 1], DisplayFunction -> $DisplayFunction, Frame -> True, Axes -> False, PlotRange -> {-10, 10}, (* x-interval of interest *) Prolog -> {{Hue[0], Thickness[0.02], Line[{{(3 - 2 Sqrt[3])/12, 0}, {1/12, 0}}]}}]] 10 7.5 5 2.5 0 -2.5 -5 -7.5 -0.6

-0.4

-0.2

0

0.2

0.4

0.6

Because each singularity is of the form Hx - x0 L1ê2 , the integrand is integrable at the singularities and NIntegrate can calculate a high-precision approximation of the integral. In[8]:= NIntegrate[f[x], {x, lowerLimit, upperLimit},

WorkingPrecision -> 50, MaxRecursion -> 9, PrecisionGoal -> 30] NIntegrate::ncvb : NIntegrate failed to converge to prescribed accuracy after 10 recursive bisections in x near x = 0.08333333333333333`. More… Out[8]= 0.2993076634918812681170097 + 0. × 10−26 

The above Power::infy and Infinity::indet messages from Integrate often indicate problems with determining the definite integral from the indefinite one. (For example, expressions of the form 0 ê 0 result from substituting limits.) Indeed, Mathematica has no problems calculating the corresponding indefinite integral.

The Classical Special Functions

1192 In[9]:= int = Integrate[f[x], x] // FullSimplify

i j j k

è!!!!!

2 H−1 + 3 L j ! 3ê2 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% jè!!!!!!!!!!!!!!!!!!!!!  Out[9]= j 1 +  j −1 + 4 x H−1 + 12 xL −1 + 12 x

è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! è!!!!! è!!!!! 2 H1 + 3 L i −H−3 + 3 L H−1 + 4 xL è!!!!! $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% jEllipticFAArcSinA  −1 +   j  è!!!!!!!!!!!!!!!!!!!!!!!! !  E, 2 + 3 E − −1 + 12 x j −1 + 12 x k è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! y è!!!!! 1 −H−3 + 3 L H−1 + 4 xL z è!!!!! y è!!!!! zz z ì EllipticPiA  I3 + 3 M, ArcSinA   zz z !  E, 2 + 3 Ez è!!!!!!!!!!!!!!!!!!!!!!!! z 2 −1 + 12 x {{ "####################### è!!!!! è!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! J6 31ê4 −1 + 3 1 − 4 x 1 + 12 x H1 + 4 x H−7 + 12 xLL N

The indefinite integral is a smooth function inside the region of integration. In[10]:= Plot[Re @ int, {x, lowerLimit, upperLimit},

Frame -> True, Axes -> False] 0 -0.05 -0.1 -0.15 -0.2 -0.25 -0.3 -0.04

-0.02

0

0.02

0.04

0.06

0.08

But when substituting limits, we get indeterminate expressions. In[11]:= (* avoid further message generation *)

Internal`DeactivateMessages[ {int /. x -> upperLimit, int /. x -> lowerLimit} // N[#, 22]&] Out[12]= 8Indeterminate, Indeterminate
upperLimit - ∂) -

(int /. x -> lowerLimit + ∂), 200] // N

Out[13]= 0.299308 + 0. 

Series is be able to obtain expansions at the endpoints of integration. In[14]:= Assuming[Element[x, Reals] && x < upperLimit,

Series[int, {x, upperLimit, 1}]] // FullSimplify[#, Element[x, Reals] && x < upperLimit]& 1 1 2 1 1 è!!!!! è!!!!! Out[14]= JEllipticFAπ −   I−1 + 3 M H−1 + 12 xL −   LogA−  I−3 + 3 ME +   LogA−  + xE, 16 2 9 2 12 1 1 è!!!!! è!!!!! è!!!!! 2 + 3 E − EllipticPiA  I3 + 3 M, π −   I−1 + 3 M H−1 + 12 xL − 2 16 1 2 1 1 1 0 è!!!!! è!!!!!   LogA−  I−3 + 3 ME +   LogA−  + xE, 2 + 3 EN OAx −  E 2 9 2 12 12

The main difficulty in obtaining the last expansion is the sin-1 IH31ê2 + 1 + 4 ê H12 x - 1LL elliptic integrals. For x Ø 1 ê 12, this expression diverges logarithmically.

1ê2

In[15]:= elliptics = Cases[int, _EllipticF | _EllipticPi, Infinity]

è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! è!!!!! −H−3 + 3 L H−1 + 4 xL è!!!!! 3 E, −1 + 12 x è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! 1 −H−3 + 3 L H−1 + 4 xL è!!!!! è!!!!! EllipticPiA  I3 + 3 M, ArcSinA   !  E, 2 + 3 E= è!!!!!!!!!!!!!!!!!!!!!!!! 2 −1 + 12 x

 Out[15]= 9EllipticFAArcSinA  !  E, 2 + è!!!!!!!!!!!!!!!!!!!!!!!!

ë H21ê2 31ê4 LM term inside the

Solutions

1193 In[16]:= Assuming[Element[x, Reals] && x < upperLimit,

Series[elliptics[[1, 1]], {x, upperLimit, 1}]] // FullSimplify[#, Element[x, Reals] && x < upperLimit]& 1 2 1 1 3 1 1 2 è!!!!! è!!!!! Out[16]= Jπ −   LogA−  I−3 + 3 ME +   LogA−  + xEN + −   I−1 + 3 M Jx −  N + OAx −  E 2 9 2 12 4 12 12

Resorting to the integral representation of FHj » mL allows us to calculate the value of FHi ¶ » mL. Mathematica does not evaluate this expression by default. In[17]:= EllipticF[I ∞, m] Out[17]= EllipticF@ ∞, mD In[18]:= Integrate[1/(Sqrt[1 - t^2] Sqrt[1 - m t^2]), {t, 0, I Infinity},

GenerateConditions -> False] // PowerExpand Out[18]=  EllipticK@1 − mD

We generate a rule to replace the incomplete elliptic integral of the first kind. In[19]:= FRule = EllipticF[ϕ_, m_] :> EllipticK[m] - EllipticK[1/m]/Sqrt[m]; In[20]:= (* quick numerical check for the rule *)

elliptics[[1]] - FRule[[2]] /. {x -> upperLimit - ∂, m -> elliptics[[1, 2]]} // N[#, 100]& // N Out[21]= 1.95035 × 10−20 + 0. 

The prefactor of FHi ¶ » mL also results in expressions of the form 0/0 after substitution of x Ø 1 ê 2. But because it is an algebraic function, it can be easily calculated using Limit. In[22]:= cf = Coefficient[int, elliptics[[1]]]; In[23]:= {cfl, cfu} = FullSimplify[RootReduce @

{Limit[cf, x -> upperLimit, Direction -> +1], Limit[cf, x -> lowerLimit, Direction -> -1]}] è!!!!! è!!!!!  I3 + 3 M% , −  $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  I3 + 3 M% = Out[23]= 9−  $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1 6

1 2

1 6

1 2

In[24]:= fPart = (cfu (elliptics[[1]] /. FRule) -

cfl (elliptics[[1]] /. x -> lowerLimit)) // FullSimplify 1 1 è!!!!! è!!!!!  I3 − 3 M% EllipticK@2 − 3 D Out[24]=  $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6 2 In[25]:= (* quick numerical check *)

{(cf elliptics[[1]] /. (x -> upperLimit - 10^-40)) (cf elliptics[[1]] /. (x -> lowerLimit + 10^-40)) // N[#, 100]& // N, N[fPart]} Out[26]= 80.225014 + 0. , 0.225014
(* ±1 depending on ±I ϕ *)

I (EllipticK[1 - m] - n EllipticPi[1 - n, 1 - m])/(1 - n); In[28]:= plusMinus1 = Round[elliptics[[2]]/ΠRule[[2]] /. {x -> 1/12 - 10^-40,

m ->

elliptics[[2, 3]], n ->

elliptics[[2, 1]]}];

(* quick numerical check for the rule *) {elliptics[[2]] , plusMinus1 ΠRule[[2]]} /. {x -> upperLimit - ∂, m -> elliptics[[2, 3]], n -> elliptics[[2, 1]]} // N[#, 30]& // N Out[31]= 80. − 0.522639 , 0. − 0.522639 < In[32]:= cp = Coefficient[int, elliptics[[2]]]; In[33]:= {cpl, cpu} = FullSimplify[RootReduce @

{Limit[cp, x -> upperLimit, Direction -> 1], Limit[cp, x -> lowerLimit, Direction -> -1]}]

The Classical Special Functions

1194 è!!!!! è!!!!!  I3 + 3 M% ,  $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  I3 + 3 M% = Out[33]= 9  $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1 6

1 2

1 6

1 2

In[34]:= pPart = (cpu (plusMinus1 elliptics[[2]] /. ΠRule) -

cpl (elliptics[[2]] /. x -> lowerLimit)) // FullSimplify 1 6 H1 + 3 L

Out[34]= −   è!!!!!

i j 1 1 è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! j j  I3 + 3 M% J−2 EllipticK@−1 − 3 D + I3 + 3 M EllipticPiA  I−1 − 3 M, −1 − 3 E − j j $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 2 k  I1 +

z 1 è!!!!! è!!!!! è!!!!! y z 3 M EllipticPiA  I3 + 3 M, 2 + 3 ENz z z 2 {

In[35]:= (* quick numerical check *)

{(cp elliptics[[2]] /. (x -> upperLimit - ∂)) (cp elliptics[[2]] /. (x -> lowerLimit + ∂)) // N[#, 100]& // N, N[pPart]} Out[36]= 80.0742937 + 0. , 0.0742937 + 7.9176 × 10−16 
-I EllipticK[1 - z] + EllipticK[1/z]/Sqrt[z]; In[40]:= badzs = Select[First /@ Union[Cases[res, _EllipticK, Infinity]],

# > 1&]; res /. If[badzs =!= {}, KRule[badzs[[1]]], {}] // FullSimplify 1 j 1 è!!!!! # è!!!!! i"################### ! j 3 − 3 EllipticK@2 − 3 D −  Out[41]=  ! è!!!! è!!!! 6 2 k 1+ 3 1 "################### è!!!!! # è!!!!! è!!!!! è!!!!! è!!!!! J 3 + 3 J−2 EllipticK@−1 − 3 D + I3 + 3 M EllipticPiA  I−1 − 3 M, −1 − 3 E − 2 1 è!!!!! è!!!!! è!!!!! y  I1 + 3 M EllipticPiA  I3 + 3 M, 2 + 3 ENNz z 2 {

So we have the following result. "################### è!!!! 1+ 3 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 12

ij 1 - è!!!! ij"################### 3 yz 4 è!!!! è!!!! è!!!! è!!!! è!!!! yz jj 3 - è!!!! 3 K jjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ zzz - 2 3 IKI2 - 3 M + I 3 - 3M PI 3 - 2 … 2 - 3 MMzzz j 2 k { k {

It agrees with the high-precision numerical integration value calculated above. In[42]:= N[%, 30] Out[42]= 0.299307663491881268117009677712 + 0. × 10−31 

e) We start by deriving partial differential equations for zHx, yL by differentiating the starting equation. In[1]:= (* D[Integrate[f[τ], {τ, 0, Τ}], Τ] == f[Τ] *)

integrand[τ_] := 1/Sqrt[(1 - τ^2) (1 - k τ^2)]

In[3]:= eqs1 = FullSimplify[{integrand[x] - integrand[z[x, y]] D[z[x, y], x],

integrand[y] - integrand[z[x, y]] D[z[x, y], y]}]

Solutions

1195 zH1,0L @x, yD H−1 + z@x, yD2 L H−1 + k z@x, yD2 L

1 H−1 + x2 L H−1 + k x2 L

Out[3]= 9   ! −     , è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

zH0,1L @x, yD 1    =   ! −  è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! H−1 + y2 L H−1 + k y2 L H−1 + z@x, yD2 L H−1 + k z@x, yD2 L

For further algebraic manipulations we eliminate the radicals. In[4]:= Sx = Numerator[Together[eqs1[[1, 1]]^2 - eqs1[[1, 2]]^2]] Out[4]= 1 − z@x, yD2 − k z@x, yD2 + k z@x, yD4 − zH1,0L @x, yD + 2

x2 zH1,0L @x, yD + k x2 zH1,0L @x, yD − k x4 zH1,0L @x, yD 2

2

2

In[5]:= Sy = Numerator[Together[eqs1[[2, 1]]^2 - eqs1[[2, 2]]^2]] Out[5]= 1 − z@x, yD2 − k z@x, yD2 + k z@x, yD4 − zH0,1L @x, yD + 2

2

H0,1L

y z

2

H0,1L

@x, yD + k y z 2

2

H0,1L

@x, yD − k y z 4

2

@x, yD

Now it is straightforward to show that zHx, yL obeys the derived differential equations. In[6]:= id = ((y^2 - z^2)^2 + x^4 (k y^2 z^2 - 1)^2 -

2 x^2 (z^2 + y^2 (1 + z^2 (k (y^2 + z^2 - 2) - 2)))); In[7]:= (PolynomialGCD[id, Numerator[Together[

#1 /. Solve[(D[id /. z -> z[x, y], #2]) == 0, D[z[x, y], #2]][[1]]]] /. z[x, y] -> z])& @@@ {{Sx, x}, {Sy, y}} // Union Out[7]= 8x4 − 2 x2 y2 + y4 − 2 x2 z2 − 2 y2 z2 + 4 x2 y2 z2 + 4 k x2 y2 z2 − 2 k x4 y2 z2 − 2 k x2 y4 z2 + z4 − 2 k x2 y2 z4 + k2 x4 y4 z4
False] 4 r r0 4 r r0  µ µ0 I−2 HHr − r0L2 + z2 L EllipticEA−   E + 2 Hr2 + r02 + z2 L EllipticKA−   EM Hr−r0L2 +z2 Hr−r0L2 +z2        Out[1]=  è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 4 π r Hr − r0L + z2

The last can be rewritten in the following form. In[2]:= Aϕ =  µ µ0 r0 /(4 Pi) Pi r r0 *

Hypergeometric2F1[3/4, 5/4, 2, 4 r^2 r0^2/(r^2 + r0^2 + z^2)^2]/ (r^2 + r0^2 + z^2)^(3/2) 2

Out[2]=

2

4 r r0 r r02  µ µ0 Hypergeometric2F1A 34 , 54 , 2,   E Hr2 +r02 +z2 L2      3ê2 4 Hr2 + r02 + z2 L

Note the compactness of this formula, expressed in terms of hypergeometric functions, compared with the longer formulas using elliptic integrals found in textbooks and the original literature [538]; for some similar hypergeometric expressions for inductance formulas, see [650], [651]. Using BHrL = rot AHrL in cylindrical coordinates, this is the z-component of the magnetic field BHrL. In[3]:= Bz = 1/r D[r Aϕ, r]

The Classical Special Functions

1196

Out[3]=

1  r

4 r2 r02 i 3 r3 r02  µ µ0 Hypergeometric2F1A 3 , 5 , 2,   E j j 4 4 Hr2 +r02 +z2 L2 j j −       + j 5ê2 j j 4 Hr2 + r02 + z2 L k 2

2

4 r r0 r r02  µ µ0 Hypergeometric2F1A 34 , 54 , 2,   E Hr2 +r02 +z2 L2      + 3ê2 2 Hr2 + r02 + z2 L 16 r3 r02 8 r r02 9 4 r2 r02 y 15 r2 r02 J−   +   N  µ µ0 Hypergeometric2F1A 74 ,   , 3,   E z z 4 Hr2 +r02 +z2 L3 Hr2 +r02 +z2 L2 Hr2 +r02 +z2 L2 z          z z 3ê2 z z 128 Hr2 + r02 + z2 L {

Thus, this is the radial component. In[4]:= Br = -D[Aϕ, z] 2

Out[4]=

2

4 r r0 3 r r02 z  µ µ0 Hypergeometric2F1A 34 , 54 , 2,   E Hr2 +r02 +z2 L2       + 5ê2 2 2 2 4 Hr + r0 + z L 2

2

4 r r0 15 r3 r04 z  µ µ0 Hypergeometric2F1A 74 , 94 , 3,   E Hr2 +r02 +z2 L2       9ê2 2 2 2 8 Hr + r0 + z L

To get series expansions of the magnetic field, we can also proceed in another way. Instead of first carrying out the integration and then making a series expansion around r = 0, we can first make a series expansion of the integrand around r = 0 and then integrate term by term. The next inputs demonstrate this process. In[5]:= AϕIntegrand =  µ µ0 r0/(4 Pi) Cos[ϕ]/Sqrt[z^2 + r^2 + r0^2 - 2r r0 Cos[ϕ]]; In[6]:= BzIntegrand = Simplify /@ Series[1/r D[r AϕIntegrand, r], {r, 0, 5}] Out[6]=

r02  µ µ0 Cos@ϕD2 r0  µ µ0 Cos@ϕD 3 r0  µ µ0 Cos@ϕD Hr02 − 2 z2 + 3 r02 Cos@2 ϕDL r    +      +  +  è!!!!!!!!!!!!!!!!!!!!!! 16 π Hr02 + z2 L5ê2 2 π Hr02 + z2 L3ê2 4 π r02 + z2 r 2 2 2 2 2 2 2 r0  µ µ0 Cos@ϕD H−3 Hr0 + z L + 5 r0 Cos@ϕD L r       + 2 π Hr02 + z2 L7ê2 5 r0  µ µ0 Cos@ϕD H9 r04 − 72 r02 z2 + 24 z4 + 20 r02 Hr02 − 6 z2 L Cos@2 ϕD + 35 r04 Cos@4 ϕDL r3         + 256 π Hr02 + z2 L9ê2 3 r02  µ µ0 Cos@ϕD2 H29 r04 − 40 r02 z2 + 120 z4 − 28 r02 Hr02 + 10 z2 L Cos@2 ϕD + 63 r04 Cos@4 ϕDL r4          128 π Hr02 + z2 L11ê2 1 +    2048 π Hr02 + z2 L13ê2 H7 r0  µ µ0 Cos@ϕD H50 r06 − 900 r04 z2 + 1200 r02 z4 − 160 z6 + 105 r02 Hr04 − 16 r02 z2 + 16 z4 L Cos@2 ϕD + 126 r04 Hr02 − 10 z2 L Cos@4 ϕD + 231 r06 Cos@6 ϕDL r5 L + O@rD6

In[7]:= Integrate[#, {ϕ, 0, 2Pi}]& /@ Normal[BzIntegrand] Out[7]=

3 r2 r02 Hr02 − 4 z2 L  µ µ0 r02  µ µ0 45 r4 r02 Hr04 − 12 r02 z2 + 8 z4 L  µ µ0    +    +     8 Hr02 + z2 L7ê2 2 Hr02 + z2 L3ê2 128 Hr02 + z2 L11ê2

In[8]:= BrIntegrand = Simplify /@ Series[-D[AϕIntegrand, z], {r, 0, 5}] Out[8]=

r0 z  µ µ0 Cos@ϕD 3 r02 z  µ µ0 Cos@ϕD2 r 3 r0 z  µ µ0 Cos@ϕD H3 r02 − 2 z2 + 5 r02 Cos@2 ϕDL r2   +    +       + 4 π Hr02 + z2 L3ê2 4 π Hr02 + z2 L5ê2 16 π Hr02 + z2 L7ê2 5 r02 z  µ µ0 Cos@ϕD2 Hr02 − 6 z2 + 7 r02 Cos@2 ϕDL r3       + 16 π Hr02 + z2 L9ê2 15 r0 z  µ µ0 Cos@ϕD IHr02 + z2 L2 − 14 r02 Hr02 + z2 L Cos@ϕD2 + 21 r04 Cos@ϕD4 M r4        + 32 π Hr02 + z2 L11ê2 21 r02 z  µ µ0 Cos@ϕD2 I5 Hr02 + z2 L2 − 30 r02 Hr02 + z2 L Cos@ϕD2 + 33 r04 Cos@ϕD4 M r5         + O@rD6 32 π Hr02 + z2 L13ê2

In[9]:= Integrate[#, {ϕ, 0, 2Pi}]& /@ Normal[BrIntegrand] Out[9]=

15 r3 r02 z H3 r02 − 4 z2 L  µ µ0 3 r r02 z  µ µ0 105 r5 r02 z H5 r04 − 20 r02 z2 + 8 z4 L  µ µ0    +    +     32 Hr02 + z2 L9ê2 4 Hr02 + z2 L5ê2 256 Hr02 + z2 L13ê2

We now look at both components in a neighborhood of the axis of symmetry. In[10]:= Series[Bz, {r, 0, 3}] // Simplify

Solutions

1197 Out[10]=

3 r02 Hr02 − 4 z2 L  µ µ0 r2 r02  µ µ0   + O@rD4    +  8 Hr02 + z2 L7ê2 2 Hr02 + z2 L3ê2

In[11]:= Series[Br, {r, 0, 3}] // Simplify Out[11]=

3 r02 z  µ µ0 r 15 r02 z H3 r02 − 4 z2 L  µ µ0 r3    +    + O@rD4 4 Hr02 + z2 L5ê2 32 Hr02 + z2 L9ê2

We can very easily visualize the vector field BHrL in the r,z-plane (r > 0). To achieve this, we choose concrete values for the parameters. In[12]:= Needs["Graphics`PlotField`"] In[13]:= valueRules = {µ -> 1, µ0 -> 1, r0 -> 1,  -> 1};

PlotVectorField[Evaluate[N[{Br, Bz} /. valueRules]], {r, 0.1, 2.3, 0.14}, {z, -1.5, 1.5, 0.14}]

We clearly see the circular flow of the magnetic field around the wire. We could go on and use ContourPlot3D to make a picture of surfaces of constant magnitude of the magnetic field of the current under investigation. For a Helmholtz coil, we have to superimpose the magnetic fields of two parallel circular rings, which are a distance r0 apart. In[15]:= BHr = (Br /. z -> z + r0/2) + (Br /. z -> z - r0/2); In[16]:= BHz = (Bz /. z -> z + r0/2) + (Bz /. z -> z - r0/2);

We now find the series expansion at the point 80, 0< of symmetry. In[17]:= {hz, hr} = (Series[Normal[Series[BHz, {r, 0, 5}]], {z, 0, 5}] //

Normal // Simplify

// PowerExpand)& /@ {BHz, BHr}

1

4 4 4 Out[17]= 9   è!!!! !  H8 H125 r0 H125 r0 − 144 z L −

r09

78125 5 18 r4 H375 r04 − 6160 r02 z2 + 8736 z4 L + 240 r2 H225 r04 z2 − 616 r02 z4 LL  µ µ0L, 1 4 4 4 4 4 2 2 4   !  H8 H125 r0 H125 r0 − 144 z L − 18 r H375 r0 − 6160 r0 z + 8736 z L + è!!!! 78125 5 r09 240 r2 H225 r04 z2 − 616 r02 z4 LL  µ µ0L=

After some minor manipulations, we obtain the following expression for the magnetic field in the vicinity of the symmetry point. In[18]:=  µ µ0/r0 * (Normal[Series[Normal[Series[Sqrt[hz^2 + hr^2],

{z, 0, 5}]], {r, 0, 5}]] /. (* remove prefactors *) Power[^2 µ^2 µ0^2/r0^2, 1/2] -> 1) i 8 "####### ij i 432 "####### y 1152 "####### 177408 "####### 1257984 "####### 2 25 z4 25 25 z2 25 z4 z j 1 j jj j j z −  + Out[18]=  j 5 −    + r4 j   +    −    z j j j z j j j z 4 4 6 j 625 r0 z r0 jj 5 625 r0 15625 r0 78125 r08 kk k { y i 3456 "####### 236544 "####### 25 z2 25 z4 y z z j zy z z j  z z r2 j   −    z z z  µ µ0z j z z j z z z j zz 625 r04 15625 r06 { k {{

We see that there are many terms of the order (radial or z-distance to the midpoint)/(ring radius)4 , not only the one of the form Hz ê r0 L4 , which are mentioned typically (e.g., [1156]). We now graphically examine the homogeneity of the resulting magnetic field. To answer the question of which direction has the largest homogeneity, we consider †BHr, zL§ as a function of r and z (right graphic).

The Classical Special Functions

1198 In[19]:= Show[GraphicsArray[

Block[{$DisplayFunction = Identity, ∂ = 10^-7}, {(* vector field plot *) PlotVectorField[Evaluate[N[{BHr, BHz} /. valueRules]], {r, ∂, 2/3 + ∂, (2/3 + 2 ∂)/10}, {z, -2/3, 2/3, (4/3)/10}], (* 3D plot of field magnitude *) Plot3D[Evaluate[Sqrt[Br^2 + Bz^2] /. valueRules], {r, ∂, 0.2}, {z, ∂, 0.2}, PlotRange -> All, AxesLabel -> {"r", "z", None}, Compiled -> False]}]]]

The last plot shows the somewhat lesser homogeneity in the z-direction. For more on circular currents (including fields near the flow, formulas for the fields in terms of Legendre functions, etc.), see [454]; for saddle-shaped Helmholtz coils, see [570]. For the movement of particles in such magnetic fields, see [498]. 3. Weierstrass Function a) In view of the periodicity and then rotational symmetry of this function, it suffices to look at just one of these parts. Here is a detailed look at the part with the pole. In[1]:= With[{pp = 90},

Show[GraphicsArray[ Plot3D[Re[#1[x + I y, 2.66, 2.66]], {x, -1, 1}, {y, -1, 1}, PlotPoints -> pp, SphericalRegion -> True, Mesh -> False, ClipFill -> None, (* indicate parameters *) PlotLabel -> StyleForm[#2 "[z, 8/3, 8/3I]", FontFamily -> "Courier", FontSize -> 6], PlotRange -> {-6, 10}, DisplayFunction -> Identity]& @@@ {{WeierstrassP, "℘"}, {WeierstrassPPrime, "℘'"}}]]]

℘@z, 8ê3, 8ê3ID

10 5 0 -5 -1

℘'@z, 8ê3, 8ê3ID

1 0.5

- 0.5

0 0

- 0.5 0.5 1

-1

10 5 0 -5 -1

1 0.5

- 0.5

0 0

-0.5 0.5 1

-1

Note that the half-periods for the values of the invariants g2 = 2.66 and g3 = 2.66 are given by w = 1.18983… and w£ = - 0.59491… + i 1.23788…. Using these values, we can implement a visualization of the real part or the imaginary part or the phase (determined via the first argument of manyPeriodParallelograms ) Weierstrass function on a bigger region, consisting of Hm + 1L2 period parallelograms. (Here, we use a contour plot instead of Plot3D.) In[2]:= manyPeriodParallelograms[reImAbsArg_, pp_, plotRange_, m_] :=

Module[{ω, ωs, tab, gr, l, ls, h, gr1, gr2, cs = 20}, (* the periods *) {ω, ωs} = WeierstrassHalfPeriods[{2.66, 2.66}]; (* ContourPlot of reImAbsArg[WeierstrassP] == 0 inside the period parallelogram; to do this transform the period parallelogram

Solutions

1199 into a square and then transform back *) gr = Graphics[ListContourPlot[ Table[reImAbsArg @ WeierstrassP[-ω - ωs + s/pp 2ω + t/pp 2ωs, 2.66, 2.66], {s, 0, pp}, {t, 0, pp}], PlotRange -> plotRange, ContourShading -> False, Contours -> cs, DisplayFunction -> Identity]][[1]]; (* the back transformation *) l = Abs[2ω]; ls = Abs[2ωs]; h = ls Sin[Arg[ωs]]; gr1 = Map[If[Head[#] === List, {(#[[1]] - 1)/pp l, (#[[2]] - 1)/pp h}, #]&, gr, {-2}]; gr2 = Map[If[Head[#] === List, {#[[1]] + (#[[2]] - 0)/h Re[2ωs], #[[2]]}, #]&, gr1, {-2}]; (* make more period parallelograms *) Show[Graphics[{Table[Map[If[Head[#] === List, {#[[1]] + i Re[2ω] + j Re[2ωs], #[[2]] + i Im[2ω] + j Im[2ωs]}, #]&, gr2, {-2}], {i, -m, m}, {j, -m, m}]}], AspectRatio -> Automatic]];

This shows the contour lines of the square of the argument. In[42]:= manyPeriodParallelograms[Arg[#]^2&, 43, All, 1]

b) Here is a picture of a suitable ģ Hz; g2 , g3 L. (Suitable means here that the period parallelogram has an appropriate extension for the picture to be constructed.) In[1]:= {g2, g3} = {-207.228 + 906.1 I, 658.759 + 188.243 I};

{ω1,

ω2} = WeierstrassHalfPeriods[{g2, g3}];

In[3]:= (* to avoid the edges of the period parallelogram *)

℘P[z_] = WeierstrassPPrime[z, g2, g3];

∂ = 10^-13;

℘PP3D = ParametricPlot3D[ (* use {Re[z], Im[z], Re[f[z]]} *) {Re[#], Im[#], Re[℘P[#]]}&[x ω1 + y ω2], {x, -1 + ∂, 1 - ∂}, {y, -1 + ∂, 1 - ∂}, BoxRatios -> {1, 1, 1}, PlotPoints -> 40, Compiled -> False, PlotRange -> Automatic] unitPolys1 = Cases[℘PP3D, _Polygon, Infinity]; -0.2

0

0.4 0.2

- 0.4 400 200 0

-200 - 400 -0.4 -0.2

0

0.2

0.4

Although the picture looks good, the polygons forming the graphics are not ideal. Because of the Automatic setting of the PlotRange option of ParametricPlot3D , the picture looks decent. But some of the polygons extend far outside the displayed volume. In[7]:= {Min[#], Max[#]}&[ Last /@ Level[unitPolys1, {-2}]]

The Classical Special Functions

1200 Out[7]= 8−993122., 993122.
3, (* split polygon into triangles *) newPolys = (Polygon[Append[#, mp]]& /@ Partition[Append[l, First[l]], 2, 1]); Transpose[splitPolygon[#, h]& /@ newPolys], splitTriangle[p, h]]]]; In[10]:= (* split a triangle at height h *) splitTriangle[p:Polygon[l_], h_] := Module[{zs = Last /@ l, c, p1, p2, p3, p1z, p2z, p3z}, c = Count[zs, _?(# > h&)]; Which[c === 3, {{}, p}, c === 0, {p, {}}, (* one point is above h *) c === 1, pos = Position[zs, Max[zs]][[1, 1]]; (* p1 is highest *) {p1, p2, p3} = RotateLeft[l, pos - 1]; {p1z, p2z, p3z} = Last /@ {p1, p2, p3}; p12 = p2 + (h - p2z)/(p1z - p2z) (p1 - p2); p13 = p3 + (h - p3z)/(p1z - p3z) (p1 - p3); {Polygon[{p2, p12, p13, p3}], Polygon[{p12, p1, p13}]}, (* two points are above h *) c === 2, pos = Position[zs, Min[zs]][[1, 1]]; {p1, p2, p3} = RotateLeft[l, pos - 1]; {p1z, p2z, p3z} = Last /@ {p1, p2, p3}; p12 = p1 + (h - p1z)/(p2z - p1z) (p2 - p1); p13 = p1 + (h - p1z)/(p3z - p1z) (p3 - p1); {Polygon[{p12, p1, p13}], Polygon[{p2, p12, p13, p3}]}]] In[12]:=  = 500;

(* cut top *) unitPolys2 = Transpose[splitPolygon[#, +]& /@ unitPolys1]; (* cut bottom *) unitPolys3 = Transpose[splitPolygon[#, -]& /@ Flatten[unitPolys2[[1]]]]; finalPolys = Flatten[unitPolys3[[2]]];

The next graphic shows all resulting polygons. We use the All option setting for PlotRange. In[18]:= Show[Graphics3D[finalPolys], BoxRatios -> {1, 1, 1},

Axes -> True, PlotRange -> All] -0.2 -0.4 0.4 500

0

0.4 0.2

250 0 -250 -500 -0.4 0.4 -0.2

0

0.2

0.4

The ƒ£ function is doubly periodic. This means we can cover the complex z-plane with copies of finalPolys in a square array-like fashion. Here we show an array of size 3 µ 3 array.

Solutions

1201 In[19]:= Show[Graphics3D[{EdgeForm[], SurfaceColor[Hue[0.22], Hue[0.8], 2.93],

Table[Apply[{#1 + Re[ix 2 ω1 + iy 2 ω2], #2 + Im[ix 2 ω1 + iy 2 ω2], #3}&, finalPolys, {-2}], {ix, -1, 1}, {iy, -1, 1}]}], PlotRange -> {-500, 500}, BoxRatios -> {2, 2, 1}]

Now we have to map the so-constructed carpet of ƒ£ -parallelograms to the Riemann sphere. The function toSphere maps the point z of the complex plane onto the Riemann sphere. In[20]:= toSphere[z_] := Function[{ϕ, ϑ}, {0, 0, 1/2} +

1/2 {Cos[ϕ] Sin[ϑ], Sin[ϕ] Sin[ϑ], Cos[ϑ]}][ Arg[z], Pi - 2 ArcTan[Abs[z]]]

And the function toDeformedSphere maps the point 8x, y, z< of the complex Hx + i yL-plane onto the “squeezed” Riemann sphere. The “squeezing” is proportional to the height z of the point. In[21]:= toDeformedSphere[{x_, y_, z_}] :=

(# + 0.3 z/ #)&[toSphere[x + I y] - {0, 0, 1/2} ]

Applying now toDeformedSphere to a 5 µ 5 carpet of ƒ£ -parallelograms gives the following picture. The more we approach the north pole, the denser the triple poles of ƒ£ become. In[22]:= Show[Graphics3D[{EdgeForm[],

Table[{SurfaceColor[Hue[Random[]], Hue[Random[]], 2.6], Map[toDeformedSphere, (* carpet of 5×5 ℘'s in the period parallelogram *) Apply[{#1 + Re[ix 2 ω1 + iy 2 ω2], #2 + Im[ix 2 ω1 + iy 2 ω2], #3}&, finalPolys, {-2}], {-2}]}, {ix, -2, 2}, {iy, -2, 2}]}], ViewPoint -> {1, 2, -4}, PlotRange -> All, Boxed -> False]

Here is the last graphic with the corners of all polygons cut off. In[23]:= Show[% /. Polygon[l_] :>

Polygon[Plus @@@ Partition[Append[l, First[l]], 2, 1]/2], ViewPoint -> {-2, 0, -3/2}]

The Classical Special Functions

1202

2

Using the elliptic y function yn Hz; g2 , g3 L = sHn z; g2 , g3 L sHz; g2 , g3 L-n [1311] we could generate similar pictures with higher-order poles. The following graphic shows y4 Hz; 1, iL over the period parallelogram. In[24]:= ψ[n_][z_, {g2_, g3_}] :=

WeierstrassSigma[n z, {g2, g3}]/WeierstrassSigma[z, {g2, g3}]^(n^2) In[25]:= With[{g2 = 1, g3 = I, n = 4},

Module[{ω1, ω2}, {ω1, ω2} = WeierstrassHalfPeriods[N[{g2, g3}]]; ParametricPlot3D[(* display one period *) Evaluate[{Re[s ω1 + t ω2], Im[s ω1 + t ω2], Re @ ψ[n][s ω1 + t ω2, {1, I}], {EdgeForm[], SurfaceColor[Hue[s t], Hue[s t], 2.2]}}], {s, -1, 1}, {t, -1, 1}, PlotPoints -> 161, Boxed -> False, BoxRatios -> {1, 1, 0.6}, Axes -> False, PlotRange -> {All, All, {-50, 50}}]]]

The interested reader can go on and display the last function over the Riemann sphere. c) The implementation is straightforward. We plug the series into the differential equations and compare the coefficients of equal powers of z. In[1]:= WeierstrassPSeries[ord_Integer?(# >= 6&)] :=

Module[{c}, c[2] = g2/20; c[4] = g3/28; ser = 1/z^2 + Sum[c[2i] z^(2i), {i, 1, ord/2}] + (* make a series *) O[z]^(2Floor[ord/2]); Off[Solve::svars]; (* solve for the coefficients by plugging ser in the differential equation *) sol = Factor[Together[Solve[D[ser, z]^2 - 4 ser^3 + g2 ser + g3 == 0, Table[c[2i], {i, 3, ord/2}]]]]; On[Solve::svars]; (ser /. sol)[[1]]]

Here is the series up to order 20. In[2]:= WeierstrassPSeries[20] Out[2]=

1 g2 z2 g3 z4 g22 z6 3 g2 g3 z8 2 +  +  +  +   + z 20 28 1200 6160 3 2 10 2 12 H49 g2 + 750 g3 L z g2 g3 z g2 H539 g23 + 18000 g32 L z14    +   +     + 7644000 184800 11435424000 g3 H1421 g23 + 5500 g32 L z16 g22 H5929 g23 + 363750 g32 L z18     +    + O@zD20 29821792000 18868449600000

The above approach works, but it is much more efficient to first calculate (more or less by hand) a recurrence relation for the coefficients [306]. Here, this can be done easily to get the following coefficients.

Solutions

1203 In[3]:= c[2] = g2/20; c[4] = g3/28;

c[n_] := c[n] = Factor[3/((n + 3)(n/2 - 2)) Sum[c[k] c[n - k - 2], {k, 2, n - 4, 2}]]

The coefficients agree with the above-calculated ones. In[5]:= Table[c[i], {i, 2, 20, 2}]

g2 H539 g23 + 18000 g32 L g2 g3 g22 3 g2 g3 49 g23 + 750 g32 g22 g3 184800 11435424000 20 28 1200 6160 7644000 g3 H1421 g23 + 5500 g32 L g22 H5929 g23 + 363750 g32 L g2 g3 H19061 g23 + 184500 g32 L    ,     ,    = 29821792000 18868449600000 49972802880000

  , Out[5]= 9  ,  ,  ,  ,    ,  , 

d) For brevity and easier readability, we suppress the g2 and g3 argument of ƒHz; g2 , g3 L in the following. We will use an algebraic approach [211] in the following. We take the given addition formula and supplement it with the two differential equations for ƒHu; g2 , g3 L and ƒHv; g2 , g3 L. We generate three polynomial equations by clearing the denominators. In[1]:= eqs = Numerator[Together[#]]& /@

{℘[u + v] + ℘[u] + ℘[v] - ((℘'[u] - ℘'[v])/(℘[u] - ℘[v]))^2/4, ℘'[u]^2 - 4 ℘[u]^3 + g2 ℘[u] + g3, ℘'[v]^2 - 4 ℘[v]^3 + g2 ℘[v] + g3} Out[1]= 84 ℘@uD3 − 4 ℘@uD2 ℘@vD − 4 ℘@uD ℘@vD2 + 4 ℘@vD3 + 4 ℘@uD2 ℘@u + vD − 8 ℘@uD ℘@vD ℘@u + vD + 4 ℘@vD2 ℘@u + vD − ℘ @uD2 + 2 ℘ @uD ℘ @vD − ℘ @vD2 , g3 + g2 ℘@uD − 4 ℘@uD3 + ℘ @uD2 , g3 + g2 ℘@vD − 4 ℘@vD3 + ℘ @vD2
EliminationOrder]] Out[2]= 8H℘@uD − ℘@vDL2 Hg22 + 16 g3 ℘@uD + 16 g3 ℘@vD + 8 g2 ℘@uD ℘@vD + 16 ℘@uD2 ℘@vD2 +

16 g3 ℘@u + vD + 8 g2 ℘@uD ℘@u + vD + 8 g2 ℘@vD ℘@u + vD − 32 ℘@uD2 ℘@vD ℘@u + vD − 32 ℘@uD ℘@vD2 ℘@u + vD + 16 ℘@uD2 ℘@u + vD2 − 32 ℘@uD ℘@vD ℘@u + vD2 + 16 ℘@vD2 ℘@u + vD2 L
WeierstrassP[u, {g2, g3}]) /.

{u -> N[2, 30], v -> 1, g2 -> 1/2, g3 -> I} Out[3]= 0. × 10−21 + 0. × 10−21 

The corresponding double argument formula is linear in ƒH2 v; g2 , g3 L. In[4]:= Factor[gb[[1, -1]] /. u -> v] Out[4]= g22 + 32 g3 ℘@vD + 8 g2 ℘@vD2 + 16 ℘@vD4 + 16 g3 ℘@2 vD + 16 g2 ℘@vD ℘@2 vD − 64 ℘@vD3 ℘@2 vD In[5]:= Solve[% == 0, ℘[2v]]

−g22 − 32 g3 ℘@vD − 8 g2 ℘@vD2 − 16 ℘@vD4 16 Hg3 + g2 ℘@vD − 4 ℘@vD L

Out[5]= 99℘@2 vD →      == 3

e) For the addition formula for ƒ£ Hu + v; g2 , g3 L, we proceed in a similar way as in part c). We supplement the given formula with the three differential equations for ƒHu; g2 , g3 L, ƒHv; g2 , g3 L, and ƒHu + v; g2 , g3 L and generate four polynomial equations by clearing the denominators. In[1]:= eqs = Numerator[Together[#]]& /@

{℘'[u + v] + (℘[u + v] (℘'[u] - ℘'[v]) + ℘[u] ℘'[v] - ℘'[u] ℘[v])/ (℘[u] - ℘[v]), ℘'[u]^2 - 4 ℘[u]^3 + g2 ℘[u] + g3, ℘'[v]^2 - 4 ℘[v]^3 + g2 ℘[v] + g3, ℘'[u + v]^2 - 4 ℘[u + v]^3 + g2 ℘[u + v] + g3} Out[1]= 8−℘@vD ℘ @uD + ℘@u + vD ℘ @uD + ℘@uD ℘ @vD − ℘@u + vD ℘ @vD + ℘@uD ℘ @u + vD − ℘@vD ℘ @u + vD, g3 + g2 ℘@uD − 4 ℘@uD3 + ℘ @uD2 , g3 + g2 ℘@vD − 4 ℘@vD3 + ℘ @vD2 , g3 + g2 ℘@u + vD − 4 ℘@u + vD3 + ℘ @u + vD2
WeierstrassPPrime[u, {g2, g3}]) /.

{u -> N[1, 40], g2 -> 1/2, g3 -> 1 + I} Out[11]= 0. × 10−27 + 0. × 10−27 

Note that for deriving the above addition formula for ƒ£ Hu + v; g2 , g3 L, we do not actually need the given addition formula for ƒ£ Hu + v; g2 , g3 L. The addition formula for ƒHu + v; g2 , g3 L together with the differential equations for ƒHv; g2 , g3 L, ƒHu; g2 , g3 L, and ƒHu + v; g2 , g3 L are sufficient. f) Now, let us deal with the mentioned functional equation of the Sutherland–Calogero model. These are the two functions jHxL and f HxL as well as the functional equation. In[1]:= (* define functions ϕ and f *)

ϕ[x_] = α WeierstrassZeta[x, {g2, g3}] + β x; f[x_] = -1/2(α^2 D[WeierstrassZeta[x, {g2, g3}], x] + α^2 WeierstrassZeta[x, {g2, g3}]^2 + 2 α β x WeierstrassZeta[x, {g2, g3}] + + β^2 x^2);

Solutions

1205 In[4]:= eqs = ϕ[x] ϕ[y] + ϕ[y] ϕ[z] + ϕ[x] ϕ[z] - f[x] - f[y] - f[z] /.

z -> -(x + y);

Here is a quick numerical check for the functional equation. In[5]:= eqs /. ((# -> Random[Complex, {0, 1 + I}, 50])& /@ {g2, g3, α, β, x, y}) Out[5]= 0. × 10−44 + 0. × 10−44 

To show that the two functions jHxL and f HxL are solutions of the functional equation, we will differentiate the functional equation with respect to x and show that the resulting equation is an identity. So to show the correctness of the functional equation, we also have to show that the functional equation is correct for some point x, say, x = 0. In[6]:= Series[eqs /. {WeierstrassP[z_, {g2_, g3_}] :> z^-2 + g2 z^2/20,

WeierstrassZeta[z_, {g2_, g3_}] :> z^-1 -g2 z^3/60}, {x, 0, 1}] Out[6]= O@xD2

In the first step, we eliminate all Weierstrass Zeta functions to obtain an equation in Weierstrass ƒ functions and its derivative. In[7]:= ℘Rules = {WeierstrassP[ξ_, _] -> ℘[ξ], WeierstrassPPrime[ξ_, _] -> ℘'[ξ]}; In[8]:= (gb1 = Factor[GroebnerBasis[{eqs, D[eqs, x]},

{}, {WeierstrassZeta[x, {g2, g3}], WeierstrassZeta[y, {g2, g3}], WeierstrassZeta[-x - y, {g2, g3}]}, MonomialOrder -> EliminationOrder]]) /. ℘Rules Out[8]= 8α2 H4 ℘@xD3 − 4 ℘@xD2 ℘@−x − yD − 4 ℘@xD ℘@−x − yD2 + 4 ℘@−x − yD3 + 4 ℘@xD2 ℘@yD − 8 ℘@xD ℘@−x − yD ℘@yD + 4 ℘@−x − yD2 ℘@yD − ℘ @xD2 + 2 ℘ @xD ℘ @−x − yD − ℘ @−x − yD2 L
EliminationOrder]] /. ℘Rules Out[9]= 8α2 H℘@xD − ℘@−x − yDL2 H℘@xD + ℘@−x − yD + ℘@yDL Hg22 − 16 g2 ℘@xD2 + 64 ℘@xD4 − 8 g2 ℘@xD ℘@−x − yD + 64 ℘@xD3 ℘@−x − yD + 16 ℘@xD2 ℘@−x − yD2 − 8 g2 ℘@xD ℘@yD + 64 ℘@xD3 ℘@yD + 8 g2 ℘@−x − yD ℘@yD − 32 ℘@xD2 ℘@−x − yD ℘@yD − 32 ℘@xD ℘@−x − yD2 ℘@yD + 16 ℘@xD2 ℘@yD2 − 32 ℘@xD ℘@−x − yD ℘@yD2 + 16 ℘@−x − yD2 ℘@yD2 − 16 ℘@xD ℘ @xD2 − 16 ℘@−x − yD ℘ @xD2 − 16 ℘@yD ℘ @xD2 L
℘[x + y],

eqs /. ℘Rules}], {}, {℘[x + y]}, MonomialOrder -> EliminationOrder] Out[11]= 8−g3 − g2 ℘@yD + 4 ℘@yD3 − ℘ @yD2 , −g3 − g2 ℘@xD + 4 ℘@xD3 − ℘ @xD2
℘[ξ], WeierstrassPPrime[ξ_, _] -> ℘'[ξ]} Out[4]= 8−4 ℘@uD3 − 4 ℘@uD2 ℘@vD + 4 ℘@uD2 ℘@u + vD + 8 ℘@uD ℘@vD ℘@u + vD +

4 ℘@uD ℘@u + vD2 − 4 ℘@vD ℘@u + vD2 − 4 ℘@u + vD3 + ℘ @uD2 + 2 ℘ @uD ℘ @u + vD + ℘ @u + vD2 , −4 ℘@uD ℘@vD2 − 4 ℘@vD3 + 8 ℘@uD ℘@vD ℘@u + vD + 4 ℘@vD2 ℘@u + vD − 4 ℘@uD ℘@u + vD2 + 4 ℘@vD ℘@u + vD2 − 4 ℘@u + vD3 + ℘ @vD2 + 2 ℘ @vD ℘ @u + vD + ℘ @u + vD2
EliminationOrder] // Factor Out[5]= 8H℘ @uD − ℘ @vDL H4 g3 ℘@uD3 − 4 g2 ℘@uD4 + 16 ℘@uD6 − 12 g3 ℘@uD2 ℘@vD + 8 g2 ℘@uD3 ℘@vD + 12 g3 ℘@uD ℘@vD2 − 48 ℘@uD4 ℘@vD2 − 4 g3 ℘@vD3 − 8 g2 ℘@uD ℘@vD3 + 4 g2 ℘@vD4 + 48 ℘@uD2 ℘@vD4 − 16 ℘@vD6 + g2 ℘@uD ℘ @uD2 − 8 ℘@uD3 ℘ @uD2 − g2 ℘@vD ℘ @uD2 + 12 ℘@uD ℘@vD2 ℘ @uD2 − 4 ℘@vD3 ℘ @uD2 + ℘ @uD4 − 2 g2 ℘@uD ℘ @uD ℘ @vD + 8 ℘@uD3 ℘ @uD ℘ @vD + 2 g2 ℘@vD ℘ @uD ℘ @vD − 8 ℘@vD3 ℘ @uD ℘ @vD − 2 ℘ @uD3 ℘ @vD + g2 ℘@uD ℘ @vD2 + 4 ℘@uD3 ℘ @vD2 − g2 ℘@vD ℘ @vD2 − 12 ℘@uD2 ℘@vD ℘ @vD2 + 8 ℘@vD3 ℘ @vD2 + 2 ℘ @uD ℘ @vD3 − ℘ @vD4 L, Hg3 − g2 ℘@uD + 4 ℘@uD3 − g2 ℘@vD + 12 ℘@uD2 ℘@vD + 12 ℘@uD ℘@vD2 + 4 ℘@vD3 + 2 ℘ @uD2 − 2 ℘ @uD ℘ @vD + ℘ @vD2 L H4 g3 ℘@uD3 − 4 g2 ℘@uD4 + 16 ℘@uD6 − 12 g3 ℘@uD2 ℘@vD + 8 g2 ℘@uD3 ℘@vD + 12 g3 ℘@uD ℘@vD2 − 48 ℘@uD4 ℘@vD2 − 4 g3 ℘@vD3 − 8 g2 ℘@uD ℘@vD3 + 4 g2 ℘@vD4 + 48 ℘@uD2 ℘@vD4 − 16 ℘@vD6 + g2 ℘@uD ℘ @uD2 − 8 ℘@uD3 ℘ @uD2 − g2 ℘@vD ℘ @uD2 + 12 ℘@uD ℘@vD2 ℘ @uD2 − 4 ℘@vD3 ℘ @uD2 + ℘ @uD4 − 2 g2 ℘@uD ℘ @uD ℘ @vD + 8 ℘@uD3 ℘ @uD ℘ @vD + 2 g2 ℘@vD ℘ @uD ℘ @vD − 8 ℘@vD3 ℘ @uD ℘ @vD − 2 ℘ @uD3 ℘ @vD + g2 ℘@uD ℘ @vD2 + 4 ℘@uD3 ℘ @vD2 − g2 ℘@vD ℘ @vD2 − 12 ℘@uD2 ℘@vD ℘ @vD2 + 8 ℘@vD3 ℘ @vD2 + 2 ℘ @uD ℘ @vD3 − ℘ @vD4 L< In[6]:= PolynomialReduce[#, {℘'[u]^2 - 4 ℘[u]^3 + g2 ℘[u] + g3,

Out[6]= 80, 0
I, z -> 2.`100} Out[7]= 0. × 10−81 + 0. × 10−81 

Finally, we solve for ƒH5 z; g2 , g3 L and simplify the result. In[8]:= Exponent[res[[1]], WeierstrassP[{1, 5} z, {g2, g3}]] Out[8]= 825, 1< In[9]:= Solve[res[[1]] == 0, WeierstrassP[5 z, {g2, g3}]] /.

WeierstrassP[1 z, {g2, g3}] -> ℘ //

Simplify

Out[9]= 99WeierstrassP@5 z, 8g2, g3 All, ViewPoint -> {2, -2, 0}]& /@ {polysRe, polysIm}]]

k) The equations for the am,n do not immediately allow for a recursion. So we generate the first equations for the am,n and solve for the lowest order am,n . The function getSeries returns the terms of the Taylor series of sHz; g2 , g3 L. In[1]:= a[0, 0] = 1;

a[m_, n_] := 0 /; Negative[m] || Negative[n]; eq[m_, n_] := (a[m, n] == 3 (m + 1) a[m + 1, n - 1] + 16/3(n + 1) a[m - 2, n + 1] 1/3(2m + 3n -1)(4m + 6n - 1) a[m - 1, n]) In[4]:= getSeries[o_] :=

Module[{eqs, sol}, (* the a-equations *) eqs = Rest @ Flatten @ Table[eq[m, n], {m, 0, o}, {n, 0, o}]; Off[Solve::svars]; (* solve the a-equations *) sol = Solve[eqs, Cases[eqs, _a, Infinity] // Union]; On[Solve::svars];

The Classical Special Functions

1210 (* make series *) Sum[a[m, n] (g2/2)^m (2g3)^n z^(4m + 6n + 1)/(4m + 6n + 1)!, {m, 0, o}, {n, 0, o}] /. Select[sol[[1]], FreeQ[#[[2]], _a, Infinity]&] /. _a -> 0]

Here is the series up to order 19. In[5]:= ser = getSeries[7] + O[z]^20 // Simplify

g2 z5 g3 z7 g22 z9 Hg2 g3L z11 H23 g23 − 576 g32 L z13 240 840 161280 2217600 16605388800 19 g22 g3 z15 H107 g24 + 52992 g2 g32 L z17 H311 g23 g3 + 4416 g33 L z19   +     +     + O@zD20 96864768000 1896999616512000 4505374089216000

Out[5]= z −  −  −  −   +    +

Using ser in an ansatz for the coefficients of the partial differential equations gives a linear set of equations for the coefficients G2[j], G3[j], and GC[j]. In[6]:= diff = D[ser, z, z] - (Sum[G2[j] z^j, {j, 0, 2}] D[ser, g2] +

Sum[G3[j] z^j, {j, 0, 2}] D[ser, g3] + Sum[GC[j] z^j, {j, 0, 2}] ser);

Solving the system results in the following partial differential equation for sHz; g2 , g3 L: ∑2 sHz; g2 , g3 L ∑sHz; g2 , g3 L 2 ∑sHz; g2 , g3 L z2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ Å = 12 g3 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅ g22 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅÅ - ÅÅÅÅÅÅÅÅÅ sHz; g2 , g3 L. ∑ z2 ∑ g2 ∑ g3 3 12 In[7]:= Solve[# == 0& /@ CoefficientList[diff, z],

Flatten[Table[{G2[j], G3[j], GC[j]}, {j, 0, 2}]]] 2 g22 3 g2 G2@1D → 0, G2@0D → 12 g3, GC@1D → 0, GC@2D → −  , GC@0D → 0== 12

Out[7]= 99G3@2D → 0, G3@0D →  , G2@2D → 0, G3@1D → 0,

l) This implements the function SHtL. In[1]:= Σ[τ_?InexactNumberQ] :=

With[{σ = WeierstrassSigma[#, WeierstrassInvariants[{1, τ}]]&}, σ[2/3 τ]^5/(σ[τ/3]^4 σ[4/3 τ])]

è!!!! To find algebraic values for SIi n M, we start by calculating a 30-digit approximation. Then we find the nearest polynomial of order four or less. (We restrict ourselves to order four to always obtain radicals when solving the polynomial.) We solve è!!!! the polynomial and determine the distance of the roots to a 200-digit approximation of SIi n M. If this distance is small (say è!!!! -150 less than 10 ), then SIi n M and the root agree to about 150 digits, and we naturally conjecture that they actually are identical. In[2]:= Needs["NumberTheory`Recognize`"] In[3]:= Do[(* low and high precision value for Σ[I Sqrt[n]] *)

x = SetPrecision[ξ = N[Σ[I Sqrt[n] + I 0.1`200*^-199], 200], 30]; (* integer coefficient polynomial such that x is a root *) poly = Recognize[x, 4, t]; (* minimal distance between root and Σ[I Sqrt[n]] *) δ = Min[Abs[(Last /@ (List @@ NRoots[poly == 0, t, 200])) - ξ]]; (* print radical value if root distance is small *) If[δ < 10^-150, Print[Σ[n] == t /. Select[Solve[poly == 0, t], Abs[t - ξ /. #] < 10^-100&][[1]]]], {n, 120}] è!!!!! è!!!!! Σ@1D  3 + 3 + "################################### 3 I3 + 2 3 M Σ@2D  5 + 2

è!!!!! 6

è!!!!! Σ@3D  3 I2 + 3 M è!!!!! è!!!!! Σ@4D  3 + 2 3 + 2 2 33ê4 è!!!!! Σ@6D  3 I3 + 2 2 M "################### è!!!!! è!!!!! # 3 +4 2+ 3 è!!!!! è!!!!! "################################### Σ@9D  3 J3 + 3 + 3 I3 + 2 3 M N Σ@8D  9 + 4

Solutions

1211 è!!!!! Σ@12D  3 I7 + 4 3 M è!!!!!!!! 3 9 15 è!!!!!!!! 5 I31 + 8 15 M Σ@15D  18 +  +  "######################################### 2 2 è!!!!! Σ@18D  9 I5 + 2 6 M Σ@24D  3 J15 + 6

è!!!!! è!!!!! 6 + 2 "######################################### 2 I49 + 20 6 M N

Σ@30D  3 J27 + 12

è!!!!! è!!!!! 5 + 2 "############################################ 2 I161 + 72 5 M# N

Σ@36D  3 J45 + 26

è!!!!! è!!!!! 3 + 2 "############################################ 6 I168 + 97 3 M# N

Σ@42D  3 J75 + 20

è!!!!!!!! è!!!!!!!! 14 + 2 "################################################### 6 I449 + 120 14 M N

Σ@48D  3 J119 + 84

è!!!!! è!!!!! 2 + 4 "############################################### 3 I577 + 408 2 M# N

Σ@60D  3 J279 + 72

è!!!!!!!! è!!!!!!!! 15 + 4 "###################################################### 5 I1921 + 496 15 M N

Σ@72D  9 J201 + 116

è!!!!! 3

+4

"########################################### è!!!!! 5042 + 2911 3

N

è!!!!!!!! è!!!!!!!! 2 I5201 + 1020 26 M N Σ@78D  3 J867 + 170 26 + 12 "######################################################### Σ@102D  3 J3267 + 2310

è!!!!! è!!!!! 2 + 8 "############################################################### 17 I19601 + 13860 2 M# N

For functions having algebraic values for all algebraic arguments, see[1103]. m) It is straightforward to implement the above formulas describing the motion of n lattice-periodicized vortices. w1 and w2 are the half periods of the lattice, GList the list of the vortex strengths, z0List the list of their initial conditions and T the time over which to solve the equations of motion. The optional argument numericalSolutionCheck implements a check of the numerical solution based on the conservation law ⁄na=1 Ga za HtL = constant. In[1]:= vortexArrayMotionGraphics[{ω1_, ω2_}, ΓList_, z0List_, T_,

numericalSolutionCheck_:False] := Module[{n = Length[ΓList], g2, g3, ∆, φ, equationsOfMotion, ndsol, ΣΓ0, , , pp = 600}, (* definitions for φ *) {g2, g3} = WeierstrassInvariants[{ω1, ω2}] // N; ∆ = 4 Abs[Im[ω1 Conjugate[ω2]]]; φ[z_] = WeierstrassZeta[z, {g2, g3}] - Pi/∆ Conjugate[z] + (Pi/∆ - WeierstrassZeta[ω1, {g2, g3}]/ω1) z; (* equations of motion *) equationsOfMotion = Table[z[α]'[t] == I/(2Pi) Sum[If[α === β, 0, Conjugate[ΓList[[β]] φ[z[α][t] - z[β][t]]]], {β, n}], {α, n}]; (* solve equations of motions numerically *) ndsol = NDSolve[Join[equationsOfMotion, Thread[Table[z[α][0], {α, n}] == z0List]], Table[z[α], {α, n}], {t, 0, T}, PrecisionGoal -> 10, MaxSteps -> 10^5]; (* make graphics *) Block[{$DisplayFunction = Identity}, If[numericalSolutionCheck, (* check conservation law *) ΣΓ0 = Sum[ΓList[[α]] z[α][0], {α, n}] /. ndsol[[1]]; (* check solution quality *)  = ListPlot[Log[10, Abs[Table[Sum[ΓList[[α]] z[α][t], {α, n}]/ΣΓ0 1 /. ndsol[[1]], {t, 0, T, T/pp}]]]], PlotRange -> All];  = ParametricPlot[Evaluate[Table[{Re[z[α][t]], Im[z[α][t]]}, {α, n}] /. ndsol[[1]]], {t, 0, ndsol[[1, 1, 2, 1, 1, 2]]}, PlotPoints -> pp, PlotStyle -> Table[{Thickness[0.002], Hue[0.78 (α - 1)/n]}, {α, 0, n - 1}], PlotRange -> All, Axes -> False, Frame -> True, FrameTicks -> False]]; (* display graphics *) If[numericalSolutionCheck, Show[GraphicsArray[{, }]], Show[]]]

The Classical Special Functions

1212

To generate random instances of lattices, vortex strengths, and positions, we implement a function randomVortexArray  MotionGraphics which accepts a seed seed for the random number generator as its first argument. In[2]:= randomVortexArrayMotionGraphics[seed_, T_,

numericalSolutionCheck_:False] := Module[{n, ωs, Γs, z0s}, (* seed random number generator *) SeedRandom[seed]; (* number of vortices *) n = Random[Integer, {2, 5}]; (* lattice half periods *) ωs = Table[Random[], {2}]{1, I}; (* vortex strength; sum is zero *) Γs = Append[#, -Plus @@ #]&[Table[Random[Real, {-1, 1}], {n - 1}]]; (* initial positions *) z0s = Table[Random[Complex, {-1 - I, 1 + I}], {n}]; (* make graphics of vortex motion *) vgr = vortexArrayMotionGraphics[ωs, Γs, z0s, T, numericalSolutionCheck]]

Calling randomVortexArrayMotionGraphics with random seeds results in a variety of vortex movements similar to the nonperiodicized case. Here are two situations with a largely translational motion structure. (We color each vertex trajectory differently.) In[3]:= Show[GraphicsArray[Block[{$DisplayFunction = Identity},

randomVortexArrayMotionGraphics @@@ {{657261560047, 1024}, {724575402766, 128}}]]]

Here are two situations with a largely rotational motion structure. In[4]:= Show[GraphicsArray[Block[{$DisplayFunction = Identity},

randomVortexArrayMotionGraphics @@@ {{491575599708, 16}, {191769440444, 32}}]]]

We end with two examples that show complicated trajectories. The left graphic shows lnH†H⁄na=1 Ga za HtLL -H⁄na=1 Ga za H0LL§L and confirms the correctness of the numerical solutions of the trajectories. In[5]:= randomVortexArrayMotionGraphics[349646403399, 256, True]

Solutions

1213

-14 -14.5 -15 -15.5

100

200

300

400

500

600

In[6]:= randomVortexArrayMotionGraphics[808492574369, 064, True] -13 -13.5 -14 -14.5 -15 -15.5 100

200

300

400

500

600

4. Jacobi’s Elliptic Functions a) Let us start with the first-order differential equations. The following implementation is straightforward. We expand the elliptic function under consideration as a series around z = 0 and differentiate this series. We compare the result with the series expansion of "################################################################################################# a f HmL + b f HmL f 2 Hu » mL + c f HmL f 4 Hu » mL . Comparing the coefficients of equal powers of z gives a linear system of equations for a f HmL, b f HmL, and c f HmL. The case that the series of ∑ f Hu » mL ê ∑ u has no constant term is treated especially to avoid dividing by zero. The undetermined sign on the right-hand side of the differential equation is determined for real 0 < m < 1 and 0 < z < KHmL ê 2 by trying both possibilities and numerically choosing the right one. (The HoldForm at the end is used to avoid actually differentiating the function, and the result of makeODEForJacobis is visually a differential equation.) In[1]:= makeODEForJacobis[jacobi_] :=

Module[{func, ser, ser1, ser2, ser3, ser4, ser5, s0, a, b, c}, func = jacobi[z, m]; (* make the series expansion *) ser = Series[func, {z, 0, 5}]; If[ (* first term of D[ser, z] equal 0 ? *) Coefficient[Normal[D[ser, z]], z, 0] =!= 0, (* plug ser in differential equation; solve for a, b, and c *) (* the If tests if D[ser, z] - Sqrt[a + b ser^2 + c ser^4] or D[ser, z] + Sqrt[a + b ser^2 + c ser^4] is appropriate *) short1 = Hold[ser2 = Normal[ser1]; ser3 = Join[{0}, Exponent[#, z]& /@ Take[Union[Cases[ser2, z^_., {2}]], 2]]; ser4 = Coefficient[ser2, z, #]& /@ ser3; ser5 = Simplify[PowerExpand @ Simplify @ Solve[# == 0& /@ ser4, {a, b, c}]]; ser5 = Select[ser5, (((ser4 /. #) /. {m -> 1/2}) === {0, 0, 0})&]]; If[ser1 = D[ser, z] - Sqrt[a + b ser^2 + c ser^4]; ReleaseHold[short1]; ser5 === {}, ReleaseHold[short1]], s0 = Coefficient[Normal[ser], z, 0]; (* plug ser in differential equation; solve for a, b, and c *) short2 = Hold[ser2 = Normal[ser1]; ser3 = Join[{0}, Exponent[#, z]& /@

The Classical Special Functions

1214

Take[Union[Cases[ser2, z^_., {2}]], 2]]; ser4 = Coefficient[ser2, z, #]& /@ ser3; ser5 = Solve[# == 0& /@ ser4, {b, c}]; ser5 = Select[ser5, (((ser4 /. #) /. {m -> 1/2}) === {0, 0, 0})&]]; If[ser1 = D[ser, z] - Sqrt[-(b + c) s0 + b ser^2 + c ser^4]; ReleaseHold[short2]; ser5 === {}, ser1 = D[ser, z] + Sqrt[-(b + c) s0 + b ser^2 + c ser^4]; ReleaseHold[short2]]; ser5 = Simplify[{Join[ser5[[1]], {a -> ((-(b + c) s0) /. ser5)[[1]]}]}]]; (* fix undetermined sign *) If[Chop[(D[func, z] - Sqrt[a + b func^2 + c func^4] /. ser5)[[1]] /. {m -> 0.3, z -> 0.5}] == 0, (* write nicely, avoid differentiation *) (HoldForm[D[func1, z]] /. func1 -> func) == (+Sqrt[a + b func^2 + c func^4] /. ser5)[[1]], (HoldForm[D[func1, z]] /. func1 -> func) == (-Sqrt[a + b func^2 + c func^4] /. ser5)[[1]]]]

Now, for the functions that Mathematica can differentiate, the differential equations are calculated. In[2]:= Off[Solve::ifun];

(makeODEForJacobis /@ {JacobiCD, JacobiCN, JacobiDC, JacobiDN, JacobiNC, JacobiND, JacobiSC, JacobiSD, JacobiSN, JacobiDC}) // TableForm è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ∂z JacobiCD@z, mD  − 1 + H−1 − mL JacobiCD@z, mD2 + m JacobiCD@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ∂z JacobiCN@z, mD  − 1 − m + H−1 + 2 mL JacobiCN@z, mD2 − m JacobiCN@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ∂z JacobiDC@z, mD  m + H−1 − mL JacobiDC@z, mD2 + JacobiDC@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ∂z JacobiDN@z, mD  − −1 + m + H2 − mL JacobiDN@z, mD2 − JacobiDN@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ∂z JacobiNC@z, mD  −m + H−1 + 2 mL JacobiNC@z, mD2 + H1 − mL JacobiNC@z, mD4 Out[3]//TableForm= è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ∂z JacobiND@z, mD  −1 + H2 − mL JacobiND@z, mD2 + H−1 + mL JacobiND@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ∂z JacobiSC@z, mD  1 + H2 − mL JacobiSC@z, mD2 + H1 − mL JacobiSC@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ∂z JacobiSD@z, mD  1 + H−1 + 2 mL JacobiSD@z, mD2 + H−1 + mL m JacobiSD@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ∂z JacobiSN@z, mD  1 + H−1 − mL JacobiSN@z, mD2 + m JacobiSN@z, mD4 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ∂z JacobiDC@z, mD  m + H−1 − mL JacobiDC@z, mD2 + JacobiDC@z, mD4

Here is a quick numerical check of the last result. In[4]:= ReleaseHold[%] /. {m -> N[2/5, 22], z -> 3/10} Out[4]= 8True, True, True, True, True, True, True, True, True, True
Sqrt[a + b f[x]^2 + c f[x]^4]] Out[8]= b f@xD + 2 c f@xD3

Now, we have d f HmL = b f HmL and e f HmL = 2 c f HmL. b) There are 12 different Jacobi functions. We use the following obvious abbreviations and suppress the argument m. In[1]:= allJacobis[u_] = {cd[u], cn[u], cs[u], dc[u], dn[u], ds[u],

nc[u], nd[u], ns[u], sc[u], sd[u], sn[u]} Out[1]= 8cd@uD, cn@uD, cs@uD, dc@uD, dn@uD, ds@uD, nc@uD, nd@uD, ns@uD, sc@uD, sd@uD, sn@uD
JacobiDS[u, m] /. Table[SetPrecision[{u -> Random[], v -> Random[], m -> Random[]}, 30], {6}] // Chop Out[49]= 80, 0, 0, 0, 0, 0< In[50]:= (* addition formula for function sd *)

gbSD = Factor @ GroebnerBasis[ Join[gbDS, {sd[u] ds[u] - 1, sd[v] ds[v] - 1, sd[u + v] ds[u + v] - 1}], {sd[u + v], sd[u], sd[v]}, {ds[u + v], ds[u], ds[v]}, MonomialOrder -> EliminationOrder] Out[51]= 8H1 + m sd@uD2 + m sd@vD2 − m sd@uD2 sd@vD2 + m2 sd@uD2 sd@vD2 L Hsd@uD4 − 2 sd@uD2 sd@vD2 + sd@vD4 − 2 sd@uD2 sd@u + vD2 − 2 sd@vD2 sd@u + vD2 + 4 sd@uD2 sd@vD2 sd@u + vD2 − 8 m sd@uD2 sd@vD2 sd@u + vD2 + 2 m sd@uD4 sd@vD2 sd@u + vD2 − 2 m2 sd@uD4 sd@vD2 sd@u + vD2 + 2 m sd@uD2 sd@vD4 sd@u + vD2 − 2 m2 sd@uD2 sd@vD4 sd@u + vD2 + sd@u + vD4 + 2 m sd@uD2 sd@vD2 sd@u + vD4 − 2 m2 sd@uD2 sd@vD2 sd@u + vD4 + m2 sd@uD4 sd@vD4 sd@u + vD4 − 2 m3 sd@uD4 sd@vD4 sd@u + vD4 + m4 sd@uD4 sd@vD4 sd@u + vD4 L< In[52]:= (* quick numerical check *)

gbSD[[1, -1]] /. sd[u_] -> JacobiSD[u, m] /. Table[SetPrecision[{u -> Random[], v -> Random[], m -> Random[]}, 30], {6}] // Chop Out[53]= 80, 0, 0, 0, 0, 0
0 1 Power::infy : Infinite expression  encountered. More… 0 ∞::indet : Indeterminate expression 0 Cos@zD ComplexInfinity encountered. More… Out[2]= Indeterminate In[3]:= Limit[D[JacobiSN[z, m], m], m -> 0]

1 2 H1 − mL m HJacobiCN@z, mD JacobiDN@z, mD HH1 − mL z − EllipticE@JacobiAmplitude@z, mD, mD + m JacobiCD@z, mD JacobiSN@z, mDLL, m → 0E

Out[3]= LimitA  

The Classical Special Functions

1222

This is the defining integral relation for snHz » mL. To prevent Mathematica from carrying out the integration, we insert a dummy function f HtL. In a moment we will set f HtL to 1. To avoid any autoevaluation, we use jacobiSN instead of JacobiSN. In[4]:= def = z - Integrate[f[t]/(Sqrt[1 - t^2] Sqrt[1 - m t^2]),

{t, 0, jacobiSN[z, m]}, GenerateConditions -> False] f@tD Out[4]= z − IntegrateA  ! , 8t, 0, jacobiSN@z, mD 0 /. f -> (1&) Out[5]=

1 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! jacobiSNH0,1L @z, 0D  I−ArcSin@jacobiSN@z, 0DD + jacobiSN@z, 0D 1 − jacobiSN@z, 0D2 M −    è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 4 1 − jacobiSN@z, 0D2

Because Jacobi functions do not have branch cuts, we can simplify the last expression. In[6]:= (* use value of JacobiSN[z, 0] and simplify inverse functions *)

jacobiSNSimplify[expr_] := expr //. jacobiSN[z, 0] -> Sin[z] //. {ArcSin[Sin[z]] -> z, (1 - Sin[z]^2)^n_ -> Cos[z]^(2n), (Cos[z]^n_)^m_ :> Cos[z]^(n m)} In[8]:= sol[1] = Solve[eq[1] == 0, Derivative[0, 1][jacobiSN][z, 0]][[1]] //

jacobiSNSimplify 1 4

Out[8]= 9jacobiSNH0,1L @z, 0D →  Cos@zD H−z + Cos@zD Sin@zDL=

Here is a quick numerical check of the last result for a random numerical value of z. In[9]:= With[{∂ = 10^-20, z0 = 1/(Sqrt[2] - 1) + 1/Pi I},

{(* numerical approximation of derivative definition *) (JacobiSN[z0, ∂/2] - JacobiSN[z0, -∂/2])/∂, (* above result *) Derivative[0, 1][jacobiSN][z, 0] /. sol[1] /. z -> z0}] // (* numericalize to high precision *) N[#, 30]& // N Out[9]= 80.576733 + 0.216977 , 0.576733 + 0.216977 
0 /. f -> (1&) /. Flatten[Table[sol[k], {k, n - 1}]] // jacobiSNSimplify; Solve[d[n] == 0, Derivative[0, n][jacobiSN][z, 0]][[1]] // jacobiSNSimplify // Simplify]

Here are the Taylor coefficients c2 HzL to c5 HzL. In[11]:= sol[2] Out[11]= 9jacobiSNH0,2L @z, 0D →

1  Cos@zD HCos@zD H6 Sin@zD + Sin@3 zDL + z H−9 + 12 Sin@zD2 − 2 z Tan@zDLL= 32 In[12]:= sol[3]

1 2048 H32 z H−21 + z2 L Cos@zD + 3 H−156 z Cos@3 zD − 20 z Cos@5 zD + 67 Sin@zD − 88 z2 Sin@zD + 82 Sin@3 zD − 72 z2 Sin@3 zD + 16 Sin@5 zD + Sin@7 zDLL=

Out[12]= 9jacobiSNH0,3L @z, 0D → 

In[13]:= sol[4] Out[13]= 9jacobiSNH0,4L @z, 0D →

1  H4 z H−1845 + 128 z2 L Cos@zD + 72 z H−83 + 12 z2 L Cos@3 zD − 1260 z Cos@5 zD − 8192 84 z Cos@7 zD + 2214 Sin@zD − 3120 z2 Sin@zD + 32 z4 Sin@zD + 2835 Sin@3 zD − 3888 z2 Sin@3 zD + 690 Sin@5 zD − 600 z2 Sin@5 zD + 72 Sin@7 zD + 3 Sin@9 zDL= In[14]:= sol[5]

Solutions

1223 Out[14]= 9jacobiSNH0,5L @z, 0D →

1  H−8 z H55245 − 4580 z2 + 16 z4 L Cos@zD + 5 H288 z H−272 + 69 z2 L Cos@3 zD + 131072 40 z H−531 + 100 z2 L Cos@5 zD + 3 H−812 z Cos@7 zD − 36 z Cos@9 zD + 2 H12104 − 19208 z2 + 544 z4 + 8 H1925 − 3174 z2 + 108 z4 L Cos@2 zD + H3739 − 5592 z2 L Cos@4 zD + 475 Cos@6 zD − 392 z2 Cos@6 zD + 33 Cos@8 zD + Cos@10 zDL Sin@zDLLL=

A numerical check of the derived results shows good agreement. In[15]:= $MaxExtraPrecision = 200;

With[{∂ = 10^-20, z0 = 1/(Sqrt[2] - 1)}, Table[N[∂^-k Sum[(-1)^(k - j) Binomial[k, j] JacobiSN[z0, j ∂], {j, 0, k}], 30] (Derivative[0, k][jacobiSN][z, 0] /. sol[k] /. z -> z0), {k, 5}]] Out[16]= 82.49068102 × 10−22 , −8.0323727111 × 10−21 , −3.8160520020 × 10−20 , −8.772201337 × 10−20 , 8.835607901 × 10−20
All, Contours -> 60, ColorFunction -> (Hue[1.6 (# - 1/2)]&), MeshRange -> {{0, T}, {0, 2Pi}}, di]; (* add intermediate points to a polygon with long edges *) addPoints[p_, δ∂_] := Module[{n, l}, Join @@ ( Function[s, If[(l = Sqrt[#. #]&[Subtract @@ s]) < δ∂, s, n = Floor[l/δ∂] + 1; Table[# + i/n (#2 - #1), {i, 0, n - 1}]& @@ s]] /@ Partition[Append[p, First[p]], 2, 1])]; (* add points to polygon edges and map to Cartesian t-coordinates *) lcpR = Show[DeleteCases[Graphics[lcp], _Line, Infinity] /. Polygon[l_] :> Polygon[{#1 Cos[#2], #1 Sin[#2]}& @@@ addPoints[l, 0.1]], di]; (* half-periods and branch point positions *) {δx, δy} = halfPeriods[N @ ϕ0]; branchPoints = Select[#, #[[1]].#[[1]] Automatic, Frame -> False, FrameTicks -> False, DisplayFunction -> $DisplayFunction]]

The last graphic allows now easily to explain the complicated oscillations of the pendulum in the complex plane. The poles of the Jacobi elliptic function sn are located in a rectangular array [950]. These poles are branch points of the elongation jHtL and when coming from a straight line from the center the solution continues on the different sheet. (After a second branch point is passed in the same direction, the two sheet might coincide again.) And the farther one is from the origin, the more branch points one has traversed to the right or left and solutions for any two values of a (also very nearby ones) can deviate arbitrarily much. We continue with a visualization of the Riemann surface of jHtL. Because only branch points are “real”, and branch cuts can be drawn arbitrarily (or come to existence due to following a solution along different path), we now use the symbolic solution jHtL in Cartesian coordinates. The following plot of jHtL has straight line branch cuts parallel to the real axis. (We choose the number of plotpoints to emphasize the cuts). In[16]:= makeHole[Polygon[l_], f_] := (* cut a hole in a polygon *)

Module[{mp = Plus @@ l/Length[l], L}, L = (mp + f(# - mp))& /@ l; {MapThread[Polygon[Join[#1, Reverse[#2]]]&, Partition[Append[#, First[#]], 2, 1]& /@ {l, L} ]}] In[17]:= Module[{ϕ0 = Pi/3., kM = 1, δx, δy, polys, polysH,

coloredPolys, coloredPolysR, coloredSheets}, {δx, δy} = 2 halfPeriods[ϕ0]; (* 3D plot of the main sheet *) polys = Cases[Graphics3D @ Plot3D[Re @ ϕP[τx + I τy, ϕ0], {τx, -δx, +δx}, {τy, -δy, +δy}, PlotPoints -> {48, 49}, PlotRange -> All, DisplayFunction -> Identity], _Polygon, Infinity]; (* make holes in polygons *)

The Classical Special Functions

1234

polysH = Flatten[makeHole[#, 0.8]& /@ polys]; (* color polygons according to real part of function value *) coloredPolys = {SurfaceColor[#, #, 2.3]&[ Hue[0.8 Abs[Last[Plus @@ #[[1]]/4]]/Pi]], #}& /@ polysH; (* mirror and shift polygons *) coloredPolysR = coloredPolys /. Polygon[l_] :> Polygon[({1, 1, -1}# + {0, 0, 2Pi})& /@ l]; (* polygons of the first sheets *) coloredSheets = Table[Map[If[Head[#] === List, (# + {0, 0, 4k Pi}), #]&, {coloredPolys, coloredPolysR}, {-2}], {k, -kM, kM}]; (* show all polygons *) Show[Graphics3D[{EdgeForm[], coloredSheets }], BoxRatios -> {1, 1, 1}, ViewPoint -> {4, -2, 1}, Boxed -> False]]

We could now continue and, say, solve the pendulum equation along circles. The following three functions pendulumND SolveAzimuthal, complexElongationsAzimuthal , and complexElongationPlotAzimuthal follow closely their ray counterparts. In[18]:= (* numerical solution of the pendulum equation

along the circle with radius ρ *) pendulumNDSolveAzimuthal[ρ_, ϕ0_, αMax_, opts___] := NDSolve[{-Exp[-2I α]/ρ^2 (ϕ''[α] - I ϕ'[α]) == -Sin[ϕ[α]], ϕ[0] == ϕP[ρ, ϕ0], ϕ'[0] == I ρ D[ϕP[t, ϕ0], t] /. {t -> ρ}}, ϕ, {α, 0, αMax}, opts, MaxSteps -> 10^5, PrecisionGoal -> 12, MaxStepSize -> 2Pi/60]; In[20]:= (* plot oscillations along the circle of radius ρ around the origin *) complexElongationNAzimuthal[ρ_, ϕ0_, αMax_, opts___] := Module[{ndsol}, (* solve pendulum equation along the circle *) ndsol = pendulumNDSolveAzimuthal[ρ, ϕ0, αMax]; (* plot real part of ϕ[t] *) Plot[Evaluate[Re[ϕ[α]] /. ndsol[[1]]], {α, 0, αMax}, opts, PlotPoints -> Round[60 αMax/(2Pi)], PlotStyle -> Hue[0.8 Abs[ϕ0]/Pi], AspectRatio -> 1/3]] In[22]:= complexElongationsAzimuthal[ρ_, ϕ0_, αMax_, kM_:1, opts___] :=

Module[{pl, lines}, Show[Graphics[{Thickness[0.002], Hue[0.8 Abs[ϕ0]/Pi], (* elongation on the main sheet *) pl = Plot[Evaluate[Re[ϕP[ρ Exp[I α], ϕ0]]], {α, 0, αMax}, DisplayFunction -> Identity, PlotPoints -> Round[60 αMax/(2Pi)]][[1, 1, 1, 1]]; (* elongation on the neighboring sheet *) lines = {Table[{Line[({0, 4k Pi} + #)& /@ pl], Line[({0, (4k + 2) Pi} + {1, -1}#)& /@ pl]}, {k, -kM, kM}]}}], opts]]; In[23]:= complexElongationPlotAzimuthal[paramList_, opts___] :=

Show[GraphicsArray[ Show[{(* multiple sheets from the symbolic form *) complexElongationsAzimuthal[#1, #2, #3, #4, DisplayFunction -> Identity] /. _Thickness :> Thickness[0.02],

Solutions

1235 (* one path from the numeric solution *) complexElongationNAzimuthal[#1, #2, #3, opts, DisplayFunction -> Identity] /. _Hue :> GrayLevel[0]}]& @@@ paramList]]

Here are again three examples. In[24]:= complexElongationPlotAzimuthal[

{{21, 1, 2Pi, 1}, {78/5, 2/3Pi, 2Pi, 1}, {37, 1/2, 2Pi, 1}}]

We could now go on and investigate the number of visited sheets as a function of the distance for a given ray direction and maximal elongation, or see what happens along spiral-shaped paths, but we end here. For applications of unusual pendulum solutions, see [79], [239]. For the analytic structure of the pendulum equation with a periodic forcing, see [994]. For genuinely complex mechanical models, see [932]. 5. Rocket with Discrete Propulsion, Neat Product, Harmonic Oscillator Spectrum a) We easily see from the conservation of momentum law that the final velocity v f is [385], [1021]: n

Hmi - m f L 1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ „ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ v f = u ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅ . n m f + k Hmi - m f L ê n k=1

To find an analytical expression for this sum as a function of n, we use Sum. In[1]:= vf = Sum[((mf - mi) u)/(k (mf - mi) - mf n), {k, n}]

mf n mf − mi

mf n mf − mi

Out[1]= −u JPolyGammaA0, 1 −  E − PolyGammaA0, 1 + n −  EN

Substituting mi ê m f Ø n, and normalizing the nozzle velocity, we get a unitless result. In[2]:= vf = Simplify[vf/u /. mf -> mi/ν]

−1 + n + ν −1 + ν

−1 + ν + n ν −1 + ν

Out[2]= −PolyGammaA0,   E + PolyGammaA0,   E

We now graphically examine the behavior of the final velocity v f as a function of the number of impulses. We use the value n = 5 ê 2. In[3]:= Block[{ν = 5/2}, ListPlot[Table[vf, {n, 1, 100}]]] 0.91

20

40

60

80

100

0.89 0.88 0.87

In order to find the limiting value for an infinite number of impulses, we look at the behavior of PolyGamma[0, x] at infinity. In[4]:= ser[x_] = Normal[Series[PolyGamma[0, x], {x, Infinity, 2}]]

1 12 x

1 2x

1 x

Out[4]= − 2 −  − LogA  E In[5]:= ser[(-1 + ν + n ν)/(-1 + ν)] - ser[(-1 + n + ν)/(-1 + ν)]

The Classical Special Functions

1236 Out[5]=

−1 + ν H−1 + νL2 H−1 + νL2    +   −   − 2 H−1 + n + νL 12 H−1 + n + νL2 12 H−1 + ν + n νL2 −1 + ν −1 + ν −1 + ν    + LogA   E − LogA   E 2 H−1 + ν + n νL −1 + n + ν −1 + ν + n ν

In[6]:= Series[%, {n, Infinity, 0}] // Simplify[#, ν > 0]&

1 n

1

Out[6]= Log@νD + OA  E

This means the limiting velocity is logHn ê Hn - 1LL + logHn - 1L = logHnL [847]. Here is an asymptotic value of the above mass relationship. In[7]:= Log[5/2] // N Out[7]= 0.916291

Here it is with units: v f = u lnHmi ê m f L. For further details on this problem, see [847] and [189]. For a similar problem, see [1030]. (V5.1 on byblis2) Out[10]=

TMGBs`SaveNotebookAndQuitKernel@D

b) A direct calculation of the infinite product gives a closed-form result. In[1]:= Product[Exp[-1/k] (1 + 1/k + 1/k^2), {k, Infinity}] è!!!!! è!!!!! 3 −    3 3 +    3 −EulerGamma−LogGammaA  2 2  E−LogGammaA  2 2  E

Out[1]= 

Here is a simplified form of the result. In[2]:= FullSimplify[%] è!!!!!

Out[2]=

3 π −EulerGamma CoshA   E 2     π

And here is a generalization of the product that contains the two parameters a and b. In[3]:= Product[Exp[-1/k] (1 + a/k + b/k^2), {k, Infinity}] Out[3]=

−EulerGamma       ! !  è!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!! GammaA 12 I2 + a − a2 − 4 b ME GammaA 12 I2 + a + a2 − 4 b ME

Further generalizations can be calculated too, but the results become more messy. In[4]:= Product[Exp[-1/k] (1 + a/k + b/k^2 + c/k^3), {k, Infinity}] //.

(* introduce abbreviations *) -a^2 b^2 + 4 b^3 + 4 a^3 c - 18 a b c + 27c^2 ->  //. -2 a^3 + 9 a b - 27 c + 3 Sqrt[3] Sqrt[] -> //. -4 a^3 + 18 a b -54 c + 6 Sqrt[3] Sqrt[] -> 2 i 1 i 2 21ê3 a2 6 21ê3 b y GammaA −EulerGamma j Out[4]=  ì jGammaA  j  +   − 22ê3 1ê3 z j6 + 2 a −  zE 6 k 1ê3 1ê3 { k è!!!!! è!!!!! è!!!!! 1ê3 2 1ê3 1ê3 1ê3 3 b + 12  H1 +  3 L a − 6 2 b−62 + 4 a 1ê3 + 22ê3 2ê3 −  22ê3 3 2ê3 22         E 12 1ê3 GammaA è!!!!! è!!!!! è!!!!! 2 21ê3 H1 −  3 L a2 − 6 21ê3 b + 6  21ê3 3 b + 12 1ê3 + 4 a 1ê3 + 22ê3 2ê3 +  22ê3 3 2ê3 y z         Ez 12 1ê3 {

For similar products containing p, e, and g, see [301], [186]. c) This is the general solution of the differential equation under consideration. (We divide out an unimportant numeric prefactor.) In[1]:= odeSol = FullSimplify[First[ψ[z] /.

DSolve[{-ψ''[z] + z^2 ψ[z] == ∂ ψ[z]}, ψ[z], z]]]/(1/2 - I/2) /. (* write all parts as hypergeometric functions *) HermiteH[n_, z_] :> 2^n HypergeometricU[-n/2, 1/2, z^2] z2 − 2

Out[1]= H1 + L 

1 1−∂ 1 JC@2D Hypergeometric1F1A  ,  , z2 E + 2 2 4 2

H−1+∂L

1−∂ 1 C@1D HypergeometricUA  ,  , z2 EN 4 2

Solutions

1237

For the eigenfunctions to be square integrable in H-¶, ¶L, they have to vanish faster than z-1ê2 as z Ø ¶. So we have a look at the series of odeSol at z = ¶. In[2]:= odeSol /. {Hypergeometric1F1[a_, b_, x_] ->

Normal[Series[Hypergeometric1F1[a, b, x], {x, Infinity, 0}]], HypergeometricU[a_, b_, x_] -> Normal[Series[HypergeometricU[a, b, x], {x, Infinity, 0}]]} Series::esss : Essential singularity encountered in  Series::esss : Essential singularity encountered in z2 −  2

Out[2]= H1 + L 

i 1 j  j j j jH−1L 4 k

i 1 j  j j j j2 2 k

H−1+∂L

H−1+∂L

1 +OA  1 E2  1 x  x .

1 2  x +O@xD .

More…

More…

1−∂

1 4 J 2 N C@1D + z 1 H−1+∂L

è!!!!! 1 4 π J 2 N z

i 1−∂ j 2 1 1 1   j 2 % GammaA  +  H−1 + ∂LE + C@2D j jH−1L 4 z $%%%%%%%%%% j z 2 4 k

1−∂ z z zy 1 1 1−∂ y 1 2 1−∂ y z z z ì JGammaA  z  +  H−1 + ∂LE GammaA  ENz J 2 N GammaA  Ez z z z z zz 2 4 4 z 4 { {{

The exponential growing term vanishes when Gamma[3/4 - ∂/4] becomes infinity; this means ¶n = 4 n + 3, n œ . The second possibility to cancel the exponential growing terms is C[2]=0. In[3]:= odeSol /. {C[2] -> 0, C[1] -> 1} 1 H−1+∂L 

Out[3]= H1 + L 2 2

z2 1−∂ 1 − 2 HypergeometricUA  ,  , z2 E 4 2

Let us now consider the origin z = 0. In[4]:= % /.

{Exp[-z^2/2] -> Normal[Series[Exp[-z^2/2], {z, 0, 3}]], HypergeometricU[a_, b_, z_] -> Normal[Series[HypergeometricU[a, b, z], {z, 0, 3}]]} /. (* for positive real z *) {(z^2)^(1/2) -> z, (z^2)^(-1/2) -> 1/z} // (CoefficientList[#, z]&) // Simplify 1 1+∂ è!!!!! 1 è!!!!! è!!!!! H1 + L 2 2 H−1+∂L π H1 + L 2 2 π H1 + L 2 2 H−3+∂L π ∂   , Out[4]= 9  3  ∂ , −  1−∂ , −  3  ∂ Gamma@ 4 −  Gamma@ Gamma@  D    D   −   D 4 4 4 4 1 1 è!!!!! è!!!!! H 13 + 3 L 2 2 H−1+∂L π ∂ H 13 + 3 L 2 2 H−7+∂L π H−1 + ∂2 L    ,    , 1−∂ Gamma@ 4 D Gamma@ 34 − ∂4 D 1 1 è!!!!! è!!!!! 1  1   +   L 2 2 H−5+∂L π H−9 + ∂2 L  +   L 2 2 H−9+∂L π H30 − 31 ∂ + ∂3 L H  H  15 15 45 45    , −     , −  1−∂ Gamma@ 4 D Gamma@ 34 − ∂4 D 1 1 è!!!!! è!!!!! 1  1   +   L 2 2 H−7+∂L π H210 − 79 ∂ + ∂3 L  +   L 2 2 H−11+∂L π H−9 + ∂L H−5 + ∂L H−1 + ∂L H  H  315 315  45 45     ,   ,  1−∂ Gamma@ 34 − ∂4 D Gamma@ 4 D 1 1   +   L 2 2 H−9+∂L è!!!! π! H−11 + ∂L H−7 + ∂L H−3 + ∂L H  315 315      = −  1−∂ Gamma@   D 4

When Gamma[1/4 - ∂/4] (meaning ¶n = 4 n + 1, n œ ) becomes infinity, the odd terms vanish and yHzL becomes an even function with y£ H0L = 0, making yHzL continuous at z = 0. At ¶n = 4 n + 3, n œ , the even terms vanish and yH0L = 0, making yHzL a smooth odd function Putting these two results together, we arrive at ¶n = 2 n + 1, n œ , the well-known oscillator spectrum. Sometimes the solution of the differential equation z2 yHzL - y££ HzL = ¶ yHzL is written in the form [1221] c1 expH-z2 ê 2L HH¶-1Lê2 HzL + c2 expH-z2 ê 2L

1 F1 H-

H¶ - 1L ê 4; 1 ê 2; z2 L.

Taking into account the asymptotics of 1 F1 and HH¶-1Lê2 yields the same result: ¶n = 2 n + 1, n œ .

The Classical Special Functions

1238

For a derivation of the spectrum through the Titchmarsh–Weyl m function, see [1324]. The interested reader could now continue and derive the energy spectrum for the harmonic oscillator in a box [760], [13], [877], [288], [961] (meaning yn H-LL = yn H+LL = 0 for large L) by using higher order terms in the series expansion of the hypergeometric functions. For a similar approach to the hydrogen spectrum, see [300], [253]. For a difference equation-based approach to eigenvalue problems, see [215]. For the most general canonical commutation relation-based quantization, see [973]. For nonclassical, canonoid, Newton-equivalent quantizations of the harmonic oscillator and the corresponding eigenvalues, see [373], [1218], and [437], [254]. For the (supersymmetric) half-space oscillator, see [354], [355], [487], [1369], [427]. For harmonic oscillators with a position-dependent mass, see [27]. For nonlinear harmonic oscillators, see [252]. 6. Contour Integral, Asymptotics of Bessel Function, Isophotes, Circular Andreev Billiard a) Let us have a look at the branch cuts of the integrand and how the integration contour crosses them. In[1]:= With[{∂ = 10^-6},

(* picture of the integrand *) Show[{Apply[Plot3D[Im[((x + I y)^2 - 1)^(1/Pi)], ##, DisplayFunction -> Identity, PlotPoints -> 20]&, (* use many parts to avoid branch cuts *) {{{x, -2, -∂}, {y, -2, -∂}}, {{x, ∂, 2}, {y, -2, -∂}}, {{x, -2, -∂}, {y, ∂, 2}}, {{x, ∂, 2}, {y, ∂, 2}}}, {1}], (* the integration contour *) Graphics3D[{Thickness[0.01], Line[Table[{3/2 Cos[p], Sin[2p], Im[((3/2Cos[p] + I Sin[2p])^2 - 1)^(1/Pi)] + (* lift slightly above the surface *) 0.05}, {p, 0, N[2Pi], N[2Pi/300]}]]}]}, DisplayFunction -> $DisplayFunction, AxesLabel -> {"x", "y", None}]]

1

2

0 -1 -2 2

1 0 y

-1 x

0

-1 1

2

-2

We see that the complex t-plane is cut along the line (interval) H-1, 1L and along the imaginary axis. (That this is a branch cut follows easily from the branch cut of the Power function along the negative real axis and solving the equation Ht2 - 1L = x for -¶ < x < 0.) These locations of the branch cuts mean that, fortunately, our contour never crosses any branch cut; it always stays on the “right” sheet. The integrand is continuous everywhere along the path and does not have to explicitly continue the integrand analytically. (If the contour of integration would not exactly go from the upper half-plane to the lower half-plane and vice versa in the point 80, 0 False, PrecisionGoal -> 4]]^2

We use the symmetry of the intensity I Hu, vL = I H- u, vL = I Hu, - vL. Here is a contour plot of the intensity in the first quadrant. In[2]:= ∂ = 10.^-6; pp = 50; cp = ContourPlot[Abs[int[u, v]], {u, ∂, 10Pi}, {v, ∂, 5Pi}, PlotPoints -> pp, ColorFunction -> Hue, AspectRatio -> Automatic, Compiled -> False]

Solutions

1241 15 12.5 10 7.5 5 2.5 0 0

5

10

15

20

25

30

To get a smoother picture, we space the contour lines more evenly. In[4]:= (lcp = ListContourPlot[cp[[1]], Contours ->

(#[[pp/2]]& /@ Partition[Sort[Flatten[cp[[1]]]], pp]), ColorFunction -> (Hue[0.7 #]&), ContourLines -> False, MeshRange -> {{∂, 10Pi}, {∂, 5Pi}}, DisplayFunction -> Identity];)

Generating the graphics in the other three quadrants by reflection, we get the following picture for the intensity distribution. In[5]:= With[{gr = Graphics[lcp]},

Show[Function[δ, gr /. Polygon[l_] :> Polygon[δ #& /@ l]] /@ {{1, 1}, {-1, 1}, {1, -1}, {-1, -1}}, DisplayFunction -> $DisplayFunction, FrameTicks -> None, AspectRatio -> Automatic]]

d) It is straightforward to implement the calculation of the determinant described. For the range 0 < ¶n < D0 , we can carry out the complex conjugation explicitly by the changing signs of the square roots. = Sqrt[1 + ∂]; {q, qc} = Sqrt[1 + # Sqrt[∂^2 - ∆0^2]]& /@ {+1, -1};

In[1]:= k

{δe, δh} = ∆0/(∂ + # Sqrt[∂^2 - ∆0^2])& /@ {-1, 1}; In[4]:= ψNe = BesselJ[m, k r] -

BesselJ[m, k ρN]/BesselY[m, k ρN] BesselY[m, k r]; ψNh = ψNe /. ∂ -> -∂; {ψSe, ψSh} = {BesselJ[m, q r], BesselJ[m, qc r]};

In[7]:= det1 = Det[{{ψNe, 0, δe ψSe, δh ψSh},

{0, ψNh, ψSe, ψSh}, {D[ψNe, r], 0, δe D[ψSe, r], δh D[ψSh, r]}, {0, D[ψNh, r], D[ψSe, r], D[ψSh, r]}} /. r -> ρS];

The calculation of the energy spectrum is now, in principle, straightforward. In practice, we have to do some more programming to yield the energy eigenvalues in a reasonable amount of time. The presence of 22 different Bessel functions in det1, the size of det1, and the ¶-dependent denominators with zeros in the interval 0 < ¶n < D0 need to be addressed. The 22 Bessel functions and the size imply a relatively slow calculation of the determinant; the poles with respect to ¶ make numerical root finding more difficult. We start with removing the denominators from the expanded determinant. In[8]:= det2 = Factor[Numerator[Together[det1]]]/∆0/2;

det2 is a relatively large expression. In[9]:= det2 // LeafCount Out[9]= 22053

The Classical Special Functions

1242

We introduce unique variables for all Bessel functions to avoid their repeated time-consuming calculation in det2 for a given ¶. (We introduce a few more abbreviations than needed because later we will get the Bessel functions for all first arguments anyway.) In[10]:= (* auxiliary function;

m stands for m - 1, 0 for m + 0, p for m + 1 *) aux[x_] := Which[x === m - 1, "m", x === m, "0", x === m + 1, "p"] In[12]:= (* all BesselJ[_, _] that occur *) allBesselJs = Union[Cases[det2, _BesselJ, Infinity]]; (* introduce abbreviations *) allBesselJsAbbr = allBesselJs /. ((BesselJ[_, #1] :> ToExpression[ToString[#2] aux[]])& @@@ {{ρN Sqrt[1 - ∂], J1}, {ρS Sqrt[1 - ∂], J2}, {ρN Sqrt[1 + ∂], J3}, {ρS Sqrt[1 + ∂], J4}, {ρS Sqrt[1 - Sqrt[-∆0^2 + ∂^2]], J5}, {ρS Sqrt[1 + Sqrt[-∆0^2 + ∂^2]], J6}}); In[16]:= (* all BesselY[_, _] that occur *)

allBesselYs = Union[Cases[det2, _BesselY, Infinity]]; (* introduce abbreviations *) allBesselYsAbbr = allBesselYs /. ((BesselY[_, #1] :> ToExpression[ToString[#2] aux[]])& @@@ {{ρN Sqrt[1 - ∂], Y1}, {ρS Sqrt[1 - ∂], Y2}, {ρN Sqrt[1 + ∂], Y3}, {ρS Sqrt[1 + ∂], Y4}});

The resulting expression is still large and we simplify it using the function OptimizeExpression. In[20]:= besselRules = Join[Rule @@@ Transpose[{allBesselJs, allBesselJsAbbr}],

Rule @@@ Transpose[{allBesselYs, allBesselYsAbbr}]]; In[21]:= (* substitute abbreviations *)

det3 = det2 //. besselRules; In[23]:= optimize = Experimental`OptimizeExpression[#,

OptimizationLevel -> 1, ExcludedForms -> {}]&; In[24]:= det4 = optimize[det3];

(* length of det3 and size of the optimized expression *) {Length[Expand[det3]], LeafCount[det4]} Out[26]= 8160, 1805
Join[{{∂, _Complex}, {∆0, _Complex}}, {#, _Complex}& /@ (* the Bessel functions *) {J1m, J10, J1p, J2m, J20, J2p, J3m, J30, J3p, J4m, J40, J4p, J5m, J50, J5p, J6m, J60, J6p, Y1m, Y10, Y1p, Y2m, Y20, Y2p, Y3m, Y30, Y3p, Y4m, Y40, Y4p}] /. (* the determinant *) body -> det4 /. OptimizedExpression[e_] :> e];

The compilation was successful. For being able to calculate high-precision values of the determinant, we extract the last argument from the compiled function and call it ucfDet. In[28]:= {Union[Head /@ Flatten[cfDet[[4]]]], (ucfDet = cfDet[[5]]) // Head} Out[28]= 88Integer, Real (Hold[ucfDet @@ args] /. args -> (ucfDet[[1]] //. (Reverse /@ besselRules)))]

Calculating a single value of the determinant takes seconds, even at this point . In[30]:= det5[300, 0.1, 0.15, {200, 400}] // Timing Out[30]= 82.07 Second, −1.86762 × 10−24 − 2.42842 × 10−7 
All, Axes -> False, Frame -> True], (* plot of average eigenvalue spacing *) ListPlot[MapIndexed[{#2[[1]] - 1, #1}&, (Plus @@ #/If[# === {}, 1, Length[#]])&[-Subtract @@@ Partition[Sort[#[[1, 2]]& /@ #], 2, 1]]& /@ theZeros], PlotRange -> All, Axes -> False, Frame -> True]}]]]

Solutions

1245

15

0.05

12.5

0.04

10

0.03

7.5

0.02

5

0.01

2.5 0

0 0

100

200

300

400

0

100

200

300

400

If we relax the restriction of m being an integer, we can observe the zeros as a function of m. We again use the function det∂List, but this time repeatedly with noninteger limits for mMin and mMax. In[45]:= detailedGraphics[∆0_, {∂Min_, ∂Max_}, ρS_, ρN_,

{mMin_, mMax_}, {pp∂_, ppδm_}, opts___] := Module[{}, (* calculate values of the determinant *)  = Transpose /@ Im[Table[ Table[det∂List[N[∂], N[∆0], ρS, ρN, {mMin + δ, mMax + δ}], {∂, ∂Min, ∂Max, (∂Max - ∂Min)/pp∂}], {δ, 0, (ppδm - 1)/ppδm, 1/ppδm}]]; (* show zeros using ContourPlot *) ListContourPlot[(* rearrange data for increasing m *) Transpose @ Flatten[Table[[[i, j]], {j, Length[[[1]]]}, {i, Length[]}], 1], opts, MeshRange -> {{mMin, mMax - 1/ppδm}, {∂Min, ∂Max}}, Contours -> {0}, ContourShading -> False]]

Here are two detailed graphs of the zeros for noninteger m for 0 < m < 10 and 300 < m < 310, where 0 < ¶ < D0 ê 3. We see that for larger m œ , ¶HmL becomes an oscillating function. With an nonintegral period, the ¶HmL for integer m appear “random”. In[46]:= Show[GraphicsArray[

Block[{$DisplayFunction = Identity}, detailedGraphics[0.15, {0., 0.05}, 200, 400, #, {24, 24}]& /@ {{0, 10}, {300, 310}}]]] 0.05

0.05

0.04

0.04

0.03

0.03

0.02

0.02

0.01

0.01

0

0

2

4

6

8

10

0 300 302 304 306 308 310

The interested reader could now continue to calculate and visualize the eigenfunctions (or its components). To avoid the time-consuming calculation of the Bessel functions involved, one could, for instance, work in polar coordinates and solve the differential equation of the Bessel functions. For the circular Andreev billiard with applied magnetic field, see [341]; for an angular sector of a circular Andreev billiard, see [342]. 7. Euler’s Integral for Beta Function, Beta Probability Distribution, Euler’s Constant a) Let us first have a look at the integration path. In[1]:= ParametricPlot[{Cos[s]^2 Cosh[Sin[Pi/4 + s]]^2 -

Sin[s]^2 Sinh[Sin[Pi/4 + s]]^2, Cos[s] Cos[Sin[Pi/4 + s]] Sin[s] Sin[Sin[Pi/4 + s]]}, {s, 0, 2Pi}, Frame -> True, Axes -> False]

The Classical Special Functions

1246 0.2 0.1 0 -0.1 -0.2 -0.5

0

0.5

1

1.5

The points 0 and 1 are branch points, and the corresponding branch cuts are H-¶, 0L and H1, ¶L, respectively. Because the direct evaluation of the integrand exhibits discontinuities when crossing the branch cuts, we split the integration path into four pieces. Here, this is visualized. In[2]:= Show[GraphicsArray[#]]& /@

Partition[(* the wavy lines of the branch cuts *) Graphics[{Line[Table[{1 + 0.02 i, (-1)^i 0.02}, {i, 0, 42}]], Line[Table[{ - 0.02 i, (-1)^i 0.02}, {i, 0, 42}]], (* showing the direction of the curve *) Apply[Function[{p1, p2}, Module[{d = p2 - p1, n, s}, n = d/Sqrt[d.d]; s = Reverse[n]{-1, 1}; Polygon[{p1 + s d, p1 - s d, p2}]]], Partition[#[[1, 1, 1, 1]], 2, 1], {1}]}, PlotRange -> {{-0.85, 1.85}, {-0.3, 0.3}}, AspectRatio -> 1/2, Frame -> True, Axes -> True]& /@ (ParametricPlot[ (* the pieces of the integration path *) {Cos[s]^2 Cosh[Sin[Pi/4 + s]]^2 - Sin[s]^2 Sinh[Sin[Pi/4 + s]]^2, Cos[s] Cos[Sin[Pi/4 + s]] Sin[s] Sin[Sin[Pi/4 + s]]}, Evaluate[Flatten[{s, #}]], DisplayFunction -> Identity, Axes -> False]& /@ (* the four segments *) Partition[{0, Pi/2, Pi, 3Pi/2, 2Pi}, 2, 1]), 2] 0.2

0.2

0.1

0.1

0

0

-0.1

-0.1

-0.2

-0.2 -0.5

0

0.5

1

1.5

0.2

0.2

0.1

0.1

0

0

-0.1

-0.1

-0.2

-0.2 -0.5

0

0.5

1

1.5

-0.5

0

0.5

1

1.5

-0.5

0

0.5

1

1.5

Now, we have to analytically continue the integrand across the branch cuts. When crossing the negative real axis from above, the analytic continuation of t p is expH2 i p pL t p . This can be seen by rewriting t p in the following way: p

t p = HelnHtL L = elnHtL p and by taking into account (¶ Ø 0)

Solutions

1247

lnHnegativeRealNumber + i ¶L - lnHnegativeRealNumber - i ¶L = 2 i p. Treating the other crossings of the branch cuts in a similar way, we can implement the path over the whole parameter range. As a sketch, here is the path on the Riemann surface of z4ê3 H1 - zL3ê2 . In[3]:= Show[GraphicsArray[Function[reIm,

Module[{p = 4/3, q = 3/2, ∂ = 10^-5, r1 = 3/2, r2 = 1/2, intPath, sheets}, (* the integration path *) intPath = ParametricPlot3D[Function[t, {Re[t], Im[t], 0.01 + reIm @ Which[ (* the analytic continuations across the branch cuts *) 0 False, Axes -> False, ViewPoint -> {0, -2.4, 2.2}]]] /@ (* use real part and imaginary part *) {Re, Im}]]

So we can now implement the following function myBeta (for especially tailored integration formulas for the integrands occurring here, see [503]). In[4]:= t =

Cos[s]^2 Cosh[Sin[Pi/4 + s]]^2 - Sin[s]^2 Sinh[Sin[Pi/4 + s]]^2 + I Cos[s] Cos[Sin[Pi/4 + s]] Sin[s] Sin[Sin[Pi/4 + s]];

The Classical Special Functions

1248 dtds = D[t, s]; (* change of the integration variable *) myBeta[p_, q_] := -Exp[I Pi (-p + q)]/(4 Sin[p Pi] Sin[q Pi]) * (NIntegrate[t^(p - 1) (1 - t)^(q - 1) dtds, {s, 0, Pi/2}] + Exp[2I Pi p] NIntegrate[t^(p - 1) (1 - t)^(q - 1) dtds, {s, Pi/2, Pi}] + Exp[2I Pi (p - q)] NIntegrate[t^(p - 1) (1 - t)^(q - 1) dtds, {s, Pi, 3Pi/2}] + Exp[2I Pi ( - q)] NIntegrate[t^(p - 1) (1 - t)^(q - 1) dtds, {s, 3Pi/2, 2Pi}]) // N

This is a small test for some random values. In[7]:= SeedRandom[1234];

Table[{p = Random[Complex, {-2 - 2 I, 2 + 2 I}], q = Random[Complex, {-2 - 2 I, 2 + 2 I}], N[{myBeta[p, q], Beta[p, q]}]}, {5}] Out[8]= 880.724648 + 1.41687 , −0.271648 + 1.58976 , 8−1.93965 − 0.226004 , −1.93965 − 0.226004  16], {k, o}]

Because we need normalized eigenfunctions for the expansion, we calculate the norm of the ψIpo[k]. Because of the periodicity of the eigenfunctions, we use the option setting Trapezoidal for NIntegrate. In[12]:= cTab = Table[

1/Sqrt[NIntegrate[Evaluate[ψIpo[k][Abs[x]]^2], {x, -3Pi, 3Pi}, MaxRecursion -> 10, Method -> Trapezoidal]], {k, o}];

The following graphic shows the first 18 normalized eigenfunctions “at” their energies together with the triple well potential. The then nearly degenerate eigenfunctions deep inside the wells are clearly visible. (The third, sixth, … are not degenerate because its degenerate partner would be antisymmetric.) In[13]:= Plot[Evaluate[Table[∂Data[[k]] + 4 cTab[[k]] ψIpo[k][Abs[x]],

{k, 24}] // N], {x, -3Pi, 3Pi}, PlotStyle -> Table[{Thickness[0.002], Hue[0.8 (k - 1)/24]}, {k, 24}], PlotRange -> All, Frame -> True, Axes -> False, AspectRatio -> 1/4, (* the triple well potential *) Prolog -> {Thickness[0.002], GrayLevel[0], Line[Table[{x, -V0 Cos[x]}, {x, -3. Pi, 3. Pi, 6Pi/300}]]}] 30 20 10 0 -10 -7.5

-5

-2.5

0

2.5

Now we calculate the expansion coefficients c j (including the normalization coefficients). In[14]:= Module[{ = 6, xM = Pi/6},

αTab = Table[2 cTab[[k]] NIntegrate[Evaluate[ ψIpo[k][Abs[x]] Cos[ x] Cos[x/xM Pi/2]^2], {x, 0, xM}, MaxRecursion -> 8, AccuracyGoal -> 5], {k, o}]];

5

7.5

The Classical Special Functions

1252

The following plot of the logarithm of absolute value of the expansion coefficients confirms that we took enough states into account for the purpose of a visualization. In[15]:= ListPlot[Log[10, Abs[αTab]], PlotRange -> All]

-2 -4 -6

25

50

75

100

125

150

A quick check of Parseval’s theorem shows that we did not miss any important eigenstate. (The 1% difference is caused by taking into account the first 160 states only; for the visualization purpose here this is sufficient.) In[16]:= {(* norm of initial wave function *)

Module[{ = 6, xM = Pi/6}, 2 Integrate[(Cos[ x] Cos[x/xM Pi/2]^2)^2, {x, 0, xM}]] // N, (* sum of modes *) Sum[αTab[[k]]^2, {k, o}]} Out[16]= 80.229074, 0.226713 + 1.35381 × 10−14 
False, FrameTicks -> False,

PlotRange -> #2, ColorFunction -> (Hue[0.8 #]&), AspectRatio -> 1/3]& @@@ {{Abs, {0, 2/3}}, {Arg[#]^2&, {0, Pi^2}}}

Solutions

1253

It remains to calculate of YHx, tL using NDSolve. We will use the "Pseudospectral" method because of the periodic boundary condition. The result from NDSolve agrees visually with the result from above. In[24]:= Module[{ = 6, xM = Pi/6, X = 3Pi, pp = 120, T = 10, V0 = 12},

(* solve differential equation *) NDSolve[{I D[Ψ[x, t], {t, 1}] == -1/2 D[Ψ[x, t], {x, 2}] - V0 Cos[x] Ψ[x, t], Ψ[x, 0] == Cos[ x] If[Abs[x] < xM, Cos[x/xM Pi/2]^2, 0], Ψ[-X, t] == Ψ[+X, t]}, Ψ[x, t], {x, -X, X}, {t, 0, T}, (* for plotting purposes use small precision goal *) AccuracyGoal -> 3, PrecisionGoal -> 3, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", DifferenceOrder -> "Pseudospectral", "MaxPoints" -> pp, "MinPoints" -> pp}}] // (nsol = #)&; (* display square absolute value *) DensityPlot[Evaluate[Abs[Ψ[x, t]] /. nsol[[1]]], {t, 0, nsol[[1, 1, 2, 0, 1, 2, 2]]}, {x, -X, X}, PlotPoints -> {600, 400}, Mesh -> False, PlotRange -> {0, 2/3}, AspectRatio -> 1/3, ColorFunction -> (Hue[0.78 #]&)]] 7.5 5 2.5 0 -2.5 -5 -7.5 0

2

4

6

8

10

For the time-evolution of similar wave packets in the cos-potential, see [525]. b) The potential V HxL = -ex is singular at x = ¶; it approaches ¶ faster than any power of x. In the first moment, one might not expect the Schrödinger equation with the potential VHxL = -ex to have any bound states. For ¶ > 0, a particle could basically move freely in the left half space and is accelerated in the right half space. So, one expects a continuous spectrum. For ¶ < 0, a particle cannot enter the classically forbidden left half space and is accelerated in the right half space. Again one would expect a continuous spectrum (like for the linear potential VHxL = -F x.) The possibility for a particle to move freely in an unbounded domain would under most circumstances still imply a continuous spectrum and no bound states. But in a physical picture, bound states are caused by suitable interferences of travelling waves. And for the V HxL = -ex potential, a classical particle will reach infinity in finite time (and will become reflected there and return). So, in this fast decaying potential interference of left- and right-moving waves and as a result bound states are possible [1051]. For clarity, we calculate the xHtL dependence for a classical particle starting with zero velocity and zero potential energy. In[1]:= V[x_] := -Exp[x] In[2]:= x[t] /. DSolve[{x''[t] == -D[V[x[t]], x[t]],

x[0] == Log[-∂], x'[0] == 0}, x[t], t]

The Classical Special Functions

1254

Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… Solve::incnst : Inconsistent or redundant transcendental equation. After reduction, the 1 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 bad equation is 4 ArcTanhATanhA  C@1D Power@2D EE == 0. More… 2 Solve::verif : Potential solution 8C@2D → 0, C@1D → 2 ∂< Hpossibly discarded by verifierL should be checked by hand. May require use of limits. More… Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… General::stop : Further output of Solve::ifun will be suppressed during this calculation. More… ! 2y è!!!!!!!!!!! i t2 ∂ j−1 + TanhA  z ! E z Out[2]= 9LogA∂ j z j è!!!! zE= j 2 { k In[3]:= X[t_, ∂_] = Log[∂ (Tanh[(t Sqrt[∂])/Sqrt[2]]^2 - 1)]

i

è!!!!!

k

2

2

y

t ∂ z j−1 + TanhA  z  Out[3]= LogA∂ j j !  E z è!!!! zE j {

In[4]:= (* equation of motion and initial conditions are fulfilled *)

{D[X[t, ∂], t, t] - Exp[X[t, ∂]] // Simplify, X[0, ∂], Derivative[1, 0][X][0, ∂]} Out[5]= 80, Log@−∂D, 0