The Mathematica GuideBook for Symbolics
Michael Trott
The Mathematica GuideBook for Symbolics
With 848 Illustration...
251 downloads
1573 Views
139MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
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
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).
54 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
Pi], {100}] // Timing 84.75 Second, Null
Pi], {100}] // Timing 81.31 Second, Null
0]}&[Sqrt[z^2]] è!!!!!! 9 z2 , z= {#, Refine[z < 0, z > 0]}&[Sqrt[z^2]] è!!!!!! 9 z2 , False= {#, Refine[#, z == Pi/2]}&[Tan[z]] 8Tan@zD, ComplexInfinity< {#, Refine[#, z == E]}&[Round[z]] 8Round@zD, 3< {#, Refine[#, z < -1]}&[Log[z]] 8Log@zD, π + Log@−zD
20]}&[Log[z] > 1] 8Log@zD > 1, Log@zD > 1
1, Refine[z > 0]] True
When the function Assuming appears in nested form, the assumptions are joined. Here is an example. In[73]:= Out[73]=
Assuming[z > 1, Assuming[x < 0, Refine[z > 0 && x < 1]]] True
All currently active assumptions are stored in $Assumptions. $Assumptions gives the currently active assumptions.
By default, $Assumptions has the value True. This means, nothing nontrivial can be derived. In[74]:= Out[74]=
$Assumptions True
Here are the assumptions printed (using a Print-statement) that are active within the inner nested Assuming. In[75]:=
Assuming[z > 1, Assuming[x < 0, Print[$Assumptions]; Simplify[z > 0 && x < 1]]] x < 0 && z > 1
Out[75]=
True
From contradictory assumptions (indicated when recognized as such), follow false statements. In[76]:=
Assuming[z > 1, Assuming[z < -1, Simplify[-1/2 < z < 1/2]]] $Assumptions::cas : Warning: Contradictory assumptionHsL z < −1 && z > 1 encountered. More…
Out[76]=
True
This was a short introduction into a directed use of Simplify and Refine using options and assumption specifications.
1.2 Operations on Polynomials
13
1.2 Operations on Polynomials 1.2.0 Remarks Polynomials and polynomial systems play an extraordinary role in computational symbolic mathematics. In this section, we deal with three aspects of such systems: 1) Structural operations that express polynomials in various canonical forms, 2) manipulations of systems of polynomial equations and 3) manipulations of systems of polynomial inequations (meaning inequalities with Less and Greater, as well as Unequal as their heads). Explicit solutions of polynomial equations (which for most univariate polynomials of degree five or higher) cannot be given in radicals; their solutions will be discussed in Section 1.5. Here we largely focus on operations on polynomials that use their coefficients only.
1.2.1 Structural Manipulations on Polynomials The two most important commands for manipulating polynomials, Expand and Factor, were already introduced in Chapter 3 of the Programming volume [1735]. Note that Factor also works for polynomials in several variables. In[1]:= Out[1]=
In[2]:= Out[2]=
Expand[(1 - x)^3 (3 + y - 2x)^2 (z^2 + 8y)] 72 y − 312 x y + 536 x2 y − 456 x3 y + 192 x4 y − 32 x5 y + 48 y2 − 176 x y2 + 240 x2 y2 − 144 x3 y2 + 32 x4 y2 + 8 y3 − 24 x y3 + 24 x2 y3 − 8 x3 y3 + 9 z2 − 39 x z2 + 67 x2 z2 − 57 x3 z2 + 24 x4 z2 − 4 x5 z2 + 6 y z2 − 22 x y z2 + 30 x2 y z2 − 18 x3 y z2 + 4 x4 y z2 + y2 z2 − 3 x y2 z2 + 3 x2 y2 z2 − x3 y2 z2 Factor[%] −H−1 + xL3 H3 − 2 x + yL2 H8 y + z2 L
The following condition is often ignored. Factor works “properly” only for polynomials whose coefficients are exact (rational) numbers. Thus, for instance, the following example does not work. In[3]:= Out[3]=
Expand[(1.0 - x)^3 (3.0 + y - 2.0 x)^2 (z^2 + 8.0 y)] // Factor −8. H−9. y + 39. x y − 67. x2 y + 57. x3 y − 24. x4 y + 4. x5 y − 6. y2 + 22. x y2 − 30. x2 y2 + 18. x3 y2 − 4. x4 y2 − 1. y3 + 3. x y3 − 3. x2 y3 + 1. x3 y3 − 1.125 z2 + 4.875 x z2 − 8.375 x2 z2 + 7.125 x3 z2 − 3. x4 z2 + 0.5 x5 z2 − 0.75 y z2 + 2.75 x y z2 − 3.75 x2 y z2 + 2.25 x3 y z2 − 0.5 x4 y z2 − 0.125 y2 z2 + 0.375 x y2 z2 − 0.375 x2 y2 z2 + 0.125 x3 y2 z2 L
The following simpler example works, but we highly discourage the use of inexact numbers inside Factor. In[4]:= Out[4]=
x^2 - 5 x + 6. // Factor 1. H−3. + xL H−2. + xL
Results such as the following are much better produced using NRoots or NSolve to achieve a factorization explicitly via solving for the roots. In[5]:=
x^3 - x^2 - 5 x + 5.23 // Factor
Symbolic Computations
14 Out[5]= In[6]:= Out[7]=
1. H−2.19252 + xL H−1.05931 + xL H2.25183 + xL (* better *) Times @@ (x - (x /. NSolve[x^3 - x^2 - 5 x + 5.23 == 0, x])) H−2.19252 + xL H−1.05931 + xL H2.25183 + xL
Using the command Rationalize introduced in Chapter 1 of the Numerics volume [1737], we can convert approximate numbers to nearby rational numbers. (But be aware that for inputs with many-digit high-precision numbers, the functions myFactor might run a long time.) In[8]:=
Out[9]=
myFactor[x_, opts___] := N[Factor[MapAll[Rationalize[#, 0]&, x], opts], (* output precision = input precision *) Precision[x]] myFactor[%%%%] 7.03682 × 10−24 H−4.74876 × 107 + 4.48287 × 107 xL H−1.03683 × 108 + 4.72897 × 107 xL H1.50951 × 108 + 6.70348 × 107 xL
For nonexact integer exponents, Expand and Factor fail. In[10]:= Out[10]=
Expand[(1.0 - x)^3. (3.0 + y - 2.0 x)^2. (z^2 + 8.0 y)^2.] H1. − xL3. H3. − 2. x + yL2. H8. y + z2 L
2.
But note that the application of N to a polynomial does not give numericalized exponents. In[11]:= Out[11]=
N[Expand[(1.0 - x)^3 (3.0 + y - 2.0 x)^2 (z^2 + 8.0 y)^2]] 576. y2 − 2496. x y2 + 4288. x2 y2 − 3648. x3 y2 + 1536. x4 y2 − 256. x5 y2 + 384. y3 − 1408. x y3 + 1920. x2 y3 − 1152. x3 y3 + 256. x4 y3 + 64. y4 − 192. x y4 + 192. x2 y4 − 64. x3 y4 + 144. y z2 − 624. x y z2 + 1072. x2 y z2 − 912. x3 y z2 + 384. x4 y z2 − 64. x5 y z2 + 96. y2 z2 − 352. x y2 z2 + 480. x2 y2 z2 − 288. x3 y2 z2 + 64. x4 y2 z2 + 16. y3 z2 − 48. x y3 z2 + 48. x2 y3 z2 − 16. x3 y3 z2 + 9. z4 − 39. x z4 + 67. x2 z4 − 57. x3 z4 + 24. x4 z4 − 4. x5 z4 + 6. y z4 − 22. x y z4 + 30. x2 y z4 − 18. x3 y z4 + 4. x4 y z4 + 1. y2 z4 − 3. x y2 z4 + 3. x2 y2 z4 − 1. x3 y2 z4
Mathematica factorizes over the integers (“not over the rationals”, and not over the algebraic numbers as long as they do not appear explicitly). This is not a big restriction for rational numbers. The following polynomial over the exact rationals is factored in such a way that the resulting polynomials have integer coefficients and is written out with a common denominator. In[12]:=
Expand[(1/4 - x)^3 (3/2 + y - 2x)^2 (z^2 + 8/5y)^2] // Factor 2
Out[12]=
H−1 + 4 xL3 H3 − 4 x + 2 yL2 H8 y + 5 z2 L − 6400
An interesting theoretical question is the following: Given a polynomial p = ⁄dk=0 ck xk of degree d with integer coefficients ck in the range - f § ck § f , what is the average number of factors of p [1413], [152], [1578], [525]? Here is a simulation for small d and f . In[13]:=
factorNumber[maxDegree_, maxCoefficient_] := Module[{x}, (* count factors *) If[Head[#] === Plus, 1, Length[#]]&[ (* factored random polynomial *) Factor[ Sum[Random[Integer, {-1, 1} maxCoefficient] x^i, {i, 0, maxDegree}]]]]
In[14]:=
Module[{n = 400, dMax = 12, fMax = 20, data}, (* use n random polynomials *) data = Table[Plus @@ Table[factorNumber[d, f], {n}], {d, 2, dMax}, {f, 1, fMax}]/n;
1.2 Operations on Polynomials
15
ListPlot3D[Log[10, data - 1], MeshRange -> {{2, dMax}, {1, fMax}}, PlotRange -> All]]
0 -0.5
20
-1
15
2
10 4 6
5
8 10 12
Polynomials that cannot be factored into multiple x-dependent factors are called irreducible [1439]. In[15]:=
irreducibleQ[poly_, x_] := With[{factors = Select[FactorList[poly], MemberQ[#, x, Infinity]&]}, If[(* at least to x-containing factors exits *) Length[factors] > 1 || (* powers *) factors[[1, 2]] > 1, False, True]] /; PolynomialQ[poly, x] && Exponent[poly, x] > 0
“Most” univariate polynomials are irreducible. The following graphic shows the reducible polynomials of a quadratic, cubic and quartic polynomial over the plane of two coefficients. Reducible polynomials occur along certain lines. In[16]:=
Show[GraphicsArray[#]]& @ Block[{o = 250, α, β}, ListDensityPlot[Table[If[TrueQ[Not[irreducibleQ[#, x]]], 0, 1], {α, -o, o}, {β, -o, o}], Mesh -> False, MeshRange -> {{-o, o}, {-o, o}}, DisplayFunction -> Identity]& /@ (* three polynomials with two parameters each *) {-2 + α x + β x^2, -4 + 3 x + α x^2 + β x^3, -4 - 3 x^2 + α x^3 + β x^4}] 200
200
200
100
100
100
0
0
0
-100
-100
-100
-200
-200
-200
-200 -100
0
100
200
-200 -100
0
100
200
-200 -100
0
100
200
`log np
Given the digits dk of an integer n in base b, we can naturally form the polynomial pb Hn; xL = ⁄k=0b dk xk . Interestingly, when n is a prime number, the polynomial p is irreducible [1424], [937]. In[17]:=
digitPolynomial[k_, b_, x_] := Plus @@ MapIndexed[#1 x^(#2[[1]] - 1)&, Reverse[IntegerDigits[k, b]]]
In[18]:=
(* checking a "random" prime in 100 bases *) Table[irreducibleQ[#, x]& @ digitPolynomial[Prime[123456789], b, x], {b, 2, 1001}] // Union 8True
All, AspectRatio -> 0.4, Frame -> True]] 200
150
100
50
0 1 µ 106
1.002 µ 106
1.004 µ 106
1.006 µ 106
1.008 µ 106
1.01 µ 106
Because no algebraic numbers are computed in the factorization of a univariate polynomial with integer (rational) coefficients, we have the following behavior. In[21]:=
{Factor[x^2 - a^2], Factor[x^2 - 2^2], Factor[x^2 - Sqrt[2]^2]} 8−Ha − xL Ha + xL, H−2 + xL H2 + xL, −2 + x2
Automatic]
1.2 Operations on Polynomials Out[23]=
17
2 è!!!! H 2 + xL
By giving a list of algebraic numbers, one can explicitly specify the extension field. Here, a quartic polynomial 4 è!!!!!! ! is factored. Adjoining 11 allows factoring x4 - 11 into two linear factors with real roots and one quadratic factor with two complex roots. In[24]:= Out[24]=
Adding In[25]:= Out[25]=
Factor[x^4 - 11, Extension -> (11)^(1/4)] è!!!!!!! −H111ê4 − xL H111ê4 + xL H 11 + x2 L
è!!!!!!!! -1 to the extensions allows for a complete factorization of x4 - 11 into linear factors. Factor[x^4 - 11, Extension -> {(11)^(1/4), I}] −H111ê4 − xL H111ê4 − xL H111ê4 + xL H111ê4 + xL
Finding an extension such that a polynomial will factor is largely equivalent to solving polynomial = 0. Here is an unsuccessful trial to factor 3 x3 + 7 x2 - 9. In[26]:= Out[26]=
Factor[x^4 - 3x^3 + 7 x^2 - 9] −9 + 7 x2 − 3 x3 + x4
Here, we use an extension such that the polynomial factors into one linear and one quadratic factor. In[27]:=
Out[27]=
Factor[3 x^3 + 7 x^2 - 9, Extension -> {(1501/2 - (27 Sqrt[2445])/2)^(1/3)}] 1ê3 1 − II−67228 + 4802 22ê3 H1501 − 27 è!!!!!!!!!!!! 2445! L + 2490394032 è!!!!!!!!!!!!! 2ê3 è!!!!!!!!!!!!! 2ê3 1ê3 1ê3 è!!!!!!!!!!!!! 1501 2 H1501 − 27 2445 L + 27 2 2445 H1501 − 27 2445 L − 86436 xM è!!!!!!!!!!!!! 1ê3 è!!!!!!!!!!!!! 1ê3 2ê3 2ê3 è!!!!!!!!!!!!! I11907 2 H1501 − 27 2445 L + 147 2 2445 H1501 − 27 2445 L + è!!!!!!!!!!!!! 2ê3 è!!!!!!!!!!!!! 2ê3 1ê3 1ê3 è!!!!!!!!!!!!! 1701 2 H1501 − 27 2445 L + 21 2 2445 H1501 − 27 2445 L + 1ê3 2ê3 I134456 + 4802 22ê3 H1501 − 27 è!!!!!!!!!!!! 2445! L + 1501 21ê3 H1501 − 27 è!!!!!!!!!!!! 2445! L + 27 21ê3
è!!!!!!!!!!!!! è!!!!!!!!!!!!! 2ê3 2445 H1501 − 27 2445 L M x + 86436 x2 MM
Be aware that factoring of polynomials is a rather complex process (see the general references given in the appendix), which takes some time. Here, the timings for the expansion of (C + 1)^i are compared with the timings for the factorization of the expanded object. (Be aware of the different degrees for Expand and Factor.) In[28]:=
Show[GraphicsArray[ ListPlot[(* reasonable units for a 2-GHz computer *) {#[[1]], 1000 #[[2, 1, 1]]}& /@ #[[1]], Frame -> True, PlotLabel -> #[[2]], FrameLabel -> {"degree", "milliSeconds"}, DisplayFunction -> Identity]& /@ (* Expand and Factor data *) {{(* clear caches for reliable timings *) Table[{i, Developer`ClearCache[]; Timing[Expand[(C + 1)^i];]}, {i, 0, 6000, 50}], "Expand"}, {Table[{i, Developer`ClearCache[]; Timing[Factor[#]]&[Expand[(C + 1)^i]]}, {i, 300}], "Factor"}}]]
Symbolic Computations
18 Expand
Factor
60
150 125 milliSeconds
milliSeconds
50 40 30 20 10
100 75 50 25
0
0 0
1000
2000
3000 4000 degree
5000
6000
0
50
100
150 degree
200
250
300
Let us take a graphical look at the result of expanding a power of a sum. Let the sum total be zero in the form 0 = ⁄n-1 j=0 expH2 p i j ê nL. Then the powers of this sum are also 0, and, by interpreting the partial sums of the expanded power as points in the complex plane, we get a closed path. In[29]:=
expandPicture[{n_, pow_}, opts___] := Show[Graphics[{Thickness[0.002], Line[{Re[#], Im[#]}& /@ (* form the partial sums *) FoldList[Plus, 0, N[(List @@ (* first make list, and then replace to avoid reordering *) (* now comes the expansion *) Expand[Sum[C[i], {i, 0, n - 1}]^pow]) /. C[i_] -> Exp[i I 2Pi/n]]]]}], opts, AspectRatio -> Automatic, Frame -> True, PlotRange -> All, FrameTicks -> None];
In[30]:=
Map[Show[GraphicsArray[ expandPicture[#, (* the parameters {Table[{3, i}, {i, Table[{5, i}, {i, Table[{8, i}, {i,
DisplayFunction -> Identity]& /@ #]]&, for the pictures *) 3, 21, 3}], Table[{4, i}, {i, 2, 20, 4}], 3, 15, 3}], Table[{6, i}, {i, 3, 12, 2}], 2, 8, 2}]}, {1}]
1.2 Operations on Polynomials
19
Here are three more complicated versions of such a graphic. We color the line segments from red to blue. In[31]:=
Show[GraphicsArray[ expandPicture[#, DisplayFunction -> Identity] /. Line[l_] :> With[{n = Length[l]}, MapIndexed[{Hue[0.78 #2[[1]]/n], Line[#1]}&, Partition[l, 2, 1]]]& /@ {{10, 10}, {16, 8}, {36, 4}}]]
Before discussing another algorithmically nontrivial operation for manipulating polynomials—namely, Decompose—we consider a method to rearrange an expression, if possible, into canonical polynomial form. PolynomialQ[polynomial, var] (we know this command from Chapter 5 of the Programming volume [1735]) tests whether polynomial is a polynomial in var. Be aware that PolynomialQ is a purely structural operation. While the expression Hcos2 H1L + sin2 H1L - 1L xx + 2 x2 - 1 is mathematically a polynomial, structurally it is not. As a function ending with Q, PolynomialQ has to return True of False and cannot stay unevaluated. But it is always possible to construct terms of the form hiddenZero nonPolynomialPart so that it is algorithmically undecidable hiddenZero is zero (Richardson theorem [1482], [1484], [1485], [442]). From this, it follows that to guarantee not to get wrong answers from PolynomialQ is not doomed to give wrong results sometimes, it must be a purely structural function. In[32]:= Out[32]=
PolynomialQ[(Sin[1]^2 + Cos[1]^2 - 1) x^x + 2 x^2 - 1, x] False
PolynomialQ[polynomial] tests if polynomial can be considered as a polynomial in at least one variable. Using Collect, we can now write an expression as an explicit polynomial in given variables.
Symbolic Computations
20
Collect[expression, {var1 , var2 , … , varn }, function] writes expression recursively as a polynomial in the variables vari Hi = 1, …, nL and applies the optional function function to the resulting coefficients. If function is omitted, the last argument is assumed to be Identity.
Here we again use our previous polynomial. In[33]:=
polyInxInyInz = (1 - x)^3 (3 + y - 2x)^2 (z^2 + 8y)^2;
Here is this expression as a polynomial in x. In[34]:= Out[34]=
Collect[polyInxInyInz, x] 2
2
2
−4 x5 H8 y + z2 L + x4 H24 + 4 yL H8 y + z2 L + x H−39 − 22 y − 3 y2 L H8 y + z2 L + 2 2
2 2
x H−57 − 18 y − y L H8 y + z L + H9 + 6 y + y L H8 y + z L + x H67 + 30 y + 3 y2 L H8 y + z2 L 3
2
2
2
2
The result of Collect depends on the form of its input. Collect will not expand or factor the resulting coefficients by default. In[35]:= Out[35]=
Collect[Expand[polyInxInyInz], x] 576 y2 + 384 y3 + 64 y4 + 144 y z2 + 96 y2 z2 + 16 y3 z2 + 9 z4 + 6 y z4 + y2 z4 + x5 H−256 y2 − 64 y z2 − 4 z4 L + x4 H1536 y2 + 256 y3 + 384 y z2 + 64 y2 z2 + 24 z4 + 4 y z4 L + x H−2496 y2 − 1408 y3 − 192 y4 − 624 y z2 − 352 y2 z2 − 48 y3 z2 − 39 z4 − 22 y z4 − 3 y2 z4 L + x3 H−3648 y2 − 1152 y3 − 64 y4 − 912 y z2 − 288 y2 z2 − 16 y3 z2 − 57 z4 − 18 y z4 − y2 z4 L + x2 H4288 y2 + 1920 y3 + 192 y4 + 1072 y z2 + 480 y2 z2 + 48 y3 z2 + 67 z4 + 30 y z4 + 3 y2 z4 L
Using the optional third argument of Collect, we can bring the coefficients to a canonical form. In[36]:= Out[36]=
Collect[Expand[polyInxInyInz], x, Factor] 2
2
−4 x5 H8 y + z2 L + H3 + yL2 H8 y + z2 L + 2 2
2
4 x4 H6 + yL H8 y + z L − x H3 + yL H13 + 3 yL H8 y + z2 L − 2 2
2
x3 H57 + 18 y + y2 L H8 y + z L + x2 H67 + 30 y + 3 y2 L H8 y + z2 L
Note that the individual terms are not strictly ordered; in particular, not all terms ( ∂ x0 ) appear one after the other. This is a consequence of the Flat and Orderless attributes of Plus and the canonical order. Here is the same expression as a polynomial in y. In[37]:= Out[37]=
Collect[polyInxInyInz, y] 64 H1 − xL3 y4 + H1 − xL3 y3 H384 − 256 x + 16 z2 L + H1 − xL3 y2 H576 − 768 x + 256 x2 + 96 z2 − 64 x z2 + z4 L + H1 − xL3 y H144 z2 − 192 x z2 + 64 x2 z2 + 6 z4 − 4 x z4 L + H1 − xL3 H9 z4 − 12 x z4 + 4 x2 z4 L
Here it is again as a polynomial in z. In[38]:= Out[38]=
Collect[polyInxInyInz, z] 64 H1 − xL3 y2 H3 − 2 x + yL2 + 16 H1 − xL3 y H3 − 2 x + yL2 z2 + H1 − xL3 H3 − 2 x + yL2 z4
Using as the second argument in Collect the list {x, y} results in a polynomial in x, whose coefficients are polynomials in y, whose coefficients are polynomials in z. In[39]:= Out[39]=
Collect[polyInxInyInz, {x, y}] 64 y4 + 9 z4 + y3 H384 + 16 z2 L + x5 H−256 y2 − 64 y z2 − 4 z4 L + y2 H576 + 96 z2 + z4 L + y H144 z2 + 6 z4 L + x H−192 y4 − 39 z4 + y3 H−1408 − 48 z2 L + y H−624 z2 − 22 z4 L + y2 H−2496 − 352 z2 − 3 z4 LL +
1.2 Operations on Polynomials
21
x3 H−64 y4 − 57 z4 + y3 H−1152 − 16 z2 L + y H−912 z2 − 18 z4 L + y2 H−3648 − 288 z2 − z4 LL + x4 H256 y3 + 24 z4 + y2 H1536 + 64 z2 L + y H384 z2 + 4 z4 LL + x2 H192 y4 + 67 z4 + y3 H1920 + 48 z2 L + y2 H4288 + 480 z2 + 3 z4 L + y H1072 z2 + 30 z4 LL
Here we apply the function C to each of the coefficients in z. In[40]:=
Collect[polyInxInyInz, {x, y}, C] y4 C@64D + x5 Hy2 C@−256D + y C@−64 z2 D + C@−4 z4 DL + C@9 z4 D + y3 C@384 + 16 z2 D + x Hy4 C@−192D + C@−39 z4 D + y3 C@−1408 − 48 z2 D + y C@−624 z2 − 22 z4 D + y2 C@−2496 − 352 z2 − 3 z4 DL + x3 Hy4 C@−64D + C@−57 z4 D + y3 C@−1152 − 16 z2 D + y C@−912 z2 − 18 z4 D + y2 C@−3648 − 288 z2 − z4 DL + y2 C@576 + 96 z2 + z4 D + 4 x Hy3 C@256D + C@24 z4 D + y2 C@1536 + 64 z2 D + y C@384 z2 + 4 z4 DL + y C@144 z2 + 6 z4 D + x2 Hy4 C@192D + C@67 z4 D + y3 C@1920 + 48 z2 D + y2 C@4288 + 480 z2 + 3 z4 D + y C@1072 z2 + 30 z4 DL
Out[40]=
The second argument in Collect need not be an atomic expression, and thus the following expression will be written as a polynomial over co[x]. In[41]:=
Collect[Expand[(co[x] + 4 si[z] + 5 co[x]^3)^4], co[x]] 150 co@xD8 + 500 co@xD10 + 625 co@xD12 + 240 co@xD5 si@zD + 1200 co@xD7 si@zD + 2000 co@xD9 si@zD + 96 co@xD2 si@zD2 + 256 co@xD si@zD3 + 256 si@zD4 + co@xD4 H1 + 960 si@zD2 L + co@xD6 H20 + 2400 si@zD2 L + co@xD3 H16 si@zD + 1280 si@zD3 L
Out[41]=
Collect only reorders. It does not carry out any “mathematical meaning- or content-dependent manipulations” . It only looks at the syntactical structure of expressions. (This means that in the following example, Cos[x]^2 is not rewritten as 1 - Sin[x]^2.) In[42]:= Out[42]=
Collect[Sin[x]^2 + (Cos[x]^2 + Sin[x]^2)^3 + 3 Sin[x]^3 + 7, Sin[x]] 7 + Cos@xD6 + H1 + 3 Cos@xD4 L Sin@xD2 + 3 Sin@xD3 + 3 Cos@xD2 Sin@xD4 + Sin@xD6
Given an expression in several variables, we can use Variables to identify in which variables the expression is a polynomial. Variables[expression] produces a list of the variables in which expression is a polynomial.
For the above polyInxInyInz, we get the expected result. In[43]:= Out[43]=
Variables[polyInxInyInz] 8x, y, z
0 jj$ X ,X >0 jj"x,x>X fllœ l - ¶ < ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 7 x3 - 5 x + 9 k k {{ In[156]:=
Out[156]=
ForAll[∂, ∂ > 0, Exists[X, X > 0, ForAll[x, x > X && Element[, Reals], - ∂ < (2x^3 - 4x + 6)/(7x^3 - 5x + 9) < + ∂]]] // Resolve 2 7
1.3 Operations on Rational Functions The commands Numerator and Denominator introduced at the beginning (Subsection 2.4.1 of the Programming volume [1735]) work for rational numbers and for rational functions, that is, for fractions of polynomials. Here is an example. In[1]:= Out[1]= In[2]:= Out[2]= In[3]:= Out[3]=
ratio = (3 + 6 x + 6 x^2)/(5 y + 6 y^3) 3 + 6 x + 6 x2 5 y + 6 y3 Numerator[ratio] 3 + 6 x + 6 x2 Denominator[ratio] 5 y + 6 y3
The parts of a product that belong to the numerator and the parts that belong to the denominator are determined by the sign of the associated exponents after transformations of the form 1/k^(-l) Ø k^l. Here is an expression that is a product of ten factors. After evaluation, eight have a positive exponent and four have a negative exponent. Some of the negative exponent terms are formatted in the denominator. (Be aware that Exp[expr] is rewritten is Power[E, expr] and the explicit formatting depends on expr.) In[4]:=
expr = a b^2 c^-2 d^(4/3) e^-(5/6) 1/f^(-12/13) g^h i^-j 1/k^-l Exp[-E^2] 2
Out[4]= In[5]:= Out[5]=
a b2 d4ê3 − f12ê13 gh i−j kl c2 e5ê6 {Numerator[expr], Denominator[expr]} 2
9a b2 d4ê3 f12ê13 gh kl , c2 e5ê6 ij =
Here is a nested fraction.
1.3 Operations on Rational Functions In[6]:= Out[6]=
79
nestedFraction = (a/(b + 1) + 2)/(c/(d + 3) + 4) a 2 + 1+b c 4 + 3+d
For nested fractions, the functions Numerator and Denominator take into account only the “outermost” structure. In[7]:= Out[7]=
{Numerator[#], Denominator[#]}&[nestedFraction] a c 92 + , 4 + = 1+b 3+d
For fractions, the command Expand, which multiplies out polynomials, is divided into four parts to facilitate working on the numerators and denominators. Expand[rationalFunction] multiplies out only the numerator of the rationalFunction, and divides all resulting terms by the (unchanged) denominator. ExpandNumerator[rationalFunction] multiplies out only the numerator of the rationalFunction, and divides the result as a single expression by the (unchanged) denominator. ExpandDenominator[rationalFunction] multiplies out only the denominator of the rationalFunction. ExpandAll[rationalFunction] multiplies out the numerator and denominator of rationalFunction, and divides all resulting terms.
We now look at the effect of these four commands on the sum of two ratios of polynomials. In[8]:= Out[8]=
ratio = (1 + 7 y^3)/(2 + 8 x^3)^2 + (1 + 6 x)^3/(1 - 4 y)^2 H1 + 6 xL3 1 + 7 y3 + H1 − 4 yL2 H2 + 8 x3 L2
Except for the lexicographic reordering of the two partial sums, Mathematica did not do anything nontrivial to this input automatically. Now, all numerators are multiplied out, and all resulting parts are individually divided. In[9]:= Out[9]=
Expand[ratio] 1 1 18 x 108 x2 216 x3 7 y3 + + + + + H1 − 4 yL2 H1 − 4 yL2 H1 − 4 yL2 H1 − 4 yL2 H2 + 8 x3 L2 H2 + 8 x3 L2
ExpandNumerator also multiplies out, but does not divide the terms individually. In[10]:= Out[10]=
ExpandNumerator[ratio] 1 + 18 x + 108 x2 + 216 x3 1 + 7 y3 + H1 − 4 yL2 H2 + 8 x3 L2
With ExpandDenominator, the numerator remains unchanged, and only the denominator is multiplied out. In[11]:= Out[11]=
ExpandDenominator[ratio] 1 + 7 y3 H1 + 6 xL3 + 1 − 8 y + 16 y2 4 + 32 x3 + 64 x6
Finally, we multiply everything out. ExpandAll typically produces the largest expressions. Now, the numerator is multiplied out and each of its terms is written over the expanded form of the denominator. In[12]:=
ExpandAll[ratio]
Symbolic Computations
80
Out[12]=
1 7 y3 + + 4 + 32 x3 + 64 x6 4 + 32 x3 + 64 x6 1 18 x 108 x2 216 x3 + + + 1 − 8 y + 16 y2 1 − 8 y + 16 y2 1 − 8 y + 16 y2 1 − 8 y + 16 y2
In the following example, the same happens. Be aware that no common factors are cancelled. In[13]:= Out[13]=
ExpandAll[(1 - x^4)/(1 + x^2)^2] 1 x4 − 1 + 2 x2 + x4 1 + 2 x2 + x4
In nested fractions, ExpandAll works again only the “outermost” structure. In[14]:= Out[14]=
ExpandAll[nestedFraction] 2 a c + c 4 + H1 + bL H4 + L 3+d 3+d
Mapping ExpandAll to all parts allows us to expand all parts. In[15]:=
Out[16]=
(* show all steps *) FixedPointList[MapAll[ExpandAll, #]&, nestedFraction] a 2 + a 1+b , 2 9 c c + c , 4 + 4 + H1 + bL H4 + L 3+d 3+d 3+d a 2 a 2 c + c + c b c , c b c = 4 + 4 + 4 + 4 b + 4 + 4 b + + + 3+d 3+d 3+d 3+d 3+d 3+d
Be aware that there is a difference between Expand //@ expr and ExpandAll[expr]. ExpandAll does not automatically recursively expanded in the inner levels of expressions with Hold-like attributes. In[17]:= Out[17]=
{Expand //@ #, ExpandAll[#]}&[(α + β)^2 + Hold[(α + β)^2]] 8α2 + 2 α β + β2 + Hold@Expand@Expand@Expand@αD + Expand@βDDExpand@2D DD, α2 + 2 α β + β2 + Hold@Hα + βL2 D
{z}] -> z''[x]} 2 z@xDz@xD + 4 x z@xDz@xD Hz @xD + Log@z@xDD z @xDL + z @xD2 z i i @xD + Log@z@xDD z @xD + y x2 j y jz@xDz@xD Hz @xD + Log@z@xDD z @xDL2 + z@xDz@xD j jz z zz z@xD {{ k k
In[8]:= Out[8]=
Expand[ex3 - ex1] x2 z@xDz@xD z @xD + x2 Log@z@xDD z@xDz@xD z @xD − x2 z@xDz@xD z @xD − x2 Log@z@xDD z@xDz@xD z @xD
For a function of several variables, the derivative is not represented by ' in output form, but instead by using numbers in parentheses to specify how many times to differentiate with respect to the corresponding variable. In[9]:= Out[9]=
D[func[t, , ], {t, 2}, {, 3}, {, 3}] funcH2,3,3L @t, , D
Mathematica is able to explicitly differentiate nearly all special functions with respect to their “argument”, but only a few special functions with respect to their “parameters”. Here is the derivative of LegendreP with respect to its first argument. In[10]:= Out[10]=
D[LegendreP[n, z], {n, 1}] LegendrePH1,0L @n, zD
Numerically, these quantities can still be calculated. In[11]:= Out[11]=
N[% /. {z -> 2.04, n -> 0.567}] 1.07925
Here is a high-precision evaluation of the last derivative. In[12]:= Out[12]=
N[%% /. {z -> 204/100, n -> 567/1000}, 22] 1.079254609237523525024
Here, we have to make a remark about the numerical differentiation encountered in the last examples. Whereas the last derivative was evaluated “just fine” by Mathematica, the following “simple” derivative does “not work”. In[13]:=
Abs'[1.]
Out[13]=
Abs @1.D
The reason Abs'[inexactNumber] does not evaluate is the fact that the derivative of Abs does not exist. The derivative is (by definition) the limit limdØ0 H f Hz + dL - f HzLL ê d for any complex d. But for Abs, the result
1.6 Classical Analysis
131
depends on the direction of d approaching 0. Let z = 1; then we have the following result. (Here, we use the soon-to-be-discussed function Limit.) In[14]:=
Out[14]=
absDeriv[zr_, zi_, ϕ_] = With[{z = zr + I zi, δz = δ Exp[I ϕ]}, Limit[ComplexExpand[(Abs[z + δz] - Abs[z])/δz, TargetFunctions -> {Re, Im}], δ -> 0]] HCos@ϕD − Sin@ϕDL Hzr Cos@ϕD + zi Sin@ϕDL è!!!!!!!!!!!!!!!!!!!!!! zi2 + zr2
Here is the direction dependence for z = 1 as a function of argHz - 1L. The two curves show the real and the imaginary parts of absDeriv[1, 0, j]. In[15]:=
Plot[{Re[absDeriv[1, 0, ϕ]], Im[absDeriv[1, 0, ϕ]]}, {ϕ, 0, 2Pi}, PlotRange -> All, Frame -> True, Axes -> False, PlotStyle -> {{Thickness[0.005]}, {Thickness[0.005], Dashing[{0.01, 0.01}]}}] 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 0
1
2
3
4
5
6
The numerical derivative is always taken for purely real δz. To use the numerical differentiation, we “hide” Abs in the following definition of abs. In[16]:=
(* make abs a numerical function for numerical arguments *) SetAttributes[abs, NumericFunction]; abs[x_?InexactNumberQ] := Abs[x]
For purely real δz and complex z, we have the following behavior of the “derivative”. The right picture shows the result of the numerical differentiation. In[19]:=
Show[GraphicsArray[ Plot3D[#, {x, -1, 1}, {y, -1, 1}, DisplayFunction -> Identity, PlotPoints -> 25]& /@ {absDeriv[x, y, 0], abs'[x + I y]}]]
1 0.5 0 -0.5 -1 -1 1
1 0.5 0 -0.5
-0.5
0 0.5 1
-1
1 0.5 0 -0.5 -1 -1 1
1 0.5 0 -0.5
-0.5
0 0.5 1
-1
While the last two pictures look “sensible”, checking the difference between absDeriv[x, y, 0] and abs' more carefully, we see near the origin the effects of the numerical differentiation.
Symbolic Computations
132 In[20]:=
Plot3D[Abs[absDeriv[x, y, 0] - abs'[x + I y]], {x, -1/4, 1/4}, {y, -1/4, 1/4}, PlotRange -> All, PlotPoints -> 50]
0.4
0.2
0.2
0.1
0 -0.2
0 -0.1
0
-0.1 0.1
-0.2
0.2 0 2
The following picture shows the points used in the numerical differentiation process near the high-precision number 1. In[21]:=
abs[x_?InexactNumberQ] := ((* collect values *) Sow[x]; Abs[x]); Show[Graphics[Line[{{#, 0}, {#, Abs[#]}}]& /@ (* evaluate derivative and return sampled x-values *) Reap[abs'[1``100]][[2, 1]]], PlotRange -> All, Frame -> True] 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0.6
0.8
1
1.2
1.4
From the last result, we conclude that we should not trust the numerical derivatives of discontinuous functions or quickly oscillating functions. Here is the numerical derivative of a step-like function (be aware that we display f HxL and f £ HxL ê 60). In[23]:=
SetAttributes[meander, NumericFunction]; meander[x_?NumberQ] := Sin[x]/Sqrt[Sin[x]^2] Plot[{meander[x], meander'[SetPrecision[x, 100]]/60}, {x, 2, 4}, PlotStyle -> {Hue[0], GrayLevel[0]}, PlotRange -> All, Compiled -> False]
1.6 Classical Analysis
133 1 0.5 2.5
3
3.5
4
-0.5 -1 -1.5 -2
One word of caution is in order here: If very reliable high-precision numerical values of derivatives are needed, it is safer to use the function ND from the package NumericalMath`NLimit` instead of numericalizing symbolic expressions containing unevaluated derivatives using N. N[unevaluatedDerivative] has to choose a scale for sample points. Like other numerical functions, no symbolic analysis of unevaluatedDerivative is carried out, and as a result, the chosen scale may result in mathematically wrong values for the derivative (this is especially the case for values of derivatives near singularities; but in principle higher-order numerical differentiation is difficult [1331]). We should make another remark concerning a potential pitfall when differentiating. Mathematica tacitly assumes that the differentiation with respect to different variables can be interchanged (a condition which is fulfilled for most functions used in practical calculations). This means that for the following well-known example strange Func, we do not get the “expected” derivatives for all values x and y if we specialize x- or y-values in intermediate steps. In[26]:=
strangeFunc[0, 0] = 0; strangeFunc[x_, y_] = x y (x^2 - y^2)/(x^2 + y^2);
Here is the function, its first derivative with respect to x, and its mixed second derivative are shown over the x,y-plane. In[28]:=
Show[GraphicsArray[ Plot3D[Evaluate[D[strangeFunc[x, y], ##]], {x, -1, 1}, {y, -1, 1}, PlotPoints -> 121, Mesh -> False, PlotRange -> All, DisplayFunction -> Identity]& @@@ (* function, one first derivative, and mixed second derivative *) {{}, {x}, {x, y}}]]
0.2 0 -0.2 -1
1 0.5 -0.5
0 0
-0.5 0.5
1
-1
1 0.5 0 -0.5 -1 -1
1 0.5 -0.5
0 0
1 0 -1 -1
-0.5 0.5
1
-1
1 0.5 -0.5
0 0
-0.5 0.5
1
-1
First, we differentiate with respect to x and evaluate at 80, y 0}, x]}& @ strangeFunc[x, y] 8−1, 1
0, 1D
For some applications, the following result is not desired, although correct almost everywhere with respect to the 1D Lebesgue measure on the real axis. In[34]:= Out[34]=
D[%, x] Which@x ≤ 0, 0, x > 0, 0D
Differentiating a univariate piecewise function (head Piecewise) gives the value Indeterminate at the position of the discontinuity. In[35]:= Out[35]=
D[Piecewise[{{1, x > 1}}], x] 0 x < 1 »» x > 1 µ Indeterminate True
Differentiating a multivariate piecewise function (head Piecewise) gives the result valid almost everywhere (including lower-dimensional curves where the result is not pointwise correct). In[36]:= Out[36]=
D[Piecewise[{{1, x + y > 1}}], x] 0
The Mathematica kernel does not recognize the derivative of such discontinuous functions as proportional to Dirac delta function by default (but see Section 1.8). Other case-sensitive functions are differentiated in a similar way.
1.6 Classical Analysis In[37]:= Out[37]=
135
D[If[true, false[unknownVariable], dontKnow[unknownVariable]], unknownVariable] If@true, false @unknownVariableD, dontKnow @unknownVariableDD
This means that D does generically not act in a distributional sense, not for the above-mentioned case of piecewise-defined functions and not for other “closed-form” functions. The following two expressions are so-called differential algebraic constants. In[38]:= Out[38]=
D[{(Sqrt[x^2] - x)/(2x), (Log[x^2] - 2 Log[x])}, x] // Together 80, 0
True, Axes -> False], Plot3D[Im[(Log[(x + I y)^2] - 2 Log[x + I y])], {x, -1, 1}, {y, -1, 1}, PlotPoints -> 30]}]]] 0 -0.2 -0.4
5 1
0
-0.6
0.5
-5 0
-1 1
-0.8
-0.5
-0.5
0 0.5
-1 -1
-0.5
0
0.5
1
1
-1
x
As a result, for such functions the identity Ÿx ∑ f HxL ê ∑ x „ x f HxL - f Hx0 L does not hold for all generic x0 and x. 9 Using a generalized function UnitStep (to be discussed below) and its derivatives (Dirac d function Dirac Delta and its derivative), the last identity hold almost everywhere. In[40]:=
intDiffIdentity[f_, {x0_, x_}] := Integrate[D[f[ξ], ξ], {ξ, x0, x}] == f[x] - f[x0]
In[41]:=
{(* generic, symbolic, not explicitly defined function *) intDiffIdentity[ , {x0, x}], (* distribution--can be differentiated freely *) intDiffIdentity[UnitStep, {-1, 1}], (* piecewise functions ignore jump contributions *) intDiffIdentity[Piecewise[{{1, # >= 0}}]&, {-1, 1}]} 8True, True, False
_]] 8DifferentiationOptions → 8AlwaysThreadGradients → False, DifferentiateHeads → True, DirectHighDerivatives → True, ExcludedFunctions → 8Hold, HoldComplete, Less, LessEqual, Greater, GreaterEqual, Inequality, Unequal, Nand, Nor, Xor, Not, Element, Exists, ForAll, Implies, Positive, Negative, NonPositive, NonNegative False)]; D[fh, {x, 6}] 4 4 4 4 4 4320 x x2 + 5760 x x6 + 11520 x x H1 + xL + 69120 x x5 H1 + xL + 30720 x x9 H1 + xL + 4
4
4
4
4320 x H1 + xL2 + 146880 x x4 H1 + xL2 + 207360 x x8 H1 + xL2 + 46080 x x12 H1 + xL2 + x4
80640
x4
x H1 + xL + 299520 3
4
3
x H1 + xL + 184320 7
4
3
x4
x
11
H1 + xL + 3
4
24576 x x15 H1 + xL3 + 10080 x x2 H1 + xL4 + 100800 x x6 H1 + xL4 + 4
4
4
134400 x x10 H1 + xL4 + 46080 x x14 H1 + xL4 + 4096 x x18 H1 + xL4 In[48]:= Out[48]=
Expand[%%% - %] 0
There is no general rule regarding what is preferable, the setting "DirectHighDerivatives" -> False or "DirectHighDerivatives" -> True . In many cases, "DirectHighDerivatives" -> True will be much faster, but will produce larger results. Here is a “typical” example. In[49]:=
Out[49]=
With[{f = x^3 Log[x^5 + 1] Exp[-x^2], n = 50}, {Developer`SetSystemOptions["DifferentiationOptions" -> ("DirectHighDerivatives" -> True)]; Timing[ByteCount[D[f, {x, n}]]], Developer`SetSystemOptions["DifferentiationOptions" -> ("DirectHighDerivatives" -> False)]; Timing[ByteCount[D[f, {x, n}]]]}] 880.06 Second, 934776 ("DirectHighDerivatives" -> False)]; Timing[ByteCount[D[f, {x, n}]]]}] 8813.47 Second, 16 {"ExcludedFunctions" -> Append["ExcludedFunctions" /. ("DifferentiationOptions" /. Developer`SystemOptions[]), ]}] DifferentiationOptions → 8AlwaysThreadGradients → False, DifferentiateHeads → True, DirectHighDerivatives → True, ExcludedFunctions → 8Hold, HoldComplete, Less, LessEqual, Greater, GreaterEqual, Inequality, Unequal, Nand, Nor, Xor, Not, Element, Exists, ForAll, Implies, Positive, Negative, NonPositive, NonNegative, True}];
In[56]:=
D[ [[x]], x]
Out[56]= In[57]:=
∂x @@xDD (* restore old settings *) Developer`SetSystemOptions[ "DifferentiationOptions" -> {"ExitOnFailure" -> False}];
The next input makes use of fairly high derivatives. We visualize the (normalized) coefficients cHnL k appearing in n-1
1 1 ∑n k ÅÅÅÅÅÅÅÅÅnÅÅÅ J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ‚ cHnL k ln HzL. n ∑ z lnHzL z lnn+1 HzL k=0 Here, we use n = 1, 2, …, 200.
Symbolic Computations
138 In[59]:=
Show[Graphics3D[ Table[(* the derivative *) deriv = D[1/Log[z], {z, n}]; (* the coefficients *) cl = CoefficientList[Expand[ (-1)^n z^n Log[z]^(n + 1)deriv], Log[z]]; (* colored line *) {Hue[n/ 250], Line[MapIndexed[{#2[[1]] - 1, n, #1}&, (* normalize coefficients *) cl/Max[Abs[cl]]]]}, {n, 200}]], BoxRatios -> {1, 3/2, 0.5}, PlotRange -> All, Axes -> True, ViewPoint -> {0, 3, 1}] 0 50 100 00 150 0 200 1 0.75 0.5 0.25 0 200
150
100
50
0
In addition to explicitly given functions, Mathematica is also able to differentiate certain abstract function(al)s of functions, for example, indefinite integrals or inverse functions [75], [942], [1724], [1622]. In[60]:=
Table[D[InverseFunction[Υ][z], {z, i}], {i, 3}] 1 3 Υ @ΥH−1L @zDD ΥH3L @ΥH−1L @zDD Υ @ΥH−1L @zDD , = 9 , − − Υ @ΥH−1L @zDD Υ @ΥH−1L @zDD3 Υ @ΥH−1L @zDD4 Υ @ΥH−1L @zDD5 2
Out[60]=
Sometimes it is convenient to form derivatives of multivariate functions with respect to all independent variables at once (especially in carrying out vector analysis operations). This can be done with the following syntax. D[toDifferentiate, {vector, n}] differentiates toDifferentiate n times with respect to the vector variable vector. If the n is omitted, it is assumed to be 1.
Here are the first and second derivatives of the scalar function f , that depends on x, y, and z. In[61]:= Out[61]= In[62]:= Out[62]=
D[f[x, y, z], {{x, y, z}, 1}] 8fH1,0,0L @x, y, zD, fH0,1,0L @x, y, zD, fH0,0,1L @x, y, zD< D[f[x, y, z], {{x, y, z}, 2}] 88fH2,0,0L @x, y, zD, fH1,1,0L @x, y, zD, fH1,0,1L @x, y, zD z; Γllu[a_, b_, c_] := Γllu[a, b, c] = (* raise third index with g *) Together[Sum[Γlll[a, b, d] guu[[c, d]], {d, 2}]] /. z[x, y] -> z
The two equations for the geodesics are of the form x≥ HtL = FHxHtL, yHtL, zHtL, x£ HtL, y£ HtL, z£ HtLL and similar for y≥ HtL. To make sure the geodesics stay on the original, implicitly defined surface, and to obtain three equations for the three coordinates, we supplement the two geodesic equations with the differentiated form of the implicit equation (meaning Hgrad holedCubeHxHtL, yHtL, zHtLLL.8x£ HtL, y£ HtL, z£ HtL< = 0 [332]. In[154]:=
geodesicEquations = (# == 0)& /@ Append[ (* second-order odes for x[τ] and y[τ] *) Table[D[[c][τ], τ, τ] + Sum[Γllu[a, b, c] D[[a][τ], τ] D[[b][τ], τ], {a, 2}, {b, 2}], {c, 2}] /. Derivative[n_][xy_][τ] :> Derivative[n][xy], (* differentiated form of the implicit equation of the surface *) D[holedCube /. {x -> x[τ], y -> y[τ], z[x, y] -> z[τ]}, τ] /. xyz_[τ] -> xyz] /. {x -> x[τ], y -> y[τ], z -> z[τ]} /. Derivative[n_][xy_[τ]] :> Derivative[n][xy][τ];
In[155]:=
((geodesicEquations // Simplify) /. {ξ_[τ] -> ξ}) // Simplify // TraditionalForm
Out[155]//TraditionalForm= 2
9I2 x2 y H2 y2 - 1L H6 z2 - 1L x£ y£ H1 - 2 x2 L + 2
x H2 x2 - 1L I4 H6 z2 - 1L x6 + H4 - 24 z2 L x4 + H24 z6 - 24 z4 + 12 z2 - 1L x2 - z2 H1 - 2 z2 L M Hx£ L2 + 2
x H2 x2 - 1L I4 H6 z2 - 1L y6 + H4 - 24 z2 L y4 + H24 z6 - 24 z4 + 12 z2 - 1L y2 - z2 H1 - 2 z2 L M Hy£ L2 + 2
2
z2 H1 - 2 z2 L I4 x6 - 4 x4 + x2 + 4 y6 - 4 y4 + y2 + z2 H1 - 2 z2 L M x££ M ë 2
IH2 z3 - zL H4 x6 - 4 x4 + x2 + 4 y6 + 4 z6 - 4 y4 - 4 z4 + y2 + z2 LM 0, 2
I2 x H2 x2 - 1L y2 H6 z2 - 1L x£ y£ H1 - 2 y2 L +
Symbolic Computations
150 2
y H2 y2 - 1L I4 H6 z2 - 1L x6 + H4 - 24 z2 L x4 + H24 z6 - 24 z4 + 12 z2 - 1L x2 - z2 H1 - 2 z2 L M Hx£ L2 + 2
y H2 y2 - 1L I4 H6 z2 - 1L y6 + H4 - 24 z2 L y4 + H24 z6 - 24 z4 + 12 z2 - 1L y2 - z2 H1 - 2 z2 L M Hy£ L2 + 2 2
2
6
4
2
6
4
2
2
2 2
££
z H1 - 2 z L I4 x - 4 x + x + 4 y - 4 y + y + z H1 - 2 z L M y M ë 2
IH2 z3 - zL H4 x6 - 4 x4 + x2 + 4 y6 + 4 z6 - 4 y4 - 4 z4 + y2 + z2 LM 0, 2
£
x H2 x - 1L x + y H2 y2 - 1L y£ + z H2 z2 - 1L z£ 0=
For a nicer visualization, we calculate a graphic of the surface. In[156]:=
Needs["Graphics`ContourPlot3D`"]
In[157]:=
holedCubeGraphic3D = Graphics3D[{EdgeForm[], (* map in other positions *) Fold[Function[{p, r}, {p, Map[# r&, p, {-2}]}], (* 3D contour plot of holedCube in the first octant *) Cases[ContourPlot3D[Evaluate[holedCube /. z[x, y] -> z], {x, 0, 1.1}, {y, 0, 1.1}, {z, 0, 1.1}, PlotPoints -> {{24, 2}, {20, 2}, {12, 2}}, MaxRecursion -> 1, DisplayFunction -> Identity], _Polygon, {0, Infinity}] /. Polygon[l_] :> (* make diamonds *) Polygon[Plus @@@ Partition[Append[l, First[l]], 2, 1]/2], {{-1, 1, 1}, {1, -1, 1}, {1, 1, -1}}]}];
We visualize the geodesics as lines on the surface. To avoid visually unpleasant intersections between the discretized surface and the discretized geodesics, we define a function liftUp that lifts the geodesics slightly in direction of the local surface normal. In[158]:=
normal[{x_, y_, z_}] = (* gradient gives the normal *) D[holedCube /. z[x, y] -> z, #]& /@ {x, y, z} // Expand;
In[159]:=
liftUp[{x_, y_, z_}, ∂_] = (* move in direction of normal *) {x, y, z} - ∂ #/Sqrt[#.#]&[normal[{x, y, z}]];
In the following graphic, we calculate 64 geodesics. We choose the starting points along the upper front “beam”. The function rStart parametrizes the starting values. In[160]:=
rStart[ϕ_] := rStart[ϕ] = Module[{r}, r /. FindRoot[Evaluate[ holedCube == 0 /. {x -> 0, y -> 0.7 + r Cos[ϕ], z[x, y] -> 0.7 + r Sin[ϕ]}], {r, 0, 1/3}]]
Here are the resulting geodesics. On the nearby smoothed corners of the cube, we see the to-be-expected caustics. In[161]:=
Module[{o = 128, T = 6, , τ1, τ2}, Show[{(* the surface *) holedCubeGraphic3D, Table[ (* solve differential equations for geodesics *) (* avoid messages from caustics that run in problems *) Internal`DeactivateMessages[ nsol = NDSolve[Join[geodesicEquations, (* starting values *) {x[0] == 0, y[0] == 0.7 + rStart[ϕ] Cos[ϕ], z[0] == 0.7 + rStart[ϕ] Sin[ϕ], x'[0] == 1, y'[0] == 0}], {x, y, z}, {τ, -T, T}, MaxSteps -> 2 10^4, PrecisionGoal -> 6, AccuracyGoal -> 6, (* use appropriate method *) Method -> {"Projection", Method -> "StiffnessSwitching",
1.6 Classical Analysis
151
(* stay on surface *) "Invariants" -> {holedCube /. {x -> x[τ], y -> y[τ], z[x, y] -> z[τ]}}}]]; (* parametrized geodesics *) [τ_] := (Append[liftUp[{x[τ], y[τ], z[τ]} /. nsol[[1]], 0.015], {Thickness[0.003], Hue[ϕ/(2Pi)]}]); (* for larger T *) {τ1, τ2} = nsol[[1, 1, 2, 1, 1]]; (* show surface and geodesics *) ParametricPlot3D[[τ], {τ, τ1, τ2}, Compiled -> False, PlotPoints -> Round[200 (τ2 - τ1)], DisplayFunction -> Identity], {ϕ, 0, 2Pi (1 - 1/o), 2Pi/o}]}, DisplayFunction -> $DisplayFunction, Boxed -> False, Axes -> False, ViewPoint -> {2.2, 2.4, 1.6}]]
We end here and leave it to the reader to calculate euthygrammes [885]. For large-scale calculations of this kind arising in general relativity (see [364]), we recommend the advanced (commercially available) Mathematica package MathTensor by L. Parker and S. Christensen [1379] (http://smc.vnet.net/MathSolutions.html); or the package Cartan by H. Soreng (http://store.wolfram.com/view/cartan). For the algorithmic simplification of tensor expressions, see [120] and [1430]. Next, we give an application of differentiation involving graphics: the evolute of a curve, the evolute of the evolute of a curve, the evolute of the evolute of the evolute of a curve, etc. [271].
Mathematical Remark: Evolutes The evolute of a curve is the set of all centers of curvature associated with the curve. For a planar curve given in the parametric form HxHtL, yHtLL, the parametric representation of its evolute is: ij xHtL - y£ HtL Hx£ HtL2 + y£ HtL2 L yHtL + x£ HtL Hx£ HtL2 + y£ HtL2 L yz j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z. x£ HtL y££ HtL - y£ HtL x££ HtL { k x£ HtL y££ HtL - y£ HtL x££ HtL For more on evolutes and related topics, see any textbook on differential geometry, for example, [1119], [1404], [492], [764], and [609]. For curves that are their own evolutes, see [1864].
1
Here we implement the definition directly. We apply Together to get one fraction. The optional function simp simplifies the resulting expressions in a user-specified way. In[162]:=
Evolute[{x_, y_}, t_, simp_:Identity] := simp[{x - #2(#1^2 + #2^2)/(#1 #4 - #2 #3), y + #1(#1^2 + #2^2)/(#1 #4 - #2 #3)}&[ (* compute all derivatives only once *)
Symbolic Computations
152 D[x, t], D[y, t], D[x, {t, 2}], D[y, {t, 2}]] // (* avoid blow-up in size of iterated form *) Together]
For a circle, the set of all centers of curvature is precisely the center of the circle. In[163]:= Out[163]=
Evolute[{Cos[ϑ], Sin[ϑ]}, ϑ] 80, 0
a})&] a2 Cos@ϑD3 − b2 Cos@ϑD3 −a2 Sin@ϑD3 + b2 Sin@ϑD3 9 , = a b
We now iterate the formation of evolutes starting with an ellipse, and we graph the resulting evolutes. We use ten ellipses with different half-axes ratios. The right graphic shows a magnified view of the center region of the left graphic. In[166]:=
Show[GraphicsArray[{Show[#], Show[#, PlotRange -> {{-3, 3}, {-3, 3}}]}&[ Table[ParametricPlot[Evaluate[(* nest forming the evolute *) NestList[Evolute[#, ϑ, (# /. {a_. Sin[ϑ]^2 + a_.Cos[ϑ]^2 -> a})&]&, {α Cos[ϑ], 2 Sin[ϑ]}, 4]], {ϑ, 0, 2Pi}, PlotStyle -> {Hue[0.78 (α - 3/2)]}, Axes -> False, PlotRange -> All, AspectRatio -> 1, DisplayFunction -> Identity, PlotPoints -> 140], (* values of α *) {α, 3/2, 5/2, 1/11}]]]]
A rich field for the generation of nice curves is given by starting the above process, for instance, with Lissajous figures. We could now go on to the analogous situation for surfaces. Here, for an ellipsoid, we construct a picture with the two surfaces formed by going the amount of the principal radii of the curvature in the direction of the normal to the surface [1157]. In[167]:=
With[{(* ellipsoid half axes *)a = 1, b = 3/4, c = 5/4, (* avoid 0/0 in calculations *) ∂ = 10^-12}, Module[{ϕ, ϑ, x, y, z, e, f, g, l, m, n, λ, ν, µ, k, h, cross, normal1, normal, ellipsoid, makeAll}, (* parametrization of the ellipsoid *) {x, y, z} = {a Cos[ϕ] Sin[ϑ], b Sin[ϕ] Sin[ϑ], c Cos[ϑ]}; (* E, F, G from differential geometry of surfaces *)
1.6 Classical Analysis
153
{e, g} = (D[x, #]^2 + D[y, #]^2 + D[z, #]^2)& /@ {ϕ, ϑ}; f = D[x, ϕ] D[x, ϑ] + D[y, ϕ] D[y, ϑ] + D[z, ϕ] D[z, ϑ]; (* L, M, N from differential geometry of surfaces *) {l, n, m} = Det[{{D[x, ##], D[y, ##], D[z, ##]}, D[#, ϕ]& /@ {x, y, z}, D[#, ϑ]& /@ {x, y, z}}]& @@@ {{ϕ, ϕ}, {ϑ, ϑ}, {ϕ, ϑ}}; {λ, ν, µ} = {l, m, n}/Sqrt[e g - f^2]; (* Gaussian curvature and mean curvature *) k = (λ ν - µ^2)/(e g - f^2); h = (g λ - 2 f µ + e ν)/(2 (e g - f^2)); (* normal on the ellipsoid *) normal = #/Sqrt[#.#]&[Cross[D[{x, y, z}, ϕ], D[{x, y, z}, ϑ]]]; (* construct all pieces from the piece of one octant *) makeAll[polys_] := Function[v, Map[v #&, polys, {-2}]] /@ {{ 1, 1, 1}, { 1, 1, -1}, { 1, -1, 1}, {-1, 1, 1}, {-1, -1, 1}, { 1, -1, -1}, {-1, 1, -1}, {-1, -1, -1}}; (* cut a hole in a polygon *) makeHole[Polygon[l_], factor_] := Module[{mp = Plus @@ l/Length[l], L, nOld, nNew}, L = (mp + factor(# - mp))& /@ l; {nOld, nNew} = Partition[Append[#, First[#]]&[#], 2, 1]& /@ {l, L}; {MapThread[Polygon[Join[#1, Reverse[#2]]]&, {nOld, nNew}]}]; (* a sketch of the ellipsoid *) ellipsoid = {Thickness[0.002], (ParametricPlot3D[Evaluate[{x, y, z}], {ϕ, 0, 2Pi}, {ϑ, 0, Pi}, DisplayFunction -> Identity][[1]]) //. Polygon[l_] :> Line[l]}; (* surfaces of the centers of the principal curvatures *) Show[GraphicsArray[ Graphics3D[{ellipsoid, {EdgeForm[], makeAll @ ParametricPlot3D[#, {ϕ, ∂, Pi/2 - ∂}, {ϑ, ∂, Pi/2 - ∂}, DisplayFunction -> Identity][[1]]}}, Boxed -> False, PlotRange -> All]& /@ (({x, y, z} + normal 1/(h + # Sqrt[h^2 - k]))& /@ {+1, -1}) ] /. p_Polygon :> makeHole[p, 0.7], GraphicsSpacing -> 0]]]
We give one more example illustrating the usefulness of symbolic differentiation.
Mathematical Remark: Phase Integral Approximation Here, we are dealing with a method for the approximate solution of the ordinary differential equation (and associated eigenvalue problem):
Symbolic Computations
154
y££ HzL + R2 HzL yHzL = 0,
R2 HzL p 1.
If we assume yHzL has the form z
yHzL = qHzL-1ê2 expJi ‡ qHz£ L dz£ N, qHzL = QHzL gHzL where QHzL is “ arbitrary”, we get the following differential equation for g: d 2 gHxL-1ê2 1 + ¶HQHxLL - gHxL2 + gHxL1ê2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ = 0 dx2 z
x = xHzL = ‡ QHz£ L dz£ , d 2 QHzL-1ê2 HRHzL - Q2 HzLL ÅÅÅÅÅÅÅÅÅÅ . ¶HQL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ + QHzL3ê2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 Q HzL dz2 Introducing the parameter l (which we will later set to 1) in the differential equation, d 2 gHxL-1ê2 ÅÅÅÅÅÅÅÅÅ = 0 1 + l2 ¶HQHxLL - gHxL2 + l2 gHxL1ê2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ d x2 ¶ and expanding gHzL in an infinite series in l (with Y2 n+1 = 0) gHzL = ⁄n=0 Y2 n HzL l2 n , we are led to the following £ ££ recurrence formula for Y as a function of ¶HxL and its derivatives ¶ HxL, ¶ HxL, … :
Y0 Y2 n
=1 1 = ÅÅÅÅÅ 2
1 ‚ Y2 a Y2 b - ÅÅÅÅÅÅ 2 a+b=n
0§a,b,§n-1
1 + ÅÅÅÅÅÅ 2
‚
Y2 a Y2 b Y2 g Y2 d
a+b+g+d=n 0§a,b,g,d§n-1
3 1 ‚ :¶ Y2 a Y2 b + ÅÅÅÅÅÅ Y2£ a Y2£ b - ÅÅÅÅÅÅ HY2 a Y2££b + Y2££a Y2 b L> 4 4 a+b=n-1
0§a,b§n-1
where Ya£ = Ya£ HxL = dY a HxL ê dx and x = xHzL. Y2 HxL, Y4 HxL, and Y6 HxL were found earlier by painful hand computations, but from Y8 HzL on, computer algebra becomes necessary [296]. For more details on such asymptotic expansions, see [671], [487], [672], [428], [1006], [1623], [142], [1306], [1883], [1104], and [674]. For the corresponding supersymmetric problem, see [16], [673], [58], and [544]. 1
Here, we want to find the first few nonvanishing Y2 a . We now give an unrefined implementation of the above recurrence. (It is unrefined considering the restriction a + b + g + d = n, and the fourfold sum can be replaced by a threefold sum.) In[168]:=
Υ[_Integer?OddQ] = 0; Υ[0] = 1; Υ[zn_Integer?EvenQ] := Υ[zn] = Module[{n = zn/2}, (* the If is the obvious implementation,
1.6 Classical Analysis
155
but it requires summing over all variables *) 1/2 Sum[If[a + b == n, 1, 0] Υ[2 a] Υ[2 b], {a, 0, n - 1}, {b, 0, n - 1}] 1/2 Sum[If[a + b + c + d == n, 1, 0] Υ[2 a] Υ[2 b] Υ[2 c] Υ[2 d], {a, 0, n - 1}, {b, 0, n - 1}, {c, 0, n - 1}, {d, 0, n - 1}] + 1/2 Sum[If[a + b == n - 1, 1, 0] * (∂[ξ] Υ[2 a] Υ[2 b] + 3/4 D[Υ[2 a], ξ] D[Υ[2 b], ξ] 1/4 (Υ[2 a] D[Υ[2 b], {ξ, 2}] + D[Υ[2 a], {ξ, 2}] Υ[2 b])), {a, 0, n - 1}, {b, 0, n - 1}] // (* keep the results as short as possible *) Expand // Factor]
We now look at the first few Yi HzL. In[171]:= Out[171]= In[172]:= Out[172]= In[173]:= Out[173]= In[174]:= Out[174]=
Υ[2] ∂@ξD 2 Υ[4] 1 H−∂@ξD2 − ∂ @ξDL 8 Υ[6] 1 H2 ∂@ξD3 + 5 ∂ @ξD2 + 6 ∂@ξD ∂ @ξD + ∂H4L @ξDL 32 Υ[8] 1 H−5 ∂@ξD4 − 50 ∂@ξD ∂ @ξD2 − 30 ∂@ξD2 ∂ @ξD − 128 19 ∂ @ξD2 − 28 ∂ @ξD ∂H3L @ξD − 10 ∂@ξD ∂H4L @ξD − ∂H6L @ξDL
The Y[i] for higher orders can also be found in a few seconds. In[175]:= Out[175]=
Timing[Υ[16]] 90.86 Second, 1 I−429 ∂@ξD8 − 60060 ∂@ξD5 ∂ @ξD2 − 316030 ∂@ξD2 ∂ @ξD4 − 12012 ∂@ξD6 ∂ @ξD − 32768 758472 ∂@ξD3 ∂ @ξD2 ∂ @ξD − 496950 ∂ @ξD4 ∂ @ξD − 114114 ∂@ξD4 ∂ @ξD2 − 1794156 ∂@ξD ∂ @ξD2 ∂ @ξD2 − 360932 ∂@ξD2 ∂ @ξD3 − 174317 ∂ @ξD4 − 168168 ∂@ξD4 ∂ @ξD ∂H3L @ξD − 877760 ∂@ξD ∂ @ξD3 ∂H3L @ξD − 1591304 ∂@ξD2 ∂ @ξD ∂ @ξD ∂H3L @ξD − 1533408 ∂ @ξD ∂ @ξD2 ∂H3L @ξD − 118404 ∂@ξD3 ∂H3L @ξD − 562474 ∂ @ξD2 ∂H3L @ξD − 684372 ∂@ξD ∂ @ξD ∂H3L @ξD − 12012 ∂@ξD5 ∂H4L @ξD − 466180 ∂@ξD2 ∂ @ξD2 ∂H4L @ξD − 188760 ∂@ξD3 ∂ @ξD ∂H4L @ξD − 893724 ∂ @ξD2 ∂ @ξD ∂H4L @ξD − 543972 ∂@ξD ∂ @ξD2 ∂H4L @ξD − 2
2
2
800176 ∂@ξD ∂ @ξD ∂H3L @ξD ∂H4L @ξD − 206138 ∂H3L @ξD ∂H4L @ξD − 71786 ∂@ξD2 ∂H4L @ξD − 2
2
163722 ∂ @ξD ∂H4L @ξD − 92664 ∂@ξD3 ∂ @ξD ∂H5L @ξD − 144780 ∂ @ξD3 ∂H5L @ξD − 529776 ∂@ξD ∂ @ξD ∂ @ξD ∂H5L @ξD − 119548 ∂@ξD2 ∂H3L @ξD ∂H5L @ξD − 2
272108 ∂ @ξD ∂H3L @ξD ∂H5L @ξD − 159268 ∂ @ξD ∂H4L @ξD ∂H5L @ξD − 23998 ∂@ξD ∂H5L @ξD − 6006 ∂@ξD4 ∂H6L @ξD − 111020 ∂@ξD ∂ @ξD2 ∂H6L @ξD − 68068 ∂@ξD2 ∂ @ξD ∂H6L @ξD − 76986 ∂ @ξD2 ∂H6L @ξD − 113456 ∂ @ξD ∂H3L @ξD ∂H6L @ξD − 41132 ∂@ξD ∂H4L @ξD ∂H6L @ξD − 2
3431 ∂H6L @ξD − 25168 ∂@ξD2 ∂ @ξD ∂H7L @ξD − 56328 ∂ @ξD ∂ @ξD ∂H7L @ξD − 25688 ∂@ξD ∂H3L @ξD ∂H7L @ξD − 6004 ∂H5L @ξD ∂H7L @ξD − 1716 ∂@ξD3 ∂H8L @ξD − 9210 ∂ @ξD2 ∂H8L @ξD − 11388 ∂@ξD ∂ @ξD ∂H8L @ξD − 4002 ∂H4L @ξD ∂H8L @ξD − 3380 ∂@ξD ∂ @ξD ∂H9L @ξD − 2000 ∂H3L @ξD ∂H9L @ξD − 286 ∂@ξD2 ∂H10L @ξD − 726 ∂ @ξD ∂H10L @ξD − 180 ∂ @ξD ∂H11L @ξD − 26 ∂@ξD ∂H12L @ξD − ∂H14L @ξDM= 2
Symbolic Computations
156
1.6.2 Integration Symbolic integration of functions is one of the most important capabilities of Mathematica. In contrast to many other operations (which can also be carried out by hand by the user, albeit more slowly and probably with more errors), and in addition to standard methods such as integration by parts, substitution, etc., Mathematica makes essential use of special algorithms for the determination of indefinite and definite integrals (see [244], the references cited in the appendix, Chapter 21 of [1917], and the very readable introductions of [1330], [990], [643], and [1205]). Mathematica can find a great many integrals, including many not listed in tables. This holds primarily for integrands that are not special functions; but even for special functions, Mathematica is often able to find a closed-form answer. Nevertheless, once in a while, the user will have to refer to a book such as [1443] for complicated integrals. For most integrals, Mathematica works with algorithms rather than looking in tables. For indefinite integrals, these algorithms are based on the celebrated work by Risch and extensions by Trager and Bronstein [244]. Definite integrals are computed by using contour integration, by the Marichev–Adamchik reduction to Meijer-G functions [1560], [1561], [284], [1650], and [574], or by integration via differentiation (Cauchy contour integral formula). We have already introduced the Integrate command for symbolic integration. In view of its extraordinary importance, we repeat it here. Integrate[integrand, var] finds (if possible) the indefinite integral Ÿ
var
integrand dvar.
Integrate[integrand, {var, lowerLimit, upperLimit}] upperLimit
finds (if possible) the definite integral ŸlowerLimit integrand dvar.
Let us start with a remark similar to the one made in section dealing with the solution of equations using Solve. All variables in integrals are assumed to take generic complex values. So the result of the simple x integral Ÿ xn d x will be 1 ê Hn + 1L xn+1 . In[1]:= Out[1]=
Integrate[x^n, x] x1+n 1+n
This is the correct answer for all complex x and for nearly all complex n (the exception, which is of Lebesgue measure zero with respect to dx, being n = -1). This assumption about all unspecified variables being generic can cause indeterminate expressions when substituting numerical values into the result of an integration containing parameters. The integrand can either be given explicitly or unspecified. Here is such an example of the latter case. In[2]:= Out[2]= In[3]:= Out[3]= In[4]:= Out[4]= In[5]:=
Integrate[f'[x], x] f@xD Integrate[f'[x] f''[x], x] 1 f @xD2 2 Integrate[f'[x] g[x] + f[x] g'[x], x] f@xD g@xD Integrate[Sin[f[x]] f'[x], x]
1.6 Classical Analysis Out[5]=
157
−Cos@f@xDD
Here is a slightly more complicated integral, the Bohlin constant of motion for a damped harmonic oscillator [720]. In[6]:= Out[6]=
Exp[Integrate[(λ1 - λ2) x'[t](x''[t] + (λ1 + λ2) x'[t] + λ1 λ2 x[t])/ ((x'[t] + λ1 x[t])(x'[t] + λ2 x[t])), t]] // Together Hλ1 x@tD + x @tDLλ1 Hλ2 x@tD + x @tDL−λ2
The following product cannot be symbolically integrated without the result containing unevaluated integrals (which would cause recursion). In[7]:= Out[7]=
Integrate[f'[x] g[x], x] ‡ g@xD f @xD ' x
Be aware that in distinction to NIntegrate, the function Integrate has no HoldAll attribute. This means that the scoping behavior in nested integrals is different. Whereas NIntegrate can treat its body as a black box that delivers values at given points (when the corresponding system option is set to avoid the evaluation of the body), the algorithms used in Integrate require unavoidably the evaluation of the integrand. When Integrate carries out an indefinite integral, it does not return any explicit constants of integration. (Implicitly the result given amounts to selecting a concrete constant of integration.) So mathematically identical integrands can result in different indefinite integrals. The following polynomial Hx + 1L4 + 1 shows such a situation. In[8]:=
Out[9]=
(* integrals of original and expanded integrand and difference *) {Integrate[#, x], Integrate[Expand[#], x], Expand[Integrate[#, x] - Integrate[Expand[#], x]]}&[(x + 1)^4 + 1] 1 x5 1 9x + H1 + xL5 , 2 x + 2 x2 + 2 x3 + x4 + , = 5 5 5
Mathematica’s ability to integrate implicitly defined functions can be seen nicely in the following example. Suppose 1 0 HxL = ÅÅÅÅÅÅ 2
x
£ £ j HxL = ‡ H£££ j-1 HxL + 4 HxL j-1 HxL + 2 HxL j-1 HxLL dx, j = 1, 2, ….
These equations are of great practical importance for the construction of the Korteweg–de Vries equation hierarchy. Because the mathematical description of Lax pairs is slightly more complicated, we do not go into details here; see, however, [37], [719], [1204], [1442], [628], [1575], [1576], [325], [1782], [255], [1788], [717]. Note that HxL is not explicitly defined. We now implement the above definition of the j HxL. In[10]:=
[0] = 1/2; [j_] := [j] = Integrate[D[[j - 1], {x, 3}] + 4 [x] D[[j - 1], x] + 2 '[x] [j - 1], x] // Together // Numerator
We look at the first few j HxL; they are “completely” integrated. In[12]:= Out[12]=
{[1], [2], [3]} 8@xD, 3 @xD2 + @xD, 10 @xD3 + 5 @xD2 + 10 @xD @xD + H4L @xD
, Derivative[i_][][x] -> Derivative[i][]}
In[14]:=
Table[KdVShortForm[k], {k, 3}]
Out[14]=
8t , t 6 + H3L , t 30 2 + 20 + 10 H3L + H5L
−1 && Re@oD > −1 && Re@pD > 0, 1+n+p+o p p GammaA p E
xn H1 − xp Lo , 8x, 0, 1 −1 && Re@oD > −1 && Re@pD > 0LDE In[50]:= Out[50]= In[51]:= Out[51]= In[52]:= Out[52]=
Integrate[(Exp[-x] - Exp[-z x])/x, {x, 0, Infinity}] −x − −x z IfARe@zD > 0, Log@zD, IntegrateA , 8x, 0, ∞ 1/2] Exp[-x] Sin[x], {x, 0, Infinity}] 3 πê4 è!!!! 2 H1 + π L
Here are two integrals of rational functions. In[63]:= Out[63]=
Integrate[1/(x^4 + 3 x^2 + 1)^8, {x, 0, Infinity}] 21377637 π è!!!! 160000000 5
1.6 Classical Analysis In[64]:=
163
largeResult = Integrate[1/(x^6 + 3 x^2 + 1)^2, {x, -Infinity, Infinity}]; Short[largeResult, 12]
Out[66]//Short=
J17 Log@Root@1 + 3 #1 + #13 &, 3DD 5ê2 "############################################################### + 53 + −Root@1 + 3 #1 + #13 &, 1D Root@1 + 3 #1 + #13 &, 2D 2
2 π I17 − 6 Root@1 + 3 #1 + #13 &, 1D + 4 Root@1 + 3 #1 + #13 &, 1D M JRoot@1 + 3 #1 + #13 &, 2D
5ê2
Root@1 + 3 #1 + #13 &, 3D
"############################################################ Root@1 + 3 #1 + #13 &, 2D Root@1 + 3 #1 + #13 &, 3D + "############################################################
5ê2
+ "######################################################################################################################## Root@1 + 3 #1 + #13 &, 2D Root@1 + 3 #1 + #13 &, 3D + 5ê2
HRoot@1 + 3 #1 + #13 &, 2D Root@1 + 3 #1 + #13 &, 3DL
NN í
Root@1 + 3 #1 + #13 &, 1D Root@1 + 3 #1 + #13 &, 2D Root@1 + 3 #1 + #13 &, 3D N J900 "####################################################################################################################################################################################
The results returned by Integrate are typically not simplified. (It is always easily possible to apply a simplifying function to the result, but it would be impossible for a user to disable any built-in simplification if it would happen automatically.) Applying RootReduce to the last expression gives a much shorter answer. In[67]:= Out[67]=
In[68]:= Out[68]=
Collect[RootReduce[largeResult], _Log, RootReduce] π Root@−11449 + 17890956 #12 − 7103376000 #14 + 59049000000 #16 &, 2D + Log@Root@1 + 3 #12 + #16 &, 1DD Root@11449 + 17890956 #12 + 7103376000 #14 + 59049000000 #16 &, 1D + Log@Root@1 + 3 #12 + #16 &, 2DD Root@11449 + 17890956 #12 + 7103376000 #14 + 59049000000 #16 &, 2D + Log@Root@1 + 3 #1 + #13 &, 2DD Root@11449 + 71563824 #12 + 113654016000 #14 + 3779136000000 #16 &, 5D + Log@Root@1 + 3 #1 + #13 &, 3DD Root@11449 + 71563824 #12 + 113654016000 #14 + 3779136000000 #16 &, 6D {LeafCount[%], LeafCount[largeResult]} 8191, 2958
Re[n] > 0]
Symbolic Computations
164 3
Out[73]=
3n
1
3n
1 3n nπ 1 3n 2− 2 − 2 H1 + H−1Ln L Gamma@ + D I2 2 + 2 − 2 r Sin@ DM + D H1 + H−1Ln L Gamma@ 2 2 2 2 , 2 = 9 è!!!! è!!!! π 2 π
Because of symmetry (and visible through the factors H1 + H-1Ln L), the odd moments vanish for and and the even moments agree. In[74]:= Out[74]=
Simplify[moment[n] == moment[n, r], Element[n/2, Integers]] True
As some of the above examples show, sometimes Mathematica will produce If statements as results, where the first argument represents a set of conditions on parameters appearing in the integral such that the second argument of If is the integrated form. This form of the result allows giving sufficient conditions for the convergence of the integral depending on parameters appearing in the integrand (and potentially in the integration limits). The last argument contains the unevaluated form of the integral (which is possible because If has the HoldRest attribute) with the negated conditions. Here is an example. In[75]:= Out[75]=
Integrate[Sin[a x] Cos[b x]/x, {x, 0, Infinity}] 1 IfAa − b ∈ Reals && a + b ∈ Reals, π HSign@a − bD + Sign@a + bDL, 4 Cos@b xD Sin@a xD IntegrateA , 8x, 0, ∞ (5 + 3 Sqrt[3])^(1/4)))&[ Simplify[Integrate[1/Sqrt[y] '[y], y]]]] 128 è!!!! 7ê8 è!!!! 9 H5 + 3 3 L H41 + 21 3 L, 469.197= 161
(If we did not know the polynomial , we could calculate it the following way.) In[87]:=
Out[87]=
GroebnerBasis[Numerator[Together[ {(5 - (27 (1 - I Sqrt[3]))/(2^(2/3) ) ((1 + I Sqrt[3]) )/ (2 2^(1/3))) - ^4, (277 + τ + ) - ^3, -2003 + 554 τ + τ^2 - ^2}]], {τ, }, {, }] 83 − 6 4 − 15 8 + 12 − τ
False]; (* 3D plot made piecewise *) Show[Table[Plot3D[Re[[x + I y]], {x, k Pi + ∂, (k + 1) Pi - ∂}, {y, -4, 4}, PlotPoints -> {8, 60}], {k, 0, 3}], AxesLabel -> {"x", "y", None}]}]]]
0.5 4
0 2
-0.5
0 y
0 -2
5 x
10
-4
By adding the piecewise constant function, we can make the antiderivative a continuous function. In[145]:=
In[146]:=
[x_] := Which[x < 1 x == 1 x < 3 x == 3 x < 5
Pi Pi Pi Pi Pi
// // // // //
N, N, N, N, N,
[x], Pi/2/Sqrt[6], [x] + Pi/Sqrt[6], 3Pi/2/Sqrt[6], [x] + 2 Pi/Sqrt[6]]
Plot[[x], {x, 0, 4Pi}] 2.5 2 1.5 1 0.5
2
4
6
8
10
12
Now, the integral is given as the difference of the function value of the upper limit and the lower limit. In[147]:= Out[147]=
[4Pi] - [0] 2 $%%%%%%% π 3
(For more details concerning such pitfalls, see [925], [923], and [926].) Even for an everywhere smooth function, the indefinite integral returned by Mathematica might be discontinuous. The following plots show the real and imaginary parts of He x - 1L ê x and Ÿ Hex - 1L ê x dx along the real axis. The imaginary part (blue curves) of the indefinite integral is discontinuous at x = 0. (This integrand has the special property to give an integral that has a single line where its value is different from its left-side and right-side limits.) In[148]:=
Module[{f, F, x}, f[x_] = (Exp[x] - 1)/x; Show[GraphicsArray[
F[x_] = Integrate[f[x], x];
Symbolic Computations
176 (* show function and indefinite integral along real axis *) Plot[{Re[#1[x]], Im[#1[x]]}, {x, -1, 1}, PlotLabel -> #2, PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 0, 1]}, DisplayFunction -> Identity, Frame -> True, PlotRange -> {{-1, 1}, {-3.5, 3.5}}]& @@@ {{f, "f[x]"}, {F, "Ÿf[x] d x"}}]]] Ÿ f@xD d x
f@xD 3
3
2
2
1
1
0
0
-1
-1
-2
-2
-3
-3 -0.75 -0.5 -0.25
0
0.25
0.5
0.75
-0.75 -0.5 -0.25
1
0
0.25
0.5
0.75
1
But the indefinite integral was nevertheless correct. In[149]:= Out[149]=
D[Integrate[(Exp[x] - 1)/x, x], x] - (Exp[x] - 1)/x // Simplify 0
As an application of Mathematica integration capabilities, let us briefly discuss a class of parametrically describable minimal surfaces.
Mathematical Remark: Minimal Surfaces Minimal surfaces are surfaces z = f Hx, yL that satisfy the differential equation H1 + f y2 L fxx + 2 fx f y fxy + H1 + fx2 L f yy = 0 or for surfaces given in parametric form 8xHu, vL, yHu, vL, zHu, vL pictVar]
Here are two examples: the Enneper surface with f HxL = 1 and gHxL = x and a Henneberg surface with f HxL = -i ê 2 H1 - x-4 L and gHxL = x. In[151]:=
Show[GraphicsArray[ Block[{$DisplayFunction = Identity, opts = Sequence[Boxed -> False, Axes -> False, PlotRange -> All]}, {(* Enneper surface *) ParametricPlot3D[Evaluate[ WeierstrassMinimalSurface[1, ξ, ξ, r Exp[I ϕ]]], {r, 0, 3}, {ϕ, 0, 2Pi}, PlotPoints -> {116, 80}, Evaluate[opts]], (* Henneberg surface *) ParametricPlot3D[Evaluate[ WeierstrassMinimalSurface[-I/2 (1 - ξ^-4), ξ, ξ, r Exp[I ϕ]]], {r, 0.72, 1}, {ϕ, 0, 2Pi}, PlotPoints -> {16, 40}, Evaluate[opts]]}]]]
Symbolic Computations
178
Here is a spiraling minimal surface related to the behavior of a soap film near a boundary wire [236]. In[152]:=
Block[{γ = 0.02 Pi, wms}, wms = WeierstrassMinimalSurface[ I Exp[-w + I Pi w/(2 Cot[γ/2])], Exp[w], w, r Exp[I ϕ]]; ParametricPlot3D[ Evaluate[Append[wms, SurfaceColor[Hue[ϕ/(2 Pi)]]]], {r, 0, 6}, {ϕ, 0, 2Pi}, PlotPoints -> {40, 160}, Boxed -> False, Axes -> False, PlotRange -> All, BoxRatios -> {1, 1, 2}]]
We could plot many other such (generally unnamed) surfaces, for example, f HxL = x1ê4 + x1ê3 and gHxL = x. In[153]:= Out[153]=
wms = WeierstrassMinimalSurface[ξ^(1/4) + ξ^(1/3), ξ, ξ, r Exp[I ϕ]] 1 5ê4 9− 260 ReAH ϕ rL I− 208 + 80 2 ϕ r2 − 195 H ϕ rL1ê12 + 78 H ϕ rL25ê12 ME, 1 5ê4 − ImAH ϕ rL I208 + 80 2 ϕ r2 + 195 H ϕ rL1ê12 + 78 H ϕ rL25ê12 ME, 260 4 9ê4 3 2 ReA H ϕ rL + H ϕ rL7ê3 E= 9 7
An initial attempt to plot this function does not produce a satisfactory result. (We use lines rather than polygons in the following graphic because the polygons touch each other often, and rendering the corresponding graphic takes a long time.) In[154]:=
Show[Graphics3D[ ParametricPlot3D[Evaluate[%], {r, 0.7, 0.75}, {ϕ, 0.001, 12Pi - 0.001}, PlotPoints -> {2, 600}, PlotRange -> All, Axes -> False, DisplayFunction -> Identity][[1]] //. Polygon[l_] :> Line[Append[l, First[l]]]]]
1.6 Classical Analysis
179
To get the “correct” function values for multivalued functions, we have to modify the results of the indefinite integration; in this case, we take the appropriate nth root. (If we would calculate the integrals through numerically solving a differential equation, we do not encounter such branch cut problems.) For ease of understanding, we view only a small strip. In[155]:=
ParametricPlot3D[Evaluate[(* analytically continue and add color *) Append[wms /. {(r Exp[I ϕ])^n_ -> r^n Exp[I n ϕ]}, SurfaceColor[Hue[ϕ/(12 Pi)], Hue[ϕ/(12 Pi)], 2]]], {r, 0.7, 0.75}, {ϕ, 0.01, 12Pi - 0.01}, PlotPoints -> {2, 600}, PlotRange -> All, Axes -> False]
Many further examples of minimal surfaces exist and are easy to (re)produce in Mathematica. By changing the integrands in the three integrals in the Weierstrass representation from integrand to expHi JL integrand, we can (in dependence on J) look at how a minimal surface evolves to its adjoint surface. For additional examples of minimal surfaces, see [1586], [1164], [1344], [865], [481], [1228], [649], [1178], [1707], [863], [1848], [484], [864], [986], [642], [780], [874], [1698], [1423], [237], [1412], [1708], [985], [1513], [279], [1312], and [1709]. Remark: It is not necessary to use integrals when constructing minimal surfaces. If the above gHxL Ø x and f HxL Ø f £££ HxL, we can write In[156]:=
WeierstrassMinimalSurface[f'''[ξ], ξ, ξ, x] // TraditionalForm
Out[156]//TraditionalForm=
8ReH- f ££ HxL x2 + 2 f £ HxL x - 2 f HxL + f ££ HxLL, -2 ImH f HxLL + 2 ImHx f £ HxLL - ImH f ££ HxLL - ImHx2 f ££ HxLL, 2 ReHx f ££ HxL - f £ HxLL
([m, n] = R[m, n]) /; NonNegative[m] && NonNegative[n] && m [n, m] /; NonNegative[m] && NonNegative[n], HoldPattern[[m_, n_]] :> [-n, -m] /; Negative[m] && Negative[n], HoldPattern[[m_, n_]] :> [n, -m] /; Negative[m], HoldPattern[[m_, n_]] :> [-n, m] /; Negative[n]};
Here is the resistance in the neighborhood of the origin. In[161]:=
With[{n = 5}, ListPlot3D[Table[[i, j], {i, -n, n}, {j, -n, n}], MeshRange -> {{-n, n}, {-n, n}}, PlotRange -> All]];
1 0.75 0.5 0.25 0
4 2 -4
0 -2
0
-2 2
4
-4
The function R makes heavy use of definite integration. For larger values of n and m, it becomes somewhat slow. In[162]:= Out[162]=
{R[10, 10] // Timing, R[8, 12] // Timing} 486215980256 + 10640 π − 62075752 14549535 == 990.43 Second, =, 945.89 Second, 2π 14549535 π
Indefinite integration is often much faster than definite integration. As a result, it is sometimes advantageous to first calculate the indefinite integral and then substitute the integration limits. (Sometimes this might require the “manual” calculation of limits). For this procedure to be correct one must of course know that, inside the integration interval, the indefinite integral is a continuous function without any singularities. For the integrands under consideration this is actually the case, and we use the function Limit (to be discussed in the next subsection) to obtain the values at the integration end points. We also have to take care about contributions from branch cuts of the integral to make sure we use a continuous antiderivative.
1.6 Classical Analysis In[163]:=
RFast[m_, n_] := Module[{upperLimitContribution, lowerLimitContribution, branchCutCorrection}, (* the indefinite integral *) indefInt = Integrate[(1 - ((t - I)/(t + I))^(m + n)* ((t - 1)/(t + 1))^Abs[m - n])/t, t]; (* contributions from the integration limits *) upperLimitContribution = Limit[indefInt, t -> Infinity]; lowerLimitContribution = Limit[indefInt, t -> 0]; (* contribution from making a continuous antiderivative *) branchCutCorrection = If[MemberQ[int, ArcTan[(1 + t)/(-1 + t)], Infinity], 2Pi, 0]; (* simplify result *) Together @ ComplexExpand @ Re (upperLimitContribution + branchCutCorrection lowerLimitContribution)/(2Pi)]
In[164]:=
{RFast[10, 10] // Timing, RFast[8, 12] // Timing}
Out[164]=
181
486215980256 + 10640 πL Re H− 62075752 Re 14549535 == 990.1 Second, =, 94.93 Second, 2π 14549535 π
For the n-dimensional case of such resistor networks, see [419], [420], [1368], [930], [94]; for the continuous analog, see [1002], [1013]; for finite lattices, see [1857]. Mathematica can differentiate expressions arising from computations in which it is not able to explicitly integrate (meaning these expressions contain unevaluated integrals). In[165]:= Out[165]=
D[Integrate[f[x], y], y] f@xD
This also works for integrals in which the variable of differentiation enters in a complicated way in the limits of integration (differentiation of parametric integrals). In[166]:= Out[167]=
Clear[f, x, y]; D[Integrate[f[x], {x, 0, y}], y] f@yD
In[168]:=
D[Integrate[f[x], {x, -x, x}], x]
Out[168]= In[169]:= Out[169]= In[170]:= Out[170]=
f@−xD + f@xD Derivative[1, 0][Integrate[f[x], {x, #1, #2}]&][a, b] −f@aD Derivative[0, 1][Integrate[f[x], {x, #1, #2}]&][a, b] f@bD
We now look at a somewhat more complicated expression: the d’Alembert solution of the one-dimensional wave equation.
Mathematical Remark: d’Alembert Solution of the One-Dimensional Wave Equation Suppose we are given the following differential equation (wave equation) ∑2 uHx, tL ∑2 uHx, tL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ2ÅÅÅÅÅÅÅÅÅÅÅÅ - a2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅ = f Hx, tL ∑t ∑ x2 in 1 ä1+ . Here, uHx, tL is the amplitude of the wave as a function of position x and time t, and a is the inverse phase velocity. The d’Alembert solution for prescribed f Hx, tL is:
Symbolic Computations
182
t x+aHt-tL x+at 1 1 1 uHx, tL = ÅÅÅÅÅÅÅÅÅÅ ‡ ‡ f Hx, tL dx dt + ÅÅÅÅÅÅÅÅÅÅ ‡ u1 HxL dx + ÅÅÅÅÅ Hu0 Hx + atL + u0 Hx - atLL. 2 a 0 x-aHt-tL 2 a x-at 2
Here, u0 HxL is the initial position, and u1 HxL is the initial velocity function; that is, uHx, t = 0L = u0 HxL and ∑uHx, tL ê ∑t§t=0 = u1 HxL. For references, see any textbook on partial differential equations, for example, [1627] and [1047]. For some direct extensions, see [413] , [848], and [1853].
1
We now check this solution. The initial conditions are fulfilled. In[171]:=
u[x_, t_] = 1/(2 a) Integrate[Integrate[f[ξ, τ], {ξ, x - a (t - τ), x + a (t - τ)}], {τ, 0, t}] + 1/(2 a) Integrate[u1[ξ], {ξ, x - a t, x + a t}] + 1/2 (u0[x + a t] + u0[x - a t]);
In[172]:=
{u[x, 0], D[u[x, t], t] /. t -> 0}
Out[172]=
8u0@xD, u1@xD
{Automatic, (# //. HoldPattern[Integrate[c_?(FreeQ[#, τ]&) r_, i_]] :> c Integrate[r, i])&}]&) f@x, tD
Here is a solution for the Schrödinger equation for a particle of mass HtL in a time-dependent linear potential HtL [627]. In[175]:=
Out[175]=
ψ[{x_, t_}, {_, _, _}] = AiryAi[ (x + Integrate[1/[τ] Integrate[[σ], {σ, 0, τ}], {τ, 0, t}] ^3/4 Integrate[1/[τ], {τ, 0, t}]^2)]* Exp[I (^3/2 Integrate[1/[τ], {τ, 0, t}]* (x + Integrate[1/[τ] Integrate[[σ], {σ, 0, τ}], {τ, 0, t}] ^3/6 Integrate[1/[τ], {τ, 0, t}]^2) 1/2 Integrate[1/[τ] Integrate[[σ], {σ, 0, τ}]^2, {τ, 0, t}] x Integrate[[σ], {σ, 0, t}])] 2 τ t Ÿ τ @σD σ i1 3 t 1 y 2 i 1 3 t 1 y 1 t IŸ0 @σD σM j z 0 jx− z− j z j τM j τM +‡ τz τ−x Ÿ t @σD σz j z 2 IŸ0 @τD 6 IŸ0 @τD @τD 2 ‡ @τD 0 k { 0 0 { k
τ
2 t t i y Ÿ0 @σD σ 1 3i 1 y j z j AiryAiA j τz z + ‡ j‡ τz j z jx − zE 4 @τD @τD { k 0 0 k {
1.6 Classical Analysis
183
The solution contains again unevaluated integrals and the Airy function AiHzL. We can verify that it is indeed a solution for any HtL and HtL. In[176]:= Out[176]=
With[{ψ = ψ[{x, t}, {, , }]}, I D[ψ, t] == -1/(2 [t]) D[ψ, x, x] + [t] x ψ] True
// Simplify
As a related example, let us develop a series solution of the differential equation z£ HtL = f HzHtL, tL for small t. We t rewrite the differential equation as an integral equation zHtL = zH0L + Ÿ0 f HzHtL, tL dt and calculate the series expansion of the right-hand side. In[177]:=
Out[177]=
Together /@ Normal[Series[z[0] + Integrate[f[z[τ], τ], {τ, 0, t}], {t, 0, 4}, Analytic -> True]] //. (* replace derivatives of z using the differential equations *) {Derivative[n_][z][0] :> (D[f[z[t], t], {t, n - 1}] /. t -> 0)} 1 t f@z@0D, 0D + z@0D + t2 HfH0,1L @z@0D, 0D + f@z@0D, 0D fH1,0L @z@0D, 0DL + 2 1 t3 HfH0,2L @z@0D, 0D + fH1,0L @z@0D, 0D HfH0,1L @z@0D, 0D + f@z@0D, 0D fH1,0L @z@0D, 0DL + 6 2 f@z@0D, 0D fH1,1L @z@0D, 0D + f@z@0D, 0D2 fH2,0L @z@0D, 0DL + 1 4 t HfH0,3L @z@0D, 0D + 3 HfH0,1L @z@0D, 0D + f@z@0D, 0D fH1,0L @z@0D, 0DL fH1,1L @z@0D, 0D + 24 3 f@z@0D, 0D fH1,2L @z@0D, 0D + 3 f@z@0D, 0D HfH0,1L @z@0D, 0D + f@z@0D, 0D fH1,0L @z@0D, 0DL fH2,0L @z@0D, 0D + fH1,0L @z@0D, 0D HfH0,2L @z@0D, 0D + fH1,0L @z@0D, 0D HfH0,1L @z@0D, 0D + f@z@0D, 0D fH1,0L @z@0D, 0DL + f@z@0D, 0D fH1,1L @z@0D, 0D + f@z@0D, 0D HfH1,1L @z@0D, 0D + f@z@0D, 0D fH2,0L @z@0D, 0DLL + 3 f@z@0D, 0D2 fH2,1L @z@0D, 0D + f@z@0D, 0D3 fH3,0L @z@0D, 0DL
Using f Hz, tL = z, we get the series expansion of expHtL. In[178]:= Out[178]=
% /. f -> (#1&) 1 1 1 z@0D + t z@0D + t2 z@0D + t3 z@0D + t4 z@0D 2 6 24
And using f Hz, tL = 2 t z, we get the series expansion of expHt2 L. In[179]:= Out[179]=
%% /. f -> (2 #1 #2&) 1 z@0D + t2 z@0D + t4 z@0D 2
At this point, we mention that Mathematica can integrate a large class of functions whose antiderivatives can be expressed as elliptic integrals. Typically, such integrands contain roots of polynomials of third or fourth degree. Here are three examples. In[180]:=
Out[180]=
In[181]:=
Integrate[Sqrt[(b^2 - x^2)/(x^2 + a^2)], x] "############## b2 −x2 "################ x2 1 a2 1 + EllipticEAArcSinA"########### − xE, − E a2 +x2 a2 a2 b2 1 "################ x2 "########### − 1 − a2 b2 Integrate[Sqrt[(b^2 - x^2)/(x^2 + a^2)^3], x]
Symbolic Computations
184 b2 − x2 Ha2 + x2 L $%%%%%%%%%%%%%%%%%%%%%%%%%%% Ha2 + x2 L3
Out[181]=
i i i j j x2 j 1 b2 1 x x2 $%%%%%%%%%%%%%%%%% j j j $%%%%%%%%%%%%%%%%% j 1 − 2 j j − 2 xE, − 2 E − 2 − j j jEllipticEA ArcSinhA$%%%%%%%%%%%% 2 j j 1 + j a b a b ja 1 "########### 2 2 − Hb − x L k k b2 k z zy zy 1 b2 y z zz zz EllipticFA ArcSinhA$%%%%%%%%%%%% − 2 xE, − 2 Ez z zz zz b a z z {{{ In[182]:= Out[182]=
Integrate[1/Sqrt[1 - x^3], x] è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!! −H−1L5ê6 − x 2 H−1L5ê6 H−1 + xL 1 + x + x2 EllipticFAArcSinA E, H−1L1ê3 E 31ê4 è!!!!!!!!!!!!!! 1ê4 3 1−x 3
Note that sometimes Mathematica produces an incorrect result for a definite integral. Such cases usually involve integrands with symbolic parameters and branches. One possibility for checking the correctness of integrals is to 1ê10+i compare the result of Integrate with that of NIntegrate. Here is an example: Ÿ1ê10-i lnHz2 - 1L dz. The integrand has a branch cut between -1 and 1. Here, the results of Integrate and NIntegrate do agree. In[183]:= Out[183]=
Integrate[Log[z^2 - 1], {z, 1/10 - I, 1/10 + I}] 1 20 400 40001 − JArcTanA E − 5 J−4 + π + ArcTanA E + LogA ENN 5 199 39999 10000
Here is an example where the two results do not agree. For generic endpoints of a definite integral, Mathematica must carry out the definite integral by first calculating the indefinite integral. Then it must find out if the straight line connecting the integration end points crosses any branch cuts of the antiderivative. In general, this means solving a transcendental equation and finding all relevant solutions. This is a very complicated step, and missing a crossed branch cut causes a different result from the one returned by NIntegrate. In[184]:=
Out[184]=
{N[Integrate[#, {z, -1 - I, -1 + I}]], NIntegrate[#, {z, -1 - I, -1 + I}]}&[ (1 + z^z (1 + Log[z]))/(z + z^z)] // Chop 84.80293 , −1.48025
specificValue, options] finds the limit of function if var Ø specificValue taking into account the option settings options.
Here are four simple examples to start. In[1]:= Out[1]= In[2]:= Out[2]= In[3]:= Out[3]=
Limit[Sin[x]/x, x -> 0] 1 Limit[Exp[-x] x^2, x -> Infinity] 0 Limit[((x + h)^(1/3) - x^(1/3))/h, h -> 0] 1 2ê3 3x
1.6 Classical Analysis In[4]:=
185
Limit[(Tan[x]/x)^(1/x^2), x -> 0] 1ê3
Out[4]=
Here are three slightly more complicated limits, two of the form ¶0 [921] and one of the form 1¶ . In[5]:= Out[5]=
Limit[(1/x)^Tan[x], x -> 0] 1
In[6]:=
Limit[(2 - 2 x)^Tan[Pi x], x -> 1/2] 2êπ
Out[6]= In[7]:= Out[7]=
Limit[(((n - 1)^2 n^n)/(n^n - n))^((n - n^(2 - n))/(n - 1)^2), n -> Infinity] 1
A more complicated limit than contains a binomial coefficient. In[8]:= Out[8]=
Limit[Binomial[n, k] (a/n)^k (1 - a/n)^(n - k), n -> Infinity] ak −a Gamma@1 + kD
The next limit is ¶. In[9]:=
Limit[x^x - x^(Log[x]), x -> Infinity] ∞
Out[9]=
The next limit shows how the logarithm lnHxL arises as the limit of a power function xa . (For continuity, it follows from this that xa and lnHxL should have the same branch cut structure.) In[10]:= Out[10]=
Limit[Integrate[ξ^a, {ξ, 0, x}, Assumptions -> x > 0 && Re[a] > -1] 1/(1 + a), a -> -1] Log@xD
For functions whose limit values depend on the direction from which we approach specificValue, we can use the option Direction. Direction is an option for Limit, and it determines a direction for computing the limit. Default: 1 (from the left) Admissible: -1 (from the right) or complexNumber (in direction complexNumber)
Here is an example of finding the limit of expH1 ê xL as x Ø 0. Using the Direction option in Limit, we can determine both limits. In[11]:= Out[11]=
Limit[Exp[1/x], x -> 0, Direction -> #]& /@ {1, -1} 80, ∞
0, Direction -> #]& /@ {-I, I}
Symbolic Computations
186 80, ∞
0, Direction -> #]& /@ {+1, -1} // ExpToTrig 8Cos@π λD − Sin@π λD, Cos@π λD + Sin@π λD
#]& /@ {1, -1} α
α
9LimitA x , x → 0, Direction → 1E, LimitA x , x → 0, Direction → −1E=
Out[15]=
Under the assumption that the real part of a is positive, the last limit can be found by Limit. In[16]:= Out[16]=
Assuming[Re[α] > 0, Limit[Exp[α/x], x -> 0, Direction -> #]& /@ {1, -1}] 80, ∞
0] Interval@8−1, 1 1], Limit[f[x], x -> 1, Analytic -> True]} 8Limit@f@xD, x → 1D, f@1D
0] −f@zD + f@z + ∂D LimitA , ∂ → 0E ∂
Assuming that f HzL is an analytic function yields, as the result, the derivative f £ HzL.
1.6 Classical Analysis In[20]:= Out[20]=
187
Limit[(f[z + ∂] - f[z])/∂, ∂ -> 0, Analytic -> True] f @zD
Here is a slightly more complicated limit. In[21]:=
Out[21]=
Limit[(f[z + ∂ + ∂^2] + f[z - ∂ - ∂^3/4] - 2 f[z + ∂^2/3])/∂^2, ∂ -> 0, Analytic -> True] f @zD + f @zD 3
Also in the following limit (that gives the Schwarz derivative wH3L ê w£ - 3 ê 2 w££2 ê w£2 ) the option setting Analytic -> True is needed. In[22]:=
Out[22]=
Limit[6 D[Log[(w[z] - w[ζ])/(z - ζ)], z, ζ], z -> ζ, Analytic -> True] // Expand 3 w @ζD2 wH3L @ζD − + w @ζD 2 w @ζD2
The following input reduces also to the Schwarzian derivative [1370], [1371], [1342]. Because w[ξ] appears multiplicative in this expression, this time the option setting Analytic -> True is not needed. In[23]:= Out[23]=
Limit[Derivative[3][Function[z, (z - w[z]/w'[z])/2]][ζ], w[ζ] -> 0] // Expand 3 w @ζD2 wH3L @ζD − + w @ζD 2 w @ζD2
The next input represents a discrete approximation to the nth derivative (n a nonnegative integer) of a function f at x [1842]. In[24]:=
derivativeApproximation[f_, n_, ξ_, ∂_] := Sum[(-1)^k Binomial[n, k] f[ξ + (n - 2k)/2 ∂], {k, 0, n}]/∂^n
In the limit ¶ Ø ¶, we get the explicit derivative for explicit nonnegative integer n. In[25]:= Out[25]=
Table[Limit[derivativeApproximation[f, n, x0, ∂], ∂ -> 0, Analytic -> True], {n, 0, 6}] 8f@x0D, f @x0D, f @x0D, fH3L @x0D, fH4L @x0D, fH5L @x0D, fH6L @x0D
Infinity]
Subtracting the value of the limit allows finding the next terms as a correction term for large, but finite n. In[29]:= Out[30]= In[31]:=
Out[32]= In[33]:=
Out[34]=
(* coefficient of 1/n term vanishes *) Limit[(expr - E) n, n -> Infinity] 0 (* coefficient of 1/n^2 term is finite *) Limit[(expr - E) n^2, n -> Infinity] −1 + 24 (* coefficient of 1/n^3 term is finite *) Limit[(expr - E - (* last term *) (E/24 - 1)/n^2) n^3, n -> Infinity] 2 2 − − 6
Symbolic Computations
188
Limit assumes that its variable approaches the limit point in a continuous manner. This means limits such as the following will stay unevaluated. In[35]:=
Limit[Nest[Sqrt[5 + #]&, 5, n], n -> Infinity] Nest::intnm : Non−negative machine−size è!!!!!!!!!!!!!!!!! integer expected at position 3 in NestA 5 + #1 &, 5, nE. More…
Out[35]= In[36]:=
è!!!!!!!!!!!!!!! LimitANestA 5 + #1 &, 5, nE, n → ∞E
Limit[Nest[1 + 1/#&, 1, n], n -> Infinity] Nest::intnm : Non−negative machine−size 1 integer expected at position 3 in NestA1 + &, 1, nE. More… #1
Out[36]= In[37]:= Out[37]=
1 LimitANestA1 + &, 1, nE, n → ∞E #1 Limit[Prime[n]/Exp[n], n -> Infinity] Limit@−n Prime@nD, n → ∞D
To compute limits when several variables are simultaneously tending toward given values, we have to apply Limit repeatedly. However, constructions of the form Limit[ f Ha, bL, a -> a0 , b -> b0 ] are not allowed. Here is a function, with two different limit values, that depends on the order in which Limit is applied. In[38]:=
Out[39]=
(* use different variable ordering *) {Limit[Limit[(x^2 - y^2)/(x^2 + y^2), x -> 0], y -> 0], Limit[Limit[(x^2 - y^2)/(x^2 + y^2), y -> 0], x -> 0]} 8−1, 1
0, y -> 0] x2 − y2 Limit::optx : Unknown option y in LimitA , x → 0, y → 0E. More… x2 + y2
Out[40]=
x2 − y2 LimitA , x → 0, y → 0E x2 + y2
To conclude this section, we now present a tiny application of Limit concerning the computation of a 2D rotation matrix from infinitesimals [922]: An infinitesimal rotation by an angle je around the z-axis can be described (which is easily seen from the geometry) by x£ = x + je y, y£ = -je x£ + y. Here, x and y are the coordinates of a point before the rotation, and x£ and y£ are the coordinates after the rotation. In matrix form, this is £ ij x yz ij 1 je yz ij x yz z j z. j £ z=j k y { k -je 1 { k y {
Here, je is the infinitesimal angle of rotation. A finite rotation by an angle j can be obtained by n-fold repetition of this small rotation, where n je = j. Here is the limit as n Ø ¶. In[41]:= Out[41]=
MatrixPower[{{1, ϕ/n}, {-ϕ/n, 1}}, n] 1 n−ϕ n 1 n+ϕ n 1 n−ϕ n 1 n+ϕ n 99 J N + J N , J N − J N =, 2 n 2 n 2 n 2 n 1 n−ϕ n 1 n+ϕ n 1 n−ϕ n 1 n+ϕ n 9− J N + J N , J N + J N == 2 n 2 n 2 n 2 n
This is what we get after some reorganization.
1.6 Classical Analysis In[42]:=
189
ComplexExpand[Map[Limit[#, n -> Infinity]&, %, {2}]] // Simplify 88Cos@ϕD, Sin@ϕD Identity] // Internal`DeactivateMessages)& @@@ (* power and difference of powers to Gaussian and decorated Gaussian *) {{Cos[x]^k, All}, {Cos[x]^k - Exp[-k/2 x^2], All}, { δcosExpK[k, x], {0, -50}}}]]]] 1
0
0
0.8
-0.05
-10
-0.1
0.6 0.4
-30
-0.2
0.2 0
-20
-0.15
-40
-0.25 -1.5
-1
-0.5
0
0.5
1
1.5
-1.5 -1 -0.5
0
0.5
1
1.5
-1.5 -1 -0.5
0
0.5
1
1.5
† Laurent Series Now, we have terms with negative powers of x. (Within Mathematica, it is a series with positive powers of 1 ê x.) In[21]:= Out[21]= In[22]:= Out[22]=
Series[1/(x^2 + a^2), {x, Infinity, 3}] 1 2 1 4 J N + OA E x x Series[Sin[x]^-1, {x, 0, 4}] 1 x 7 x3 + + + O@xD5 x 6 360
Note the O[x] terms in the following two examples. In[23]:= Out[23]= In[24]:= Out[24]=
Series[x^-6, {x, 0, 4}] 1 6 + O@xD5 x Series[(1/Sin[x])^4, {x, 0, 4}] 1 2 11 62 x2 41 x4 4 + 2 + + + + O@xD5 x 3x 45 945 2835
The next series has no nonvanishing terms up to order x4 . And the result returned by Series indicates that the first nonvanishing coefficient might appear earliest at order x10 . In[25]:= Out[25]=
Series[(x^2 + 3)/(x^12 - 17), {x, Infinity, 4}] 1 10 OA E x
To get a nontrivial term for the last series, we must calculate more terms. In[26]:=
Series[(x^2 + 3)/(x^12 - 17), {x, Infinity, 12}]
1.6 Classical Analysis
Out[26]=
193
1 10 1 12 1 13 J N + 3 J N + OA E x x x
In case we have a series with many negative power terms and are only interested in the leading terms, we can use a negative value for order. In[27]:= Out[27]=
Series[(1/Sin[x])^1000, {x, 0, -995}] 1 500 125050 1 + 998 + + x1000 3x 9 x996 O@xD994
The trigonometric functions cscHzL and cotHzL have Laurent expansions around z = 0. The next input shows that the function Series is effectively behaving like a listable function (because its second argument is a list, Series cannot carry the Listable attribute). In[28]:= Out[28]=
Series[{Csc[z], Cot[z]}, {z, 1 z 7 z3 1 z 9 + + + O@zD4 , − − z 6 360 z 3
0, 3}] z3 + O@zD4 = 45
Here is a series of a special function (to be discussed in Chapter 3). We use an approximate expansion point to force the numericalization of the resulting coefficients. In[29]:= Out[29]=
Series[Gamma[z], {z, 1/2., 8}] 1.77245 − 3.48023 Hz − 0.5L + 7.79009 Hz − 0.5L2 − 15.7948 Hz − 0.5L3 + 31.8788 Hz − 0.5L4 − 63.9127 Hz − 0.5L5 + 127.943 Hz − 0.5L6 − 255.961 Hz − 0.5L7 + 511.974 Hz − 0.5L8 + O@z − 0.5D9
Here are two series expansions for expressions that tend to e. In[30]:=
Out[31]=
(* expand one time at zero and one time at infinity *) {Series[(1 + 1/n)^n, {n, Infinity, 2}], Series[(1 + n)^(1/n), {n, 0, 2}]} 11 1 2 1 3 n 11 n2 9 − + J N + OA E , − + + O@nD3 = 2n 24 n n 2 24
† Puiseux Series è!!!! The expression z is an independent term in a Puiseux series. The O@xD13ê2 term arises from the order 6 of the series requested and the fact that the nonvanishing terms have fractional exponents with denominator 2. In[32]:= Out[32]=
Series[Sqrt[x], {x, 0, 6}] è!!!! x + O@xD13ê2
The next series can be expressed in powers of x1ê2 . The last argument of the SeriesData-object is 2, meaning that the increments in the powers of the expansion variable are 1 ê 2. In[33]:= Out[33]=
Series[1 x^(1/2) + 3 x^(3/2) + 5 x^(5/2), {x, 0, 6}] è!!!! x + 3 x3ê2 + 5 x5ê2 + O@xD13ê2
In[34]:=
InputForm[%]
Out[34]//InputForm=
SeriesData[x, 0, {1, 0, 3, 0, 5}, 1, 13, 2]
Similarly, the O-term in the following has the value 7 µ H1 ê 7L + 1 ê 7 = 50 ê 7. In[35]:= Out[35]=
Series[x^(1/7), {x, 0, 7}] x1ê7 + O@xD50ê7
For large denominators, the third argument of the underlying SeriesData-object can become a long list. In[36]:=
Series[x^(1/2000) + x^2, {x, 0, 2}][[3]] // Length
Symbolic Computations
194 Out[36]=
4000
The next two series expansions contain logarithms. In[37]:= Out[37]= In[38]:= Out[38]=
Series[x^x, {x, 0, 4}] 1 1 1 1 + Log@xD x + Log@xD2 x2 + Log@xD3 x3 + Log@xD4 x4 + O@xD5 2 6 24 Series[x^(x^2), {x, 0, 3}] 1 + Log@xD x2 + O@xD4
The last example contained a term of the form lnHxL x2 . Logarithmic factors appear in the third argument of the underlying SeriesData-object. In[39]:=
FullForm[%]
Out[39]//FullForm=
SeriesData@x, 0, List@1, 0, Log@xDD, 0, 4, 1D
The function arcsinHzL has three branch points: two square-root–like branch points at ≤1 and a logarithmic branch point at ¶. Looking at the series expansion of ArcSin, these two different types of branch points are clearly visible. In[40]:= Out[40]= In[41]:= Out[41]= In[42]:= Out[42]=
Series[ArcSin[z], {z, Infinity, 3}] π 1 1 1 1 2 1 4 J − Log@4D + LogA EN + J N + OA E 2 2 z 4 z z Series[ArcSin[z], {z, -1, 3}] π è!!!! è!!!!!!!!!!!! Hz + 1L3ê2 3 Hz + 1L5ê2 5 Hz + 1L7ê2 − + 2 z + 1 + + + + O@z + 1D4 è!!!! è!!!! è!!!! 2 6 2 80 2 448 2 Series[ArcSin[z], {z, +1, 3}] Arg@−1+zD π 2 π E + H−1LFloorA− 2 3 Hz − 1L5ê2 5 Hz − 1L7ê2 i è!!!! è!!!!!!!!!!!! Hz − 1L3ê2 4y j z + − + j− 2 z − 1 + è!!!! è!!!! è!!!! + O@z − 1D z 6 2 80 2 448 2 k {
The last expansion at the branch point z = 1 shows the slightly unusual prefactor H-1Ld-argHz-1LêH2 pLt . We will encounter such-type factors frequently when expanding analytic functions on branch points and branch cuts. Such factors ensure that the resulting series expansions are correct in any direction from the expansion point. The discontinuous function d-argHz - 1L ê H2 pLt reflects the fact that the original function arcsinHzL has a line of discontinuity (a branch cut) emerging from the point z = +1. The next input shows that in the last example, the factor is needed to get the sign of the imaginary part just above the branch cut corrected. In[43]:=
Out[44]=
(* function, naive series, and corrected series *) {ArcSin[z], Pi/2 - I Sqrt[2] Sqrt[z - 1], Pi/2 - (-1)^Floor[-(Arg[z - 1]/(2 Pi))] I Sqrt[2] Sqrt[z - 1]} /. z -> 1 + 10^-3 + (* above branch cut *) 10^-10 I // N 81.5708 + 0.0447176 , 1.5708 − 0.0447214 , 1.5708 + 0.0447214
z - eP[i - 1]}], {i, 1, Length[summedSeries]}]
We look at the resulting Riemann surface by showing the values of the various sqrt[i, z] inside their disks of convergence. In[59]:=
Do[points[i] = Table[{Re[#], Im[#], Im[N[sqrt[i, #]]]}&[ N[eP[i] + r Exp[I ϕ]]], {r, 0, 0.99, 0.99/10}, {ϕ, 0, N[2Pi], N[2Pi]/16}], {i, 0, 8}]
In[60]:=
Show[Graphics3D[{ {Thickness[0.002], Table[(* the disks *) {Hue[i/8 0.76], Line /@ points[i], Line /@ Transpose[points[i]]}, {i, 0, 8}]}, {Thickness[0.01], GrayLevel[0.3], Line[{{-1, 0, -5}, {-1, 0, 2}}]}, {Thickness[0.01], (* the continuation path *) Line[N[Append[#, First[#]]]& @ Table[{Re[eP[i]], Im[eP[i]], Im[N[sqrt[i, eP[i]]]]}, {i, 1, 8}]]}}], PlotRange -> All, BoxRatios -> {1, 1, 1.5}, ViewPoint -> {-2, -1, 1.1}, Axes -> True, AxesLabel -> (StyleForm[#, TraditionalForm]& /@ {"x", "y", "Sqrt[1 + x + I y]"})]
1.6 Classical Analysis
231
2 0 Sqrt@1 + x + I yD -2 2 -4 4 2
1
0 y -1 -2
1 0 -1x -2 -3 3
Because of the two-valuedness of H1 + zL1ê2 , the first function sqrt[0, z] (in red) and the last function sqrt[8, z] (in blue) do not coincide, and the branch cut of Sqrt[1 + z] along the negative real axis is—because of the analytic continuation—missing. As another application of Sum, let us look at the Hölder summation method [1744], [1054], [200], [656]. Given a divergent sum (divergent in the limit n Ø ¶) S0HnL = ⁄nj=1 a j one recursively forms the (partial) sums n HnL SkHnL = n-1 ‚ Sk-1 until SkHnL converges (if this happens). j=1
Let us take an example, the series of -Hx + 1L-2 for x = 1. The nth term of the series is given by a j = H-1L j j x j-1 . In[61]:= Out[61]=
Series[-1/(1 + x)^2, {x, 0, 8}] −1 + 2 x − 3 x2 + 4 x3 − 5 x4 + 6 x5 − 7 x6 + 8 x7 − 9 x8 + O@xD9
The first partial sums are formed. In[62]:= Out[62]=
sum1 = Sum[(-1)^j j x^(j - 1), {j, n}] −1 + H−xLn + n H−xLn + n H−xLn x H1 + xL2
The first partial sum does not converge for n Ø ¶. In[63]:= Out[63]=
Table[sum1 /. x -> 1, {n, 12}] 8−1, 1, −2, 2, −3, 3, −4, 4, −5, 5, −6, 6
j], {j, n}]/n // Together −n − 2 x − n x + 2 H−xLn x + n H−xLn x + n H−xLn x2 n H1 + xL3
This partial sum still does not converge. In[65]:= Out[65]= In[66]:= Out[66]=
Table[sum2 /. x -> 1, {n, 12}] 2 3 4 5 6 9−1, 0, − , 0, − , 0, − , 0, − , 0, − , 0= 3 5 7 9 11 {sum2 /. x -> 1 /. (-1)^n -> -1, sum2 /. x -> 1 /. (-1)^n -> +1} −4 − 4 n 9 , 0= 8n
So, let us do one more iteration. In[67]:=
sum3 = Sum[Evaluate[sum2 /. n -> j], {j, n}]/n // Together
Symbolic Computations
232 Out[67]=
1 − Hn + n2 + n x + n2 x + x2 + n x2 − H−xLn x2 − n H1 + nL H1 + xL3 n H−xLn x2 + 2 x HarmonicNumber@nD + 2 n x HarmonicNumber@nD − 2 H−xLn x2 Hypergeometric2F1@1 + n, 1, 2 + n, −xD + 2 x Log@1 + xD + 2 n x Log@1 + xDL
Now, we finally have a convergent sum. In[68]:= Out[68]=
Table[Expand[sum3 /. x -> 1], {n, 12}] // N 8−1., −0.5, −0.555556, −0.416667, −0.453333, −0.377778, −0.405442, −0.354762, −0.377072, −0.339365, −0.3581, −0.328259
1 /. n -> N[10^k, 22]], {k, 20}] // N[#, 2]& 80.089, 0.015, 0.0020, 0.00026, 0.000032, 3.8 × 10−6 , 4.3 × 10−7 , 4.9 × 10−8 , 5.5 × 10−9 , 6.1 × 10−10 , 6.6 × 10−11 , 7.2 × 10−12 , 7.8 × 10−13 , 8.4 × 10−14 , 9.0 × 10−15 , 9.5 × 10−16 , 1.0 × 10−16 , 1.1 × 10−17 , 1.1 × 10−18 , 1.2 × 10−19
False, ColorFunction -> (Hue[0.78#]&)], (* 3D plot for uniform random variables *) ListPlot3D[Log @ Abs @ recursivePartialSumList[ Table[Random[Real, {-1, 1}], {i, 120}], 20], Mesh -> False]}]]] 10 8 -0.5 -1 -1.5
6 4
25
2 0
20 15
0
200
400
600
10 50
75
5 100
800 1000 1200
The next inputs use the Cesàro summation method [216] to establish the value -1 ê 4. In[72]:=
Out[72]= In[73]:=
partialSums = Simplify[#, x > 0]& @ Sum[(-1)^(j + 1) (j + 1) x^j, −1 + H2 + kL H−xL1+k − H1 + kL H−xL2+k H1 + xL2
{j, 0, k}]
(* multiply partial sums with a binomial and sum again *) cesaroSum = Sum[Evaluate[partialSums Binomial[n - k + - 1, n - k]], {k, 0, n}]/Binomial[n + , n] /. x -> 1 // Simplify
1.7 Differential and Difference Equations
233
Gamma@1+n+D 3 Gamma@n+D Hypergeometric2F1@1,−n,1−n−,−1D +
Out[74]= In[75]:=
Out[76]=
2 Gamma@−1+n+D Hypergeometric2F1@2,1−n,2−n−,−1D Gamma@1+D Gamma@D − + Gamma@1+nD Gamma@nD Gamma@D 4 Binomial@n + , nD
(* limits for different values for the parameter p *) Table[Limit[FullSimplify[cesaroSum], n -> Infinity], {, 4}] 1 1 1 1 9− , − , − , − = 4 4 4 4
The function Integrate gives finite results for (some) divergent integrals when using the option setting GenerateConditions -> False. Sum does not have the option GenerateConditions. But the function SymbolicSum`SymbolicSum does. The next input calculates a finite result for the divergent sum ¶ H-1Lk lnHkL. ⁄k=1 In[77]:=
Out[77]=
SymbolicSum`SymbolicSum[(-1)^k Log[k], {k, Infinity}, GenerateConditions -> False] // Simplify 1 π LogA E 2 2
Taking into account that ∑ k ¶ ê ∑ ¶ = k ¶ lnHkL, the last result can be understood in the following way (zeta regularization). In[78]:=
Out[78]=
Normal[Series[D[Sum[(-1)^k k^∂, {k, Infinity}], ∂], {∂, 0, 0}]] // Simplify 1 π LogA E 2 2
We end this subsection by remarking that the symbolic analog of the function NProduct, namely the function Product should be mentioned here. Because its syntax and functionality is largely identical to the one of Sum, we just give three simple examples here. In[79]:=
Out[79]=
{Product[Sin[z + k Pi/ν], {k, 0, ν - 1}], Product[1 - k^-4, {k, 2, Infinity}], Product[(1 - Prime[k]^-2)^4, {k, Infinity}]} Sinh@πD 1296 921−ν Sin@z νD, , = 4π π8
We end with an infinite sum over finite products. In[80]:= Out[80]=
Sum[n!/Product[x + k, {k, n}], {n, Infinity}] 1 −1 + x
1.7 Differential and Difference Equations 1.7.0 Remarks In this section, we discuss another of the very useful Mathematica commands for symbolic computations: DSolve, the function for the symbolic solution of ordinary differential equations (ODEs), systems of ODEs [1667], partial differential equations, and differential-algebraic equations. The function DSolve is quite powerful and will find closed-form solutions to many differential equations. Here we present examples for the most popular classes of differential equations. This listing is far from exhaustive.
Symbolic Computations
234
1.7.1 Ordinary Differential Equations The syntax for solving an ordinary differential equation is straightforward. DSolve[listOfODEsAndInitialValues, listOfFunctions, independentVariable] tries to solve the ODE(s) with potential initial conditions given by listOfODEsAndInitialValues for the functions in listOfFunctions. The independent variable is independentVariable. In the case of a single differential equation without initial conditions with only one unknown function, the first and second arguments can appear without the braces.
We first look at a simple example. The result of a successfully solved differential equation is a list of lists of rules—structurally, like the result of Solve. In[1]:= Out[1]=
y1 = DSolve[y''[x] == x^2, y[x], x] x4 99y@xD → + C@1D + x C@2D== 12
Here is a more complicated example. Similar to the results of Integrate and Sum, DSolve-results often contain special functions, Root-objects, and RootSum-objects. In[2]:= Out[2]=
DSolve[y'[x] == y[x]^2 - x, y[x], x] 1 2 2 2 99y@xD → J−BesselJA− , x3ê2 E C@1D + x3ê2 J−2 BesselJA− , x3ê2 E − 3 3 3 3 4 2 2 2 3ê2 3ê2 BesselJA− , x E C@1D + BesselJA , x E C@1DNN í 3 3 3 3 1 2 1 2 J2 x JBesselJA , x3ê2 E + BesselJA− , x3ê2 E C@1DNN== 3 3 3 3
The next picture shows a visualization of the last solution curves generated by choosing real values from the interval @-4, 4D for the integration constant C[1]. In[3]:=
Show[Graphics[{Thickness[0.002], Table[With[{c = Random[Real, {-3, 3}]}, Line /@ DeleteCases[Partition[Table[{x, -(AiryAiPrime[x] + AiryBiPrime[x] c)/(AiryAi[x] + AiryBi[x] c)}, {x, -4., 4., 1/50.}], 2, 1], (* delete steep vertical parts *) _?(#.#&[Subtract @@ #] > 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 n ∑k-1 GHxL ê ∑ xn yHn-kL H0L to the right-hand side as an inhomogeneous term. Here is a simple example—the ⁄k=1 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 2 12 12 δ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]: 1 1 ∑ rHx, tL 2 ∑yHx, tL 1 ∑2 yHx, tL + ÅÅÅÅÅ Å x J ÅÅÅÅÅÅÅÅ Å ÅÅÅÅÅÅÅ Å ÅÅÅ Å ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ N yHx, tL Å ÅÅÅ Å i ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = - ÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 8 rHx, tL ∑x ∑ x2 ∑t 2 êêêêêêêêêê 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 t Ik2 +γ2 I1+ ξ MMM 1−ξ
2 Ik x− 2
ξ
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 ξ MMM ξ 2 2 ξ 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−ξ γ2 ξ UnitStep@π + 2 H−k t + xL γD − J Ik x− 2 t Ik +γ I1+ 2 H1 − ξL ξ
1−ξ Cos@H−k t + xL γD1+ UnitStep@π − 2 H−k t + xL γD UnitStep@π + 2 H−k t + xL γDN + 1
2
2
ξ
ξ
MMM 1−ξ 1−ξ Ik x− 2 t Ik +γ I1+ k γ 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 ξ ξ 2 2 1 MMM 1−ξ 1−ξ k γ ξ Cos@H−k t + xL γD Sin@H−k t + xL γD J Ik x− 2 t Ik +γ I1+ 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 ξ ξ 2 2 1 MMM 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]=
2ξ
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,... 1 the series is divergent (corresponding to the singularity of 1 ê H1 - a x2 L at x = 1 ê a). Exchanging summation and integration yields a divergent sum. But due to the automatic Borel summation of SymbolicSum`SymbolicSum for such type sums, we get the a closed-form result as for the integral.
Symbolic Computations
296
¶
‡
0
2 ¶ i¶ e-x 2j zy ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ2ÅÅ dx =° ‡ e-x jjj‚ H1 + kL ak xk zzz dx =° H1 - a xL 0 k k=0 {
¶
i kj
¶
„ H1 + kL a j‡ e k 0 k=0
In[13]:= Out[13]= In[14]:=
Out[14]=
¶
-x2
GHH1 + kL ê 2L y x dxz =° „ H1 + kL ak ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 { k
k=0
Integrate[x^k Exp[-x^2], {x, 0, Infinity}, Assumptions -> k >= 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 k x3 - 82 x2 - 82 x + 1 {{ k k x3 - 82 x2 - 82 x + 1 {{ 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 -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 {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 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 1 + p - 1, 2 + p - 2, …, which give immediately 2 cosI ÅÅÅÅ ÅÅÅÅ M, 2 cosI2 µ 2 ÅÅÅÅppÅ M, …. To explicitly calculate the 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.) Å2ÅÅÅÅÅ can be given in closed form. The two values for the periods of length ÅÅÅÅp-1 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 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 xi - 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 i i1 ÅÅÅÅÅ dtz dx = ‡ j ÅÅÅÅÅ ‡ f HtL dtyz dx + jjj x ‡ ÅÅÅÅÅÅÅÅÅÅ ÅÅÅ dt + ÅÅÅÅÅÅÅÅ ÅÅÅÅ!Å ‡ f HtL dtzzz . ‡ j‡ ÅÅÅÅÅÅÅÅ è!!! t t { { 0 k x 0 k x 0 x 0 x 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 jj HrL r 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 i=1 i=1 {z k 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 2 k1 ! k 2 ! ∫ k j ! 1
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]
i n-1 f HxL yz n f HxL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅ = ÅÅÅÅÅÅ Å jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ z n x k xn-1 { x with the first quotential derivatives . ê x defined as 1 f HxL f HxL f Hq xL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅ = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = lim lnJ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N. qØ1 x f HxL x1 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 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅ . y x y x y x ¶ s) Conjecture the value of the following sum: ⁄k=1 H¤kj=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
Hx2 + x + 1L
1000
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 + 4zz. ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 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]: ¶ qk HzL xk = expHz x + x3 ê 3L (for k < 0, let Let the polynomials qk HzL be defined by the generating function ⁄k=0 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 < [215], [1403], [1746], [1105], [467], [949]. These are defined by PHx*i , y*i L = QHx*i , y*i L = 0. It is possible to trace the typical form of the solution curves in the neighborhood of a singular point by solving y£ HxL = Ha x + b yL ê Hc x + d yL. Some typical forms include the following examples:
2 yHxL yHxL + x yHxL y£ HxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , y£ HxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , y£ HxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ x x x yHxL £ a vortex point y HxL = - ÅÅÅÅÅÅÅÅÅÅÅÅÅ x yHxL - x £ an eddy point y HxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . yHxL + x
a knot point
Investigate which of the given differential equations can be solved analytically by Mathematica, and plot the behavior of the solution curves in a neighborhood of the singular point 80, 0 1) [1594]: ¶ g
lim ‡
gØ0
1
1 z -1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅ H1 + x Hzg - 1LL- ÅÅgÅÅ -1 dz. g z2
Let k Hx, a0 + a1 x + ∫ + an xn L stand for the root that is represented by the Root-object Root@a0 + a1 # + ∫ + an #n , k]. Calculate the following integrals symbolically (express the results using Root-objects): d)
2 6 ‡ lnHx L 1 Hx, -x - x x + x L dx
2 7 2 7 2 7 ‡ expH3 Hx, -x - x + x LL lnH3 Hx, -x - x + x LL 3 Hx, -x - x + x L dx
Symbolic Computations
354
2 Hx, -x - x + x3 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ % dx ‡ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 Hx, -x - x + x3 L 2 Hx, -x - x x + x3 L 3 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ dx ‡ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 Hx, -x - x x + x3 L 1 2 Hx, -x - x + x3 L ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å dx ‡ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 3 0 2 Hx, x - x + x L - 1
‡
¶i 1
1 1 zy 1 jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅ ÅÅÅ zz dx ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ5ÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅ j 5 è!!!! Hx, x + x + x L 5 x 1 x { k
e) Under which conditions on a1 , a2 , a3 can the three roots of the cubic x3 + a1 x2 + a2 x + a3 = 0 be interpreted
as the side length of a nondegenerate triangle [1338]? Visualize the volume in a1 ,a2 ,a3 -space for which this happens. For random a1 , a2 , a3 from the interval @-1, 1D, what is the probability that the roots are the side length of a nondegenerate triangle? 23.L2 Riemann Surface of Cubic Visualize the Riemann surface of xHaL, where x = xHaL is implicitly given by x3 + x2 + a x - 1 ê 2 = 0. Do not use ContourPlot3D. 24.L2 Celestial Mechanics, Lagrange Points a) For the so-called Kepler equation (see [1332], [1699], [1521], [781], [1236], [303], [343], and [388]) L = M + e sinHLL find a series solution for small e in the form n
ijn or n-1 yz L º M + „ jjj ‚ aij e j zzzz sinHi M L j j=i { i=1 k with n around 10. b) Find a short time-series solution (power series in t up to order 10, for example) for the equation of motion for
a body in a spherical symmetric gravitational field (to avoid unnecessary constants, appropriate units are chosen) rHtL r££ HtL = ÅÅÅÅÅÅÅÅÅÅÅÅ3ÅÅ rHtL with the initial conditions rH0L = r0 , r£ H0L = v0 . Here, rHtL is the time-dependent position vector of the body and rHtL = †rHtL§. To shorten the result, introduce the abbreviations v0 .v0 r0 .v0 1 s = ÅÅÅÅÅÅÅÅÅ2ÅÅÅÅÅ Å w = ÅÅÅÅÅÅÅÅÅ2ÅÅÅÅÅ ÅÅ u = ÅÅÅÅ3ÅÅÅÅ r0 r0 r0 (Do not use explicit lists as vectors, first because this is explicitly dependent on the dimension, and second because it slows down the calculation considerably. It is better to implement an abstract vector type for rHtL and define appropriate rules for it.)
Exercises
355
c) The Lagrange points 8xHmL, yHmL< of the restricted three-body problem are the solutions of the following system of equations [430], [1421], [1755], [801], [1433], [745], [137]:
∑V Hx, yL ∑ VHx, yL - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å = - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = 0. ∑x ∑y The potential VHx, yL is given by the following expression: m 1-m 1 V Hx, yL = - ÅÅÅÅÅÅ Hx2 + y2 L - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅ r1 r2 2 "############################## 2 2 r1 = Hx - x1 L + y r2 =
"############################## Hx - x2 L2 + y2
x1 = -m x2 = 1 - m 1 ÅÅ , calculate all real Calculate explicit symbolic solutions for the Lagrange points. For the parameter value m = ÅÅÅÅ 10 solutions (do not do this by a direct call to Solve).
25.L2 Algebraic Lissajous Curves, Light Ray Reflection Inside a Closed Region Derive an implicit representation f Hx, yL of the Lissajous curves 8xHtL, yHtL< = 8cosHtL, sinH2 tL EliminationOrder]] Out[6]= 8H−1 + h@xDL Hf@xD g@xD w@xD − w@xD f @xD − f@xD w @xD + g@xD w @xD − g@xD h@xD w @xD + h @xD w @xD − w @xD + h@xD w @xDL
0 /. d[c] -> d] Out[8]= 12 c H2 c2 + d2 L H2187 c2 + 648 c8 + 48 c14 + 486 c6 d2 + 72 c12 d2 −
243 c4 d4 − 36 c10 d4 − 189 c2 d6 − 82 c8 d6 − 27 d8 − 4 c6 d8 + 21 c4 d10 + 2 c2 d12 − d14 L
Using the numerical solution of the system allows us to extract the corresponding symbolic solution. In[9]:= FindRoot[Evaluate[{gb == 0, gbD == 0}], {c, 1}, {d, 1.5}] Out[9]= 8c → 1.09112, d → 1.54308< In[10]:= {#, N[#]}& @ Select[{c, d} /. Solve[{gb == 0, gbD == 0}, {c, d}],
# == {1.09112`5, 1.54308`5}&] è!!!!! è!!!!! 3 3 Out[10]= 999 , ==, 881.09112, 1.54308 False]
Symbolic Computations
398
150 100 50 0 20
100 80 60 40
40
60
20 80
100
0
For a semi-closed form of the ce,d , see [1336]. l) It is straightforward to write a one-liner that calculates the first n Appell–Nielsen polynomials. To avoid an explicit counter n, we operate recursively on a two-element list 8≤1, poly -(z + 1)), C][[1]] /. C -> 0][ *) Integrate[p, z] + C]}] @@ #&, {1, 1}, n]
The next plot shows the logarithm of the absolute value of the first 36 Appell–Nielsen polynomials. The steep vertical cusps are the zeros of the polynomials. While the majority of the roots seem to have identical numerical values, most of them are actually slightly different. In[2]:= With[{o = 35},
Plot[Evaluate[Log @ Abs @ AppellNielsenPolynomialList[o, z]], {z, -6, 6}, PlotRange -> {-45, 5}, PlotPoints -> 200, Frame -> True, Axes -> False, PlotStyle -> Table[{Thickness[0.002], Hue[0.8 k/o]}, {k, o + 1}]]] 0 -10 -20 -30 -40 -6
-4
-2
0
2
4
6
HnL
m) Evaluating the multiple integral of f Hx + hn L for a given integer n yields (up to sign and the term f Hx + hL) the first n - 1 terms of the Taylor series. Because the integrand at each integration stage is a complete differential, the n iterated integrations can all be carried out completely. The following function TaylorTerms implements the multiple integral (we use the same integration variable h for each integration). In[1]:= TaylorTerms[n_, {f_, x_, h_}] := Expand[f[x + h] -
Nest[Integrate[#, {h, 0, h}]&, Derivative[n][f][x + h], n]]
And here are the first ten Taylor terms obtained from integration for a not explicitly specified function f . In[2]:= TaylorTerms[10, {f, x, h}]
1 2
1 6
1 24
Out[2]= f@xD + h f @xD + h2 f @xD + h3 fH3L @xD + h4 fH4L @xD +
h7
fH7L @xD
1 h8 fH8L @xD h9 fH9L @xD 1 h5 fH5L @xD + h6 fH6L @xD + + + 120 5040 40320 362880 720
The next input expands f HxL = cosHxL around x = p. In[3]:= TaylorTerms[10, {Cos, Pi, h}]
h2 2
h4 24
h6 720
h8 40320
Out[3]= −1 + − + −
For direct integral analogues of the Taylor formula, see [1358].
Solutions
399
n) Here is the above formula implemented as the function GeneralizedTaylorExpansion. In[1]:= GeneralizedTaylorExpansion[f_, ϕs_, x_, x0_] :=
Module[{n = Length[ϕs], W, Φ}, (* the Wronskian *) W = Det[Table[D[ϕs, {x, k}], {k, 0, n - 1}]] /. x -> x0; (* the second determinant *) Φ = Det[Join[{Prepend[ϕs, 0]}, Table[D[Prepend[ϕs, f], {x, k}], {k, 0, n - 1}] /. x -> x0]]; (* the approximation *) -Expand[Φ/W]]
For small m (say m d 10), it works fine. In[2]:= ExpBasis[m_] := Table[Exp[x/k], {k, m}]
GeneralizedTaylorExpansion[Cos[x], ExpBasis[8], x, 0] // Timing 173539328 xê8 631657481 xê7 Out[3]= 90.27 Second, − + − 10614240 xê6 + 63 72 xê5 xê4 435546875 14643200 1431027 xê3 47840 xê2 5135 x − + − + = 72 9 8 9 504
Due to the calculation of a determinant with symbolic entries, this form is not suited for larger m. The Taylor-like approximation carried out by GeneralizedTaylorExpansion cancels the leading monomial terms in a classical Taylor n ck jk HxL around x = x0 . We can so reformulate the problem to the determination of the ck . expansion of f HxL - ⁄k=0 Assuming no additional degeneracy and the presence of all monomials, the following function GeneralizedTaylor Expansion1 solves for the ck and returns the resulting sum. In[4]:= GeneralizedTaylorExpansion1[f_, ϕs_, x_, x0_] :=
Module[{n = Length[ϕs], vars = Table[C[k], {k, Length[ϕs]}], sol}, sol = Solve[# == 0& /@ CoefficientList[Series[f - vars.ϕs, {x, x0, n - 1}], x], vars]; vars.ϕs /. sol[[1]]]
If all the ck are numbers, the resulting linear system can be solved much more quickly then the above symbolic determinant. In[5]:= GeneralizedTaylorExpansion1[Cos[x], ExpBasis[8], x, 0] // Timing
173539328 xê8 631657481 xê7 63 72 435546875 xê5 14643200 xê4 1431027 xê3 47840 xê2 5135 x − + − + = 72 9 8 9 504
Out[5]= 90.05 Second, − + − 10614240 xê6 +
Now, we can also deal with m = 25. In[6]:= Approx[x_] = GeneralizedTaylorExpansion1[Cos[x], ExpBasis[25], x, 0];
Some of the resulting numbers have up to 50 digits. In[7]:= {#, N[#]}& @ Max[Abs[{Numerator[#], Denominator[#]}& /@
Cases[Approx[x], _Integer | _Rational, {0, Infinity}]]] Out[7]= 823081981002827323123938185744918882846832275390625, 2.3082× 1049
{Hue[0]}], ListPlot[dataApprox // N, PlotRange -> {-2, 2}, PlotJoined -> True]}], (* logarithm of absolute error *) ListPlot[N[{#1, Log[10, Abs[#2 - Cos[#1]]]}]& @@@ dataApprox, PlotRange -> All, PlotJoined -> True]}]]]
Symbolic Computations
400 1
-15
-10
-5
5 5
10
15
-1
-15
-10
-5
5
10
15
-5 -2 -3 -4
-10 -15
o) PainlevéODEVI is the differential operator for the special Painlevé VI equation under consideration. In[1]:= PainlevéODEVI[w_, z_] := D[w, z, z] -
(1/2 (1/w + 1/(w - 1) + 1/(w - z)) D[w, z]^2 (1/z + 1/(z - 1) + 1/(w - z)) D[w, z] + 1/2 w (w - 1)(w - z)/(z^2 (z - 1)^2)(4 + z (z - 1)/(w - z)^2))
The function yChazy is the proposed solution. In[2]:= yChazy[z_] = With[{ = (c1 [1][#] + c2 [2][#])&},
1/8 (([z] + 2z '[z])^2 - 4z '[z]^2)^2/ ([z] '[z] (2(z - 1) '[z] + [z])([z] + 2z '[z]))];
Substituting now yChazy[z] into PainlevéODEVI, replacing the second and third derivatives of [k] by using its defining differential equation, and simplifying the result shows that yChazy[z] is a solution. In[3]:= Together[PainlevéODEVI[yChazy[z], z] //.
{[k_]'''[z] :> (8 (1 - 2z) [k]''[z] - 9 [k]'[z])/(4 z(z - 1)), [k_]''[z] :> (4 (1 - 2z) [k]'[z] - [k][z])/(4 z(z - 1))}] Out[3]= 0
We end by remarking that the explicit solution of HzL is HzL = c1 KHzL + c2 KH1 - zL where K is the complete elliptic integral of the first kind. In[4]:= Together[z (1 - z) ''[z] + (1 - 2z) '[z] - [z]/4 /.
-> Function[z, c[1] EllipticK[z] + c[2] EllipticK[1 - z]]]
Out[4]= 0
3. Nested Integration, Derivative[-n], PowerFactor, Rational Painlevé II Solutions a) First, we look at the actual result. In[1]:= f[n_][x_] := Integrate[f[n - 1][x - z], {z, 0, x}]
f[0][x_] = Exp[-x];
Out[3]=
f[2][x] 1 H−x Cosh@xD + Sinh@xD + x Sinh@xDL 2
We compare it to the following. In[4]:= fn[2][x] = Nest[Integrate[# /. {x -> x - z}, {z, 0, x}]&, Exp[-x], 2] Out[4]= −1 + −x + x In[5]:= Expand[TrigToExp[fn[2][x] - f[2][x]]]
5 −x 4
x 4
−x x 2
Out[5]= −1 + − + x +
The reason for this in the first moment unexpected result is that Integrate does not localize its integration variable. (It is impossible for Integrate to do this because it has no HoldAll attribute, and so it cannot avoid the evaluation of all its arguments before Integrate can go to work.) So the integration variables are not screened from each other in nested integrations. Here is what happens in detail by calculating f[2][x]. f[2][x] Integrate[f[2 - 1][x - z], {z, 0, x}]
Now the two variables (from a mathematical point of view—dummy variables) z interfere.
Solutions
401
f[1][x - z] Integrate[f[0][(x - z) - z], {z, 0, (x - z)}] Integrate[f[0][(x - z) - z], {z, 0, x}] Integrate[Exp[-((x - z) - z)], {z, 0, x}] Integrate[Exp[-((x - z) - z)], {z, 0, x}] Exp[x - 2 z]/2 - Exp[-x]/2 Integrate[Exp[x - 2z]/2 - Exp[-x]/2, {z, 0, x}] Exp[x]/4 - (1 + 2 x)/4 Exp[-x]
By using On[], we could follow all of the above steps in more detail, but because of the extensive output, we do not show it here. To screen the integration variables in nested integrations, we could, for instance, use the following construction for the function definiteIntegrate . (We implement it here only for 1D integrals—the generalization to multidimensional integrals is obvious.) In[6]:= SetAttributes[definiteIntegrate, HoldAll]
definiteIntegrate[integrand_, {iVar_, lowerLimit_, upperLimit_}] := Function[x, Integrate[#, {x, lowerLimit, upperLimit}]& @@ (* avoid evaluation of integrand; substitute new integration variable *) (Hold[integrand] //. iVar -> x)][ (* create a unique integration variable *) Unique[x]]
(Note that definiteIntegrate has the attribute HoldAll and that an additional Hold on the right-hand side is necessary to avoid any evaluation. A unique integration variable is created via Unique[x].) Using the function definiteIntegrate in the recursive definition of f now gives the “expected” result. In[8]:= f1[n_][x_] := definiteIntegrate[f1[n - 1][x - z], {z, 0, x}]
f1[0][x_] = Exp[-x];
Now, we get from f[2][x] the expected result. In[10]:= f1[2][x] Out[10]= −1 + −x + x In[11]:= f1[2][x] - fn[2][x] // TrigToExp // Expand Out[11]= 0
For the simple example under consideration, we could use a simpler way of creating different dummy integration variables. Here is an example. In[12]:= f2[n_][x_] := Integrate[f2[n - 1][x - z[x]], {z[x], 0, x}]
f2[0][x_] = Exp[-x]; f2[2][x] Out[14]= −1 + −x + x
b) Obviously, Integrate[f, x] + Integrate[g, x] and Integrate[f + g, x] can only differ by an x-independent constant. It turns out that finding a pair of functions f and g is not difficult; low-degree polynomials and powers already do the job. In[1]:= Integrate[(1 + x)^2, x] + Integrate[x^α, x]
x3 3
x1+α 1+α
Out[1]= x + x2 + + In[2]:= Integrate[(1 + x)^2 + x^α, x] Out[2]=
1 x1+α H1 + xL3 + 3 1+α
In[3]:= % - %% // Expand Out[3]=
1 3
Symbolic Computations
402
Now, let us deal with the definite integrals. The function f should have a discontinuity at xm . We choose the branch cut of the square root function as the discontinuity. We take xl and xu on opposite sides of the branch cut and xm directly on the branch cut. In[4]:= Integrate[Sqrt[z], {z, -1 - I, -1 + I}] Out[4]=
4 2 2 − H−1 − L3ê2 + H−1 + L3ê2 3 3 3
In[5]:= Integrate[Sqrt[z], {z, -1 - I, 0}] + Integrate[Sqrt[z], {z, 0, -1 + I}]
2 3
2 3
Out[5]= − H−1 − L3ê2 + H−1 + L3ê2 In[6]:= % - %% // Expand
4 3
Out[6]= −
c) First, the input adds a new rule to Derivative (which does not have the attribute Protected) for a negative integer argument for an arbitrary function. Now, we look at the actual code. With evaluates its first argument, which means the local variable pI, and sets the value to Integrate[f[C], C] . In the case that the result does not contain Integrate, pI becomes a pure function by substituting Slot[1] for C and adding the head Function. The whole expression so constructed again has a Derivative wrapped around it, but with the order incremented by one. In summary, this means that taking a Derivative of negative order n is interpreted as an iterated n-fold integration. Let us look at some examples. In[1]:= Derivative[i_Integer?Negative][f_] :=
(* because the test is the whole calculation, use With and then use pI as test and as the result *) With[{pI = Integrate[f[C], C]}, (* test if Integrate appears in result *) Derivative[i + 1][Function[pI] /. C -> #] /; FreeQ[pI, Integrate, {0, Infinity}]] In[2]:= Derivative[-3][Exp] Out[2]= #1 & In[3]:= Derivative[-3][#^3 + Sin[#]&] Out[3]=
#16 + Cos@#1D & 120
Here are the two derivatives Derivative[+4][Exp[1 #]&] and Derivative[-4][Exp[1 #]&]. In[4]:= {Derivative[+4][Exp[1 #]&], Derivative[-4][Exp[1 #]&]} Out[4]= 8#1 &, #1 &
Module[{product = List @@ t, rads, rest}, (* select the radicals *) rads = Cases[product, Power[_, _Rational], {1}]; rest = Complement[product, rads]; (* the new exponent *) exp = LCM @@ Denominator[Last /@ rads]; (Times @@ rads^exp)^(1/exp) (Times @@ rest)];
Here is an example showing rulePower at work. In[2]:= a^(2/3) b^(3/4) c^(4/5) (d + e)^(5/6) f^(1/n) g /. rulePower 1ê60
Out[2]= Ha40 b45 c48 Hd + eL50 L
1
f n g
The rule ruleLogSum rewrites sums of logarithms as one logarithm. In[3]:= ruleLogSum = p:_Plus :>
Module[{sum = List @@ p, logs, rest}, (* select the logarithms *) logs = Cases[sum, _Log, {1}]; rest = Complement[sum, logs]; Plus[Sequence @@ rest, Log[Times @@ (First /@ logs)]]];
Here is an example. The term -Log[c] has the head Times and is not matched by the rule ruleLogSum. In[4]:= Log[a] + Log[b] - Log[c] /. ruleLogSum Out[4]= Log@a bD − Log@cD
The rule ruleLogProduct rewrites products involving logarithms. In[5]:= ruleLogProduct = c_ Log[a_] :> Log[a^c];
Now terms of the form -Log[c] are rewritten too. In[6]:= 1 - Log[a] + Log[b] Log[c] /. ruleLogProduct
1 a
Out[6]= 1 + LogA E + Log@bLog@cD D
The rule ruleLogProduct rewrites products involving logarithms. In[7]:= ruleLogPower = Log[a_]^e_ :> Log[a^(Log[a]^(e - 1))];
Here is an example. In[8]:= Log[a]^3 /. ruleLogPower 2
Out[8]= LogAaLog@aD E
Now, we put all rules together in the function PowerFactor. To make sure that every rule gets applied whenever possible, we use ReplaceRepeated and MapAll. In[9]:= PowerFactor[expr_] := MapAll[(# //. rulePower //. ruleLogSum //.
ruleLogProduct //. ruleLogPower)&, expr]
Here is PowerFactor applied to a more complicated input. In[10]:= 1 + a^(1/3) b^(2/3) c /d^(5/3) (z^3)^(1/2) + Log[s^2] +
((Log[x] + Log[z^2])^2 + 1)^(1/2) + 3(Log[a] - Log[b] Log[c]) + Log[x]^3 Log[y]^3 è!!!!!!! a1ê3 b2ê3 c z3 Out[10]= 1 + + 3 HLog@aD − Log@bD Log@cDL + d5ê3 "################################################################## 2 Log@s D + Log@xD3 Log@yD3 + 1 + HLog@xD + Log@z2 DL2 In[11]:= PowerFactor[%]
Symbolic Computations
404 1ê6 LogA 13 E 2 Log@xD E LogAy i a2 b4 z9 y c + LogAa3 b s IxLogAx M { k d
z Out[11]= 1 + c j j 10 z
LogAyLog@yD E E
E + "############################################################### 1 + LogAHx z2 LLog@x z D E 2
PowerExpand rewrites the expression in the opposite direction. In[12]:= PowerExpand[%]
a1ê3 b2ê3 c z3ê2 d è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 Log@sD + Log@xD3 Log@yD3 + 1 + HLog@xD + 2 Log@zDL2
Out[12]= 1 + + 3 Log@aD − 3 Log@bD Log@cD + 5ê3
PowerFactor recovers the above expression. In[13]:= PowerFactor[%] 1ê6 LogA 13 E 2 Log@xD E LogAy i a2 b4 z9 y c + LogAa3 b s IxLogAx M { k d
z Out[13]= 1 + c j j 10 z
LogAyLog@yD E E
E + "############################################################### 1 + LogAHx z2 LLog@x z D E 2
We could now continue and extend the rulePower to complex powers. The above rule rulePower was designed to work with rational powers. For complex powers it will not work. In[14]:= PowerFactor[x^I y^I (1/x)^I (1/y)^I
(1 - I z)^((1 - I)/2) (1 + I z)^((I - 1)/2)] 1 x
1 y
1 − 2
Out[14]= J N x J N y H1 − zL 2
1
H1 + zL− 2 + 2
Now, we have to deal with exponents e and -e appropriately. In[15]:= rulePower = t:_Times?(MemberQ[#, Power[_, _Complex]]&) :>
Module[{product = List @@ t, crads, rest, exp, cradsN}, (* select the radicals *) crads = Cases[product, Power[_, _Complex], {1}]; rest = Complement[product, crads]; (* the new exponent *) exp = LCM @@ Denominator[Last /@ crads]; cradsN = crads^exp; If[exp =!= 1, (Times @@ cradsN)^(1/exp), (* complementary powers *) Times @@ (Function[l, Times @@ (#[[2, 1]]^(l[[1, 2, 2]]/ #[[2, 2]])& /@ l)^l[[1, 2, 2]]] /@ Split[{Sort[{#[[2]], -#[[2]]}], #}& /@ cradsN, #1[[1]] === #2[[1]]&])] (Times @@ rest)]; In[16]:= PowerFactor[x^I y^I (1/x)^I (1/y)^I
(1 - I z)^((1 - I)/2) (1 + I z)^((I - 1)/2)] 1 − z 1− Out[16]= $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% J N 1+ z
f) We use the series of the generating function to define the qk HzL for the first k. In[1]:= q[_, z_] = 0;
(* make definitions for the q *) MapIndexed[(q[#2[[1]], z_] = #1)&, CoefficientList[Series[Exp[z ξ + ξ^3/3], {ξ, 0, 20}], ξ] // Expand];
Given the qk HzL, the definition of the sk HzL is straightforward. In[4]:= σ[0, z_] := 1;
σ[k_, z_] := σ[k, z] = Det[Table[q[k + i - 2 j, z], {i, 0, k - 1}, {j, 0, k - 1}]]
Now, we can calculate the first few wk HzL. In[6]:= kMax = 10;
Do[w[k, z_] = D[Log[σ[k + 1, z]/σ[k, z]], z] // Together // Factor, {k, kMax}]
Solutions
405
Here are the first four wk HzL. In[8]:= Table[w[k, z], {k, 4}]
1 + 2 z3 H−1 + zL z H1 + z + z L
1 z
3 z2 H10 − 2 z3 + z6 L H−1 + zL H1 + z + z L H−5 − 5 z + z L
Out[8]= 9 , 2 , 2 3 6 , 875 − 1750 z3 + 1400 z6 + 250 z9 − 50 z12 + 4 z15 = z H−5 − 5 z3 + z6 L H−175 − 15 z6 + z9 L
Here is a quick check for the correctness of the calculated functions. In[9]:= Table[Together[D[w[k, z], {z, 2}] - (2w[k, z]^3 - 4 z w[k, z] + 4 k)],
{k, kMax}] Out[9]= 80, 0, 0, 0, 0, 0, 0, 0, 0, 0
1, aq -> 1, bq -> 1, i_Integer ws_ -> ws}] Out[6]= 8y2@zD4 y1 @zD2 , y1@zD y2@zD3 y1 @zD y2 @zD, y2@zD3 y1 @zD2 y2 @zD, y1@zD2 y2@zD2 y2 @zD2 , y1@zD y2@zD2 y1 @zD y2 @zD2 , y2@zD2 y1 @zD2 y2 @zD2 , y1@zD2 y2@zD y2 @zD3 , y1@zD y2@zD y1 @zD y2 @zD3 , y1@zD2 y2 @zD4
RationalFunctions] Out[9]= 84 f@zD g@zD w@zD + 2 w@zD g @zD + 2 f@zD2 w @zD + 4 g@zD w @zD + f @zD w @zD + 3 f@zD w @zD + wH3L @zD
{{-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 1 λ H−Cos@x − ξD + Cos@1 − x − ξD Sin@1DL + Sin@x + ξD − 2 , 1 − 14 λ2 Cos@1D2 − λ Sin@1D2 1 − λ H−Cos@x − ξD + Cos@1 − x − ξD Sin@1DL + Sin@x + ξD 2 = 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 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 {{-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 + ÅÅÅÅ ÅÅ y Hx, yL ÅÅÅÅ ÅÅ y j Hx, yL in the form ∑x ∑x ∑y i ∑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 y y i ∑ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ A = jjjj ÅÅÅÅÅÅÅÅÅ xHx, yLzz + jj ÅÅÅÅÅÅÅÅÅÅ xHx, yLzz zz J = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J ∑ y ∑ x { { { k kk 2 2 Hx2 - x1 L2 + Hy2 - y1 L2 ii ∑ y i ∑ y y C = jjjj ÅÅÅÅÅÅÅÅÅ hHx, yLzz + jj ÅÅÅÅÅÅÅÅÅÅ hHx, yLzz zz J = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J ∑ x ∑ y { 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 i ∑ yz 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 2A 2B 2B 2C A + B + C2 + B6 6B + C6 − − 0 − − 2 6 3 3 3 3 A B + 6 6
Out[55]//TableForm=
A 2
B C + 6 6 2A 2B − 3 3
−
B6
B − 6
2A 2B − − 3 3
2B 3
0
C 2
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
4B 4C 4A + + 3 3 3
4A 4B − − 3 3
2B 2C − − 3 3
0
2B 2C − − 3 3
4B 3
4A 4B − − 3 3
4B 4C 4A + + 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 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 and d, we want to number the functions cHp,dL HxL using one index to easily assemble the global finite element k,l HxL = ch 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 22, MaxIterations -> 40]
8848, 12, 6 e[b], b] /. {e'[b] -> 0,
e[b] -> e}) == 0, evEq[0] == 0}, {b, e}], (Im[e] == 0 && b > 0 /. N[#])&] 13 è!!!!! Out[16]= 99e → , b → 2 == 16
Here is a sketch of the behavior of the yHb; xL, including more terms. In[17]:= Show[GraphicsArray[#]]& /@
Partition[Table[ ListPlot[Table[{b, NRoots[evEq[i] == 0, e][[1, 2]]}, {b, 0.8, 2.5, 0.025}], PlotRange -> {0.8, 0.82}, PlotJoined -> True, AxesOrigin -> {0.8, 0.8}, DisplayFunction -> Identity, PlotLabel -> StyleForm["evEq[" ToString[i] "]", "MR"]], {i, 6}], 3] evEq@1D 0.8175 0.815 0.8125 0.81 0.8075 0.805 0.8025
evEq@2D 0.8175 0.815 0.8125 0.81 0.8075 0.805 0.8025
1 1.25 1.5 1.75 2 2.25 2.5
1 1.25 1.5 1.75 2 2.25 2.5
evEq@4D 0.8175 0.815 0.8125 0.81 0.8075 0.805 0.8025
1 1.25 1.5 1.75 2 2.25 2.5
evEq@5D 0.8175 0.815 0.8125 0.81 0.8075 0.805 0.8025
1 1.25 1.5 1.75 2 2.25 2.5
evEq@3D 0.8175 0.815 0.8125 0.81 0.8075 0.805 0.8025
evEq@6D 0.8175 0.815 0.8125 0.81 0.8075 0.805 0.8025
1 1.25 1.5 1.75 2 2.25 2.5
1 1.25 1.5 1.75 2 2.25 2.5
Let us now numerically compute the minimizing values for b. We compare three different methods for the case of evEq[3]. One method is to use FindMinimum for the lowest value of e, which we calculate by solving the polynomial in e with NRoots. In[18]:= oFevEq3[_?NumericQ] :=
Block[{b = }, NRoots[evEq[3] == 0, e, 20][[1, 2]]] Timing[FindMinimum[oFevEq3[b], {b, ##}, WorkingPrecision -> 25, PrecisionGoal -> 12, Compiled -> False]& @@@ (* two initial intervals *) {{11/10, 12/10}, {17/10, 18/10}}] Out[19]= 80.02 Second, 880.8074145723427270178250488, 8b → 1.203732086388522417922241 0) /. e[b] -> e) == 0, evEq[3] == 0} . This would not have resulted in a faster solution. Actually, the quality of the solution is not guaranteed. In[22]:= Sort[Select[NSolve[{((D[evEq[3] /. e -> e[b], b] /. e'[b] -> 0) /.
e[b] -> e) == 0, evEq[3] == 0}, {e, b}], Im[e] == 0 && Im[b] == 0 && Re[b] > 0 /. #&], #1[[1, 2]] < #2[[1, 2]]&] // Timing Out[22]= 82.38 Second, 88e → 0.804175, b → 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 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
False] l2 L2 Hl−LL2 i y 1 + LogA 8 I1 + LogA E 2 EM E − 2 Log@πD z 1 + LogA j 1 n2 π2 − 4 n2 π n2 j z z Out[3]= n2 π3 j + j z 2 2 j z 2 l L Hl − LL2 k {
We can understand the finite result for this divergent integral by considering ∑Ha + kLa ê ∑a = Ha + kLa lnHHa + kLL for a = 0. In[4]:= Series[D[Integrate[(κ + a)^α, {κ, 0, ∞},
GenerateConditions -> False], α], {α, 0, 2}]
Out[4]= Ha − a Log@aDL + H−2 a + 2 a Log@aD − a Log@aD2 L α +
3 1 J3 a − 3 a Log@aD + a Log@aD2 − a Log@aD3 N α2 + O@αD3 2 2 ¶
This means that we use Ÿ0 lnHk + aL dk = aH1 - lnHaLL. In[5]:= intH = Pi (PowerExpand[Σ] /. kx^2 + ky^2 -> κ) /.
Log[a_ + κ] :> a (1 + Log[1/a]);
In[6]:= Simplify[int - intH] Out[6]= 0
(Using a convergence-generating factor such as expH-¶ kL, then make a series expansion around k = 0 and ignore algebraically and logarithmically diverging terms gives a similar result. The difference a g will disappear after the following summation.) In[7]:= ser = Integrate[Log[a + κ] Exp[-∂ κ], {κ, 0, Infinity},
Assumptions -> Re[a] > 0 && Re[∂] > 0]
Solutions
481 Out[7]=
a ∂ Gamma@0, a ∂D − Log@∂D + Log@a ∂D ∂
In[8]:= Assuming[a > 0 && ∂ > 0, Series[%, {∂, 0, 1}]] /. _Arg -> 0 // Simplify Out[8]=
−EulerGamma − Log@∂D − a H−1 + EulerGamma + Log@aD + Log@∂DL + O@∂D1 ∂
Using the last result in the sum over n yields a divergent sum. We change the double infinite sum to a single infinite sum by observing that int depends only on n2 and the n = 0 term does not contribute to the finite result. We carry out the summation in a zeta-regularization sense. The sums of pure integer powers of n vanish and the product term n2 lnHnL gives a nonvanishing contribution. In[9]:= Series[PowerExpand[int], {n, 0, 1}] Out[9]= O@nD2 In[10]:= res = Expand[PowerExpand[int]] /.
n^2 Log[n] -> Zeta[3]/(4 Pi^2) /. n -> 0 π Zeta@3D π Zeta@3D 2 π Zeta@3D 4l L 4 Hl − LL
Out[10]= − − 2 + 2 2
We end by writing the last result in a symmetric form. In[11]:= -4 Pi Zeta[3] Apart[-1 /(Pi Zeta[3]/4) Factor[res], l]
1 l
1 Hl − LL
8 L
Out[11]= −4 J 2 + N π Zeta@3D 2 − 2 2 2 As a quick explanation for the result ⁄¶ k=1 k lnHkL = zH3L ê H4 p L, we proceed in a way similar to part a) of this exercise. Taking into account that ∑ na ê ∑a = lnHnL na , we immediately obtain the desired result.
In[12]:= D[Sum[n^α, {n, Infinity}], α] /. α -> 2 Out[12]=
Zeta@3D 4 π2
16. Random Functions, Use of Numerical Techniques a) One difficulty with this problem is that it is not so easy to define what constitutes a “random function”. Here is a possible heuristic definition: RandomFunction[ n] should be a function of depth “about” n, which makes use of randomly selected functions of a given class of functions. For our random univariate functions, we assume the independent variable is always x. We now give a possible implementation: the functions involved can have several arguments. Here, we restrict ourselves to functions with one, two, or three arguments. The lists are arbitrarily extendable in number and size (in particular, for more than three arguments, Times and Plus are appropriate). Here, we avoid special functions and instead just use elementary functions. In[1]:= functionWithiArguments[1] := #[[Random[Integer, {1, Length[#]}]]]&[
(* we use only elementary functions here *) {Sin, Cos, Tan, Cot, ArcSin, ArcCos, Exp, Log, Sqrt, Log, Minus, Sinh, Tanh, Power[#, 1/3]& (* … *)}] functionWithiArguments[2] := #[[Random[Integer, {1, Length[#]}]]]&[ {Power, Plus, Times, Log, Divide (* plus many special functions *)}] functionWithiArguments[3] := #[[Random[Integer, {1, Length[#]}]]]&[{Plus, Times}] (* expandable: functionWithiArguments[4] := ... *)
The list of random functions should also include constants. To be able to combine these more easily later, we do not use the built-in command Unique directly, but instead employ the following modified version. In[5]:= myUnique := c[Unique[my]]
The expression myUnique produces the previously unused constant of the form c[my$number]. Here are some examples. In[6]:= Table[myUnique, {20}]
Symbolic Computations
482 Out[6]= 8c@my$16D, c@my$17D, c@my$18D, c@my$19D, c@my$20D, c@my$21D,
c@my$22D, c@my$23D, c@my$24D, c@my$25D, c@my$26D, c@my$27D, c@my$28D, c@my$29D, c@my$30D, c@my$31D, c@my$32D, c@my$33D, c@my$34D, c@my$35D
newConstant *)
simpRule = {f_[__c] :> myUnique, _?NumericQ*(_c)^_. :> myUnique};
Solutions
483
Secondly, in this form, the constants do not look especially nice; c1, c2, … , looks better than c[my$number]. So, we can implement the function randomFunctionPre. In[16]:= randomFunctionPre[n_] :=
Function[p, p //. ((Rule @@ #)& /@ Transpose[ (* replace c[...] by ci for shortness *) {#, Table[ToExpression["c" ToString[i]], {i, Length[#]}]}]&[Cases[p, c[_], {-2}]])][ randomFunction[n] //. simpRule] Table[randomFunctionPre[3], {6}] Log@xD Log@ D c1 + x c1 , Out[17]= 92 x Tan@xD, , 3 x Hc1 + 2 xL, Log@Cot@xDD 2x ArcCos@Tanh@xDD, Hc1 + c2 + xL Hc3 + c4 + xL ArcCos@xD=
Complications can and still do arise. Because of the completely independent choice of functions, the result can turn out to be x-independent, we could be dividing by 0, and so on. We check for the most common of these problems, and keep calling RandomFunctionH until a satisfactory result is obtained. We do not insist on an exact depth of n, because not all functions collected in functionWithiArguments have the same depth because some of them are composite. This leads us finally the following definition. In[18]:= RandomFunction[n_Integer?(# >= 2&)] :=
Module[{aux, test1, test2, test3, test4}, While[Check[ (* until we have a "good" result *) aux = TimeConstrained[randomFunctionPre[n], (* possibly increase for large n *) 10 n], " error "]; test1 = !(And @@ (* might be 0/0 or related objects were generated *) (FreeQ[aux, #, {0, Infinity}]& /@ {Indeterminate, DirectedInfinity})); (* the variable x should be present *) test2 = !MemberQ[aux, x, {0, Infinity}]; (* may be do here: test3 = Depth[aux] =!= n; *) test4 = aux === $Aborted; test5 = aux === " error "; !(test1 == False && test2 == False && (* test3 == False && *) test4 == False && test5 == False), Null]; aux]
We now look at a few examples of random functions of various depths. In[19]:= Table[RandomFunction[2], {12}]
c1 x
Log@xD c1
c1 Log@xD
Out[19]= 9 , x , c1 + c2 + x, 2 x, c1x , , x2 , , Tan@xD, ArcSin@xD, c1 x2 , x2 = In[20]:= Table[RandomFunction[3], {12}] 3 Log@3 xD è!!!!!!!!!!!!!!!!!!!!! c1 ArcSin@xD Cot@xD , , , x , x Log@x3 D c1 x Cos@xD, ArcCos@2 xD, Cot@x3 D, c1 c2 x2 , Tan@Sin@xDD, Tanh@xD1ê3 =
Out[20]= 9Tan@xx D, c1 x2 ,
In[21]:= Table[RandomFunction[4], {12}] 2
Out[21]= 91 + Log@Tan@xDD + Sin@xDc1 x , Cos@c1 xD1ê3 , 1 −
è!!!!! x , ArcSin@Log@Cot@xDDD,
Log@xD 1 L H x + Sin@xD + Tanh@xDL x1ê3 Hxc1 + Log@xD + c2 , SinhAx 3 +c1 Hc2 + 2 xLE, Log@xD
x2 ArcSin@xD Log@xD Log@xD c2 Sin@c3 + xD + , x3 Cot@1D TanA E, , + 3 c1 + 2 x c2 c1 c1 x2 3 è!!!!!!! x2 Log@xD1ê3 , Hxx Lc1 c2 x , c1 c2 c3 x4 ArcCos@xD2 Cos@3 xD Cot@xD= In[22]:= Table[RandomFunction[5], {6}]
Symbolic Computations
484 1ê3
1ê3
1+x Log@x D + Cot@xD z è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! i y j % , j z Out[22]= 9 x1ê3 + c1 x2 Log@2 x2ê3 D $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1ê3 1ê3
Log@ArcCos@xDD
k
Hc1 + 2 xL
{
,
Log@x1ê3 D è!!!!! Coth@Log@xD Tan@xDD Sin@xDc1+x , −TanhA x + c1 c2 x1+x ArcCos@xD − E, Log@c3 + c4 + xD Sin@xD −x x Cot@Hc1 c2 xL D JArcCos@x D + + Tan@xDN, ArcSin@xD c7 + c8 +x Hc1x + c2 + 2 x + c3 c4 c5 x3 L LogA E Sin@xD3 x Sinh@xx D= c6 + 2 x In[23]:= RandomFunction[6] Out[23]= 2 + c1 + c2 + c3 + 5 x + x3 + ArcCos@Log@xDD + Cos@xD + Cos@x2 Hc4 + c5 + xL Log@xDD +
c11 x3 Tanh@xD Hc6 + c7 + xL H3 x + Cot@xD1ê3 + Log@x2 DL + Log@Hc8 + c9 + xL Hc10 + 2 xLD + Log@xD
We can use RandomFunction to test Mathematica’s integration capabilities by first integrating the random functions, and then differentiating them and comparing with the originals. In[24]:= IntegrateTest[n_] :=
Module[{v = RandomFunction[n], int}, int = Integrate[v, x]; If[FreeQ[int, Integrate, {0, Infinity}, Heads -> True], If[(* hopefully, Simplify can do it *) Simplify[D[int, x] - v] =!= 0, v, Null], Null]] In[25]:=
SeedRandom[111]; Do[If[# =!= Null, Print[#]]&[IntegrateTest[3]], {10}] // Timing Out[26]= 81.25 Second, Null
True], (* Risch should do it *) Print["Antiderivative of the complete differential", d, " not found"], (* tricky case or a bug? *) If[MemberQ[Simplify[int - v], x, {0, Infinity}], Print["Equality cannot be established: ", v, " ", int], Null]]]
Because indefinite integration is correct modulo a differential-algebraic constant, the branch cut structure of some functions x ∑ f HxL might change after carrying out ÅÅÅÅ ÅÅ f HxL dx. Here, we find such an example. ∑x Ÿ In[28]:= SeedRandom[175068687549];
Do[IntegrateTest2[3], {1}] Equality cannot be established: Log@x3 D 3 Log@xD
To get “positive” results with these tests, we have to look at several thousand examples for n = 3. (We found an example quickly because we used a “lucky” seed for the random number generator.) Now let us use n = 5 to find an example for a doable integral that will not be done by Mathematica. We count the number of tries needed to find such an integrand. In[30]:= SeedRandom[7777777];
Module[{counter, v, d, int}, counter = 0; While[counter = counter + 1; v = RandomFunction[4]; (* differentiation *) d = D[v, x]; (* integration *) int = Integrate[d, x];
Solutions
485 FreeQ[int, Integrate, {0, Infinity}, Heads -> True], Null]; {counter, v}] 2 2 Out[31]= 96, 2c1 x ArcSin@xD Tanh@xD xc1 x ArcSin@xD Tanh@xD =
Often such type integrands contain radicals. In[32]:= D[%[[2]], x] 2 2 Out[32]= 2c1 x ArcSin@xD Tanh@xD xc1 x ArcSin@xD Tanh@xD Log@2D
c1 x2 Tanh@xD i y j + 2 c1 x ArcSin@xD Tanh@xDz jc1 x2 ArcSin@xD Sech@xD2 + z+ è!!!!!!!!!!!!!!!! 1 − x2 k { i c1 x2 ArcSin@xD Tanh@xD c1 x2 ArcSin@xD Tanh@xD j 2 x jc1 x ArcSin@xD Tanh@xD + k c1 x2 Tanh@xD y yz i x2 ArcSin@xD Sech@xD2 + j + 2 c1 x ArcSin@xD Tanh@xDz Log@xD jc1 zz è!!!!!!!!!!!!!!!! 1 − x2 {{ k In[33]:= Integrate[%[[2]], x] 2 2 i Out[33]= ‡ 2c1 x ArcSin@xD Tanh@xD xc1 x ArcSin@xD Tanh@xD j jc1 x ArcSin@xD Tanh@xD +
k c1 x2 Tanh@xD i yy Log@xD j + 2 c1 x ArcSin@xD Tanh@xDz jc1 x2 ArcSin@xD Sech@xD2 + z x zz è!!!!!!!!!!!!!!!! 1 − x2 k {{
The function RandomFunction can also be used to discover functions for which Mathematica is not able to find series expansions or limit values, and so on. With an analogous implementation, we can also construct random functions of several variables. Such techniques are typically very useful for automatic testing for larger pieces of code that need to be robust in all cases. Using the function randomFunction, we can easily implement the generation of random numeric expressions (say for investigating the uniformity conjecture [1485], [1486]). randomNumericExpression[ n, iMax] generates a random numeric expression by (about) n-fold composition that has no integers larger than iMax (to avoid expressions with huge integers that might arise from repeatedly forming powers of smaller integers). In[34]:= randomNumericExpressionPre[n_, nMax_] :=
randomFunction[n] //. (* substitute integers for symbols *) (x | _c) :> Random[Integer, {-nMax, nMax}] In[35]:= randomNumericExpression[n_, iMax_] :=
Module[{rNe}, While[(* better reproducibility *) Developer`ClearCache[]; rNe = MemoryConstrained[TimeConstrained[ randomNumericExpressionPre[n, iMax], 100], 10^6]; (* is it a "good" expression? *) MatchQ[rNe, _Integer] || rNe === $Aborted || rNe === Overflow[] || rNe === Underflow[] || Max[Abs[Cases[rNe, _Integer, {-1}]]] > iMax || Max[{Numerator[#], Denominator[#]}& /@ Abs[Cases[rNe, _Rational, {-1}]]] > iMax || Not[NumericQ[rNe]], Null]; rNe]
Here are four examples of random numeric expressions. In[36]:= Off[General::dbyz]; Off[Infinity::indet]; Off[Power::infy];
Off[Power::indet]; Off[General::ovfl]; Off[General::unfl]; Off[N::meprec]; Table[randomNumericExpression[8, 10], {4}] è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! −1 − Cot@Cot@7DD + 2 ArcCos@10D Cos@6D Log@7D + Tan@7D ArcCos@−10D π 1 Cos@Tanh@ArcSin@ArcSin@Log@−Tan@8DD − Sinh@9DDDDD, + ArcCosA E= 2 ArcSin@4D
, Out[39]= 9Cos@Cos@Sinh@Tan@Cot@2DDDDD,
b) To find out if a function uses inexact numbers when evaluating its input, we have to monitor internal evaluation steps. We could use Trace or On, but these functions produce large outputs and slow down calculations substantially. So, we add additional rules to Real and Complex (with inexact arguments) as well as to N. In case any of these heads is used, we
Symbolic Computations
486
record this and immediately after this, we remove the rule to avoid the slowdown of any further computation. The argument HoldAll is needed to avoid the evaluation of the input before Real, Complex, and N are overloaded. inexactNumber UseChecker returns a list with three elements. The first element is the result of the calculation, the second indicates if inexact numbers were used in this calculation, and the third indicates if explicit calls to N were carried out. In[1]:= SetAttributes[inexactNumberUseChecker, HoldAll];
inexactNumberUseChecker[f_] := Module[{realsWereUsed = False, complexesWereUsed = False, NWasCalled = False}, Unprotect[{N, Real, Complex}]; (* intercept calls to N *) DownValues[N] = {HoldPattern[N[x__]] :> Null /; (NWasCalled = True; Clear[N]; False)}; (* intercept calls to a function with an approximative argument *) Real /: _[___, _Real, ___] := Null /; (realsWereUsed = True; Clear[Real]; False); Complex /: _?(# =!= Precision&)[___, c_Complex, ___] := Null /; (If[Precision[c] < Infinity, complexesWereUsed = True; Clear[Complex]]; False); (* return result and if approximative numbers were used and if N was called explicitly *) res = {f, realsWereUsed || complexesWereUsed, NWasCalled}; Protect[{N, Real, Complex}]; (* return result *) res]
Here are three sample inputs demonstrating that inexactNumberUseChecker works correctly. In[3]:= inexactNumberUseChecker[Sin[3.]] Out[3]= 80.14112, True, False< In[4]:= inexactNumberUseChecker[Sin[N @ Pi]] Out[4]= 81.22465 × 10−16 , True, True< In[5]:= inexactNumberUseChecker[Sin[1. + I]] Out[5]= 81.29846 + 0.634964 , True, False
False]] Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… π 1 è!!!!!!!!!!!!!!!!!!!! π 1 è!!!!!!!!!!!!!!!!!!!! Out[10]= 999x → −ArcCosA − −2 + π2 E=, 9x → ArcCosA − −2 + π2 E=, 2 2 2 2 π 1 è!!!!!!!!!!!!!!!!!!!! π 1 è!!!!!!!!!!!!!!!!!!!! 9x → −ArcCosA + −2 + π2 E=, 9x → ArcCosA + −2 + π2 E==, True, True= 2 2 2 2
Solutions
487
For definite integrals, Integrate will use numerical techniques to find singularities along the integration path. In[11]:= inexactNumberUseChecker[Integrate[1/(x - zero), {x, -1, 1}]]
Integrate::idiv : 1 Integral of è!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! ! does not converge on 8−1, 1 {(1501/2 - (27 Sqrt[2445])/2)^(1/3)}]] // Simplify Out[12]= 8−9 + 7 x2 + 3 x3 , True, True
Round[r]; fractionalPart = eqSolved - integerPart; {varToSolveFor[[1]] -> integerPart + C[i], C[i] - fractionalPart}] In[2]:= linearDiophantineSolve[equation_Equal, varList_] :=
Module[{equation1, coeffs, rhs, currentEquation, aux, integerPartBag, n, substitutedSolutions, substitutedSolutionswithOutTempVars, rhss, remainingFreeVars, additionalParameterVars, rules, expandAll = If[Head[#] === Rule, ExpandAll /@ #, ExpandAll @ #]&}, (* write equation in form Sum[coeff[i] var[i], {i, m}] = integer *) equation1 = Subtract @@ equation; coeffs = Coefficient[equation1, #]& /@ varList; rhs = Expand[coeffs.varList - equation1]; (* solvability condition *) If[Mod[rhs, GCD @@ coeffs] =!= 0, {}, (* recursively solve for var with smallest coefficient until process terminates *) integerPartBag = {}; currentEquation = equation1; i = 0; While[i = i + 1; aux = eliminateSmallestPart[ currentEquation, i, varList]; currentEquation = aux[[2]]; If[i > 1, (* termination conditions *) currentEquation =!= C[i] && (MemberQ[currentEquation, Alternatives @@ varList, {0, Infinity}] || MemberQ[Solve[currentEquation == 0, C[i - 1]][[1, 1, 2]], _Rational, {0, Infinity}]), True], AppendTo[integerPartBag, aux]]; AppendTo[integerPartBag, aux]; n = Length[integerPartBag]; sol = If[MemberQ[integerPartBag[[-1, 2]], C[n - 1], {0, Infinity}], Solve[integerPartBag[[-1, 2]] == 0, C[n - 1]], {{C[n] -> 0}}]; (* substitute solutions back *) substitutedSolutions = Fold[{Flatten[{expandAll[#2 //. Flatten[#1]], #1}]}&, {expandAll[integerPartBag[[-1, 1]] //. sol[[1, 1]]]}, Flatten[(First /@ Rest[Reverse[integerPartBag]]) //. sol]]; substitutedSolutionswithOutTempVars = DeleteCases[Flatten[substitutedSolutions], _C -> _]; rhss = Last /@ substitutedSolutionswithOutTempVars; (* introduce parameter variables in case a variable from varList is used *) remainingFreeVars = Union[Cases[rhss, Alternatives @@ varList, {0, Infinity}]]; additionalParameterVars = Table[C[j], {j, i + 1, i + 1 + Length[remainingFreeVars] - 1}]; (* make rules for the result *) rules = Apply[Rule, Transpose[{remainingFreeVars, additionalParameterVars}], {1}]; (* return result, recursively backsubstituted *) Flatten[{substitutedSolutionswithOutTempVars //. rules, rules}]]] /; (* test if equation is a linear diophantine equation *) Function[eq1, Function[coeffs, Not[And @@ (NumberQ /@ N[varList])] && Union[Exponent[eq1, varList]] === {1} && And @@ (IntegerQ /@ coeffs) && IntegerQ[Expand[eq1 - coeffs.varList]]][ Coefficient[eq1, #]& /@ varList]][Subtract @@ equation]
Let us test linearDiophantineSolve using a few examples. In[3]:= linearDiophantineSolve[16 x[1] + 17 x[2] == 2, {x[1], x[2]}] Out[3]= 8x@1D → −2 + 17 C@1D, x@2D → 2 − 16 C@1D
0, If[Union[Last /@ oddPrimeParts] =!= {1}, False, True], True], False]]
Taking into account the above-stated conditions when this can be done, we easily verify the following examples. In[25]:= squareRootableQ[1/(2^3 5^3)] Out[25]= False In[26]:= squareRootableQ[1/(2^4 3 5 17)] Out[26]= True In[27]:= squareRootableQ[131/(2^12 17)] Out[27]= True
To actually express a trigonometric function of p ê q p we need explicit expressions for basic fractions of the form p2 ê 2n p, p3 ê 3 p, p5 ê 5 p, p17 ê 17 p. For fractions less than 1/2, we implement these here. We use our own functions sin and cos here, to avoid any autosimplification of built-in functions. (The other trigonometric functions we express later through sin and cos.) In[28]:= sin[0] = 0;
cos[0] = 1; sin[Pi/3] = Sqrt[3]/2; cos[Pi/3] = 1/2; sin[Pi/5] = Sqrt[(5 - Sqrt[5])/2]/2; cos[Pi/5] = (1 + Sqrt[5])/4;
Solutions
511
sin[2 Pi/5] = Sqrt[(5 + Sqrt[5])/2]/2; cos[2 Pi/5] = (-1 + Sqrt[5])/4; In[36]:= (* use some abbreviations to shorten definitions *)
With[{ = Sqrt}, Module[{α = [17 - [17]], β = [17 + [17]]}, cos[1 Pi/17] = [15 + [17] + [2] α + [2] [34 + 6 [17] - [2] α + [34] α - 8 [2] β]]/(4 [2]); sin[1 Pi/17] = [8 - [2] [15 + [17] - [2] α + [2] [34 + 6 [17] + [2] α - [34] α + 8 [2] β]]]/4; cos[2 Pi/17] = [15 + [17] - [2] α + [2] [34 + 6 [17] + [2] α [34] α + 8 [2] β]]/(4 [2]); sin[2 Pi/17] = [8 - [2] [15 + [17] + [2] α - [2] [34 + 6 [17] [2] α + [34] α - 8 [2] β]]]/4; cos[3 Pi/17] = [15 - [17] + [2] β + [2] [34 - 6 [17] + 8 [2] α [2] β - [34] β]]/(4 [2]); sin[3 Pi/17] = [8 - [2] [15 - [17] - [2] β + [2] [34 - 6 [17] 8 [2] α + [2] β + [34] β]]]/4; cos[4 Pi/17] = [15 + [17] + [2] α - [2] [34 + 6 [17] - [2] α + [34] α - 8 [2] β]]/(4 [2]); sin[4 Pi/17] = [8 - [2] [15 + [17] - [2] α - [2] [34 + 6 [17] + [2] α - [34] α + 8 [2] β]]]/4; cos[5 Pi/17] = [15 - [17] + [2] β - [2] [34 - 6 [17] + 8 [2] α [2] β - [34] β]]/(4 [2]); sin[5 Pi/17] = [17 + [17] - [2] β + [2] [34 - 6 [17] + 8 [2] α [2] β - [34] β]]/(4 [2]); cos[6 Pi/17] = [15 - [17] - [2] β + [2] [34 - 6 [17] - 8 [2] α + [2] β + [34] β]]/(4 [2]); sin[6 Pi/17] = [17 + [17] + [2] β - [2] [34 - 6 [17] - 8 [2] α + [2] β + [34] β]]/(4 [2]); cos[7 Pi/17] = [15 - [17] - [2] β - [2] [34 - 6 [17] - 8 [2] α + [2] β + [34] β]]/(4 [2]); sin[7 Pi/17] = [17 + [17] + [2] β + [2] [34 - 6 [17] - 8 [2] α + [2] β + [34] β]]/(4 [2]); cos[8 Pi/17] = [15 + [17] - [2] α - [2] [34 + 6 [17] + [2] α [34] α + 8 [2] β]]/(4 [2]); sin[8 Pi/17] = [17 - [17] + [2] α + [2] [34 + 6 [17] + [2] α [34] α + 8 [2] β]]/(4 [2])]];
Now remaining is the implementation of the reduction of every “square rootable” trigonometric function to the previously-defined cases. All trigonometric functions are periodic with period 2 p. In[38]:= cos[(fract_Rational | fract_Integer) Pi] :=
(cos[fract Pi] = cos[Mod[fract, 2] Pi]) /; fract >= 2 sin[(fract_Rational | fract_Integer) Pi] := (sin[fract Pi] = sin[Mod[fract, 2] Pi]) /; fract >= 2
Trigonometric functions with arguments p < p ê q p < 2 p can be reduced to arguments in the range H0, pL. In[40]:= cos[(fract_Rational | fract_Integer) Pi] :=
(cos[fract Pi] = +cos[(2 - fract) Pi]) /; fract >= 1 sin[(fract_Rational | fract_Integer) Pi] := (sin[fract Pi] = -sin[(2 - fract) Pi]) /; fract >= 1
We can actually go one step further: trigonometric functions with arguments p ê 2 < p ê q p < p can be reduced to arguments in the range H0, p ê 2L. In[42]:= cos[fract_Rational Pi] :=
(cos[fract Pi] = -cos[(1 - fract) Pi]) /; fract > 1/2 sin[fract_Rational Pi] := (sin[fract Pi] = +sin[(1 - fract) Pi]) /; fract > 1/2
And in the case q = 2n , we can go still one step further and reduce all arguments to the range H0, p ê 4L.
Symbolic Computations
512 In[44]:= cos[fract_Rational Pi] :=
(cos[fract Pi] = sin[(1/2 - fract) Pi]) /; fract > 1/4 sin[fract_Rational Pi] := (sin[fract Pi] = cos[(1/2 - fract) Pi]) /; fract > 1/4
Taking again into account the periodicity of trigonometric functions, negative arguments can always be transformed to positive ones. In[46]:= cos[fract_Rational Pi] :=
(cos[fract Pi] = +cos[-fract Pi]) /; fract < 0 sin[fract_Rational Pi] := (sin[fract Pi] = -sin[-fract Pi]) /; fract < 0
The next rule governs the case when the numerator is 1 and the denominator is a power of 2 by recursively using half-angle formulas. In[48]:= cos[fract_Rational Pi] :=
(cos[fract Pi] = Sqrt[Together[(1 + cos[2 fract Pi])/2]]) /; fract > 0 && MatchQ[FactorInteger[1/fract], {{2, _?(# > 1&)}}] && Numerator[fract] === 1 sin[fract_Rational Pi] := (sin[fract Pi] = Sqrt[Together[(1 - cos[2 fract Pi])/2]]) /; fract > 0 && MatchQ[FactorInteger[1/fract], {{2, _?(# > 1&)}}] && Numerator[fract] === 1
Using multiple-angle formulas, arguments p ê q p can be reduced to a sum of products of trigonometric functions with argument 1 ê q p. In[50]:= cos[fract_Rational Pi] := (cos[fract Pi]
= With[{z = 1/Denominator[fract] Pi, n = Numerator[fract]}, Factor @ Together @ (* this might be a bit dangerous from a timing point of view for large n *) Sum[(-1)^k Binomial[n, 2k] cos[z]^(n - 2k) (1 - cos[z]^2)^k, {k, 0, n/2}]]) /; Numerator[fract] > 1 && IntegerQ[Log[2, Denominator[fract]]]
sin[fract_Rational Pi] := (sin[fract Pi] = With[{z = 1/Denominator[fract] Pi, n = Numerator[fract]}, Factor @ Together @ (* this might be a bit dangerous from a timing point of view *) Sum[(-1)^(k) Binomial[n, 2k + 1] sin[z]^(2k + 1) cos[z]^(n - 2k - 1), {k, 0, (n - 1)/2}]]) /; Numerator[fract] > 1 && IntegerQ[Log[2, Denominator[fract]]]
The last rules govern the generic case p ê q p. If the argument is such that the trigonometric function can be expressed in square roots, the decomposition of p ê q is actually carried out and the resulting sum of products of trigonometric functions contains the already implemented cases. In[52]:= cos[fract_Rational Pi] := (cos[fract Pi]
= Module[{singles, auxVars, expa}, (* write fract as a sum of fractions with denominators 3 or 5 or 17 or powers of 2 *) singles = sumOfFractions[fract]; (* introduce dummy variable for expanding the sum of fractions *) auxVars = Table[cc[i], {i, Length[singles]}]; expa = cos[Plus @@ auxVars] //. {sin[x_ + y_] :> sin[x] cos[y] + cos[x] sin[y], cos[x_ + y_] :> cos[x] cos[y] - sin[x] sin[y]}; (* substitute fractions for dummy variables *) expa //. Apply[Rule, Transpose[{auxVars, singles Pi}], {1}]]) /; squareRootableQ[fract]
sin[fract_Rational Pi] := (sin[fract Pi] Module[{singles, auxVars, expa},
=
Solutions
513 (* write fract as a sum of fractions with denominators 3 or 5 or 17 or powers of 2 *) singles = sumOfFractions[fract]; (* introduce dummy variable for expanding the sum of fractions *) auxVars = Table[cc[i], {i, Length[singles]}]; expa = sin[Plus @@ auxVars] //. {sin[x_ + y_] :> sin[x] cos[y] + cos[x] sin[y], cos[x_ + y_] :> cos[x] cos[y] - sin[x] sin[y]}; (* substitute fractions for dummy variables *) expa //. Apply[Rule, Transpose[{auxVars, singles Pi}], {1}]]) /; squareRootableQ[fract]
We reduce the trigonometric functions tan, cot, sec, and csc to rational functions of sin and cos with the same arguments. In[54]:= tan[z:(fract_Rational Pi)] := (tan[z] = sin[z]/cos[z]) /;
squareRootableQ[fract] cot[z:(fract_Rational Pi)] := (cot[z] = cos[z]/sin[z]) /; squareRootableQ[fract] sec[z:(fract_Rational Pi)] := (sec[z] = 1/cos[z]) /; squareRootableQ[fract] csc[z:(fract_Rational Pi)] := (csc[z] = 1/sin[z]) /; squareRootableQ[fract]
Now, we have everything together to define a function TrigToSquareRoots[ expr] that expresses every trigonometric function in expr, which can be expressed in square roots. In[58]:= TrigToSquareRoots[expr_] :=
(expr //. {Sin Sec (* restore {sin sec
-> sin, Cos -> -> sec, Csc -> nontransformed -> Sin, cos -> -> Sec, csc ->
cos, Tan -> tan, Cot -> cot, csc}) //. expressions *) Cos, tan -> Tan, cot -> Cot, Csc}
Here are a few examples. First are some fractions with denominators being fractions of 2. In[59]:= sin[1/16Pi] Out[59]=
1 "################### è!!!!!# $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2− 2+ 2 2
In[60]:= sin[Pi/256]
* *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ )+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ) *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Out[60]=
1 "################### è!!!!!# (2 − (2 + (2 + &''''''''''''''''''''''''''''''''''''''''''''''''''' 2 + $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2+ 2+ 2 ' 2
Here are two compound denominators. In[61]:= cos[1/(2 3 5) Pi]
1 1 è!!!!! 1 è!!!!! è!!!!! I5 − 5 M% 3 I−1 − 5 M + $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 8 4
Out[61]= −
In[62]:= cos[1/272 Pi]
Symbolic Computations
514
Out[62]=
i1 i j 1 "################### è!!!!!# j è!!!!!!!! è!!!!!!!! "##################################### j j . j J2 + 2 + 2 N j j j j15 + 17 + 2 I17 − 17 M + j 8 2 k k y z zy è!!!!!!!! è!!!!!!!! è!!!!!!!! è!!!!!!!! z z+ z $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 J34 + 6 17 − "#################################### 2 I17 − 17 M# + "######################################## 34 I17 − 17 M − 8 "#################################### 2 I17 + 17 M# N% z z z zz {{ i i i i j j j 1 "################### ! è!!!!!!!! è!!!!! # j j j j15 + è!!!!!!! j j8 − . j j 17 − "#################################### 2 I17 − 17 M# + . j j j j j2 j j jJ2 − 2 + 2 N j 8 k k k k y yz yz yz z è!!!!!!!! è!!!!!!!! è!!!!!!!! è!!!!!!!! z z zz zz z $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 J34 + 6 17 + "#################################### 2 I17 − 17 M# − "######################################## 34 I17 − 17 M + 8 "#################################### 2 I17 + 17 M# N% z z z zz zz zz {{{{
These are all fractions 1 ê q with numerator 1, which allow the corresponding trigonometric functions with argument p ê q to be expressed in square roots. In[63]:= Select[1/Range[1000], squareRootableQ]
1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 8 10 12 15 16 1 1 1 1 1 1 1 1 , , , , , , , , 102 120 60 64 68 80 85 96 1 1 1 1 1 1 1 , , , , , , , 256 272 320 340 384 408 480
1 17 1 , 128 1 , 510
1 1 1 1 1 20 24 30 32 34 1 1 1 1 , , , , 136 160 170 192 1 1 1 1 , , , , 512 544 640 680
1 40 1 , 204 1 , 768
1 1 48 51 1 1 , , 240 255 1 1 , = 816 960
Out[63]= 9 , , , , , , , , , , , , , , , , , , ,
We test all of these fractions using the Cos function. In[64]:= Chop[N[TrigToSquareRoots[Cos[# Pi]] - Cos[# Pi]]& /@ %] // Union Out[64]= 80
c1, Sin[V] -> s1} Out[1]= 8c17 − 21 c15 s12 + 35 c13 s14 − 7 c1 s16 −1, 7 c16 s1 − 35 c14 s13 + 21 c12 s15 − s17 0
3 s1 - 4 s1^3};
So, we have the first identity. In[8]:= id1 = s2/s3^2 - s1/s2^2 + s3/s1^2 == 2 Sqrt[7]
s1
s2
s3
Out[8]= − 2 + 2 + 2 2 s2 s3 s1
è!!!!! 7
This gives the following equation. In[9]:= (Numerator[#]^2 - (id1[[2]] Denominator[#])^2)&[Together[id1[[1]]]] 2
Out[9]= −28 s14 s24 s34 + Hs12 s23 − s13 s32 + s22 s33 L
Elimination of s1 results in a polynomial. In[10]:= Eliminate[{(% /. repRules) == 0, c1^2 + s1^2 == 1}, s1] Out[10]= 13 c12 + 16 c13 + 446 c14 − 144 c15 − 10710 c16 − 32 c17 + 97675 c18 + 4832 c19 − 491575 c110 −
23856 c111 + 1511080 c112 + 55984 c113 − 2925680 c114 − 74176 c115 + 3516544 c116 + 56832 c117 − 2385920 c118 − 23552 c119 + 536576 c120 + 4096 c121 + 397312 c122 − 311296 c124 + 65536 c126 1
This has solutions similar to the equation d1. In[11]:= PolynomialGCD[Subtract @@ %, Subtract @@ d1] // Factor
Symbolic Computations
516 Out[11]= H1 + c1L H1 − 4 c1 − 4 c12 + 8 c13 L
Here is the same calculation (in an abbreviated form) for the second identity. In[12]:= id2 = s2^2/s3^4 + s1^2/s2^4 + s3^2/s1^4 == 28; In[13]:= PolynomialGCD[Subtract @@ Eliminate[{(
(Numerator[#] - id2[[2]] Denominator[#])&[ Together[id2[[1]]]] /. repRules) == 0, c1^2 + s1^2 == 1}, s1], Subtract @@ d1] // Factor Out[13]= H1 + c1L H1 − 4 c1 − 4 c12 + 8 c13 L
Here it is for the third identity. In[14]:= id3 = s3^2/s1^4 ( 2 s2/s3 + 4 s3/s1) +
s1^2/s2^4 (-2 s3/s1 + 4 s1/s2) s2^2/s3^4 ( 2 s1/s2 + 4 s2/s3) == 280; In[15]:= PolynomialGCD[Subtract @@ Eliminate[{(
(Numerator[#] - id3[[2]] Denominator[#])&[ Together[id3[[1]]]] /. repRules) == 0, c1^2 + s1^2 == 1}, s1], Subtract @@ d1] // Factor Out[15]= H1 + c1L H1 − 4 c1 − 4 c12 + 8 c13 L
This gives the same result. Because we have done all calculations so far for cosHn p ê 7L, we must determine which of the possible ≤sin Hn p ê 7L = sinH≤ n p ê 7L do not fulfill the identities. This is easily done by plugging in the numerical values in all possible combinations. (We exclude the solution n = 0 because this would give zeros in the denominators.) The testing must of course give N::meprec messages. In[16]:= (* avoid messages from true identities *) Off[N::meprec];
TableForm[ Outer[N[#1 //. {s1 -> s3 -> {id1, id2, id3}, TableHeadings -> 1 Out[17]//TableForm= id1
id2 id3
2
True True True
Sin[1 #2 Pi/7], s2 -> Sin[2 #2 Pi/7], Sin[3 #2 Pi/7]}]&, Range[6]], {{"id1", "id2", "id3"}, {" 1\n", " 2", " 3", " 4", " 5", " 6"}}] 3 4 5 6
False True False
False True True
False True False
False True True
False True False
This also answers the question for which integers n there are similar identities. Now, we will give a straightforward solution using RootReduce. We first transform the trigonometric functions into exponentials using TrigToExp. Then we transform the exponentials into explicit algebraic numbers of the form H-1Lrational using Together, and finally we use RootReduce to canonicalize the resulting algebraic number. These three operations are put together in the function simplify. In[18]:= simplify[expr_] :=
RootReduce[RootReduce[Together[TrigToExp[#]]]& /@ expr]
Here are the three identities checked. In[19]:= simplify @ (Sin[2Pi/7]/Sin[3Pi/7]^2 - Sin[1Pi/7]/Sin[2Pi/7]^2 + Out[19]= 2
è!!!!! 7
Sin[3Pi/7]/Sin[1Pi/7]^2)
In[20]:= simplify @ (Sin[2Pi/7]^2/Sin[3Pi/7]^4 + Sin[1Pi/7]^2/Sin[2Pi/7]^4 +
Sin[3Pi/7]^2/Sin[1Pi/7]^4) Out[20]= 28 In[21]:= simplify @
(Sin[3Pi/7]^2/Sin[1Pi/7]^4 * ( 2 Sin[2Pi/7]/Sin[3Pi/7] + 4 Sin[3Pi/7]/Sin[1Pi/7]) + Sin[1Pi/7]^2/Sin[2Pi/7]^4 * (-2 Sin[3Pi/7]/Sin[1Pi/7] + 4 Sin[1Pi/7]/Sin[2Pi/7]) -
Solutions
517 Sin[2Pi/7]^2/Sin[3Pi/7]^4 * ( 2 Sin[1Pi/7]/Sin[2Pi/7] + 4 Sin[2Pi/7]/Sin[3Pi/7])) Out[21]= 280
In a similar way, we can now check the sinHexprL ö sinHn exprL part of the exercise. In[22]:= Table[{k, simplify @ (Sin[k 2Pi/7]/Sin[k 3Pi/7]^2 -
Sin[k 1Pi/7]/Sin[k 2Pi/7]^2 + Sin[k 3Pi/7]/Sin[k 1Pi/7]^2)}, {k, 1, 6}] è!!!!! Out[22]= 881, 2 7 x > 1]
Symbolic Computations
546 1 −1− γ
H−1 + zγ L H1 + x H−1 + zγ LL z γ
Out[2]= IntegrateA , 8z, 1, ∞ 1E 2 In[3]:= TimeConstrained[Limit[%, γ -> 0], 10] Out[3]= $Aborted
We will try a term-by-term integration after expanding the integrand in a power series around g = 0. The terms might not be integrable, so potentially we might have to regularize the result. In[4]:= Off[Power::infy];
Limit[int, γ -> 0] + γ Limit[D[int, γ], γ -> 0] 1 2
Out[5]= z−2−x Log@zD + z−2−x γ Log@zD2 H1 − 2 x + H−1 + xL x Log@zDL
Now a direct call to Integrate succeeds. In[6]:= Integrate[%, {z, 1, Infinity}, Assumptions -> x > 1, Out[6]=
GenerateConditions -> False] /. γ -> 0 1 + x H2 + xL 4 H1 + xL
Here is a quick check for a random value of x and a small value of g. In[7]:= With[{γ = 10^-20, x = E Pi},
{(* numerical value for small γ *) NIntegrate[(z^γ - 1)/γ (1 + (z^γ - 1)x)^(-1/γ - 1)/z^2, {z, 1, 2, Infinity}, PrecisionGoal -> 20, WorkingPrecision -> 22], (* exact result *) (1 + 2x + x^2)/(1 + x)^4} // N[#, 20]&] Out[7]= 80.010988222609486848337, 0.010988222609486848337
X Out[4]= X Log@x2 D
Expressing the original integration variable x through X is straightforward. In[5]:= sol = Solve[root[[1]][X] == 0, x]
X6 1+X
Out[5]= 99x → ==
So, we have the following new integrand. In[6]:= newIntegrand2 = newIntegrand /. sol[[1]]
X12 H1 + XL
Out[6]= X LogA 2 E
The change of variables Ÿ f HxL dx = Ÿ f HxHX LL Hdx ê d X L d X requires the calculation of the derivative dx ê d X as a function of X. In[7]:= gb = GroebnerBasis[{#, D[#, X]}&[root[[1]][X] /. x -> x[X]] /. x[X] -> x,
{}, {x}, MonomialOrder -> EliminationOrder]; In[8]:= dxdX = x'[X] /. Solve[gb[[1]] == 0, x'[X]][[1]] Out[8]=
6 X5 + 5 X 6 H1 + XL2
So, we arrive at the following result for the first integral.
Solutions
547 In[9]:= int = (Integrate[newIntegrand2 dxdX, X] // Simplify) /. X -> root
Root@−x − x #1 + #16 &, 1D12 H1 + Root@−x − x #1 + #1 &, 1DL
i
j Out[9]= − j 2 E + 1764 Log@1 + Root@−x − x #1 + #16 &, 1DD + j−720 + 360 LogA 6 k
12
Root@−x − x #1 + #16 &, 1D E Log@1 + Root@−x − x #1 + #16 &, 1DD + 360 LogA H1 + Root@−x − x #1 + #16 &, 1DL2 2
360 Log@1 + Root@−x − x #1 + #16 &, 1DD + 2556 Root@−x − x #1 + #16 &, 1D + 1764 Log@1 + Root@−x − x #1 + #16 &, 1DD Root@−x − x #1 + #16 &, 1D + 12
Root@−x − x #1 + #16 &, 1D E 360 LogA H1 + Root@−x − x #1 + #16 &, 1DL2 6 Log@1 + Root@−x − x #1 + #1 &, 1DD Root@−x − x #1 + #16 &, 1D + 2
360 Log@1 + Root@−x − x #1 + #16 &, 1DD Root@−x − x #1 + #16 &, 1D + Root@−x − x #1 + #16 &, 1D12 2 2358 Root@−x − x #1 + #16 &, 1D − 180 LogA 2 E H1 + Root@−x − x #1 + #16 &, 1DL 2
3
Root@−x − x #1 + #16 &, 1D − 426 Root@−x − x #1 + #16 &, 1D + Root@−x − x #1 + #16 &, 1D12 3 E Root@−x − x #1 + #16 &, 1D + 60 LogA H1 + Root@−x − x #1 + #16 &, 1DL2 12
Root@−x − x #1 + #16 &, 1D 4 153 Root@−x − x #1 + #16 &, 1D − 30 LogA E H1 + Root@−x − x #1 + #16 &, 1DL2 4
5
Root@−x − x #1 + #16 &, 1D − 75 Root@−x − x #1 + #16 &, 1D + 12
Root@−x − x #1 + #16 &, 1D 5 E Root@−x − x #1 + #16 &, 1D + 18 LogA H1 + Root@−x − x #1 + #16 &, 1DL2 Root@−x − x #1 + #16 &, 1D12 6 44 Root@−x − x #1 + #16 &, 1D − 12 LogA E H1 + Root@−x − x #1 + #16 &, 1DL2 6
7
Root@−x − x #1 + #16 &, 1D + 500 Root@−x − x #1 + #16 &, 1D − #16
12
&, 1D Root@−x − x #1 + 7 E Root@−x − x #1 + #16 &, 1D − 300 LogA H1 + Root@−x − x #1 + #16 &, 1DL2 4320 Log@Root@−x − x #1 + #16 &, 1DD H1 + Root@−x − x #1 + #16 &, 1DL + y z 4320 PolyLog@2, −Root@−x − x #1 + #16 &, 1DD H1 + Root@−x − x #1 + #16 &, 1DLz zì { 6 H360 H1 + Root@−x − x #1 + #1 &, 1DLL
Differentiating the last result allows us straightforwardly to check the integral. In[10]:= D[int, x] - integrand // Simplify Out[10]= 0
Mathematica also cannot carry out the second integral directly. In[11]:= root = Root[#^7 - #^2 - x &, 3];
integrand = Exp[root] Log[root] root; Integrate[integrand, x] 2 7 Out[13]= ‡ RootA−x−#1 +#1 &,3E Log@Root@−x − #12 + #17 &, 3DD Root@−x − #12 + #17 &, 3D x
Again, we introduce a new integration variable X=root. This time we have not to solve for x as a function of X . In[14]:= newIntegrand = integrand /. root -> X Out[14]= X X Log@XD
We proceed as above and express the integrand and dx ê d X as a function of X . Then, we carry out the resulting integral and substitute root for X. In[15]:= sol = Solve[root[[1]][X] == 0, x] Out[15]= 88x → −X2 + X7 x[X]] /. x[X] -> x,
{}, {x}, MonomialOrder -> EliminationOrder]; In[18]:= dxdX = x'[X] /. Solve[gb[[1]] == 0, x'[X]][[1]] Out[18]= −2 X + 7 X6 In[19]:= int = (Integrate[newIntegrand2 dxdX, X] // Simplify) /. X -> root Out[19]= 35284 ExpIntegralEi@Root@−x − #12 + #17 &, 3DD +
RootA−x−#1
2 +#17 &,3E
2
I−91482 + 56198 Root@−x − #12 + #17 &, 3D − 19278 Root@−x − #12 + #17 &, 3D + 2
3
7
2
4
7
4466 Root@−x − #1 + #1 &, 3D − 749 Root@−x − #1 + #1 &, 3D + 5
6
91 Root@−x − #12 + #17 &, 3D − 7 Root@−x − #12 + #17 &, 3D + Log@Root@−x − #12 + #17 &, 3DD 2
I−35284 + 35284 Root@−x − #12 + #17 &, 3D − 17642 Root@−x − #12 + #17 &, 3D + 3
4
5880 Root@−x − #12 + #17 &, 3D − 1470 Root@−x − #12 + #17 &, 3D + 294 5
6
7
Root@−x − #12 + #17 &, 3D − 49 Root@−x − #12 + #17 &, 3D + 7 Root@−x − #12 + #17 &, 3D MM
Again, we can use differentiation to check the result. In[20]:= D[int, x] - integrand // Simplify Out[20]= 0
The third integrand is a square root of a ratio of roots. In[21]:= Clear[x, integrand];
poly[x_] = #^3 - # - x&; In[23]:= ratio[x_] = Root[poly[x], 2]/Root[poly[x], 3];
integrand[x_] = (ratio[x]^2)^(1/2);
A direct integration fails again. In[25]:= Integrate[integrand[x], x]
Root@−x − #1 + #13 &, 2D2 Root@−x − #1 + #1 &, 3D
Out[25]= ‡ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 x 3
In this example, some discontinuities come from the Root-objects and some from the square root. The following graphic shows the imaginary part of the integrand and the argument of the square root. In[26]:= Plot[{Im[ratio[x]], Im[integrand[x]]}, {x, -10, 10},
PlotStyle -> {{Thickness[0.02], GrayLevel[0.4]}, {Hue[0]}}, Frame -> True, Axes -> False] 1 0.5 0 -0.5 -1 -4
-2
0
2
4
Along the real line, the discontinuities arising from the roots are at x º ≤ 0.385. In[27]:= NSolve[{poly[x][ξ] == 0, D[poly[x][ξ], ξ] == 0}, {x}, {ξ}] Out[27]= 88x → −0.3849 ratio[x]; In[32]:= aux1[R2_, R3_, x_] = Simplify[D[intPre[x], x] /. {Root[poly[x], 2] -> R2,
Root[poly[x], 3] -> R3}]; In[33]:= der[x_] := Module[{R2 = Root[poly[x], 2], R3 = Root[poly[x], 3]},
aux1[R2, R3, x]] In[34]:= Plot3D[Re[der[x + I y]/integrand[x + I y]], {x, -3, 3}, {y, -3, 3},
PlotPoints -> 60, Mesh -> False]
1 0.5 0 -0.5 -1
2 0
-2 0 2
-2
Let aHxL be this differential algebraic constant. Let P HxL be the current integral intPre[x] and HxL the correct value. Differentiating the relation HxL = aHxL P HxL and taking into account a£ HxL = 0 yields HxL = integrandHxL ê £P HxL P HxL. Calculating HxL according to this formula yields the following result. (We abbreviate the two roots for brevity.) In[35]:= int = integrand[x]/D[intPre[x], x] intPre[x]; In[36]:= Simplify[int /. {Root[poly[x], 2] -> R2, Root[poly[x], 3] -> R3}]
i
j R2 j2 H−1 + 3 R22 L $%%%%%%%%%%%%% Out[36]= j 2 % R3 HR22 + R2 R3 + R32 L H−1 + 3 R32 L j j j k
2
R3
3ê2 y i 2 R2 + R3 y R22 + R2 R3 + R32 z zì zz j j j7 R23 + 9 R22 R3 + 6 R2 R32 + 2 R33 − 3 R33 i y ArcSinhA j z z è!!!!! Ezz z R32 3 R3 {z k { k {
H3 R2 HR2 − R3L2 H6 R24 + 21 R23 R3 − 2 R32 + 6 R34 + R2 R3 H−5 + 21 R32 L + R22 H−2 + 27 R32 LLL
Using the defining polynomial relations for R2 and R3, we could eliminate all powers of degree ¥ 3, but we do not need this here. A quick numerical check (because of the large size of the derivative we use a numerical check here) shows that int is the correct indefinite integral for all complex x. In[37]:= aux2[R2_, R3_, x_] = Simplify[D[int, x] /.
{Root[poly[x], 2] -> R2, Root[poly[x], 3] -> R3}]; (* compiled version for faster numerical evaluation *)
Symbolic Computations
550 aux2c = Compile[{{R2, _Complex}, {R3, _Complex}, {x, _Complex}}, Evaluate[aux2[R2, R3, x]]]; In[40]:= der[x_] := Module[{R2 = Root[poly[x], 2], R3 = Root[poly[x], 3]},
aux2c[R2, R3, x]] In[41]:= Plot3D[Re[der[x + I y]/integrand[x + I y]] - 1,
{x, -3, 3}, {y, -3, 3}, PlotPoints -> 60, Mesh -> False]
2 µ 10-14 0 -2 µ 10-14
2 -2
0 0
-2
2
Although the fourth integrand looks more complicated than the third one, it is actually easier to integrate. In[42]:= poly[x_] = #^3 - x # - x&; In[43]:= ratio[x_] = Root[poly[x], 2]/Root[poly[x], 3];
integrand[x_] = (ratio[x]^3)^(1/3);
A direct integration fails again. In[45]:= TimeConstrained[Integrate[integrand[x], x], 100] 3
3
1ê3
i Root@−x − x #1 + #1 &, 2D y j z Out[45]= ‡ j 3 z j z 3 k Root@−x − x #1 + #1 &, 3D {
x
In[46]:= TimeConstrained[Integrate[ToRadicals[integrand[x]], x], 100] Out[46]= $Aborted
Again, we let the new integration variable be the ratio of the roots X = 2 Hx, -x - x + x 3 L ê 3 Hx, -x - x + x 3 L. In[47]:= xXEq = Factor[GroebnerBasis[Numerator[Together[
{poly[x][r2], poly[x][r3], X^3 - (r2/r3)^3}]], {X, x}, {r2, r3}, MonomialOrder -> EliminationOrder][[1]]] Out[47]= −x H−1 + XL H1 + X + X2 L H−1 − 3 X − 6 X2 + x X2 − 7 X3 + 2 x X3 − 6 X4 + x X4 − 3 X5 − X6 L H1 − 3 X + 3 X2 + x X2 − 4 X3 − x X3 + 9 X4 − 5 x X4 + x2 X4 − 9 X5 + 13 x X5 − 2 x2 X5 + 6 X6 − 16 x X6 + 3 x2 X6 − 9 X7 + 13 x X7 − 2 x2 X7 + 9 X8 − 5 x X8 + x2 X8 − 4 X9 − x X9 + 3 X10 + x X10 − 3 X11 + X12 L
This time, the second factor is the one of relevance. In[48]:= sol = x'[X] /. Solve[{xXEq[[-2]] == 0, D[xXEq[[-2]] /.
x -> x[X], X] == 0} /. x[X] -> x, {x'[X]}, {x}] 2 + 7 X + 9 X2 + 5 X3 − 5 X4 − 9 X5 − 7 X6 − 2 X7 Out[48]= 9− = X3 H1 + XL3
The resulting indefinite integral is quite simple. In[49]:= intX = Integrate[(X^3)^(1/3) sol[[1]], X] // Simplify Out[49]=
HX3 L1ê3 H12 + 36 X + 30 X2 + 3 X3 + 10 X4 + 11 X5 + 4 X6 − 6 X H1 + XL2 Log@XD + 6 X H1 + XL2 Log@1 + XDL 6 X2 H1 + XL2
A numerical check shows that int is the correct indefinite integral. In[50]:= int = intX /. X -> ratio[x]; In[51]:= Clear[diff];
diff[x_] = D[int, x] - integrand[x] // Simplify; In[53]:= Plot3D[Re[diff[x + I y]], {x, -3, 3}, {y, -3, 3},
PlotPoints -> 60, Mesh -> False]
Solutions
551
2 µ 10-14 0 -2 µ 10-14
2 -2
0 0
-2
2
In[54]:= diff[x] 2
Out[54]= I8 x3 Ix I7 x + H3 + 9 xL Root@−x − x #1 + #13 &, 3D + 2 H4 + xL Root@−x − x #1 + #13 &, 3D M + 3
x Root@−x − x #1 + #1 &, 2D
2
I3 + 9 x + 11 H1 + xL Root@−x − x #1 + #13 &, 3D + H15 + 2 xL Root@−x − x #1 + #13 &, 3D M + 3
2
3
Root@−x − x #1 + #1 &, 2D I2 x H4 + xL + x H15 + 2 xL Root@−x − x #1 + #1 &, 3D + 2
H3 + 9 xL Root@−x − x #1 + #13 &, 3D MMM ì i 3 2 j 3 3 j j jRoot@−x − x #1 + #1 &, 1D Ix − 3 Root@−x − x #1 + #1 &, 2D M k 2ê3
y i Root@−x − x #1 + #13 &, 2D3 z j j 3 z z j 3 k Root@−x − x #1 + #1 &, 3D {
6
Root@−x − x #1 + #13 &, 3D
2 y z Ix − 3 Root@−x − x #1 + #13 &, 3D Mz z z {
Mathematica cannot carry out the fifth integral directly. In[55]:= integrand = Root[#^3 - # - x&, 2]/(Root[#^3 - # + x&, 2] - 1);
Integrate[integrand, {x, 0, 1}] 1 Root@−x − #1 + #13 &, 2D Out[56]= ‡ x 3 0 −1 + Root@x − #1 + #1 &, 2D
Also, the indefinite integral cannot be calculated. In[57]:= Integrate[integrand, x]
Root@−x − #1 + #13 &, 2D −1 + Root@x − #1 + #1 &, 2D
Out[57]= ‡ x 3
Of course, we can calculate a numerical approximation of this integral. In[58]:= NIntegrate[integrand, {x, 0, 2/(3 Sqrt[3]), 1}] Out[58]= 0.927235 − 0.186968
We introduce a new integration variable X=integrand. In[59]:= xXEq = Eliminate[{r1^3 - r1 - x == 0, r2^3 - r2 + x == 0,
X - r1/(r2 - 1) == 0}, {r1, r2}] // Subtract @@ #& // Factor Out[59]= Hx − X + 3 x X − 2 X2 + 3 x X2 + x X3 L Hx − 2 X − 3 x X + 5 X2 + 6 x X2 − 7 x X3 − 5 X4 + 6 x X4 + 2 X5 − 3 x X5 + x X6 L dx This time, we have two different possibilities for ÅÅÅÅ ÅÅÅÅÅ . dX
In[60]:= sol = Solve[{xXEq == 0, D[xXEq /. x -> x[X], X] == 0} /.
x[X] -> x, {x'[X]}, {x}] 1 + 2 X − 2 X2 2 − 6 X − 15 X2 + 40 X3 − 15 X4 − 6 X5 + 2 X6
Out[60]= 99x @XD → =, 9x @XD → == H1 + XL4 H1 − X + X2 L4
The first one is correct in certain parts of the complex x-plane. In[61]:= int1 = Integrate[X sol[[1, 1, 2]], X] /. X -> integrand
Symbolic Computations
552 16 RootA−x−#1+#13 &,2E
2
23 RootA−x−#1+#13 &,2E
9 + 2 + 3 −1+Root@x−#1+#13 &,2D
Root@−x − #1 + #13 &, 2D −1 + Root@x − #1 + #1 &, 2D
H−1+Root@x−#1+#1 &,2DL Root@−x−#1+#13 &,2D M 2 I1 + −1+Root@x−#1+#13 &,2D
E − Out[61]= −2 LogA1 + 3 3 In[62]:= Plot[Evaluate[Abs[D[int1, x] - integrand]], {x, -1, 1}, PlotRange -> All] 1.2 1 0.8 0.6 0.4 0.2 -1
-0.5
0.5
1
The boundaries of the interval where int1 is correct coincide with the points of discontinuity of Root[#^3 - # - x&, 2]. In[63]:= Show[GraphicsArray[Plot[Evaluate[#[Root[#^3 - # - x&, 2]]], {x, -1, 1},
PlotRange -> All, DisplayFunction -> Identity]& /@ {Re, Im}]] 0.6
-1
-0.5
-1
-0.5
0.5
0.4
-0.1
0.2
-0.2 0.5
-0.2
1
-0.3
1
-0.4
-0.4 -0.5
-0.6
The two points are branch points of rHxL3 - rHxL + x ã 0. In[64]:= Solve[{r1^3 - r1 + x == 0, D[r1^3 - r1 - x, r1] == 0}, {x}, {r1}]
2
2
! == Out[64]= 99x → − ! =, 9x → è!!!! è!!!! 3
3
3
3
The integral int1 is a continuous function of x at the branch points. In[65]:= Show[GraphicsArray[
Plot[Evaluate[#[int1]], {x, -1, 1}, PlotRange -> All, Frame -> True, Axes -> False, DisplayFunction -> Identity]& /@ {Re, Im}]] 0
-4.4
-0.025
-4.45
-0.05
-4.5
-0.075
-4.55
-0.1
-4.6
-0.125
-4.65
-0.15
-4.7
-0.175 -1
-0.5
0
0.5
1
-1
-0.5
0
0.5
In a similar manner, we find that int2 is the correct indefinite integral outside of the interval I-2 ë I3 In[66]:= int2 = Integrate[X sol[[2, 1, 2]], X] /. X -> integrand
Root@−x − #1 + #13 &, 2D2 H−1 + Root@x − #1 + #13 &, 2DL
Root@−x − #1 + #13 &, 2D −1 + Root@x − #1 + #1 &, 2D
E + Out[66]= LogA1 + 2 − 3 i 2 Root@−x − #1 + #13 &, 2D5 j j j9 − 5 + H−1 + Root@x − #1 + #13 &, 2DL k
1
è!!!! è!!!! 3 M, 2 ë I3 3 MM.
Solutions
553 32 Root@−x − #1 + #13 &, 2D4 54 Root@−x − #1 + #13 &, 2D3 − + H−1 + Root@x − #1 + #13 &, 2DL4 H−1 + Root@x − #1 + #13 &, 2DL3 2 49 Root@−x − #1 + #13 &, 2D 25 Root@−x − #1 + #13 &, 2D y zì z − −1 + Root@x − #1 + #13 &, 2D z H−1 + Root@x − #1 + #13 &, 2DL2 { 3 y i i Root@−x − #1 + #13 &, 2D y Root@−x − #1 + #13 &, 2D2 z j j1 + z j z z z j z j 2 − 3 j2 j 3 −1 + Root@x − #1 + #1 &, 2D { z H−1 + Root@x − #1 + #1 &, 2DL { k k
In[67]:= Plot[Evaluate[Abs[D[int2, x] - integrand]], {x, -1, 1}, PlotRange -> All] 50 40 30 20 10
-1
-0.5
0.5
1
int2 too is a continuous function at the branch points. In[68]:= Show[GraphicsArray[
Plot[Evaluate[#[int2]], {x, -1, 1}, PlotRange -> All, Frame -> True, Axes -> False, DisplayFunction -> Identity]& /@ {Re, Im}]] 5.75
0
5.5
-0.025 -0.05
5.25
-0.075
5
-0.1
4.75
-0.125
4.5
-0.15
4.25
-0.175 -1
-0.5
0
0.5
1
-1
-0.5
0
0.5
1
Using now the two indefinite integrals int1 and int2 allows us to calculate the definite integral. In[69]:= (int1 /. x -> 2/(3 Sqrt[3])) - (int1 /. x -> 0) +
(int2 /. x -> 1) - (int2 /. x -> 2/(3 Sqrt[3])) // RootReduce 3 1 è!!!!! 3 ME + 2 2 Log@Root@27 − 108 #1 + 162 #12 − 112 #13 + 35 #14 − 4 #15 + #16 &, 5DD + Root@362560396897 − 1532000472480 #1 + 8733315168288 #12 − 24291598615200 #13 + 33284161513440 #14 − 15784654934016 #15 + 750008916864 #16 − 18351484416 #17 + 690216360192 #18 − 101220378624 #19 − 41721661440 #110 + 2176782336 #112 &, 12D
Out[69]= −LogA E − 2 LogA I3 +
Combining the logarithms, we have the following final result. In[70]:= % //. Log[x_] + a_. Log[y_] :> Log[x y^a] // RootReduce Out[70]= Log@Root@16777216 − 603979776 #1 + 8493465600 #12 − 59567505408 #13 + 223494930432 #14 −
460940378112 #15 + 742572417024 #16 − 857061015552 #17 + 588411475200 #18 − 217134038016 #19 + 38722917024 #110 − 2754990144 #111 + 387420489 #112 &, 5DD + Root@362560396897 − 1532000472480 #1 + 8733315168288 #12 − 24291598615200 #13 + 33284161513440 #14 − 15784654934016 #15 + 750008916864 #16 − 18351484416 #17 + 690216360192 #18 − 101220378624 #19 − 41721661440 #110 + 2176782336 #112 &, 12D
The numerical value of the last expression agrees with the above result from NIntegrate. In[71]:= N[%] Out[71]= 0.927235 − 0.186968
Mathematica also cannot carry out the last integral directly.
Symbolic Computations
554 In[72]:= integrand = 1/Root[#^5 + # - x&, 1] - (x^(-1/5) + 1/5 x^-1);
Integrate[integrand, {x, 1, Infinity}] ∞ 1 1 1 J− − + N x 5x x1ê5 Root@−x + #1 + #15 &, 1D 1
Out[73]= ‡
We can use NIntegrate to get a numerical approximation of the integral. In[74]:= NIntegrate[Evaluate[integrand], {x, 1, Infinity},
Method -> DoubleExponential, WorkingPrecision -> 50, PrecisionGoal -> 5] Out[74]= 0.1253021
We introduce a new integration ¶ 5 Ÿ1 1 ê 1 Hx, - x + x + x L dx.
variable
X=Root[#^5 + # - x&, 1]
to
integrate
the
first
summand
In[75]:= Solve[{X^5 + X - x == 0, D[X^5 + X - x[X], X] == 0} /.
x[X] -> x, {x'[X]}, {x}] Out[75]= 88x @XD → 1 + 5 X4
Normal[rootSer], {x, Infinity, 2}] Out[81]=
1 1 1 1 4ê5 1 1 8ê5 1 11ê5 5 − J N + OA E + J−1 − LogA EN − J N 1 4ê5 5 x 10 x 50 x x 4 H L x
Putting all subresults together, we arrive at the following short result for the integral. In[82]:= int2 - int1 - 1 /. x -> 1 // RootReduce Out[82]= −Log@Root@−1 + #12 + #13 &, 1DD + Root@59 + 332 #1 − 288 #12 + 64 #13 &, 1D
The numerical value of the last result agrees with the above value from NIntegrate. In[83]:= N[%] Out[83]= 0.125302
For an algorithmic treatment of the integration of algebraic functions, see [440]. e) Using the function Resolve, it is straightforward to obtain a cylindrical description of the region in a1 , a2 , a3 -space such that the roots are the side length of a nondegenerate triangle. To obtain a canonical description of the volume, we apply the function CylindricalDecomposition.
Solutions
555 In[1]:= conds = CylindricalDecomposition[#, {a1, a2, a3}]& @
Resolve[Exists[{x1, x2, x3}, Element[{a1, a2, a3, x1, x2, x3}, Reals], (* x1, x2, x3 are roots of cubic *) x1 x2 x3 == a3 && x1 x2 + x1 x3 + x2 x3 == a2 && x1 + x2 + x3 == -a1 && (* triangle conditions *) x1 > 0 && x2 > 0 && x3 > 0 && x1 + x2 > x3 && x2 + x3 > x1 && x1 + x3 > x2]] 5 a12 ij i a12 Out[1]= a1 < 0 && j jj < a2 ≤ && 16 kk 4 2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 1 3 z H2 a1 − 9 a1 a2L − a16 − 9 a14 a2 + 27 a12 a22 − 27 a23 ≤ a3 < Ha13 − 4 a1 a2Ly z »» 27 8 27 { a12 1 2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5 a12 i j j < a2 < && H2 a13 − 9 a1 a2L − a16 − 9 a14 a2 + 27 a12 a22 − 27 a23 ≤ 3 27 27 k 16 1 2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!y a3 ≤ H2 a13 − 9 a1 a2L + a16 − 9 a14 a2 + 27 a12 a22 − 27 a23 z z »» 27 27 {
a12 1 2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! y i zy z j z ja2 && a3 H2 a13 − 9 a1 a2L − a16 − 9 a14 a2 + 27 a12 a22 − 27 a23 z 3 27 27 {{ k
For the visualization and probability calculation, we can ignore lower-dimensional parts of conds. In[2]:= conds2 = DeleteCases[conds //. a_ && (b_ || c_) :> a && b || a && c,
_?(MemberQ[#, Equal, Infinity, Heads -> True]&)] /. LessEqual -> Less;
conds2 yields immediately a piecewise parametrization of the region in a1 ,a2 ,a3 -space. The right graphic shows the cross section of the 3D region for a1 = -1. In[3]:= makePoints[a1 < 0 && Inequality[a2l_, Less, a2, Less, a2u_] &&
Inequality[a3l_, Less, a3, Less, a3u_], {∂_, pp_}] := (* points along boundaries; avoid endpoints for numerical evaluation *) Table[{a1, a2, Re[#]}, {a1, -2 + ∂, 0 - ∂, (2 - 2∂)/pp}, {a2, Re[a2l + ∂], Re[a2u - ∂], Re[(a2u - a2l - 2∂)/pp]}]& /@ {a3l, a3u}; In[4]:= Needs["Graphics`Graphics3D`"] In[5]:= Show[GraphicsArray[{
Graphics3D[{EdgeForm[], Cases[(* the region in a1,a2,a3-space *) Map[ListSurfacePlot3D[#, DisplayFunction -> Identity]&, makePoints[#, {10^-12, 24}]& /@ conds2, {2}], _Polygon, Infinity]}, BoxRatios -> {1, 1, 1}, Axes -> True, PlotRange -> All] // N, (* zoomed in outline plot in the a1 == -1 plane *) ContourPlot[Evaluate[If[conds2 /. a1 -> -1, 1, -1]], {a2, 0.25, 0.35}, {a3, 0.01, 0.04}, PlotPoints -> 250, ContourShading -> False, Contours -> {0}, DisplayFunction -> Identity]}]] 0.5 0.3
1
0.04
0
0.035 0.03
0.2
0.025
0.1 0 -2 -1.5
0.02 0.015 -1
0.01 -0.5 -0 5
0
0.26 0.28 0.3 0.32 0.34
conds2 also yields immediately the boundaries for the 3D region that allows for a triangle interpretation of the roots. A1 is the smallest value of a1. In[6]:= toIntegral[a1 < 0 && Inequality[a2l_, Less, a2, Less, a2u_] &&
Inequality[a3l_, Less, a3, Less, a3u_], A1_] :=
Symbolic Computations
556 Integrate[1, {a1, A1, 0}, {a2, a2l, a2u}, {a3, a3l, a3u}, GenerateConditions -> False]
Calculating the volume of the region for -1 < a1 , a2 , a3 < 1 gives a 0.00014% probability that for random a1 , a2 , a3 from the interval @-1, 1D, the roots are the side length of a nondegenerate triangle. In[7]:= Simplify[toIntegral[conds2[[1]], A1] +
toIntegral[conds2[[2]], A1], A1 < 0] Out[7]=
A16 92160
In[8]:= {#, N[#]}&[%/2^3 /. A1 -> 1]
1 737280
Out[8]= 9 , 1.35634 × 10−6 =
A “random” check shows that it takes on average about three-quarters of a million trials until we find a cubic whose roots can be interpreted as triangle side lengths. In[9]:= (* do the three numbers x1, x2, and x3 form the edges of a triangle? *)
triangleQ[{x1_, x2_, x3_}] := If[Union[Head /@ {x1, x2, x3}] === {Real}, If[x1 + x2 > x3 && x2 + x3 > x1 && x1 + x3 > x2, True, False], False] In[11]:= SeedRandom[18];
counter = 0; While[{a1, a2, a3} = Table[Random[Real, {-1, 1}], {3}]; {x1, x2, x3} = x /. {ToRules[NRoots[ x^3 + a1 x^2 + a2 x + a3 == 0, x]]}; Not[triangleQ[{x1, x2, x3}]], counter++]; counter Out[14]= 728655
23. Riemann Surface of Cubic Because the branch points and the branch cuts are unknown in this example, it is not so obvious how to generate a picture like those in the corresponding examples treated in Chapter 2 of the Graphics volume [1736]. Of course, we could use the general numerical algorithm implemented in Subsection 1.12.1 of the Numerics volume [1737], but here we will use some more symbolic calculations to generate the Riemann surface under consideration. We start by looking at the branch points of the Riemann surface. Because they connect the various sheets, they occur at the points abp where the polynomial x3 + x2 + a x - 1 ê 2 = 0 has multiple roots. In[1]:= Eliminate[{# == 0, D[#, x] == 0}, x]&[eq = x^3 + x^2 + a x - 1/2] Out[1]= 36 a − 4 a2 + 16 a3 −19
That means we have three branch points bps that have the following coordinates. In[2]:= bps = #[[1, 2]]& /@ NSolve[%, a] Out[2]= 8−0.460727, 0.355363 − 1.56562 , 0.355363 + 1.56562
ax + I ay]], {ax, -3, 3}, {ay, -3, 3}, PlotRange -> All, PlotPoints -> 45, DisplayFunction -> Identity]& /@ sol]]
1 0 -1
2 0
-2 0 2
-2
1.5 1 0.5 0
2 0
-2 0 2
-2
0 -0.5 -1 -1.5
2 0
-2 0 2
-2
The use of NSolve or NRoots also does not avoid this problem, because in their output, the roots are ordered lexicographically, which, of course, does not give better pictures. To avoid these discontinuities in the graphic, we have to be a little bit more careful. First, we determine where the above branch cuts are located. Looking at the solution sol, we recognize that they are caused by negative values of the expression under the square root, this means by H19 + 36 a - 4 a2 + 16 a3 L, which is simply the left-hand side of the defining equation for the branch points. Here, the branch cuts are calculated and graphically represented. The underlying ContourGraphics shows the real part of the first solution of sol. In[5]:= ContourPlot[Evaluate[Im[sol[[1, 1, 2]] /. a -> ax + I ay]],
{ax, -3, 3}, {ay, -3, 3}, PlotPoints -> 120, ContourShading -> False, Contours -> 50, (* the branch cuts implicitly parametrized *) Epilog -> (* use ParametricPlot for smooth curves *) ParametricPlot[Evaluate[{Re[#[[1, 2]]], Im[#[[1, 2]]]}& /@ Solve[19 + 36 a - 4 a^2 + 16 a^3 == -t, a]], {t, 0, 600}, PlotStyle -> {{Thickness[0.02], Dashing[{0.01, 0.04}]}}, PlotRange -> {{-3, 3}, {-3, 3}}, AspectRatio -> Automatic, DisplayFunction -> Identity][[1]]]
Symbolic Computations
558 3 2 1 0 -1 -2 -3
-3
-2
-1
0
1
2
3
By using a = r ei j in 19 + 36 a - 4 a2 + 16 a3 , we can obtain an implicit equation for the branch cuts. In[6]:= Module[{y1, realPart, imaginaryPart},
(* change to polar coordinates *) y1 = (19 + 36a - 4 a^2 + 16 a^3 /. {a -> r (Cos[ϕ] + I Sin[ϕ])}) // Expand; (* take out real and imaginary parts *) imaginaryPart = Plus @@ Cases[y1, _ _Complex]; realPart = y1 - ii; (* make nice equations *)Factor[Simplify[Subtract @@ Eliminate[{realPart == -t, imaginaryPart == 0}, {t}]]]] Out[6]= −r H9 + 4 r2 − 2 r Cos@ϕD + 8 r2 Cos@2 ϕDL Sin@ϕD
For a given value of r, we can determine the corresponding j. (We do this here numerically to make sure that we pick the “correct” one in the first quadrant.) In[7]:= pOfr[r_] := pOfr[r] =
FindRoot[9 Sin[ϕ] - r Sin[2ϕ] + 4 r^2 Sin[3ϕ], {ϕ, 1.3}][[1, 2]]
Now, we have to put all of these together to make a picture of the Riemann surface of xHaL. To avoid the vertical walls due to the branch cuts, we subdivide the complex a-plane in various regions. For †a§ Identity]}, Flatten[{(* the various parts, avoiding crossing any branch cut *) (* the inner parts wrt r *) Table[ParametricPlot3D[{r Cos[ϕ], r Sin[ϕ], reim @ f[i][N[r Exp[I ϕ]]]}, {r, 0, r1}, {ϕ, 0, 2Pi}, PlotPoints -> {2nr, np}, Evaluate[opts]][[1]], {i, 3}], (* the middle part wrt r *) Table[ParametricPlot3D[{r Cos[ϕ], r Sin[ϕ], reim @ f[i][N[r Exp[I ϕ]]]}, {r, r1, r2}, {ϕ, -Pi + ∂, Pi - ∂}, PlotPoints -> {5nr, np}, Evaluate[opts]][[1]], {i, 3}], (* the outer part wrt r *) ParametricPlot3D[{r Cos[ϕ], r Sin[ϕ], Which[ϕ < pOfr[r], reim @ f[1][N[r Exp[I ϕ]]], ϕ < Pi + ∂, reim @ f[3][N[r Exp[I ϕ]]], ϕ < 2Pi - pOfr[r], reim @ f[2][N[r Exp[I ϕ]]],
Solutions
559 reim @ f[1][N[r Exp[I ϕ]]]]}, {r, r2, 3.2}, {ϕ, 0, 2Pi}, PlotPoints -> {7nr, np}, Evaluate[opts]][[1]], ParametricPlot3D[{r Cos[ϕ], r Sin[ϕ], Which[ϕ < N[Pi] + ∂, reim @ f[2][N[r Exp[I ϕ]]], True, reim @ f[3][N[r Exp[I ϕ]]]]}, {r, r2, 3}, {ϕ, 0, 2Pi}, PlotPoints -> {7nr, np}, Evaluate[opts]][[1]], ParametricPlot3D[{r Cos[ϕ], r Sin[ϕ], Which[ϕ < pOfr[r], reim @ f[3][N[r Exp[I ϕ]]], ϕ < 2Pi - pOfr[r], reim @ f[1][N[r Exp[I ϕ]]], True, reim @ f[2][N[r Exp[I ϕ]]]]}, {r, r2, 3}, {ϕ, 0, 2Pi}, PlotPoints -> {7nr, np}, Evaluate[opts]][[1]]}]]; True,
So, we can display the whole surface. If all the pieces are put together now, no spurious vertical walls will be there. For better visibility, we make holes in the polygons. In[11]:= Show[GraphicsArray[
Function[reIm, Block[{$DisplayFunction = Identity, opts = Sequence[ Boxed -> False, BoxRatios -> {1, 1, 2}, ViewPoint -> {1.53, -1.9, 1.15}, PlotRange -> {{-3.25, 3.25}, {-3.25, 3.25}, {-2.3, 1.45}}]}, Show[Graphics3D[{EdgeForm[], SurfaceColor[Hue[0.22], Hue[0.12], 2.1], (* make holes in the polygons to better see that it is one surface *) Function[l, Module[{mp = Mean[l], λ, nOld, nNew}, λ = (mp + 0.74 (# - mp))& /@ l; {nOld, nNew} = Partition[Append[#, First[#]], 2, 1]& /@ {l, λ}; {MapThread[Polygon[Join[#1, Reverse[#2]]]&, {nOld, nNew}]}]] /@ (* the polygons of the last picture *) (First /@ Cases[rsfP[reIm], _Polygon, Infinity])}], opts]]] /@ (* show real part and imaginary part *) {Re, Im}]]
24. Celestial Mechanics, Lagrange Points a) We solve the equation by iteration. To avoid unnecessary big terms in the first stages, we take care of the increase of the order in every step. At the end, we use TrigFactor /@ … to reduce all trigonometric functions to sin functions. In[1]:= Function[ord, (* rewrite at the end *)
Collect[#, Cases[#, _Sin, {0, Infinity}]]&[ (* simplify the sin functions *) TrigFactor /@ Expand[Fold[Normal[M + e Sin[#1 + (* this makes automatically the expansion *) O[e]^#2]]&, M, Range[ord]]]]][10] Out[1]= M + He + e2 Cos@MD + e3 Cos@MD2 + e4 Cos@MD3 + e5 Cos@MD4 + e6 Cos@MD5 + e7 Cos@MD6 + e8 Cos@MD7 + e9 Cos@MD8 + e10 Cos@MD9 L Sin@MD + 3 5 11 20 65 e i j j− − e4 Cos@MD − e5 Cos@MD2 − e6 Cos@MD3 − e7 Cos@MD4 − 2 3 3 3 6 k 70 9 49 8 y 5 6 10 7z e Cos@MD − e Cos@MD − 32 e Cos@MD z Sin@MD3 + 3 3 { 13 e5 47 6 1291 7 427 8 i 2 j + e Cos@MD + e Cos@MD + e Cos@MD3 + j 15 120 15 k 24
Symbolic Computations
560 1281 644 y Sin@MD5 + e9 Cos@MD4 + e10 Cos@MD5 z z 20 5 { 7 9 Cos@MD2 1957 36619 e 6368 541 e i z j − e10 Cos@MD3 y z Sin@MD7 + j− − e8 Cos@MD − 720 315 1260 63 { k 9 5141 9509 e i z Sin@MD9 j + e10 Cos@MDy z j 405 { k 8064
Note that by using the Lagrange-Bürmann theorem, it is possible to give this result in closed form [829]. b) In the following, we implement a straightforward realization of the calculation of the required series. (A more elegant, recursive possibility can be found in [1588], [192], and [254]; an application of the series can be found in [426], [317].) We do not directly use a list of the form {x[t], y[t], z[t]} for the position vector, because first, this is very memory-consuming, and second, it makes it quite difficult to introduce the given abbreviations. So, we define our own rules for the time derivative […, t], and for the position vector R[t] and its length r[t]. (We use capital and small letters for the vector and its length.) Because R[t] is not an explicit list (meaning it does not have the head List), we use dot instead of Dot for the scalar product. Here are all relevant definitions for the time evolution of R[t]. In[1]:= (* scalar product is commutative *)
SetAttributes[dot, Orderless] (* linearity of *) [sum_Plus, t] := [#, t]& /@ sum (* Leibniz rule for differentiation of products *) [product_Times, t] := Plus @@ MapIndexed[Function[{arg, pos}, MapAt[[#, t]&, arg, pos[[1]]]], Array[product&, Length[product]]] (* time derivative of a constant vanishes *) [_?(FreeQ[#, r[t], {0, Infinity}] && FreeQ[#, R[t], {0, Infinity}] &), t] = 0; (* time derivative of r[t] via explicit differentiation *) [r[t]^n_., t] := n r[t]^(n - 1) dot[R[t], [R[t], t]]/r[t] (* time derivative of scalar product *) [dot[a_, b_], t] := dot[[a, t], b] + dot[a, [b, t]] (* time derivative of powers of scalar products *) [dot[R[t], [R[t], t]]^n_, t] := n dot[R[t], [R[t], t]]^(n - 1) [dot[R[t], [R[t], t]], t] (* equation of motion for [[R[t], t], t] *) [[R[t], t], t] = -R[t]/r[t]^3; (* pulling out nonvectors from the scalar product *) dot[a_?(FreeQ[#, R[t]] && FreeQ[#, [R[t], t]]&) b_, c_] := a dot[b, c] (* definition of r[t] through scalar product of R[t] *) dot[R[t], R[t]] = r[t]^2;
The most important ingredient in the last definition is the use of the equation of motion. This allows us to reduce all higher-order time derivatives as linear combinations of the two vectors R[0] and R'[0]. The derivatives needed in rHtL = rH0L + r£ H0L + 1 ê 2 ! r££ H0L t2 + 1 ê 3! r£££ H0L t3 + ∫ are calculated recursively. In[21]:= term[0] = R[t];
term[n_] := term[n] = Expand[[term[n - 1], t]];
The command shorten introduces the abbreviations given above. shorten[term[i]] gives a list with the coefficients of r0 and v0 in term[i]. (Because the lowest-order terms are not sums, we give their short forms separately.) In[23]:= (* initial terms *)
shorten[term[0]] = { 1, 0}; shorten[term[1]] = { 0, 1}; shorten[term[2]] = {-u, 0};
Solutions
561
shorten[term_] := shorten[term] = (* collect wrt R[t] and d[R[t], t]; factor coefficients *) {Factor[Plus @@ (Cases[#, R[t] _.]/R[t])], Factor[Plus @@ (Cases[#, [R[t], t] _.]/[R[t], t])]}&[ (* introduce shortcuts *) (term //. {dot[[R[t], t], R[t]] -> s r[t]^2, dot[[R[t], t], [R[t], t]] -> w r[t]^2}) //. {r[t]^n_ -> u^(-n/3)}]
Now, we have everything together to define and to test the resulting series. In[28]:= newtonSeries[ord_] := {r0, v0}.
Table[Sum[shorten[term[i]][[1]] t^i/i!, {i, 0, ord}], {i, 2}]
Here are the first few terms of the resulting series expansion. In[29]:= newtonSeries[5]
1 1 1 t2 u i y Out[29]= r0 j j1 − + s t3 u + s t5 u H7 s2 + 2 u − 3 wL − t4 u H15 s2 + 2 u − 3 wLz z+ 2 2 8 24 k { 1 1 1 4 t2 u y i − 3 5 2 2 z + s t u + s t u H7 s + 2 u − 3 wL − t u H15 s + 2 u − 3 wL v0 j z j1 2 2 8 24 { k
Much larger expansions can be calculated quite quickly too. In[30]:= Short[newtonSeries[15], 8] // Timing 2
1 t u i − + s t3 u + 11 + Out[30]= 91.48 Second, r0 j j1
2 2 k s 2 H1L t12 u H13749310575 s10 + 35 + 9450 u1 w4 r@tDL − + 13305600 479001600 13 10 8 4ê3 4 s t u H35137127025 s + 56015709750 s u + 35 + 548100 u w r@tDL 1 + 691891200 435891456000 15 12 10 8 2 Hs t u H71152682225625 s + 137034795397500 s u + 87316737725700 s u + 47 + 13314596400 s2 u4ê3 w4 r@tD + 1387649880 u7ê3 w4 r@tD − 390152700 u4ê3 w5 r@tDLL − 1 Ht14 u H7905853580625 s12 + 13914302301900 s10 u + 8047182795750 s8 u2 + 87178291200 1864391484960 s6 u3 + 192016033056 s4 u4 + 10842907680 s2 u5 + 43 + z+ 531789300 s2 u4ê3 w4 r@tD + 8138340 u7ê3 w4 r@tD − 3231900 u4ê3 w5 r@tDLLy z { 14 1 u 1 t u H1L z y i j − z= v0 j1 − + 16 + 2 11 0 87178291200 { k
For a similar expansion for a quantum-mechanical problem, see [784]. c) This is the potential function VHx, yL. In[1]:= x1 = -µ; x2 = 1 - µ; In[2]:= V[x, y] =
With[{r1 = Sqrt[(x - x1)^2 + y^2], r2 = Sqrt[(x - x2)^2 + y^2]}, -(1/2 (x^2 + y^2) + (1 - µ)/r1 + µ/r2)];
The two equations to be solved (meaning equilibrium points) are the following. In[3]:= eqs1 = {D[V[x, y], x], D[V[x, y], y]}
µ H−1 + x + µL Hy2 + H−1 + x + µL2 L
H1 − µL Hx + µL Hy2 + Hx + µL2 L
yµ Hy2 + H−1 + x + µL2 L
y H1 − µL Hy2 + Hx + µL2 L
Out[3]= 9−x + + , −y + + = 3ê2 3ê2 3ê2 3ê2
Solving the last two equations directly fails in a reasonable amount of time. So, we will solve the two equations “manually”. In[4]:= TimeConstrained[#[Thread[eqs1 == {0, 0}], {x, y}], 100]& /@
{Solve, Reduce} Out[4]= 8$Aborted, $Aborted
R2, Sqrt[(x - x1)^2 + y^2] -> R1}]
Symbolic Computations
562 Out[5]= 8R2 x − 2 R2 x2 + R2 x3 − R1 R2 x3 + 2 R1 R2 x4 − R1 R2 x5 + R2 x y2 − R1 R2 x y2 +
2 R1 R2 x2 y2 − 2 R1 R2 x3 y2 − R1 R2 x y4 + R2 µ − 5 R2 x µ − R1 x2 µ + 5 R2 x2 µ − 2 R1 R2 x2 µ + R1 x3 µ − R2 x3 µ + 6 R1 R2 x3 µ − 4 R1 R2 x4 µ − R1 y2 µ + R2 y2 µ + R1 x y2 µ − R2 x y2 µ + 2 R1 R2 x y2 µ − 4 R1 R2 x2 y2 µ − 3 R2 µ2 − 2 R1 x µ2 + 7 R2 x µ2 − R1 R2 x µ2 + 3 R1 x2 µ2 − 3 R2 x2 µ2 + 6 R1 R2 x2 µ2 − 6 R1 R2 x3 µ2 + R1 y2 µ2 − R2 y2 µ2 − 2 R1 R2 x y2 µ2 − R1 µ3 + 3 R2 µ3 + 3 R1 x µ3 − 3 R2 x µ3 + 2 R1 R2 x µ3 − 4 R1 R2 x2 µ3 + R1 µ4 − R2 µ4 − R1 R2 x µ4 , −y H−R2 + 2 R2 x − R2 x2 + R1 R2 x2 − 2 R1 R2 x3 + R1 R2 x4 − R2 y2 + R1 R2 y2 − 2 R1 R2 x y2 + 2 R1 R2 x2 y2 + R1 R2 y4 + 3 R2 µ − 4 R2 x µ + 2 R1 R2 x µ − R1 x2 µ + R2 x2 µ − 6 R1 R2 x2 µ + 4 R1 R2 x3 µ − R1 y2 µ + R2 y2 µ − 2 R1 R2 y2 µ + 4 R1 R2 x y2 µ − 3 R2 µ2 + R1 R2 µ2 − 2 R1 x µ2 + 2 R2 x µ2 − 6 R1 R2 x µ2 + 6 R1 R2 x2 µ2 + 2 R1 R2 y2 µ2 − R1 µ3 + R2 µ3 − 2 R1 R2 µ3 + 4 R1 R2 x µ3 + R1 R2 µ4 L
EliminationOrder, ParameterVariables -> {µ}, CoefficientDomain -> Rationals] // Factor Out[6]= 8y, H−1 + x + µL Hx + µL H1 − x + x2 − µ + 2 x µ + µ2 L H1 − x − x2 + x3 − 2 µ − x µ + 2 x2 µ + x µ2 L H−1 + 2 x − x2 + x3 − 2 x4 + x5 + 3 µ − 4 x µ + 2 x2 µ − 6 x3 µ + 4 x4 µ − 3 µ2 + x µ2 − 6 x2 µ2 + 6 x3 µ2 − 2 x µ3 + 4 x2 µ3 + x µ4 L H1 − 2 x + x2 + x3 − 2 x4 + x5 − 3 µ + 4 x µ + 2 x2 µ − 6 x3 µ + 4 x4 µ + 3 µ2 + x µ2 − 6 x2 µ2 + 6 x3 µ2 − 2 x µ3 + 4 x2 µ3 + x µ4 L H−1 + 2 x − x2 + x3 − 2 x4 + x5 + 3 µ − 4 x µ + 4 x2 µ − 6 x3 µ + 4 x4 µ − 3 µ2 + 5 x µ2 − 6 x2 µ2 + 6 x3 µ2 + 2 µ3 − 2 x µ3 + 4 x2 µ3 + x µ4 L
False, Quartics -> False]; sol1 = Union[Append[#, y -> 0]& /@ (ToRules[Roots[# == 0, x]]& /@ Rest[gb1])]; Short[sol1, 6] 1 1 è!!!!! è!!!!! 3 − 2 µM, y → 0=, 9x → I1 + 3 − 2 µM, y → 0=, 8x → 1 − µ, y → 0 Rationals] // Factor; Short[gb2, 8] Out[14]//Short= 8H−1 + µL µ H−1 + 2 x + 2 µL
H−7 + 7 x − 7 x2 − 3 y2 − 48 x y2 + 48 x2 y2 + 24 y4 + 7 µ − 14 x µ − 48 y2 µ + 96 x y2 µ − 7 µ2 + 48 y2 µ2 L, H−1 + µL µ H−1 + 2 x + 2 µL H5 − 13 x + 21 x2 − 16 x3 + 8 x4 + 9 y2 − 13 µ + 42 x µ − 48 x2 µ + 32 x3 µ + 21 µ2 − 48 x µ2 + 48 x2 µ2 − 16 µ3 + 32 x µ3 + 8 µ4 L, H−1 + µL µ H1L H1L, −4608 + 18432 x − 27648 x2 + 169 + 9031680 x µ9 + 1999872 µ10 , −H−1 + µL µ H1708 − 7784 x + 13860 x2 − 12152 x3 + 6076 x4 + 3939 y2 − 11328 x y2 + 11328 x2 y2 + 3504 y4 − 6240 x y4 + 6240 x2 y4 − 1440 y6 − 2880 y8 − 2304 y10 − 7784 µ + 27720 x µ − 36456 x2 µ + 24304 x3 µ − 11328 y2 µ + 22656 x y2 µ − 6240 y4 µ + 12480 x y4 µ + 13860 µ2 − 36456 x µ2 + 36456 x2 µ2 + 11328 y2 µ2 + 6240 y4 µ2 − 12152 µ3 + 24304 x µ3 + 6076 µ4 L
{µ}] // Factor;
Short[gb3, 8] 3
Out[16]//Short= 9y2 H−3 + 4 y2 L H1 + 4 y2 L H21 + 12 y2 + 16 y4 L H21 + 24 y2 + 16 y4 L H−1 + µL µ,
y2 H1 + 4 y2 L H21 + 12 1 + 16 y4 L 1 µ H−1 + 2 x + 2 µL, 1, −16777662720 + 67110650880 x − 100665976320 x2 + 67110650880 x3 − 16777662720 x4 + 16777662720 x6 − 67110650880 x7 + 100665976320 x8 − 67110650880 x9 + 16777662720 x10 − 33555325440 y2 + 67110650880 x y2 − 33555325440 x2 y2 + 50332988160 x4 y2 − 201331952640 x5 y2 + 176 + 4680967898880 x µ8 − 8030845467141 y2 µ8 − 133040302378416 y4 µ8 − 206881083710496 y6 µ8 + 6186983622336 y8 µ8 + 284442471251712 y10 µ8 + 474522386614272 y12 µ8 + 315544814714880 y14 µ8 + 138124091179008 y16 µ8 + 4613857248000 µ9 − 1040215088640 x µ9 − 922771449600 µ10 =
The first two equations determine the possible y-values. In[17]:= Prepend[Union[(ToRules[Roots[# == 0, y]]& /@
Union[Cases[gb3, _Plus?(FreeQ[#, x]&), Infinity]])], {y -> 0}] è!!!!! è!!!!! è!!!!! 3 3 3 3 Out[17]= 98y → 0 (1 - s^2)/(1 + s^2), Sin[t] -> 2s/(1 + s^2)}; (* make polynomial equations *) aux3 = Numerator[Together[aux2]]; (* eliminate parametrization variable s *) aux4 = Factor[Resultant[##, s]& @@ aux3]; (* if present - delete X and Y independent prefactor *) If[Head[aux4] === Times, DeleteCases[aux4, _?IntegerQ], aux4]]
As a first test, we treat the circle. In[4]:= algebraizise[{Cos[t], Sin[t]}, t, {x, y}] Out[4]= −1 + x2 + y2
Here are the two Lissajous curves of interest. In[5]:= algebraizise[{Cos[t], Sin[2t]}, t, {x, y}]
Symbolic Computations
566 Out[5]= −4 x2 + 4 x4 + y2 In[6]:= algebraizise[{Cos[3t], Sin[2t]}, t, {x, y}] Out[6]= −4 x2 + 4 x4 + 9 y2 − 24 y4 + 16 y6
For the second one, we compare the contour plot of the implicit representation with the plot of the parametric representation. In[7]:= Show[GraphicsArray[{
(* the parametrized form *) ParametricPlot[{Cos[3t], Sin[2t]}, {t, 0, 2Pi}, Frame -> True, Axes -> False, DisplayFunction -> Identity, AspectRatio -> 1], (* the implicit form *) ContourPlot[4 x^4 - 4 x^2 + 9 y^2 - 24 y^4 + 16 y^6, {x, -1.1, 1.1}, {y, -1.1, 1.1}, Contours -> {0}, PlotPoints -> 160, DisplayFunction -> Identity, AspectRatio -> 1]}]] 1
1
0.5
0.5
0
0
-0.5
-0.5
-1
-1 -1
-0.5
0
0.5
1
-1
-0.5
0
0.5
1
For some other, more effective methods of how to implicitize parametrically given curves, see [414], [872], [1246], and [748]. b) This is the polynomial under consideration. In[1]:= lissa = (9 x^2 - 24 x^4 + 16 x^6 - 4 y^2 + 4 y^4)^2 - 1/2;
To get an idea about the shape of the region under consideration, we use ContourPlot. The black part is the region to be described. Because of the obvious symmetry of lissa with respect to the x-axis and y-axis, we restrict our investigation to the region x ¥ 0, y ¥ 0. In[2]:= sketch = ContourPlot[Evaluate[lissa], {x, 0, 1.1}, {y, 0, 1.1},
PlotPoints -> 60, ContourShading -> True, Contours -> {0}] 1 0.8 0.6 0.4 0.2 0
0
0.2
0.4
0.6
0.8
1
We divide the region under interest in vertical stripes xl < x < xu , in such a manner that in each stripe, yl HxL and yu HxL are real analytic functions. In principle, the yl HxL and yu HxL may change their form (form = the branch of the roots of lissa) if a beginning or end of a hole or extremum is traversed. Analytically, this means y£ HxL = ¶. The points xl and xu are so described by the following equation. In[3]:= res = Resultant[lissa, D[lissa, y], y] // Factor 2
Out[3]= 562949953421312 H1 − 36 x2 + 258 x4 − 928 x6 + 1728 x8 − 1536 x10 + 512 x12 L
H−1 + 162 x4 − 864 x6 + 1728 x8 − 1536 x10 + 512 x12 L
Here, these points are explicitly calculated.
Solutions
567 In[4]:= xPoints = Simplify @ Sort[Cases[Union[x /. Solve[res == 0, x]],
(* or use Roots with Root-solutions to avoid numerical selection *) _?((Im[Chop[N[#]]] == 0 && Re[Chop[N[#]]] > 0)&)], Re[N[#1]] < Re[N[#2]]&] 1ê3 2ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! −1 − 3 + 4 I1 − 2 + 2 H−1 + 2 L M + H + 3 L I1 − 2 + 2 H−1 + 2 L M 1 Out[4]= 9 &''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' , 1ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! 2 2 I1 − 2 + 2 H−1 + 2 L M 1ê3 2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! J−1 + I1 − 2 + 2 H−1 + 2 L M N 1 &'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' − 1ê3 ', è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! 2 I1 − 2 + 2 H−1 + 2 L M 1ê3 2ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! è!!!!! 1 − è!!!! 3! + 4 I1 − è!!!! 2! + 2 H−1 + è!!!! 2! L M + H1 + 3 L I1 − 2 + 2 H−1 + 2 L M 1 &''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ', 1ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! 2 2 I1 − 2 + 2 H−1 + 2 L M 1ê3 2ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! + H−1 − 3 L I1 − 2 + 2 H−1 + 2 L M −1 + 3 + 4 I1 − 2 + 2 H−1 + 2 L M 1 ', &'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 1ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! 2 2 I1 − 2 + 2 H−1 + 2 L M 1ê3 1 1 è!!!!! è!!!!! 2 I−1 + 2 M N ' , &''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 2 + + J1 − 2 + "################################## 1ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! 2 I1 − 2 + 2 H−1 + 2 L M 1ê3 2ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! 1 + 3 + 4 I1 − 2 + 2 H−1 + 2 L M + H1 − 3 L I1 − 2 + 2 H−1 + 2 L M 1 &''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ', 1ê3 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! è!!!!! 2 2 I1 − 2 + 2 H−1 + 2 L M 1ê3 1 1 è!!!!! è!!!!! 2 + + J1 + 2 − "############################## 2 I1 + 2 M# N ' = &''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! ! 1ê3 2 I1 + 2 − 2 H1 + 2 L M
Adding the vertical lines corresponding to xPoints to sketch, we clearly see the six resulting stripes. In[5]:= Show[{sketch, Graphics[{Hue[0], Line[{{#, 0}, {#, 1.1}}]& /@ xPoints}]}] 1 0.8 0.6 0.4 0.2 0
0
0.2
0.4
0.6
0.8
1
Inside each of the stripes, we need the solutions of lissa with respect to y. Because lissa is a quartic polynomial in y, we can explicitly solve for yHxL in radicals. In[6]:= sol = Simplify[Union[Solve[lissa == 0, y]]]
1 # è!!!!! "############################################################################# è!!!!! Out[6]= 99y → − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 + 2 2 − 2 − 18 x2 + 48 x4 − 32 x6 % =, 2
1 # è!!!!! "############################################################################# è!!!!! 9y → $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 + 2 2 − 2 − 18 x2 + 48 x4 − 32 x6 %=, 2 1 # è!!!!! "############################################################################# è!!!!! 9y → − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 − 2 2 − 2 − 18 x2 + 48 x4 − 32 x6 %=, 2 1 # è!!!!! "############################################################################# è!!!!! 2 − 2 2 − 2 − 18 x2 + 48 x4 − 32 x6 % =, 9y → $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2
Symbolic Computations
568 1 # è!!!!! "############################################################################# è!!!!! 9y → − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 + 2 2 + 2 − 18 x2 + 48 x4 − 32 x6 % =, 2 1 # è!!!!! "############################################################################# è!!!!! 9y → $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 + 2 2 + 2 − 18 x2 + 48 x4 − 32 x6 %=, 2 1 # è!!!!! "############################################################################# è!!!!! 9y → − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 − 2 2 + 2 − 18 x2 + 48 x4 − 32 x6 %=, 2 1 # è!!!!! "############################################################################# è!!!!! 2 − 2 2 + 2 − 18 x2 + 48 x4 − 32 x6 % == 9y → $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2
To see which of the last solutions is describing which part of the boundary inside each stripe, we look at the curves described by the solutions. In[7]:= (* avoid messages from spurious numericalization *)
Off[Plot::plnr]; Show[GraphicsArray[#]]& /@ Partition[ Show[{sketch, Graphics[{Hue[0], Line[{{#, 0}, {#, 1.1}}]& /@ xPoints}], Plot[Evaluate[#[[1, 2]]], {x, 0, 1.2}, PlotStyle -> {{RGBColor[0, 1, 0], Thickness[0.02]}}, DisplayFunction -> Identity, PlotRange -> {0, 1.1}]}, DisplayFunction -> Identity, PlotRange -> {0, 1.1}]& /@ sol, 4] 1
1
1
1
0.8
0.8
0.8
0.8
0.6
0.6
0.6
0.6
0.4
0.4
0.4
0.4
0.2
0.2
0.2
0.2
0
0.2 0.4 0.6 0.8
1
0
0.2 0.4 0.6 0.8
1
0
0.2 0.4 0.6 0.8
1
1
1
1
1
0.8
0.8
0.8
0.8
0.6
0.6
0.6
0.6
0.4
0.4
0.4
0.4
0.2
0.2
0.2
0.2
0
0.2 0.4 0.6 0.8
1
0
0.2 0.4 0.6 0.8
1
0
0.2 0.4 0.6 0.8
So, we finally have the following xl , xu , yl HxL, and yu HxL. In[10]:= u = (1 - Sqrt[2] + I Sqrt[2 Sqrt[2] - 2]);
v = 2 - 18 x^2 + 48 x^4 - 32 x^6; x1 = 0; x2 = Sqrt[4 - u^(-1/3) - I Sqrt[3]/u^(1/3) u^(1/3) + I Sqrt[3] u^(1/3)]/(2 Sqrt[2]); x3 = Sqrt[2 - u^(-1/3) - u^(1/3)]/2; x4 = Sqrt[4 + u^(-1/3) - I Sqrt[3]/u^(1/3) + u^(1/3) + I Sqrt[3] u^(1/3)]/(2 Sqrt[2]); x5 = Sqrt[4 - u^(-1/3) + I Sqrt[3]/u^(1/3) u^(1/3) - I Sqrt[3] u^(1/3)]/(2 Sqrt[2]); x6 = Sqrt[2 + u^(-1/3) + u^(1/3)]/2; x7 = Sqrt[4 + u^(-1/3) + I Sqrt[3]/u^(1/3) + u^(1/3) - I Sqrt[3] u^(1/3)]/(2 Sqrt[2]); x8 = ((1 + Sqrt[2] + Sqrt[2 + 2 Sqrt[2]])^(-1/6) + (1 + Sqrt[2] + Sqrt[2 + 2 Sqrt[2]])^( 1/6))/2;
1
0
0.2 0.4 0.6 0.8
1
0
0.2 0.4 0.6 0.8
1
Solutions
569 y1 y2 y3 y4 y5
= = = = =
0; Sqrt[2 Sqrt[2 Sqrt[2 Sqrt[2
+ +
Sqrt[2] Sqrt[2] Sqrt[2] Sqrt[2]
Sqrt[v Sqrt[v Sqrt[v Sqrt[v
+ +
Sqrt[2]]]/2; Sqrt[2]]]/2; Sqrt[2]]]/2; Sqrt[2]]]/2;
In terms of x0, x1, x2, x3, x4, x5, x6, x7, x8, y0, y1, y2, y3, y4, and y5, the region lissa < 0 can be described in the following manner. In[25]:= (* avoid messages from spurious numericalization *)
Off[Less::"nord"]; In[27]:= negativeRegion =
x1 x2 x4 x5 x7
< < < <
1], (* the implicit plot *) ContourPlot[evolute[ξ, η], {ξ, -3, 3}, {η, -3/2, 3/2}, PlotPoints -> 160, Contours -> {0}, AspectRatio -> 1, DisplayFunction -> Identity]}]] 1.5
1.5
1
1
0.5
0.5
0
0
-0.5
-0.5 -1
-1 -2 -1
0
1
2
3
-1.5
-3 -2 -1
0
1
2
3
d) The main issue in the construction of the orthopodic locus is to determine at which point of the curve the second tangent starts for a given first tangent. So our goal is to derive an equation hHx1 , x2 L that connects the two points 8x1 , y1 4 x1^2 - 4 x1^4) //
Expand // Factor Out[14]= 16 x12 x22
H15 − 63 x12 + 64 x14 − 63 x22 + 255 x12 x22 − 256 x14 x22 + 64 x24 − 256 x12 x24 + 256 x14 x24 L
We eliminate y1 from the implicit representation of the first tangent. In[15]:= eq2[3] = Resultant[eq1[1], eq1[4], y1] // Factor Out[15]= 4 x12 H4 x2 − 16 x2 x12 + 8 x x13 + 16 x2 x14 − 16 x x15 + 4 x16 − y2 + x12 y2 L
We also eliminate y2 from the implicit representation of the second tangent. In[16]:= eq2[4] = Resultant[eq1[2], eq1[5], y2] // Factor Out[16]= 4 x22 H4 x2 − 16 x2 x22 + 8 x x23 + 16 x2 x24 − 16 x x25 + 4 x26 − y2 + x22 y2 L
Thus, we have to eliminate the variables x1 and x2 to get the implicit representation of the orthopodic locus. We do not carry out the two missing steps here because they take a long time and the result is an expression that is not of interest here. eq2[5] = Resultant[Last[eq2[1]], Last[eq2[3]], x1] results in a polynomial with 175 terms, and the last step Resultant[eq2[5], Last[eq2[4]], x2] yields a polynomial of degree 64 in x and degree 96 in y with 1073 terms. Let us now concentrate on the animation. The equation hHx1 , x2 L = eq2[1] can be explicitly solved with respect to x2 . In[17]:= x2 /. Solve[15 - 63 x1^2 + 64 x1^4 - 63 x2^2 + 255 x1^2 x2^2 -
256 x1^4 x2^2 + 64 x2^4 - 256 x1^2 x2^4 + 256 x1^4 x2^4 == 0, x2]
Solutions
573 i
63 255 x12 2 H64 − 256 x1 2 H64 − 256 x1 + 256 x1 L + 256 x1 L k è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 4 2 129 − 642 x1 + 1025 x14 − 512 x16 y 128 x1 z − z z, 64 − 256 x12 + 256 x14 2 H64 − 256 x12 + 256 x14 L {
j Out[17]= 9− - j j 2 4 − 2 4 +
i 255 x12 128 x14 63 j + − j -j 2 4 − 2 H64 − 256 x12 + 256 x14 L 64 − 256 x12 + 256 x14 k 2 H64 − 256 x1 + 256 x1 L è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! y 129 − 642 x12 + 1025 x14 − 512 x16 z z z, 2 H64 − 256 x12 + 256 x14 L { i 63 255 x12 j + − −- j j 2 + 256 4L 2 H64 − 256 x12 + 256 x14 L 2 H64 − 256 x1 x1 k è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 129 − 642 x12 + 1025 x14 − 512 x16 y 128 x14 z + z z, 64 − 256 x12 + 256 x14 2 H64 − 256 x12 + 256 x14 L {
i 255 x12 128 x14 63 j − + + j 2 H64 − 256 x1 -j 2 + 256 x14 L 2 H64 − 256 x12 + 256 x14 L 64 − 256 x12 + 256 x14 k è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! y 129 − 642 x12 + 1025 x14 − 512 x16 z z z= 2 H64 − 256 x12 + 256 x14 L {
We inspect the four solutions. In[18]:= Show[GraphicsArray[
Plot[Evaluate[#[%]], {x1, -1, 1}, Frame -> True, Axes -> False, DisplayFunction -> Identity]& /@ {Re, Im}]] 1
30 20
0.5
10 0
0
-10 -0.5
-20 -30
-1 -1
-0.5
0
0.5
1
-1
-0.5
0
0.5
1
We see that the four solutions are not real for every -1 § x1 § 1. We find the regions where the first and second solution for x2 are not real with the following. In[19]:= Function[data, Abs[data[[#]]]& /@ {Position[#, Min[#]][[1, 1]],
Position[#, Max[#]][[1, 1]]}&[Abs[N[data]]]][ x1 /. Solve[(63 - 255 x1^2 + 256 x1^4)^2 (129 - 642 x1^2 + 1025 x1^4 - 512 x1^6) == 0, x1]] è!!!!!!!!!!! 1 63 129 1 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% è!!!!!!!!!!! I63 − 129 M , $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + = Out[19]= 9 2 128 128 8
So, we can implement the following solution of the equation hHx1 , x2 L = eq2[1]. In[20]:= x2Roots[x1_] :=
With[{denom = Sqrt[2] Sqrt[64 - 256 x1^2 + 256 x1^4], num1 = Sqrt[129 - 642 x1^2 + 1025 x1^4 - 512 x1^6], num2 = 63 - 255 x1^2 + 256 x1^4}, If[N[Sqrt[63 - Sqrt[129]]/(8 Sqrt[2])] < Abs[x1] < N[Sqrt[63 + Sqrt[129]]/(8 Sqrt[2])], Drop[#, 2], #]&[{-Sqrt[num2 - num1]/denom, Sqrt[num2 - num1]/denom, -Sqrt[num2 + num1]/denom, Sqrt[num2 + num1]/denom}]]
For the actual construction of the two tangents, we need the two y-values corresponding to every x-value. In[21]:= Clear[y];
{y[1][x_], y[2][x_]} = {+Sqrt[4 x^2 - 4 x^4], -Sqrt[4 x^2 - 4 x^4]};
We also need the crossing point of the two tangents originating from x1 , y1 and x2 , y2 and having slope y£1 and y£2 .
Symbolic Computations
574 In[23]:= cp[{x1_, y1_}, {x2_, y2_}, ys1_, ys2_] =
{0, y1} + {x2 ys2 - x1 ys1 + y1 - y2, ys1(x2 ys2 - x1 ys2 + y1 - y2)}/(ys2 - ys1);
So, we can program for the points of the orthopodic locus. In[24]:= orthopodicLocus[x1_] := orthopodicLocus[x1] =
Module[{x2p = x2Roots[x1] // N, ∂ = 10^-6, x2real, snips}, Table[(* y[1] and y[2] *) ysa = ys[x1, y[i][x1]]; (* select perpendicular crossings *) x2real = Select[x2p, Abs[N[(1 + ysa ys[#, y[j][#]])]] < ∂&]; snips = cp[{x1, y[i][x1]}, {#, y[j][#]}, ysa, ys[#, y[j][#]]]& /@ x2real; snips, {i, 2}, {j, 2}]]
This is the original curve. In[25]:= curve = ParametricPlot[{Cos[1t], Sin[2t]}, {t, 0, 2Pi},
PlotStyle -> {{Thickness[0.01], Hue[0]}}, DisplayFunction -> Identity];
This shows the original curve and its orthopodic locus. In[26]:= Module[{a = ArcCos @ N[Sqrt[63 - Sqrt[129]]/(8 Sqrt[2])],
b = ArcCos @ N[Sqrt[63 + Sqrt[129]]/(8 Sqrt[2])], ∂ = 10.^-6, pp = 60}, Show[{curve, (* the orthopodic locus *) Graphics[{#, Map[# {-1, 1}&, #, {-2}]}&[ Map[Line, Transpose[#, {4, 2, 3, 1, 5}], {3}]& /@ {Table[orthopodicLocus[Cos[t]], {t, ∂, b - ∂, (b - 2∂)/pp}], Table[orthopodicLocus[Cos[t]], {t, a + ∂, N[Pi/2 - ∂], N[(Pi/2b - 2∂)]/pp}]}]]}, DisplayFunction -> $DisplayFunction, Axes -> False]]
For the animation, we should also display the tangents. We vary x1 between 1 and -1 and mark the points of the orthopodic locus traversed. In[27]:= orthopodicLocusAndTangents[x1_] := orthopodicLocusAndTangents[x1] =
Module[{x2p = x2Roots[x1] // N, ∂ = 10^-6, x2real, snips}, Table[(* y[1] and y[2] *) ysa = ys[x1, y[i][x1]]; (* select perpendicular crossings *) x2real = Select[x2p, Abs[(1 + ysa ys[#, y[j][#]])] < ∂&]; snips = cp[{x1, y[i][x1]}, {#, y[j][#]}, ysa, ys[#, y[j][#]]]& /@ x2real; {MapThread[Line[{##}]&, {Table[Evaluate[{x1, y[i][x1]}], {Length[snips]}], snips, {#, y[j][#]}& /@ x2real}], Point /@ snips}, {i, 2}, {j, 2}]]
Here are a few configurations for various x1 . In[28]:= Show[GraphicsArray[#]]& /@ Map[
Show[{curve, Graphics[{Thickness[0.002], PointSize[0.015], (* the tangents *) orthopodicLocusAndTangents[#]}]}, Frame -> True, Axes -> False, PlotRange -> {{-2, 2}, {-2, 2}}, AspectRatio -> Automatic, FrameTicks -> None, DisplayFunction -> Identity]&, Partition[Table[N[t], {t, 1/10, 9/10, 1/10}], 3], {2}]
Solutions
575
The animation could now be done via the following. Make Input
(* points of the orthopodic locus already traversed *) rememberPoints[x1_] := Cases[DownValues[orthopodicLocusAndTangents], _Point, {-3}]; orthopodicLocusAnimation[n_] := With[{∂ = 10^-6}, Do[Show[{curve, Graphics[ {Thickness[0.002], PointSize[0.01], (* the current x1 value *) orthopodicLocusAndTangents[N[Cos[t]]], (* already traversed points of the orthopodic locus *) rememberPoints[N[t]]}]}, Frame -> True, Axes -> False, PlotRange -> {{-2, 2}, {-2, 2}}, AspectRatio -> Automatic, FrameTicks -> None, DisplayFunction -> $DisplayFunction], {t, ∂, Pi - ∂, (Pi - 2∂)/n}]]; (* 250 frames give a smooth animation *) orthopodicLocusAnimation[250]
e) This is the implicit representation of the curve under investigation. In[1]:= f[x_, y_] = 4 x^4 - 4 x^2 + y^2;
Because the cissoid is the midpoint of two points on the curve, these two points {x1, y1} and {x2, y2} fulfill the implicit representation. In[2]:= {eq[1] = f[x1, y1], eq[2] = f[x2, y2]} Out[2]= 8−4 x12 + 4 x14 + y12 , −4 x22 + 4 x24 + y22
{{Thickness[0.01], GrayLevel[1/2]}}], (* the cissoid *) ContourPlot[Evaluate[res[[2]]], {x, -1, 1}, {y, -1, 1}, Contours -> {0}, ContourShading -> False, PlotPoints -> 200, ContourStyle -> {Thickness[0.02]}]}], Frame -> True, Axes -> False, PlotRange -> All, AspectRatio -> Automatic] 1 0.5 0 -0.5 -1
-1
-0.5
0
0.5
1
Note that due to the implicit form, points outside of the original curve are also contained in the above representation of the cissoid. For comparison, let us construct the cissoid for the last example explicitly. The first problem is the calculation of all points of the Lissajous curve that go through a given line. To avoid the numerical solution of transcendental equations, we calculate a polynomial equation for the x-values of these points. In[9]:= x1Eq = Resultant[eq[1], dx py + dy x1 - dx y1 - dy px, y1] // Factor Out[9]=
1 Hdx2 − 2 dx dy + dy2 + 4 dx dy x1 − 4 dy2 x1 − 16 dx2 x12 + 4 dy2 x12 + 16 dx2 x14 L 4
Solutions
577
Next, rotating a line through {px, py}, we calculate for each configuration all x-values on the Lissajous curve, all corresponding y-values, and select all points which actually lie on the given line. Then, forming all pairs of different points, we get all lines segments, the midpoints of which form the cissoid. The next input carries out this construction. In[10]:= Show[{lissa, Graphics[{PointSize[0.02],
Table[(* direction of line *) dx = Cos[t]; dy = Sin[t]; MapIndexed[(* only different points *) Drop, (* all point pairs *) Outer[Point[(#1 + #2)/2]&, #, #, 1]]&[ Flatten[(Function[x, Select[{x[[1]], #}& /@ x[[2]], (* select all points on line *) (Abs[# - t] < 10^-5 || Abs[# - N[(t - Pi)]] < 10^-5)&[ (ArcTan @@ (# - {px, py}))]&]] /@ ({#, Cases[(* all y-values *) NRoots[f[#, y] == 0, y], _Real, {-1}]}& /@ (* all x-values *) Cases[NRoots[x1Eq == 0, x1], _Real, {-1}])), 1]], (* a bunch of lines *) {t, N[0], N[Pi], N[Pi]/5555}]}]}, PlotRange -> All, AspectRatio -> Automatic, Frame -> True, Axes -> False] 1 0.5 0 -0.5 -1
-1
-0.5
0
0.5
1
f) We first calculate the implicit form from the parametric representation given, then transform the equation to a list of the letters of the individual characters, and place them along the curve. For the calculation of the implicit form, we rewrite all trigonometric functions of a multiple argument into powers of sinHjL and cosHjL and then call Eliminate with the given equations and the identity cosHjL2 + sinHjL2 = 1. In[1]:= eq = Factor[(Subtract @@ Eliminate[Append[TrigExpand //@
{x == Cos[3ϕ] - Sin[ϕ]/5, y == Sin[2ϕ] + Cos[ϕ]/3}, (* add algebraic relation between Cos and Sin *) Sin[ϕ]^2 + Cos[ϕ]^2 == 1], {Cos[ϕ], Sin[ϕ]}])] == 0 Out[1]= 55919 + 4860 x − 1470875 x2 − 121500 x3 + 1822500 x4 + 846180 y + 902250 x y − 648000 x2 y − 3645000 x3 y + 2779254 y2 + 1714500 x y2 + 1822500 x2 y2 − 4101840 y3 + 3510000 x y3 − 11712600 y4 + 2916000 y5 + 7290000 y6 0
Now, we transform the FullForm of the Mathematica expression eq into a string (for compactness, we eliminate all spaces). In[2]:= string = StringReplace[ToString[FullForm[eq]], " " -> ""] Out[2]= Equal@Plus@55919,Times@4860,xD,Times@−1470875,Power@x,2DD,Times@−121500,Power@
x,3DD,Times@1822500,Power@x,4DD,Times@846180,yD,Times@902250,x,yD,Times@ −648000,Power@x,2D,yD,Times@−3645000,Power@x,3D,yD,Times@2779254,Power@ y,2DD,Times@1714500,x,Power@y,2DD,Times@1822500,Power@x,2D,Power@y,2DD, Times@−4101840,Power@y,3DD,Times@3510000,x,Power@y,3DD,Times@−11712600, Power@y,4DD,Times@2916000,Power@y,5DD,Times@7290000,Power@y,6DDD,0D
To adjust the equation properly, we treat every letter individually. Here are all letters from string. In[3]:= chars = Characters[string];
To have the same spacing between all letters, we now calculate the arc length of the given curve (for later work, we do not use NIntegrate here, but NDSolve, because the resulting InterpolatingFunction will be reused later). In[4]:= sol = NDSolve[{arcLength'[ϕ] == Sqrt[D[Cos[3ϕ] - Sin[ϕ]/5, ϕ]^2 +
D[Sin[2ϕ] + Cos[ϕ]/3, ϕ]^2], arcLength[0] == 0}, arcLength, {ϕ, 0, 2Pi}] Out[4]= 88arcLength → InterpolatingFunction@880., 6.28319 8], {Cos[3#] - Sin[#]/5, Sin[2#] + Cos[#]/3}, {0, 0}, (* their direction *) letterDir[#]]&[ϕTab[[i]]], {i, Length[chars]}]}}], AspectRatio -> Automatic, FrameTicks -> None, Frame -> True, PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}] 59 19, T i m es@ 4 8 6 0,xD ,Tim es@−1 470875 50 ,Power@x,2 DD,Times@−121
es im D,T 0, ,3D Power@x
es@−4
ow 5 er@ us@ y,6 DDD, @Pl 0D Equal
r@y,2DD,Tim ,2D,Powe ower@x @1 500,P 822 1822 mes@ i 500 T , ,Po 2DD wer wer@y, @Pxo ,x, ,4DD ,Ti 500 14 mes @84 618 0,y P D,T 0, ime 000 s@9 729 022 imes@ 5T 5DD,0,x, , y @ r Powe 6000, r@y,4DD,Times@291
er@y,2DD,Ti ,Pow mes 254 @17 779
00 126 117 s@− ime D,T ,3D r@y owe x,P 00, 100 @35 mes ,Ti 3DD @y, wer ,Po 840 101
000,P −648 es@ Tim yD,
,P ow e
r@x,2D,yD,Times@−36 4 5 0 0 0 owe ,Powe r@x, 3D,y D,T ime s@2
g) The polynomial system to be solved in this exercise is relatively complicated. We will use three different approaches to solve it. Let us start and have a look at the region under consideration. In[1]:= poly0[x_, y_] = x^4 + y^4 - 2 x^3 + 2 y - 1 + 2 x; In[2]:= cp = Graphics[ContourPlot[Evaluate[poly0[x, y]], {x, -2, 2}, {y, -2, 1},
PlotPoints -> 60, Contours -> {0}]]; 1 0.5 0 -0.5 -1 -1.5 -2
-2
-1
0
1
2
Solutions
579
After calculating the x-values enclosing the region, we could have also used Plot to get a picture of the region as follows. Make Input
Module[{domain, sol, ∂ = 10^-6}, (* boundaries with respect to x *) domain = Cases[NRoots[poly0[x, Cases[NRoots[Numerator[D[poly0[x, y], y]/D[poly0[x, y], x]] == 0, y], _Real, {-1}][[1]]] == 0, x], _Real, {-1}] + {∂, -∂}; (* get y = y(x) *) sol = Solve[poly0[x, y] == 0, y]; (* form polygons from discretized y(x) curves *) Show[Graphics[Polygon[Join[#1, Reverse[#2]]]& @@ (Plot[Evaluate[sol[[#, 1, 2]]], Evaluate[{x, Sequence @@ domain}, DisplayFunction -> Identity]][[1, 1, 1, 1]]& /@ {3, 4})], AspectRatio -> 1, PlotRange -> {{-2, 2}, {-2, 1}}, Frame -> True]]
To follow the light ray, we must calculate where a given ray hits the boundary of our region and its new direction after the reflection. Taking a ray originating from {x0, y0} and pointing in the direction {dx, dx}, the implicit equation for the x-value of the intersection with the region is given by the following. In[3]:= polyInx[dx_, dy_, x0_, y0_] =
Factor[Resultant[dy x0 + dx y - dx y0 - dy x, poly0[x, y], y]] Out[3]= −dx4 + 2 dx4 x + 2 dx3 dy x − 2 dx4 x3 + dx4 x4 + dy4 x4 − 2 dx3 dy x0 −
4 dy4 x3 x0 + 6 dy4 x2 x02 − 4 dy4 x x03 + dy4 x04 + 2 dx4 y0 + 4 dx dy3 x3 y0 − 12 dx dy3 x2 x0 y0 + 12 dx dy3 x x02 y0 − 4 dx dy3 x03 y0 + 6 dx2 dy2 x2 y02 − 12 dx2 dy2 x x0 y02 + 6 dx2 dy2 x02 y02 + 4 dx3 dy x y03 − 4 dx3 dy x0 y03 + dx4 y04
We can now use this result to straightforwardly implement the following routine that calculates the point of intersection. We first calculate the roots of polyInx[dx, dy, x0, y0]. We select the real ones and calculate the corresponding y-values as the roots of poly0. Again, we select the real solutions. Then we discard the starting point (which is, of course, also a solution), check if the directions of the so-calculated points are the same as the direction of {dx, dx}, and finally, take the nearest point to the starting point. (Due to the fact that the region is concave, there might be more than one intersection in a given direction.) Here is the corresponding Mathematica implementation. In[4]:= nextPoint[{x0_, y0_}, {dx_, dy_}] :=
Module[{s1, s2, s3, s4, s5, ∂ = 10^-7}, (* maybe add here a check if point is on curve and if normal points toward the interior; but we start always inside; so, we do not check this here *) (* all solutions of polyInx *) s1 = Chop[Last /@ List @@ NRoots[polyInx[dx, dy, x0, y0] == 0, x]]; (* discard solutions with imaginary part *) s2 = Union[Re @ Cases[s1, _?((Abs[Im[#]] < ∂)&)], SameTest -> (Abs[#1 - #2] < ∂&)]; (* calculate corresponding y-values and discard them if they have a "nonvanishing" imaginary part *) s3 = Flatten[Function[xv, {xv, #}& /@ Union[Re @ Cases[Last /@ List @@ NRoots[poly0[xv, y] == 0, y], _?((Abs[Im[#]] < ∂)&)], SameTest -> (Abs[#1 - #2] < ∂&)]] /@ s2, 1]; (* discard the starting point {x0, y0} *) s4 = Delete[s3, Position[#, Min[#]]&[(#.#&[{x0, y0} - #])& /@ s3][[1, 1]]]; (* which solutions are on the ray in the specified direction; ∂ is chosen somewhat arbitrary *) s5 = Select[s4, Chop[Abs[(#[[1]] - x0) dy - (#[[2]] - y0)dx], ∂] === 0&]; If[s5 === {}, s5 = {s4[[Position[#, Min[#]]&[ Abs[(#[[1]] - x0) dy - (#[[2]] - y0)dx]& /@ s4][[1, 1]]]]}]; (* choose the nearest point (if boundary is concave, s5 may have more than one element); for the general case this test needs refinement! *) If[Length[s5] === 1, s5[[1]], s5[[Position[#, Min[#]]&[#.#&[{x0, y0} - #]& /@ s5][[1, 1]]]]]]
Symbolic Computations
580
For calculating the new direction of the light ray after it has undergone one reflection, we need the normal to the boundary of our region. In[5]:= normal[{x_, y_}] = -{D[poly0[x, y], x], D[poly0[x, y], y]};
Now, we have everything together to implement newPointAndDirection , that calculates the point of intersection of a ray originating from {x0, y0} and pointing in the direction {dx, dx} and its direction after reflection. In[6]:= newPointAndDirection[{{x0_, y0_}, {dx_, dy_}}] :=
Module[{p1, dir1, n}, (* the next point *) p1 = nextPoint[{x0, y0}, {dx, dy}]; n = #/Sqrt[#.#]&[normal[p1]]; (* the reflection law *) dir1 = #/Sqrt[#.#]&[-{dx, dy} + 2 n({dx, dy}.n)]; {p1, dir1}]
Let us have a look at some rays that are reflected multiple times. (To see better what happens after multiple reflections, we use rays which all originate from {x0, y0}, but start in the direction {dx, dx} + {0, r div}, -rays § r § rays.) In[7]:= reflectionPicture[{x0_, y0_}, {dx_, dy_},
rays_, reflections_, div_, opts___Rule] Show[{cp, Graphics[{Thickness[0.004], (* a small arrow at the starting point *) {GrayLevel[0.2], Function[{d, n}, {Line[{{x0, y0} - 0.1 d, {x0, y0} - 0.35 Polygon[{{x0, y0} - 0.1 d, {x0, y0} - 0.2 d - 0.03 n, {x0, y0} - 0.2 d + 0.03 n}]}][#/Sqrt[#.#]&[{dx, Reverse[#/Sqrt[#.#]&[{dx, dy}]] {-1, 1}]}, Transpose[Table[(* the path *) {Hue[(r + rays) 0.78/(2 rays + 1)], Line[#]}& /@ (Partition[First /@ NestList[(* construct the path *) newPointAndDirection, {{x0, y0}, {dx, dy} + {0, r div}}, reflections], 2, {r, -rays, rays}]]}]}, opts, PlotRange -> All, AspectRatio -> Automatic, Frame -> False, Axes -> False]
:=
d}], dy}],
1]),
Here are three examples (the little arrow indicates the starting point and the starting direction of the light ray). The spreading of the ray after multiple reflections is clearly visible. In[8]:= Show[GraphicsArray[
Module[{x0, y0, dp = DisplayFunction -> Identity}, {x0 = 0; y0 = Min[Cases[NRoots[poly0[x0, y] == 0, y], _?(Im[#] == 0&), {-1}]]; reflectionPicture[{x0, y0}, {1, 1}, 12, 20, 10^-7, dp], x0 = -0.55; y0 = Max[Cases[NRoots[poly0[x0, y] == 0, y], _?(Im[#] == 0&), {-1}]]; reflectionPicture[{x0, y0}, {1, -0.39}, 12, 17, 10^-6, dp], x0 = 1.7; y0 = Min[Cases[NRoots[poly0[x0, y] == 0, y], _?(Im[#] == 0&), {-1}]]; reflectionPicture[{x0, y0}, {-1, 0.11}, 12, 12, 10^-6, dp]}]]]
To find some stationary light rays, that means light rays that are each reflected into itself, we need to find points P1 and P2 êêêêêêêê on the boundary of our region, so that their normal aims in the opposite direction and that the direction given by P1 P2 also
Solutions
581
points in the same direction. êêêêêêêê We start by forming an equation that expresses that the normal in the point P1 lies on the same line as P1 P2 . In[9]:= r1 = Resultant[Sequence @@
Apply[Subtract, Thread[normal[{x1, y1}] == a1 ({x2, y2} - {x1, y1})], {1}], a1] Out[9]= Hx1 − x2L H−2 − 4 y13 L − H−2 + 6 x12 − 4 x13 L Hy1 − y2L
êêêêêêêê The following equation expresses that the normal in the point P2 lies on the same line as P1 P2 . In[10]:= r2 = Resultant[Sequence @@
Apply[Subtract, Thread[normal[{x2, y2}] == a2({x2, y2} - {x1, y1})], {1}], a2] Out[10]= −H−2 + 6 x22 − 4 x23 L Hy1 − y2L + Hx1 − x2L H−2 − 4 y23 L
These two equations, together with the equations for the boundary of our region applied to P1 and P2 , form four equations for the four unknowns x1, x2, y1, and y2. In[11]:= eqs[{x1_, x2_, y1_, y2_}] =
{r1, r2, poly0[x1, y1], poly0[x2, y2]} // Expand Out[11]= 8−2 x1 + 2 x2 + 2 y1 − 6 x12 y1 + 4 x13 y1 − 4 x1 y13 + 4 x2 y13 − 2 y2 + 6 x12 y2 − 4 x13 y2,
−2 x1 + 2 x2 + 2 y1 − 6 x22 y1 + 4 x23 y1 − 2 y2 + 6 x22 y2 − 4 x23 y2 − 4 x1 y23 + 4 x2 y23 , −1 + 2 x1 − 2 x13 + x14 + 2 y1 + y14 , −1 + 2 x2 − 2 x23 + x24 + 2 y2 + y24
-((1 - 3 x2^2 + 2 x2^3)/(1 + 2 y2^3))} //. {y1[x1] -> y1, y2[x2] -> y2})] Out[14]= 82 x1 − 2 x2 − 2 y1 + 6 x12 y1 − 4 x13 y1 + 4 x1 y13 − 4 x2 y13 + 2 y2 − 6 x12 y2 + 4 x13 y2, −2 x1 + 2 x2 + 2 y1 − 6 x22 y1 + 4 x23 y1 − 2 y2 + 6 x22 y2 − 4 x23 y2 − 4 x1 y23 + 4 x2 y23
0.01, AppendTo[rayBag, #], Null]]&[ CheckAbort[ FindRoot[Evaluate[# == 0& /@ eqs[{x1, x2, y1, y2}]], {x1, Random[Real, {-1, 1}]}, {x2, Random[Real, {-1, 1}]},
Symbolic Computations
582 {y1, Random[Real, {-1, 1}]}, {y2, Random[Real, {-1, 1}]}, MaxIterations -> 50], Null]]] In[19]:= $MessagePrePrint = Short;
Here are the so-generated stationary rays. In[20]:= rayBag Out[20]= 88x1 → 1.74831, x2 → −1.08927, y1 → −0.89113, y2 → −0.423101 Identity, ContourStyle -> {{Thickness[0.008], Hue[0]}}]]; In[20]:= Show[GraphicsArray[Function[xys,
Show[{(* supercircle and its wave caustics *) superCircleGraphics, causticsGraphics, (* normals through point {x,y} *) Graphics[{Thickness[0.002], GrayLevel[1/2], Function[xy, Line[{xy, #}]& /@ ξηPoints[xy]] /@ xys}]}, AspectRatio -> Automatic, DisplayFunction -> Identity]] /@ (* two points {x, y}} *) {{{1/6, 1/5}}, {{0, Root[(-128 + 6429 #^4 + 552 #^8 + 16 #^12)& , 2]}}}]]
Now, we calculate the intersection points of the normals for a dense set of 8x, y {{0, 1}, {0, 1}}, PlotRange -> All]
Solutions
593 1 0.8 0.6 0.4 0.2 0
0
0.2
0.4
0.6
0.8
1
For the above expression for k Hx, yL, we can easily calculate the expressions †a£ HjL y + b£ HjL x + c£ HjL§ and s£ HjL. In[23]:= δDen[{x_, y_}, ϕ_] =
Abs[Simplify[D[normalLine[{R[ϕ] Cos[ϕ], R[ϕ] Sin[ϕ]}, {x, y}], ϕ]]] 1 HCos@ϕD4 + Sin@ϕD4 L
Out[23]= AbsA 2
1ê4
ICos@ϕD6 − 3 Cos@ϕD4 Sin@ϕD2 + Sin@ϕD6 + 3 x Cos@ϕD3 Sin@ϕD2 HCos@ϕD4 + Sin@ϕD4 L 2
3
4
4 1ê4
3 Cos@ϕD Sin@ϕD ISin@ϕD − y HCos@ϕD + Sin@ϕD L
−
MME
In[24]:= s[ϕ_] = Sqrt[D[R[ϕ] Cos[ϕ], ϕ]^2 + D[R[ϕ] Sin[ϕ], ϕ]^2] // Simplify
5 + 3 Cos@4 ϕD H3 + Cos@4 ϕDL
% Out[24]= 2 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5ê2
Now, we have everything together to generate the animation. ΨCF is a compiled function that calculates the sum, for a given value of k, a point xy, and the intersection points xhs of the normals with . In[25]:= CF = Compile[{k, {xy, _Real, 1}, {ξηs, _Real, 2}},
Module[{x = xy[[1]], y = xy[[2]], ξ, η, ϕ, l, Ψ = 0.I, ψ}, (* sum over all normals *) Sum[{ξ, η} = ξηs[[j]]; ϕ = ArcTan[ξ, η]; l = Sqrt[(x - ξ)^2 + (y - η)^2]; #1/#2 Exp[I k l], {j, Length[ξηs]}]]]&[s[ϕ], δDen[{x, y}, ϕ]];
The function fullMatrix uses the reflection symmetry of to generate an array of k Hx, yL-values for all points inside (meaning it adds the points from the second, third, and fourth quadrants). In[26]:= fullMatrix[m_] := Join[Reverse[Rest[#]], #]& /@ Join[Reverse[Rest[m]], m]
Here is finally the resulting animation. In[27]:= (* show sum of ray contributions, supercircle, and caustics *)
superCircleDataGraphics[m_] := Show[{ListDensityPlot[fullMatrix[m], Mesh -> False, MeshRange -> L {{-1, 1}, {-1, 1}}, PlotRange -> Automatic, FrameTicks -> None, DisplayFunction -> Identity], superCircleGraphics, causticsGraphics}, DisplayFunction -> $DisplayFunction, Frame -> False] In[29]:= animationGraphics[k_, _] :=
superCircleDataGraphics[ @ Apply[CF[k, ##]&, N[ξηData], {2}]] In[30]:= Show[GraphicsArray[Block[{$DisplayFunction = Identity},
animationGraphics[#, Log[Abs[Re[#]] + 1]&]& /@ #]]]& /@ (* selected frames *) {{0, 10, 30}, {60, 90, 120}}
Symbolic Computations
594
Make Input
Do[animationGraphics[k, Log[Abs[Re[#]] + 1]&], {k, 1, 150}]
è Now, we will calculate and visualize k Hx, yL. This time we have to carry out a numerical integration for each point 8x, y 16, Method -> Trapezoidal], {x, 0, y, 1/pp}], {y, 0, L, 1/pp}]; (* mirror to obtain remaining values for first quadrant *) m = Table[0.I, {pp}, {pp}]; Do[m[[i, j]] = dataT[[i, j]]; m[[j, i]] = dataT[[i, j]], {i, pp}, {j, i}]; (* add supercircle and caustics *) superCircleDataGraphics[ @ m]]
è The next graphics show k Hx, yL and k Hx, yL, the absolute value and the argument for two k-values. No direct relation è between the two graphic exists. k Hx, yL has caustics (we display the logarithm), while k Hx, yL has no singularities. In[33]:= (* absolute value for k == 120; use logarithmic scale for *)
Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {animationGraphics[120, Log[Abs[#] + 1]&], animationGraphicsT[120, Abs]}]]]
In[35]:= (* argument value for k == 30 *)
Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {animationGraphics[30, Arg], animationGraphicsT[30, Arg]}]]]
Solutions
595
26. Change of Variables in a Differential Equation, Functional Equation a) We use the chain rule for rewriting the quantities y'[x] and y''[x] as functions of u'[x1] and u''[x1]: y'[x] == D[y[x], x] == D[u[x1], x] == D[x1, x] D[u[x1], x1] == y''[x] u'[x1] y''[x] == D[y'[x], x] == D[y''[x] u'[x1], x] == D[y''[x], x] u'[x1] + y''[x] D[u'[x1], x] == y'''[x] u'[x1] + D[x1, x] D[u'[x1], x1] == y'''[x] u'[x1] + y''[x]^2 u''[x1] So, we arrive at the following set of equations. (Be aware that we added the differentiated form of the original equation to get an expression for y'''[x].) In[1]:= eqs = {x1 == y'[x],
u[x1] == y[x], y'[x] == y''[x] u'[x1], y''[x] == y'''[x] u'[x1] + y''[x]^2 u''[x1], y''[x] == x^3 + y[x]^3 + y'[x]^3, y'''[x] == 3 x^2 + 3 y[x]^2 y'[x] + 3 y'[x]^2 y''[x]} Out[1]= 8x1 y @xD, u@x1D y@xD, y @xD u @x1D y @xD, y @xD u @x1D y @xD2 + u @x1D yH3L @xD, y @xD x3 + y@xD3 + y @xD3 , yH3L @xD 3 x2 + 3 y@xD2 y @xD + 3 y @xD2 y @xD
y /. y'[x] -> ys /. y''[x] -> yss /. y'''[x] -> ysss /. u[x1] -> u /. u'[x1] -> us /. u''[x1] -> uss, {1}] Out[2]= 8x1 − ys, u − y, ys − us yss, yss − uss yss2 − us ysss, −x3 − y3 − ys3 + yss, −3 x2 − 3 y2 ys − 3 ys2 yss + ysss< In[3]:= gb = GroebnerBasis[eqs1, {x1, u, us, uss}, {x, y, ys, yss, ysss},
MonomialOrder -> EliminationOrder][[1]] Out[3]= 27 u6 us9 − 54 u3 us8 x1 + 27 us7 x12 − us3 x13 + 9 u2 us5 x13 − 27 u4 us7 x13 + 54 u3 us9 x13 +
27 u6 us9 x13 − 54 us8 x14 + 3 us2 uss x14 − 18 u2 us4 uss x14 + 27 u4 us6 uss x14 + 9 us4 x15 − 54 u2 us6 x15 + 81 u4 us8 x15 − 3 us uss2 x15 + 9 u2 us3 uss2 x15 + 27 us9 x16 − 18 us3 uss x16 + 54 u2 us5 uss x16 + uss3 x16 − 27 us5 x17 + 81 u2 us7 x17 + 9 us2 uss2 x17 + 27 us4 uss x18 + 27 us6 x19
In[4]:= newOde = gb /. u -> u[x1] /. us -> u'[x1] /. uss -> u''[x1] Out[4]= −x13 u @x1D3 + 9 x15 u @x1D4 − 27 x17 u @x1D5 + 9 x13 u@x1D2 u @x1D5 + 27 x19 u @x1D6 −
54 x15 u@x1D2 u @x1D6 + 27 x12 u @x1D7 + 81 x17 u@x1D2 u @x1D7 − 27 x13 u@x1D4 u @x1D7 − 54 x14 u @x1D8 − 54 x1 u@x1D3 u @x1D8 + 81 x15 u@x1D4 u @x1D8 + 27 x16 u @x1D9 + 54 x13 u@x1D3 u @x1D9 + 27 u@x1D6 u @x1D9 + 27 x13 u@x1D6 u @x1D9 + 3 x14 u @x1D2 u @x1D − 18 x16 u @x1D3 u @x1D + 27 x18 u @x1D4 u @x1D − 18 x14 u@x1D2 u @x1D4 u @x1D + 54 x16 u@x1D2 u @x1D5 u @x1D + 27 x14 u@x1D4 u @x1D6 u @x1D − 3 x15 u @x1D u @x1D2 + 9 x17 u @x1D2 u @x1D2 + 9 x15 u@x1D2 u @x1D3 u @x1D2 + x16 u @x1D3
Symbolic Computations
596
Now let us calculate the series solution for u[x1]. Because we do not know the general form of the series terms of u[x1], we calculate the series for y[x], which is a pure power series. Then we convert this series into a series for u[x1]. Here, the first 13 terms of the series for y[x] are calculated. In[5]:= cBag = {};
Do[(* substitute already-calculated terms *) y[x_] = 0 + 0 x + Sum[c[i] x^i, {i, 2, n}] + O[x]^(n + 1) /. cBag; (* plug in y[x] in the differential equation *) odeRest = y''[x] - (x^3 + y[x]^3 + y'[x]^3); (* the rest must vanish *) mustBeZero = SeriesCoefficient[odeRest, n - 2]; (* solve for the next coefficient c[n] *) sol = Solve[mustBeZero == 0, c[n]][[1, 1]]; AppendTo[cBag, sol], {n, 2, 50}] In[7]:= seriesSolutionY = 0 + 0 x + Sum[c[i] x^i, {i, 2, 50}] +
Out[7]=
O[x]^(51 + 1) /. cBag x5 x14 x17 3 x23 393 x26 3 x29 + + + + + + 20 11648 2176000 6735872 121139200000 706764800000 58948767 x35 692109 x38 183 x32 + + + 60428386304 2042397220864000000 9265501306880000000 552680721620117 x41 2792961751271 x44 + + 23619576128064716800000000 9966584725603195289600000 47 2383434617247962925203 x50 3669093790017 x + + O@xD52 3398294084344532172800000000 12224197559809812306329600000000000
Substituting the series into the differential equation for y[x] verifies that the solution is correct. In[8]:= y1''[x] - (x^3 + y1[x]^3 + y1'[x]^3) /.
y1 -> Function[x, Evaluate[seriesSolutionY]] Out[8]= O@xD50
Now, we calculate x as a function of x1 by inverting the relation x1 = y[x]. In[9]:= xOfx1 = InverseSeries[D[seriesSolutionY, x], x1] Out[9]=
97 x119ê4 1489 x111ê2 x15ê2 x113ê4 è!!!!! 2 x11ê4 − − ! + ! + + è!!!! è!!!! 26 4550000 1000 2 14872 2 81 x17 2206812117 x131ê4 299578749 x117ê2 2971 x125ê4 ! − − ! − + 136214 74410700000000 476000000 è!!!! 2 14246632400000 è!!!! 2 933275794381453793 x137ê4 6544294647507 x110 è!!!! ! + + 216019906252150000 10056210063099200000000 2 348018511894286811 x143ê4 57698366608485292979397 x123ê2 ! − + O@x1D12 è!!!! 15761485195982805479200000000 110327345968840000000000 2
Substituting this series into the series solution for y[x] gives the series solution for u[x1] we are looking for. In[10]:= seriesSolutionU = (seriesSolutionY /. x -> xOfx1) // Simplify Out[10]=
1 è!!!!! 1843 x123ê4 5 x17ê2 13 x117ê4 2 x15ê4 − − ! + ! + è!!!! è!!!! 5 182 17000 2 342056 2 2971 x129ê4 567 x18 68411175627 x135ê4 16379 x113ê2 + ! − − ! − 59150000 1089712 552160000 è!!!! 2 498632134000000 è!!!! 2 6544294647507 x111 34531204392113790341 x141ê4 299578749 x119ê2 + ! + + è!!!! 83164900000000 237621896877365000 412304612587067200000000 2 1327062431995161738526131 x125ê2 14964796011454332873 x147ê4 ! − + O@x1D13 394037129899570136980000000000 2 5185385260535480000000000 è!!!!
Here is a quick check for the correctness of seriesSolutionU. In[11]:= newOde /. u -> Function[x1, Evaluate[seriesSolutionU]] Out[11]= O@x1D31ê2
Now, we see the structure of the series; it is a series in x1^(1/4). So, we could equivalently have done the following.
Solutions
597
Make Input
cBag = {}; Do[(* substitute already calculated terms *) u[x1_] = Sqrt[2]/5 x1^(5/4) + Sum[c[i/4] x1^(i/4), {i, 6, n}] + O[x1]^((n + 1)/4) /. cBag; (* plug in y[x] in the differential equation *) odeRest = newOde; (* the rest must vanish *) mustBeZero = odeRest[[3, 1]]; (* solve for the next coefficient c[n] *) sol = Solve[mustBeZero == 0, c[n/4]][[1, 1]]; AppendTo[cBag, sol], {n, 6, 60}]
Here is a plot of the series solution. Plotting each partial sum of the series solution gives a rough idea about the range where the series solution is correct. This is done in the right picture. In[12]:= seriesSolutionU1 = Normal[seriesSolutionU]; In[13]:= Show[GraphicsArray[
Block[{$DisplayFunction = Identity}, {Plot[Evaluate[seriesSolutionU1], {x1, 0, 3}], Plot[Evaluate[Rest[FoldList[Plus, 0, List @@ seriesSolutionU1]]], {x1, 0, 3}, PlotStyle -> Table[{Thickness[0.002], Hue[i/18]}, {i, 13}]]}]]] 4
1.25
3
0.75
1 0.5
2
0.25
1
-0.25 0.5
1
1.5
2
2.5
3
0.5
1
1.5
2
2.5
3
-0.5
Now let us compare the series solution with the numerical solution for u[x1]. We solve newOde with respect to u''[x]. In[14]:= s1 = (Solve[newOde == 0, u''[x1]] // Simplify) /.
u[x1] -> u /. u'[x1] -> us 1ê3
us x15 − 3 u2 us3 x15 − 3 us2 x17 + 3 I−us7 x112 Hx1 − us Hu3 + x13 LL2 M Out[14]= 99u @x1D → =, x16 1ê3 è!!!!! 5 2 3 5 2 7 7 12 2 us x1 − 6 u us x1 − 6 us x1 + 3 H + 3 L I−us x1 Hx1 − us Hu3 + x13 LL2 M =, 9u @x1D → 2 x16 1ê3 è!!!!! −2 us x15 + 6 u2 us3 x15 + 6 us2 x17 + 3 H1 + 3 L I−us7 x112 Hx1 − us Hu3 + x13 LL2 M 9u @x1D → − == 6 2 x1
It turns out that the second solution is the one that corresponds to the above series solution. We now use NDSolve to solve the resulting differential equation. We cannot start with the numerical solution at x==0 because the right-hand side does not evaluate to a number. Instead, we use our above series solution to start at a small distance away from the origin.) In[15]:= ∂ = 10^-2; (* start away from the origin *)
nsol = NDSolve[(* the differential equation *) {u''[x1] == 1/(2 x1^6) * (2 x1^5 u'[x1] - 6 x1^7 u'[x1]^2 6 x1^5 u[x1]^2 u'[x1]^3 - 3 (-x1^12 u'[x1]^7 (x1 - (x1^3 + u[x1]^3) u'[x1])^2)^(1/3) + 3 I Sqrt[3] (-x1^12 u'[x1]^7 * (x1 - (x1^3 + u[x1]^3) u'[x1])^2)^(1/3)), (* initial values from series solution *) u[∂] == seriesSolutionU1 /. x1 -> ∂, u'[∂] == D[seriesSolutionU1, x1] /. x1 -> ∂}, u[x1], {x1, ∂, 3}, MaxSteps -> 10000, WorkingPrecision -> 20, PrecisionGoal -> 15, AccuracyGoal -> 12];
Symbolic Computations
598
Here, the numerically calculated solution shown (we use Re because due to numerical inaccuracies, we got a small imaginary part from extracting the cube root). The right plot shows the difference of the partial sums of the above-calculated series solution to the numerical solution. In[17]:= Show[GraphicsArray[
Block[{$DisplayFunction = Identity}, {Plot[Evaluate[Re[u[x1]] /. nsol], {x1, ∂, 3}, PlotRange -> All], Plot[Evaluate[Re[u[x1] /. nsol[[1]]] - (* list of partial sums *) Rest[FoldList[Plus, 0, List @@ seriesSolutionU1]]], {x1, ∂, 3}, PlotRange -> All, PlotStyle -> Table[{Thickness[0.002], Hue[i/18]}, {i, 13}]]}]]] 0.6 2
0.5 0.4
0.5
0.3
1
1.5
2
2.5
3
-2
0.2
-4
0.1
-6 0.5
1
1.5
2
2.5
3
Because for x < 2 the difference between the series solution and the numerical solution is quite small, let us look at the logarithm of the difference. In[18]:= Plot[Evaluate[Log[10, Abs[Re[u[x1] /. nsol[[1]]] -
(* list of partial sums *) Rest[FoldList[Plus, 0, List @@ seriesSolutionU1]]]]], {x1, ∂, 3}, PlotRange -> All, PlotStyle -> Table[{Thickness[0.002], Hue[i/18]}, {i, 13}]]
-2.5
0.5
1
1.5
2
2.5
3
-5 -7.5 -10 -12.5 -15
The large cusps in the above curve are due to the different signs of the last term of the partial sums. b) Because †q§ > 1, it is straightforward to use the functional equation to iteratively make the argument smaller. In[1]:= fContinued[q_, z_] := (q/2 (fContinued[q, z/q]^2 - 1) + 1) /; Abs[z] > ε
For a small enough argument z, we will use the first few terms of the series of fq HzL. Using a generic ansatz of the form fq HzL = c0 HqL + c1 HqL z + c2 HqL z2 + ∫, it is straightforward to calculate as many series terms as wanted. Here we calculate the first four. In[2]:= eqs = ((f[q x] - (2 - q + q f[x]^2)/2) /.
q 2
f[x_] :> Sum[c[k] x^k, {k, 0, 4}]) + O[x]^5 1 2
Out[2]= J−1 + + c@0D − q c@0D2 N + Hq c@1D − q c@0D c@1DL x +
1 J− q c@1D2 + q2 c@2D − q c@0D c@2DN x2 + H−q c@1D c@2D + q3 c@3D − q c@0D c@3DL x3 + 2 1 J− q c@2D2 − q c@1D c@3D + q4 c@4D − q c@0D c@4DN x4 + O@xD5 2
Inspecting the equations shows that, for generic q, we must have c0 HqL = 1 and without loss of generality, we choose c1 HqL = 1. In[3]:= cl = CoefficientList[eqs, x] // Factor
Solutions
599 1 2
1 2
Out[3]= 9− H−1 + c@0DL H−2 + q + q c@0DL, −q H−1 + c@0DL c@1D, q H−c@1D2 + 2 q c@2D − 2 c@0D c@2DL,
1 q H−c@1D c@2D + q2 c@3D − c@0D c@3DL, q H−c@2D2 − 2 c@1D c@3D + 2 q3 c@4D − 2 c@0D c@4DL= 2 In[4]:= sol = Solve[# == 0& /@ (cl /. {c[0] -> 1, c[1] -> 1}),
{c[2], c[3], c[4]}] // Simplify 1 5+q 2 H−1 + qL H1 + qL 8 H−1 + qL H1 + 2 q + 2 q + q L
1 2 H−1 + qL
Out[4]= 99c@3D → , c@2D → == 2 , c@4D → 3 2 3 In[5]:= fSeries[q_, z_] = 1 + z + Sum[c[k] z^k, {k, 2, 4}] /. sol[[1]]
z2 2 H−1 + qL
z3 2 H−1 + qL H1 + qL
H5 + qL z4 8 H−1 + qL H1 + 2 q + 2 q + q L
Out[5]= 1 + z + + 2 + 3 2 3 In[6]:= fContinued[q_, z_] := fSeries[q, z] /; Abs[z] ∂, ζ = ζ/a; c++]; Nest[(a/2 (#^2 - 1) + 1)&, 1 + ζ + ζ^2/(2(a - 1)) + ζ^3/(2(a - 1)^2(a + 1)) + ζ^4 (5 + a)/(8(a - 1)^3(1 + a)(a^2 + a + 1)), c]]]; In[9]:= (* check if compilation was successful *) Union[Head /@ Flatten[cf[[4]]]] Out[10]= 8Integer, Real
{0}, DisplayFunction -> Identity]}, Show[{ListContourPlot[Im[data], opts1], ListContourPlot[Re[data], opts1, ContourShading -> False, ContourStyle -> {Hue[0]}]}, opts, Frame -> False]] In[12]:= With[{o = 16, L = 25, pp = 200},
Show[GraphicsArray[#]]& /@ Partition[ Table[graphic[{ϕ}, L, pp, DisplayFunction -> Identity], {ϕ, 0, 2Pi(1 - 1/o), 2Pi/o}], 4]]
Symbolic Computations
600
Here is the corresponding animation. Make Input
With[{o = 128, L = 25, pp = 240}, Do[graphic[{ϕ}, L, pp, DisplayFunction -> $DisplayFunction], {ϕ, 0, 2Pi(1 - 1/o), 2Pi/o}]]
For some theoretical considerations of related functional equations, see [1526]. 27. Discriminant Surface, Multivalued Surface, 27 Lines on the Clebsch Surface a) Here, the implicit definition is implemented. In[1]:= disc = 256 z^3 + 128 x^2 z^2 + 16 x^4 z - 144 x z y^2 - 4 x^3 y^2 + 27 y^4;
This determines the lower values for the z-coordinate for the picture. (This can be easily verified with the next picture.) In[2]:= {#, N[#]}&[Solve[disc == 0 /. {x -> 2, y -> 3/2}, z]]
5 1 1 è!!!!!!!! è!!!!!!!! 13 M=, 9z → I−37 + 13 13 M==, 16 32 32 88z → 0.3125 True, AxesLabel -> {x, y, z}]
Solutions
601 1
y 0 -1 0 z-1 -2 -1
0
1
x
2
Now, we see the problem. This surface has some sharp edges, and due to the regularly spaced tensor product grid used by ContourPlot3D, the sharp edges cannot be modeled with high quality. Some of the partial derivatives must vanish at the sharp edges. We can use this fact to get a parametric representation 8x, yHxL, zHxL< of the sharp edges. In[5]:= Solve[{D[disc, y] == 0, D[disc, z] == 0, disc == 0}, {y, z}]
x2 4
x2 12
2 3
2 3
x3ê2 =, Out[5]= 99z → − , y → 0=, 9z → , y → − $%%%%%%%% 2 2 2 2 x2 2 x2 2 x2 % x3ê2 =, 9z → , y → $%%%%%%% % x3ê2 =, 9z → , y → $%%%%%%% % x3ê2 == 9z → , y → − $%%%%%%% 3 3 3 12 3 12 3 12 3
Here is the above picture together with the parametrized edges. In[6]:= Show[{%%, Graphics3D[{
{Thickness[0.02], (* the sharp edges *) Line /@ { Table[{x, -(2x/3)^(3/2), x^2/12}, {x, 0, 2, 0.01}], Table[{x, +(2x/3)^(3/2), x^2/12}, {x, 0, 2, 0.01}], Table[{x, 0, -x^2/4}, {x, 0, 2, 0.01}]}}}]}, PlotRange -> All, Axes -> True] 1
y 0 -1 0 z-1 -2 -1
0 x
1
2
To get a better resolution of the sharp edges, we calculate all parts of the surface bounded by these edges separately. From the above crude picture (and as well from the equation), we see that z = zHx, yL is in general a three-valued function, and by sorting the three real roots of disc == 0, we get all parts of the surface separately. prePoints are the x,y-coordinates of the points used to calculate the corresponding z-values numerically. In[7]:= pp = 12;
prePoints = Table[{x, i/pp 2/3 Sqrt[2/3] x^(3/2)}, {x, 0, 2, 2/pp}, {i, 0, pp}] // N;
This is the grid formed by these x,y-coordinates. (Because of symmetry, we calculate only points with y > 0.) In[9]:= Show[Graphics[{Line /@ prePoints, Line /@ Transpose[prePoints]}],
AxesLabel -> {"x", "y"}, Axes -> True]
Symbolic Computations
602 y 1.5 1.25 1 0.75 0.5 0.25 0.5
1
1.5
2
x
We calculate and sort the roots zHx, yL. In[10]:= roots = Map[Sort[List @@ (Last (* the last is of interest *) /@
NRoots[(* the polynomial *) disc == 0 /. Apply[Rule, Transpose[{{x, y}, #}], {1}], z])]&, prePoints, {2}];
It gives the following two parts of the surface, which are bounded by the sharp edges. In[11]:= {s2, s3} = Function[p, Map[#[[p]]&, roots, {2}]] /@ {2, 3};
{f2, f3} = MapThread[Append, {prePoints, #}, 2]& /@ {s2, s3};
For the graphical visualization, we again use ListSurfacePlot3D from the package Graphics`Graphics3D`. In[13]:= Needs["Graphics`Graphics3D`"] In[14]:= pic1 = Show[ListSurfacePlot3D[#, DisplayFunction -> Identity]& /@
{f2, f3}, DisplayFunction -> $DisplayFunction, PlotRange -> All, Axes -> True] 1
0.5
1.5
0 0 -0.5 -1 0
0.5
1
1.5
2
The missing third part of the surface is now easily calculated and displayed. In[15]:= f1 = Table[{ξ, η, If[η === 0 && ξ ξ, y -> η}, z]], _Real]]]}, {ξ, -1, 2, 2/pp}, {η, 0, 3/2, (3/2)/pp}] /. {0, 0, Infinity} -> {0, 0, 0}; In[16]:= pic2 = ListSurfacePlot3D[f1, PlotRange -> All, Axes -> True]
0
0.5
1
1.5 -1
0
1
2 0 -1 -2 -
After mirroring the surface constructed so far to get the second half, we finally have the following picture, which is much better than the earlier ContourPlot3D. In[17]:= Show[Graphics3D[{(* mirror on x,z-plane *)
pic1[[1]], Map[{1, -1, 1}#&, pic1[[1]], {-2}],
Solutions
603 pic2[[1]], Map[{1, -1, 1}#&, pic2[[1]], {-2}]}], PlotRange -> All, ViewPoint -> {1.8, -2.2, 2.2}, Boxed -> False]
b) To get an impression of the form of the surface under consideration, let us use ContourPlot3D for a first sketch. (We define the variable pi as the numerical value of Pi, which we will use very often in the following.) In[1]:= Needs["Graphics`ContourPlot3D`"]
pi = N[Pi]; In[3]:= ContourPlot3D[Sin[x] Cos[y] + Sin[y] Cos[z] + Sin[z] Cos[x],
{x, 0, 2pi}, {y, 0, 2pi}, {z, 0, 2pi}, Axes -> True, PlotPoints -> 18, MaxRecursion -> 0] 4
2
6
0 6 4 2 0 0
2
4
6
This is the implicit form of the surface. In[4]:= F[x_, y_, z_] = Sin[x] Cos[y] + Sin[y] Cos[z] + Sin[z] Cos[x];
To avoid the use of ContourPlot3D for the generation of the picture, we need a parametric description of the surface (at least locally). The x, y, and z appear in a symmetrical way in F; so, we pick z as the dependent variable and we try to construct z = zHx, yL. We have four different solutions for z. In[5]:= Solve[F[x, y, z] == 0, z] // Simplify
Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… 1 Out[5]= 99z → −ArcCosA− ICos@yD Sin@xD Sin@yD + Cos@xD2 + Sin@yD2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Cos@xD Csc@yD Sin@yD2 HCos@xD2 − Cos@yD2 Sin@xD2 + Sin@yD2 L ME=, 1 9z → ArcCosA− ICos@yD Sin@xD Sin@yD + Cos@xD2 + Sin@yD2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Cos@xD Csc@yD Sin@yD2 HCos@xD2 − Cos@yD2 Sin@xD2 + Sin@yD2 L ME=, 1 9z → −ArcCosA I−Cos@yD Sin@xD Sin@yD + Cos@xD2 + Sin@yD2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Cos@xD Csc@yD Sin@yD2 HCos@xD2 − Cos@yD2 Sin@xD2 + Sin@yD2 L ME=, 1 9z → ArcCosA I−Cos@yD Sin@xD Sin@yD + Cos@xD2 + Sin@yD2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Cos@xD Csc@yD Sin@yD2 HCos@xD2 − Cos@yD2 Sin@xD2 + Sin@yD2 L ME==
Taking into account that Mathematica chooses the values of arccos in the range @0, pD, we define the following solutions for z = zHx, yL. In[6]:= {sol1[x_, y_], sol2[x_, y_]} =
(-Cos[y] Sin[x] Sin[y] - # Sqrt[Cos[x]^2 *
Symbolic Computations
604 (Cos[x]^2 - Cos[y]^2 Sin[x]^2 + Sin[y]^2)])/ (Cos[x]^2 + Sin[y]^2)& /@ {+1, -1} è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! −Cos@yD Sin@xD Sin@yD − Cos@xD2 HCos@xD2 − Cos@yD2 Sin@xD2 + Sin@yD2 L , Out[6]= 9 Cos@xD2 + Sin@yD2 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! −Cos@yD Sin@xD Sin@yD + Cos@xD2 HCos@xD2 − Cos@yD2 Sin@xD2 + Sin@yD2 L = Cos@xD2 + Sin@yD2 In[7]:= f1[x_, y_] = +ArcCos[sol1[x, y]]; f2[x_, y_] = +ArcCos[sol2[x, y]];
f3[x_, y_] = -ArcCos[sol1[x, y]]; f4[x_, y_] = -ArcCos[sol2[x, y]];
Now, we must look for which regions of the x,y-plane where the four functions f1, f2, f3, and f4 are really solutions. The solution should satisfy the following two conditions: a) zHx, yL must be real, and b) zHx, yL must be a solution of the implicit equation. For better visibility of the various regions (shown in black if the two conditions are satisfied) that are related to each other by translations and reflections, we add some grid lines. In[9]:= grid = {GrayLevel[1/2], Line[{{0, #}, {2pi, #}}]& /@ (pi/2 Range[0, 4]),
Line[{{#, 0}, {#, 2pi}}]& /@ (pi/2 Range[0, 4])}; In[10]:= Show[GraphicsArray[#]]& /@ Map[ContourPlot[
If[(* does the “solution” fulfill the equation? *) Abs[F[x, y, #1]] < 10^-10 && (* is the solution real-valued? *) Im[#] === 0, -1, 1], {x, 0, N[2Pi]}, {y, 0, N[2Pi]}, Contours -> {0}, PlotPoints -> 100, AspectRatio -> Automatic, Epilog -> grid, DisplayFunction -> Identity, Evaluate[FrameTicks -> {#, #}&[Table[i Pi/2, {i, 0, 4}]]]]&, (* the four solutions *) {{f1[x, y], f2[x, y]}, {f3[x, y], f4[x, y]}}, {2}]
2p
0
p ÅÅÅÅÅ 2
p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
2p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
0
p ÅÅÅÅÅ 2
p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
2p 3p ÅÅÅÅÅÅÅÅÅÅÅ 2
p
p
p
p
p ÅÅÅÅ Å 2
p ÅÅÅÅ Å 2
p ÅÅÅÅ Å 2
p ÅÅÅÅÅ 2
0
0
0
2p
0
0
p ÅÅÅÅÅ 2 p ÅÅÅÅÅ 2
p
p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2 3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
2p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
2p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
0
0
p ÅÅÅÅÅ 2 p ÅÅÅÅÅ 2
p
p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2 3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
2p
0
2p 3p ÅÅÅÅÅÅÅÅÅÅÅ 2
p
p
p
p
p ÅÅÅÅ Å 2
p ÅÅÅÅ Å 2
p ÅÅÅÅ Å 2
p ÅÅÅÅÅ 2
0
0
0
0
p ÅÅÅÅÅ 2
p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
0
p ÅÅÅÅÅ 2
p
3p ÅÅÅÅÅÅÅÅÅÅÅ 2
2p
0
We see (modulo translation and reflection symmetry) three types of regions where our function F can be locally inverted by our f1 or f2 or f3 or f4. Let us analytically calculate the boundaries of these three regions. Because of the underlying symmetry, we restrict the calculation to the square of p ê 2 § x § p, 0 § y § p ê 2. The first restriction is given by the condition of real-valuedness of the f1, f2, f3, and f4. This means that arguments of the square root appearing in the fs must be nonnegative. Solving argumentOfTheSquareRoot == 0 for y thus gives the boundary curve in the form y = yHxL. In[11]:= Solve[{Cos[x]^4 - Cos[x]^2 Cos[y]^2 Sin[x]^2 +
Cos[x]^2 Sin[y]^2 == 0 /. Cos[y]^2 -> 1 - Sin[y]^2}, {Sin[y]}] // Simplify è!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!! −Cos@2 xD −Cos@2 xD =, 9Sin@yD → == Out[11]= 99Sin@yD → − è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 1 + Sin@xD 1 + Sin@xD2
Solutions
605
The second condition is that F[x, y, fi[x, y]] == 0 holds. A little bit of inspection shows that this means that f1[x, y] for a fixed x, x > xmin is a solution of F[x, y, fi[x, y]] == 0 for increasing values of y as long as sol1[x, y] § -1. A direct solution of sol1[x, y] == -1 works just fine. In[12]:= Solve[sol1[x, y] == -1, y]
Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… 1 1 Out[12]= 99y → −ArcCosA− E=, 9y → ArcCosA− E=, è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 + Sin@xD2 1 + Sin@xD2 1 1 9y → −ArcCosA E=, 9y → ArcCosA E== è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 + Sin@xD2 1 + Sin@xD2
We rewrite this solution for sinHyL instead for y. In[13]:= Sin[y /. %] // Simplify // PowerExpand // Union
Sin@xD 1 + Sin@xD2
Sin@xD 1 + Sin@xD2
Out[13]= 9− , = è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
So, we have analytical descriptions of the two arcs bounding the region of validity of F[x, y, fi[x, y]] == 0. Our next step is to generate mesh for the three (up to translation and reflection symmetry) different regions. To get a nice-looking mesh, we subdivide the region in a polar coordinate system-like fashion generated by radial rays going outward from the point Hp ê 2, 0L and divide the rays into equal parts. To calculate the starting length for the rays, we have to solve the equation yHxL = yray HxL. Here, the above two equations are rewritten as an equation in r for the two arcs. (We take Hp ê 2, 0L as the origin.) In[14]:= y1[r_, ϕ_] = ArcSin[Sqrt[-Cos[2(Pi/2 + r Cos[ϕ])]]/
Sqrt[1 + Sin[(Pi/2 + r Cos[ϕ])]^2]] == r Sin[ϕ] // ExpandAll
è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Cos@2 r Cos@ϕDD Out[14]= ArcSinA ! E r Sin@ϕD è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 + Cos@r Cos@ϕDD2
In[15]:= y2[r_, ϕ_] = ArcSin[Sin[Pi/2 + r Cos[ϕ]]/
Sqrt[1 + Sin[Pi/2 + r Cos[ϕ]]^2]] == r Sin[ϕ] // ExpandAll Cos@r Cos@ϕDD Out[15]= ArcSinA ! E r Sin@ϕD è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 + Cos@r Cos@ϕDD2
We solve the two equations numerically using FindRoot. In[16]:= radius1[ϕ_] := FindRoot[Evaluate[y1[r, ϕ]], {r, Pi/4}][[1, 2]]
radius2[ϕ_] := FindRoot[Evaluate[y2[r, ϕ]], {r, pi/4}][[1, 2]]
Now, we have all ingredients together to generate the meshes for the three regions of interest. In[18]:= ppr = 12; ppl = 12; In[19]:= tab[1] = Table[#[[1]] + i/ppr(#[[2]] - #[[1]]), {i, 0, ppr}]& /@
Table[{radius1[ϕ] {Cos[ϕ], Sin[ϕ]}, (* the endpoint along the sides of the square *) Which[ϕ All, Epilog -> grid]&, {mesh1, mesh2, mesh3, mesh4}, {1}]
To generate the three-dimensional graphic, we use the command ListSurfacePlot3D from the package Graphics` Graphics3D`. In[29]:= Needs["Graphics`Graphics3D`"]
Here, each of the four solutions is shown. In[30]:= Show[GraphicsArray[#]]& /@
MapThread[Function[{func, mesh}, Show[ ListSurfacePlot3D[(* generate z-values on the mesh *) Map[Flatten[{#, Re[func @@ #]}]&, #, {-2}], DisplayFunction -> Identity]& /@ mesh]], (* the solutions and corresponding meshes *) {{{f1, f2}, {f3, f4}}, {{mesh1, mesh2}, {mesh3, mesh4}}}, 2]
Together, they form the complete surface described by sinHxL cosHyL + sinHyL cosHzL + sinHzL cosHxL = 0. In[31]:= Show[GraphicsArray[
Graphics3D[{EdgeForm[#], (* extract polygons from last graphic *) allPolys = Cases[%, _Polygon, {0, Infinity}]}, Axes -> True, PlotRange -> All]& /@ {{Thickness[0.001]}, {}}]]
0
4
2
6 0
2
4
2
6
2
0
0
-2
-2
0
2
0 4
6
2
4
6
Due to the 2 p periodicity of the surface along the x, y, and z-axes, we can continue this surface. With enough memory, one could, for instance, display the surface continued to seven adjacent cubes.
Symbolic Computations
608 Make Input
(* the Gauss curvature of an implicitly given surface; see Chapter 3 of the Graphics volume *) κ[{x_, y_, z_}] = Together @ Module[{}, [ds__] := Derivative[ds][Function[{x, y, z}, Sin[x] Cos[y] + Sin[y] Cos[z] + Sin[z] Cos[x]]][x, y, z]; (-([0, 0, 2] [0, 1, 0] [1, 0, 0] + [0, 0, 1] (-[0, 1, 1] [1, 0, 0] - [0, 1, 0] [1, 0, 1] + [0, 0, 1] [1, 1, 0]))^2 + ([0, 0, 2] [0, 1, 0]^2 + [0, 0, 1] (-2 [0, 1, 0] [0, 1, 1] + [0, 0, 1] [0, 2, 0])) ([0, 0, 2] [1, 0, 0]^2 + [0, 0, 1] (-2 [1, 0, 0] [1, 0, 1] + [0, 0, 1] [2, 0, 0])))/ ([0, 0, 1]^2 ([0, 0, 1]^2 + [0, 1, 0]^2 + [1, 0, 0]^2)^2)]; (* color polygons according to Gauss curvature *) colorPolygon[p:Polygon[l_]] := Module[{ = Hue[-Plus @@ (κ /@ l)/4]}, {SurfaceColor[, , 2.2], p}] Show[Graphics3D[{EdgeForm[{}], Table[(colorPolygon /@ allPolys) /. (* use periodicity of the surface *) Polygon[l_] :> Polygon[(# + 2Pi {i, j, k})& /@ l], {i, 0, 1}, {j, 0, 1}, {k, 0, 1}]}], Boxed -> False, Axes -> False]
For similar surfaces, see [689] and [690]. c) This is the implicit equation of the surface under consideration. In[1]:= clebsch = 32 - 216 x^2 + 648 x^2 y - 216 y^2 - 216 y^3 - 150 z +
216 x^2 z + 216 y^2 z + 231 z^2 - 113 z^3;
Let us make the following ansatz for the (18, as will be shown in the following) lines which are not in a plane parallel to the x,y-plane: 8x, y, z< = 8x0 , y0 , 0< + t 8x1 , y1 , 1 x0 + x1 t, y -> y0 + y1 t, z -> t} Out[2]= 32 − 150 t + 231 t2 − 113 t3 − 216 Hx0 + t x1L2 + 216 t Hx0 + t x1L2 +
648 Hx0 + t x1L2 Hy0 + t y1L − 216 Hy0 + t y1L2 + 216 t Hy0 + t y1L2 − 216 Hy0 + t y1L3
Extracting the coefficients with respect to t gives us a set of polynomial equations for x0 , x1 , y0 , and y1 . In[3]:= cl1 = CoefficientList[%, t] Out[3]= 832 − 216 x02 + 648 x02 y0 − 216 y02 − 216 y03 ,
−150 + 216 x02 − 432 x0 x1 + 1296 x0 x1 y0 + 216 y02 + 648 x02 y1 − 432 y0 y1 − 648 y02 y1, 231 + 432 x0 x1 − 216 x12 + 648 x12 y0 + 1296 x0 x1 y1 + 432 y0 y1 − 216 y12 − 648 y0 y12 , −113 + 216 x12 + 648 x12 y1 + 216 y12 − 216 y13
y0 + y1 t, z -> z0} Out[10]= 32 − 216 Ht + x0L2 + 648 Ht + x0L2 Hy0 + t y1L − 216 Hy0 + t y1L2 −
216 Hy0 + t y1L3 − 150 z0 + 216 Ht + x0L2 z0 + 216 Hy0 + t y1L2 z0 + 231 z02 − 113 z03
We again extract the coefficients with respect to t. In[11]:= cl1 = CoefficientList[%, t] Out[11]= 832 − 216 x02 + 648 x02 y0 − 216 y02 − 216 y03 − 150 z0 + 216 x02 z0 + 216 y02 z0 + 231 z02 − 113 z03 ,
−432 x0 + 1296 x0 y0 + 648 x02 y1 − 432 y0 y1 − 648 y02 y1 + 432 x0 z0 + 432 y0 y1 z0, −216 + 648 y0 + 1296 x0 y1 − 216 y12 − 648 y0 y12 + 216 z0 + 216 y12 z0, 648 y1 − 216 y13
1, PlotPoints -> {{8, 4}, {8, 3}, {22, 3}}, DisplayFunction -> Identity][[1]], {-2}]]]}]
Just displaying this surface and the lines together in one picture does not yield a reasonable quality. Due to the approximative nature of the polygons from the surface, they intersect in a complicated manner with the lines, and so some parts of the lines will be “below” and some parts “above” the surface. To avoid this, we “lift” the lines slightly in the direction of the local normal on the surface. Here is the normal vector for our cubic. In[22]:= normalVector[{x_, y_, z_}] =
#/Sqrt[#.#]&[{D[#, x], D[#, y], D[#, z]}&[clebsch]];
The routine liftLines lifts its first argument (a line) to both sides of the surface to avoid intersections with the polygons by a height height. In[23]:= liftLines[Line[{p1_, p2_}], height_, pp_] :=
Function[{l, normal}, (* move slightly up and down *) {Line[MapThread[Plus, {l, +height normal}]], Line[MapThread[Plus, {l, -height normal}]]}] @@ {#, normalVector /@ #}&[ Evaluate[p1 + # (p2 - p1)]& /@ (Range[0, pp]/pp)];
Now, we can display the lines and the surface together. In[24]:= Show[Graphics3D[{
{(* the 27 lines *) GrayLevel[1], Thickness[0.004], liftLines[#, 0.005, 200]& /@ twentySevenLines}, (* the Clebsch surface *) {EdgeForm[{GrayLevel[0], Thickness[0.002]}],
Symbolic Computations
612 Flatten[clebschSurface[[1]]]}}], PlotRange -> All, Axes -> False, Boxed -> False, ViewPoint -> {1.87, -1.6, 0.9}, BoxRatios -> {1, 1, 2.45}, Background -> GrayLevel[0.9]]
d) This is the original implicit formula for the Clebsch surfaces used here. In[1]:= clebsch3 = 32 - 216 x^2 + 648 x^2 y - 216 y^2 - 216 y^3 - 150 z +
216 x^2 z + 216 y^2 z + 231 z^2 - 113 z^3;
The threefold rotational symmetry becomes obvious in cylindrical coordinates. In[2]:= Simplify[clebsch3 /. {x -> r Sin[ϕ], y -> r Cos[ϕ]}] Out[2]= H−1 + zL H−32 + 216 r2 + 118 z − 113 z2 L − 216 r3 Cos@3 ϕD
A straightforward generalization from the threefold rotational symmetry to an n-fold rotational symmetry is achieved by using Cos[n ϕ] instead of Cos[3 ϕ]. In[3]:= clebsch[n_] := (z - 1) (-32 + 216 r^2 + 118 z - 113 z^2) - 216 r^3 Cos[n ϕ]
To obtain the corresponding implicit representation, we eliminate the coordinates r and ϕ and use the Cartesian x and y instead. Using, say, the elimination capabilities of GroebnerBasis, this is straightforward. In[4]:= generalizedClebsch[n_] :=
GroebnerBasis[{TrigExpand[clebsch[n]], x - r Sin[ϕ], y - r Cos[ϕ], Sin[ϕ]^2 + Cos[ϕ]^2 - 1}, {x, y, z}, {r, Sin[ϕ], Cos[ϕ]}, MonomialOrder -> EliminationOrder][[1]] // Factor
Another possibility to obtain an implicit representation would be the direct substitution of r and ϕ as functions of x and y and ongoing simplification of the resulting formula. In[5]:= generalizedClebsch1[n_] :=
Module[{aux, pre}, (* remove r and ϕ *) aux = clebsch[n] /. {r -> Sqrt[x^2 + y^2], ϕ -> ArcCos[y/Sqrt[x^2 + y^2]]}; (* remove trigs *) pre = Numerator[Factor[Together[TrigExpand[aux]]]]; (* remove square roots if present *) If[MemberQ[pre, Sqrt[x^2 + y^2], Infinity], Factor[Expand[(pre - #)^2 - #^2]]&[ Plus @@ Cases[pre, Sqrt[x^2 + y^2] _]], pre]]
For n = 3, we recover the original Clebsch surface. In[6]:= generalizedClebsch[3] Out[6]= 32 − 216 x2 + 648 x2 y − 216 y2 − 216 y3 − 150 z + 216 x2 z + 216 y2 z + 231 z2 − 113 z3 In[7]:= generalizedClebsch[3] == generalizedClebsch1[3] Out[7]= True
For n = 5, n = 7, we get the following implicit representations of Clebsch surfaces. In[8]:= generalizedClebsch[5] Out[8]= −32 x2 + 216 x4 + 1080 x4 y − 32 y2 + 432 x2 y2 − 2160 x2 y3 + 216 y4 + 216 y5 + 150 x2 z −
216 x4 z + 150 y2 z − 432 x2 y2 z − 216 y4 z − 231 x2 z2 − 231 y2 z2 + 113 x2 z3 + 113 y2 z3
Solutions
613 In[9]:= generalizedClebsch[7] Out[9]= 32 x4 − 216 x6 + 1512 x6 y + 64 x2 y2 − 648 x4 y2 − 7560 x4 y3 + 32 y4 − 648 x2 y4 + 4536 x2 y5 −
216 y6 − 216 y7 − 150 x4 z + 216 x6 z − 300 x2 y2 z + 648 x4 y2 z − 150 y4 z + 648 x2 y4 z + 216 y6 z + 231 x4 z2 + 462 x2 y2 z2 + 231 y4 z2 − 113 x4 z3 − 226 x2 y2 z3 − 113 y4 z3
For an even number n, we get the following implicit representations of Clebsch surfaces. In[10]:= generalizedClebsch[2] Out[10]= −1024 + 13824 x2 − 46656 x4 + 46656 x6 + 13824 y2 − 93312 x2 y2 − 46656 x4 y2 − 46656 y4 − 46656 x2 y4 +
46656 y6 + 9600 z − 78624 x2 z + 93312 x4 z − 78624 y2 z + 186624 x2 y2 z + 93312 y4 z − 37284 z2 + 164592 x2 z2 − 46656 x4 z2 + 164592 y2 z2 − 93312 x2 y2 z2 − 46656 y4 z2 + 76532 z3 − 148608 x2 z3 − 148608 y2 z3 − 87261 z4 + 48816 x2 z4 + 48816 y2 z4 + 52206 z5 − 12769 z6
In[11]:= generalizedClebsch[4] Out[11]= −1024 x2 + 13824 x4 − 46656 x6 + 46656 x8 − 1024 y2 + 27648 x2 y2 − 139968 x4 y2 − 559872 x6 y2 +
13824 y4 − 139968 x2 y4 + 1772928 x4 y4 − 46656 y6 − 559872 x2 y6 + 46656 y8 + 9600 x2 z − 78624 x4 z + 93312 x6 z + 9600 y2 z − 157248 x2 y2 z + 279936 x4 y2 z − 78624 y4 z + 279936 x2 y4 z + 93312 y6 z − 37284 x2 z2 + 164592 x4 z2 − 46656 x6 z2 − 37284 y2 z2 + 329184 x2 y2 z2 − 139968 x4 y2 z2 + 164592 y4 z2 − 139968 x2 y4 z2 − 46656 y6 z2 + 76532 x2 z3 − 148608 x4 z3 + 76532 y2 z3 − 297216 x2 y2 z3 − 148608 y4 z3 − 87261 x2 z4 + 48816 x4 z4 − 87261 y2 z4 + 97632 x2 y2 z4 + 48816 y4 z4 + 52206 x2 z5 + 52206 y2 z5 − 12769 x2 z6 − 12769 y2 z6
The expression generalizedClebsch is more advantageous than is generalizedClebsch1 because it does not contain additional factors. In[12]:= generalizedClebsch1[2] Out[12]= Hx2 + y2 L H−1024 + 13824 x2 − 46656 x4 + 46656 x6 + 13824 y2 − 93312 x2 y2 − 46656 x4 y2 − 46656 y4 −
46656 x2 y4 + 46656 y6 + 9600 z − 78624 x2 z + 93312 x4 z − 78624 y2 z + 186624 x2 y2 z + 93312 y4 z − 37284 z2 + 164592 x2 z2 − 46656 x4 z2 + 164592 y2 z2 − 93312 x2 y2 z2 − 46656 y4 z2 + 76532 z3 − 148608 x2 z3 − 148608 y2 z3 − 87261 z4 + 48816 x2 z4 + 48816 y2 z4 + 52206 z5 − 12769 z6 L
Now let us visualize some of the generalized Clebsch surfaces. For efficiency, we will make use of the symmetry of the surface and generate a contour plot of a part of the surface and then rotate this part to generate the whole surface. In[13]:= Needs["Graphics`ContourPlot3D`"] In[14]:= clebschPicture[n_, opts___] :=
Module[{cpPolys, CartesianPolys, }, (* contour plot in cylindrical coordinates *) cpPolys = ContourPlot3D[Evaluate[clebsch[n]], {r, 0, 0.9}, {ϕ, 0, N[2Pi/n]}, {z, -0.975, 2.173}, MaxRecursion -> 1, PlotPoints -> {{8, 3}, {12, 3}, {22, 3}}, DisplayFunction -> Identity][[1]]; (* polygons in Cartesian coordinates *) CartesianPolys = Apply[{#1 Cos[#2], #1 Sin[#2], #3}&, cpPolys, {-2}]; (* rotation matrices *) Do[[i] = N[{{ Cos[i 2Pi/n], Sin[i 2Pi/n], 0}, {-Sin[i 2Pi/n], Cos[i 2Pi/n], 0}, {0, 0, 1}}], {i, 0, n - 1}]; (* show generalized Clebsch surface *) Show[Graphics3D[{EdgeForm[], SurfaceColor[Hue[Random[]], Hue[Random[]], 2.6], Table[Map[[i].#&, CartesianPolys, {-2}], {i, 0, n - 1}]}], opts, Boxed -> False]] In[15]:= Show[GraphicsArray[#]]& /@ Partition[clebschPicture[#,
DisplayFunction -> Identity]& /@ Range[2, 7], 3]
Symbolic Computations
614
We could now continue and calculate the straight lines that could be found on these surfaces. 28. 28 Bitangents on a Real Plane Quartic, Curve Intersections, Pentaellipse a) This is the implicit equation of the quartic under consideration. In[1]:= F[x_, y_] = x^4 + y^4 - 6 (x^2 + y^2) + 10;
Let us have a look at the form of this curve. In[2]:= sketch = ContourPlot[Evaluate[F[x, y]], {x, -3, 3}, {y, -3, 3},
Contours -> {0}, PlotPoints -> 100] 3 2 1 0 -1 -2 -3
-3
-2
-1
0
1
2
3
We see four equal components in symmetrical position. Between each of the six possible pairs of these regions, there are obviously four (two outer and two crossing) bitangents. As it will turn out later, the remaining four bitangents touch the regions in the point nearest to 80, 0< where a degenerate bitangent occurs. Let us now explicitly calculate the bitangents. We will derive an equation for the slope m of the possible bitangents, and then calculate the constants b in the equations y = m x + b of the bitangents (assuming m ∫ ¶ and treating the case m = ¶ later on). We could also try to calculate the points where the bitangents touch the quartic and then calculate m and b for each line. Let us attach a tangent at the point 8x1 , y1 [p[5][j], {x, y}];
The function Graphics finally calculates all contour lines for a given value of c. The contour lines of the original expression will be shown in red. In[31]:= Graphics[c_, opts___] :=
Module[{R = 7, ppr = 300, ppϕ = 120, ∂ = 0.1, cp, grC, L1, L2, grD, cpO, outerCircle}, (* contour plot in r,ϕ-coordinates *) cp = ContourPlot[cfpolarPoly[r, ϕ, c], {r, 0, R}, {ϕ, 3Pi/10, Pi/2}, Compiled -> False, ContourLines -> False, DisplayFunction -> Identity, PlotPoints -> {ppr, ppϕ}, Contours -> {0}]; (* convert contour graphics into Cartesian polygons *) grC = Graphics[cp] /. Polygon[l_] :> Polygon[addPoints[l, 0.1]] /. Polygon[l_] :> Polygon[Apply[#1 {Cos[#2], Sin[#2]}&, l, {1}]]; (* deal especially with boundaries of the Pi/5 wedge *)
Solutions
623 L1 = {GrayLevel[Sign[Plus @@ (Last /@ #)] /. -1 -> 0], Line[{0, #}& @@@ #]}& /@ Split[Table[{r, cfpolarPoly[r, Pi/2, c]}, {r, 0, R, R/(ppr)}], Sign[#1] == Sign[#2]&]; L2 = {GrayLevel[Sign[Plus @@ (Last /@ #)] /. -1 -> 0], Line[# {Cos[3Pi/10], Sin[3Pi/10]}& @@@ #]}& /@ Split[Table[{N @ r, cfpolarPoly[r, 3Pi/10, c]}, {r, 0, R, R/(2ppr)}], Sign[#1] == Sign[#2]&]; grD = {Graphics[{Thickness[0.004], L1, L2 }]}; (* contour plot of the radical version *) cpO = ContourPlot[Evaluate[[r Cos[ϕ], r Sin[ϕ], c]], {r, 0, R}, {ϕ, 3Pi/10, Pi/2}, ContourShading -> False, DisplayFunction -> Identity, PlotPoints -> {ppr, ppϕ}, Contours -> {0}]; (* convert contour graphics into polygons *) grO = Graphics[cpO] /. Line[l_] :> {Hue[0], Thickness[0.002], Line[Apply[#1 {Cos[#2], Sin[#2]}&, l, {1}]]}; (* outer white boundary *) outerCircle = Graphics[{GrayLevel[1], Polygon[Join[0.99 #, 1.01 Reverse[#]]]&[ Table[R{Cos[ϕ], Sin[ϕ]}, {ϕ, 0, 2Pi, 2Pi/360}]]}]; (* display all elements *) Show[{makeAll[grC], makeAll[grD], makeAll[grO], outerCircle}, opts, Frame -> False, DisplayFunction -> $DisplayFunction] // N]
The following array of graphics shows the contour lines of the polynomial and the original version for various values of the parameter c. As expected, all graphics show a fivefold symmetry. In[32]:= Show[GraphicsArray[
Graphics[#, DisplayFunction -> Identity]& /@ #]]& /@ Partition[Table[c, {c, 0, 11, 11/14}], 3]
Symbolic Computations
624
Here is the corresponding animation. Make Input
Do[Graphics[c], {c, 0, 11, 1/8}]
For other generalizations of ellipses, see [617]. 29. Maxwell’s Equations Are Galilei Invariant, X-Waves, Fields in a Moving Media, Thomas Precession, Retarded Potential Expansion a) Here, the four-vector analysis operations div, curl, D, and “ .v” are implemented. In[1]:= curl[{ax_, ay_, az_}] :=
{D[az, y] - D[ay, z], D[ax, z] - D[az, x], D[ay, x] - D[ax, y]} In[2]:= div[{ax_, ay_, az_}] := D[ax, x] + D[ay, y] + D[az, z] In[3]:= laplace[a_] := D[a, x, x] + D[a, y, y] + D[a, z, z] In[4]:= nablaV[{vx_, vy_, vz_}, ψ_] := vx D[ψ, x] + vy D[ψ, y] + vz D[ψ, z]
The unprimed fields fulfill the Maxwell equations in the unprimed coordinates. We write substitution rules that will replace all time derivatives by the corresponding space derivatives. In[5]:= maxwellRules1 =
{Derivative[1, dx_, dy_, dz_][Ex][t_, x_, -Derivative[0, dx, dy, dz + 1][Hy][t, Derivative[0, dx, dy + 1, dz][Hz][t, Derivative[1, dx_, dy_, dz_][Ey][t_, x_, Derivative[0, dx, dy, dz + 1][Hx][t, Derivative[0, dx + 1, dy, dz][Hz][t, Derivative[1, dx_, dy_, dz_][Ez][t_, x_, -Derivative[0, dx, dy + 1, dz][Hx][t, Derivative[0, dx + 1, dy, dz][Hy][t, Derivative[1, dx_, dy_, dz_][Hx][t_, x_, Derivative[0, dx, dy, dz + 1][Ey][t, Derivative[0, dx, dy + 1, dz][Ez][t, Derivative[1, dx_, dy_, dz_][Hy][t_, x_, -Derivative[0, dx, dy, dz + 1][Ex][t, Derivative[0, dx + 1, dy, dz][Ez][t, Derivative[1, dx_, dy_, dz_][Hz][t_, x_, Derivative[0, dx, dy + 1, dz][Ex][t, Derivative[0, dx + 1, dy, dz][Ey][t,
y_, z_] -> x, y, z] + x, y, z], y_, z_] -> x, y, z] x, y, z], y_, z_] -> x, y, z] + x, y, z], y_, z_] -> x, y, z] x, y, z], y_, z_] -> x, y, z] + x, y, z], y_, z_] -> x, y, z] x, y, z]};
Solutions
625
In a similar way, we solve the last two Maxwell equations with respect to the Ex and Hx . In[6]:= maxwellRules2 =
{Derivative[0, dx_?(# >= -Derivative[0, -Derivative[0, Derivative[0, dx_?(# >= -Derivative[0, -Derivative[0,
1&), dx dx 1&), dx dx -
dy_, dz_][Ex][t_, x_, 1, dy + 1, dz][Ey][t, 1, dy, dz + 1][Ez][t, dy_, dz_][Hx][t_, x_, 1, dy + 1, dz][Hy][t, 1, dy, dz + 1][Hz][t,
y_, z_] -> x, y, z] + x, y, z], y_, z_] -> x, y, z] + x, y, z]};
The following implements some abbreviations for the fields, the position, and the velocity vector. In[7]:= e = {Ex[t, x, y, z], Ey[t, x, y, z], Ez[t, x, y, z]};
h = {Hx[t, x, y, z], Hy[t, x, y, z], Hz[t, x, y, z]}; v = {vx, vy, vz}; r = {x, y, z};
These are the transformed fields. In[11]:= eP = e - Cross[v, h] - (v.r + 1/2 v.v t) curl[h] +
1/2 (v.v e - v v.e + r.v (nablaV[v, e] - 2 Cross[v, curl[e]]) + (r.v)^2 laplace[e]); In[12]:= hP = h + Cross[v, e] + (v.r + 1/2 v.v t) curl[e] +
1/2 (v.v h - v v.h + r.v (nablaV[v, h] - 2 Cross[v, curl[h]]) + (r.v)^2 laplace[h]);
The function U checks if eq is zero up to order 3 in v”. In[13]:= Υ[eq_] := Expand[Expand[eq] /. maxwellRules1 /. maxwellRules2] /.
{vx -> λ vx, vy -> λ vy, vz -> λ vz} /. λ^(n_)?(# >= 3&) -> 0 /. λ -> 1
According to the chain rule and using the Galilei transformation, the derivatives transform as “ ' = “ and ∑t' = ∑t -“ .v”. Here are the transformed fields used in the Maxwell equations. In[14]:= Υ[D[hP, t] - nablaV[v, hP] + curl[eP]] Out[14]= 80, 0, 0< In[15]:= Υ[D[eP, t] - nablaV[v, eP] - curl[hP]] Out[15]= 80, 0, 0< In[16]:= Υ[div[eP]] Out[16]= 0 In[17]:= Υ[div[hP]] Out[17]= 0
This means that the transformed fields fulfill the Maxwell equations to the given order. Only the relation between the fields in a media determines if the symmetry is the one of the Galilei group or of the Lorentz group. For the transition from the Lorentz invariance to the Galilei invariance in the Maxwell equations, see [868]. To calculate the maximal symmetry group of a free nonrelativistic point particle, see [917]. For the invariance of the Maxwell equations with respect to intertial transformations, see [270]. b) We start by defining the five vector-valued functions , , , , v. In the following, symbolc[i] denotes the ith component of the three-vector symbol. In[1]:= {, , , , v} = Map[(# /@ Range[3])&, {c, c, c, c, vc}];
Componentwise, it is straightforward to solve the constitutive equations for and . In[2]:= eqs = Flatten[Thread /@
{ + 1/c Cross[v, ] == ∂ ( + 1/c Cross[v, ]),
- 1/c Cross[v, ] == µ ( - 1/c Cross[v, ])}] −vc@3D c@2D + vc@2D c@3D −vc@3D c@2D + vc@2D c@3D ∂ J + c@1DN, Out[2]= 9c@1D + c c vc@3D c@1D − vc@1D c@3D vc@3D c@1D − vc@1D c@3D c@2D + ∂ J + c@2DN, c c
Symbolic Computations
626
−vc@2D c@1D + vc@1D c@2D −vc@2D c@1D + vc@1D c@2D c@3D + ∂ J + c@3DN, c c −vc@3D c@2D + vc@2D c@3D −vc@3D c@2D + vc@2D c@3D c@1D − µ J− + c@1DN, c c vc@3D c@1D − vc@1D c@3D vc@3D c@1D − vc@1D c@3D µ J− + c@2DN, c@2D − c c −vc@2D c@1D + vc@1D c@2D −vc@2D c@1D + vc@1D c@2D c@3D − µ J− + c@3DN= c c In[3]:= sol = Simplify[Solve[eqs, Join[ , ]]] Out[3]= 88c@1D →
Hc2 ∂ c@1D − ∂ Hvc@2D2 c@1D + vc@3D2 c@1D − vc@1D vc@2D c@2D − vc@1D vc@3D c@3D + ∂ µ vc@1D Hvc@1D c@1D + vc@2D c@2D + vc@3D c@3DLL − c H−1 + ∂ µL Hvc@3D c@2D − vc@2D c@3DLL ê Hc2 − ∂ µ Hvc@1D2 + vc@2D2 + vc@3D2 LL, c@2D → H−c H−1 + ∂ µL Hvc@3D c@1D − vc@1D c@3DL + c2 µ c@2D − µ HH−1 + ∂ µL vc@1D vc@2D c@1D + vc@1D2 c@2D + vc@3D Hvc@3D c@2D − vc@2D c@3DL + ∂ µ vc@2D Hvc@2D c@2D + vc@3D c@3DLLL ê Hc2 − ∂ µ Hvc@1D2 + vc@2D2 + vc@3D2 LL, c@3D → H−∂2 µ vc@3D Hvc@1D c@1D + vc@2D c@2D + vc@3D c@3DL + c Hvc@2D c@1D − vc@1D c@2DL + ∂ Hvc@2D vc@3D c@2D + c2 c@3D − vc@1D2 c@3D − vc@2D2 c@3D − c µ vc@2D c@1D + vc@1D Hvc@3D c@1D + c µ c@2DLLL ê Hc2 − ∂ µ Hvc@1D2 + vc@2D2 + vc@3D2 LL, c@2D → H−∂2 µ vc@2D Hvc@1D c@1D + vc@2D c@2D + vc@3D c@3DL + c H−vc@3D c@1D + vc@1D c@3DL + ∂ Hc2 c@2D − vc@1D2 c@2D − vc@3D2 c@2D + vc@2D vc@3D c@3D + c µ vc@3D c@1D + vc@1D Hvc@2D c@1D − c µ c@3DLLL ê Hc2 − ∂ µ Hvc@1D2 + vc@2D2 + vc@3D2 LL, c@1D → Hc H−1 + ∂ µL Hvc@3D c@2D − vc@2D c@3DL + c2 µ c@1D − µ Hvc@2D2 c@1D + vc@3D2 c@1D − vc@1D vc@2D c@2D − vc@1D vc@3D c@3D + ∂ µ vc@1D Hvc@1D c@1D + vc@2D c@2D + vc@3D c@3DLLL ê Hc2 − ∂ µ Hvc@1D2 + vc@2D2 + vc@3D2 LL, c@3D → Hc H−1 + ∂ µL Hvc@2D c@1D − vc@1D c@2DL + c2 µ c@3D − µ HH−1 + ∂ µL vc@1D vc@3D c@1D + H−1 + ∂ µL vc@2D vc@3D c@2D + vc@1D2 c@3D + vc@2D2 c@3D + ∂ µ vc@3D2 c@3DLL ê Hc2 − ∂ µ Hvc@1D2 + vc@2D2 + vc@3D2 LL
Lexicographic][[-1]]]& /@ {num, den} 1 2 vx@1D x@1D H µ H−1 + ∂ µL vc@1D vx@1D2 + µ H1 − ∂ µL vc@1D vx@1D2 − µ vc@1D vx@1D2 c@1D2 + ∂ µ2 vc@1D vx@1D2 c@1D2 + 2 c vx@1D2 x@1D − 2 c ∂ µ vx@1D2 x@1D − vv µ vc@1D x@1D2 + vv ∂ µ2 vc@1D x@1D2 + µ vc@1D3 x@1D2 − ∂ µ2 vc@1D3 x@1D2 + 2 c2 µ vx@1D x@1D c@1D − 2 vv µ vx@1D x@1D c@1D + 2 µ vc@1D2 vx@1D x@1D c@1D − 2 ∂ µ2 vc@1D2 vx@1D x@1D c@1D + µ vc@1D vx@1D2 c@1D2 − ∂ µ2 vc@1D vx@1D2 c@1D2 L, c2 − vv ∂ µ=
Out[9]= 9
The last two equations show that the first component has been appropriately expressed in other quantities that are either scalars or contain only the first components of the fields and the velocity. Proceeding in a similar way shows that the second and third components give a similar result. This means that the corresponding vector equation can be obtained by simply dropping the component index, and we arrive at: 1 = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H¶ H1 - ¶ mL v. v + c H¶ m - 1L v µ + ¶ c2 - ¶ v.v L, c2 - ¶ m v.v 1 = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Hm H1 - ¶ mL v. v + c H1 - ¶ mL v µ + m c2 - m v.v L. c2 - ¶ m v.v c) This is the complex potential jv Hr, z; tL. In[1]:= ϕ[{ρ_, z_}, t_, {α_, v_}] :=
(z - t v + I α)/Sqrt[(z - t v + I α)^2 + (1 - (v/c)^2) ρ^2]^3
It is straightforward to show that the real part and the imaginary part of jv Hr, z; tL fulfill the 3D wave equation. In[2]:= With[{(* X-wave *) φ = ϕ[{ρ, z}, t, {α, v}]},
(* 1D wave equation *) 1/c^2 D[φ, t, t] - (1/ρ D[ρ D[φ, ρ], ρ] + D[φ, z, z])] // Together Out[2]= 0
Here is the real part written in an explicitly real way. In[3]:= ComplexExpand[Re[ϕ[{ρ, z}, t, {α, v}]],
TargetFunctions -> {Re, Im}] // Simplify 3 v2 y 2 i j j v + zL CosA ArcTanAH−t v + zL2 − α2 + i Out[3]= jH−t z ρ , 2 H−t v + zL αEE + j1 − 2 z k
2 c { k v2 z 3 y i yì 2 2 2 j α SinA ArcTanAH−t v + zL − α + j1 − 2 z ρ , 2 H−t v + zL αEEz z c { 2 k { 3ê4
2 i v2 y y y i − j j j4 H−t v + zL2 α2 + i z z z ρ2 z z z jH−t v + zL2 − α2 + j j1 2 c { { { k k k
jv Hr, z; tL is a solution of the wave equation for any value of v. Because jv Hr, z; tL = jv Hr, z - v t; 0L, it is a (unphysical) solution that propagates with any possible speed v. The following graphics show the ReHjv Hr, z; 0LL for v = 1 ê 2 and v = 2 in the r,z-plane. In[4]:= Show[GraphicsArray[
Plot3D[Evaluate[Re[ϕ[{ρ, z}, 0, {1, # c}]] /. c -> 1], {ρ, 0, 5}, {z, -5, 5}, PlotPoints -> 120, DisplayFunction -> Identity, Mesh -> False, PlotRange -> All]& /@ {1/2, 1, 2}]]
Symbolic Computations
628
20 0 -20 0
4 2 1
0 2
3
-2 4
1 0.5 0 -0.5 -1 0
4 2 1
-4
0 2
3
5
1 0.5 0 -0.5 -1 0
-2 4
4 2 1
0 2
-4
3
5
-2 4
-4 5
For similar superluminal solutions of the wave equations, see [1532], [1466], [1471], [1892], [1127], [166], [1656], [1604], [849], [41], [1268], [207], [1911], [1890], [1891], [1465], [507], and [1347]; for localized, finite energy solutions, see [1787]. d) We start by forming the products of the matrix exponentials. In[1]:= σ[1] = {{0,
1}, {1, 0}}; σ[2] = {{0, -I}, {I, 0}}; σ[3] = {{1, 0}, {0, -1}};
In[4]:= m1 = MatrixExp[-ξ σ[3]].MatrixExp[η (Sin[α] σ[1] + Cos[α] σ[3])] //
Simplify 1 1 2 2 1 1 9 −η+ξ H−1 + 2 η L Sin@αD, −η+ξ H1 + 2 η + Cos@αD − 2 η Cos@αDL== 2 2
Out[4]= 99 −η−ξ H1 + 2 η + H−1 + 2 η L Cos@αDL, −η−ξ H−1 + 2 η L Sin@αD=,
In[5]:= m2 = MatrixExp[ρ (Sin[θ] σ[1] + Cos[θ] σ[3])].MatrixExp[I ψ σ[2]] //
Expand // Simplify // TrigExpand // Expand // Simplify 1 2 1 −ρ HH1 + 2 ρ L Sin@ψD + H−1 + 2 ρ L Sin@θ + ψDL=, 2 1 9 −ρ H−H1 + 2 ρ L Sin@ψD + H−1 + 2 ρ L Sin@θ + ψDL, 2 1 −ρ HH1 + 2 ρ L Cos@ψD − H−1 + 2 ρ L Cos@θ + ψDL== 2
Out[5]= 99 −ρ HH1 + 2 ρ L Cos@ψD + H−1 + 2 ρ L Cos@θ + ψDL,
After threading m1 == m2, we have a set of four pseudopolynomial equations to be solved. Due to the complexity of this problem, a direct call to Solve will not succeed. To be on safe ground for equation solving, we rewrite the equations m1 == m2 in polynomial form by replacing the exponents with variables and clearing denominators. In[6]:= eqs1 = Expand[Numerator[Together[(Flatten[m1 - m2] // Expand) /.
{Exp[ρ] -> ρ, Exp[-ρ] -> 1/ρ}]]] // TrigExpand
Out[6]= 8ρ + 2 η ρ − ρ Cos@αD + 2 η ρ Cos@αD − η+ξ Cos@ψD − η+ξ ρ2 Cos@ψD +
η+ξ Cos@θD Cos@ψD − η+ξ ρ2 Cos@θD Cos@ψD − η+ξ Sin@θD Sin@ψD + η+ξ ρ2 Sin@θD Sin@ψD, −ρ Sin@αD + 2 η ρ Sin@αD + η+ξ Cos@ψD Sin@θD − η+ξ ρ2 Cos@ψD Sin@θD − η+ξ Sin@ψD − η+ξ ρ2 Sin@ψD + η+ξ Cos@θD Sin@ψD − η+ξ ρ2 Cos@θD Sin@ψD, −ξ ρ Sin@αD + 2 η+ξ ρ Sin@αD + η Cos@ψD Sin@θD − η ρ2 Cos@ψD Sin@θD + η Sin@ψD + η ρ2 Sin@ψD + η Cos@θD Sin@ψD − η ρ2 Cos@θD Sin@ψD, ξ ρ + 2 η+ξ ρ + ξ ρ Cos@αD − 2 η+ξ ρ Cos@αD − η Cos@ψD − η ρ2 Cos@ψD − η Cos@θD Cos@ψD + η ρ2 Cos@θD Cos@ψD + η Sin@θD Sin@ψD − η ρ2 Sin@θD Sin@ψD
False, MonomialOrder -> EliminationOrder] // Factor Out[8]= 8−ηP ξP HCos@ψD Sin@αD − ηP2 Cos@ψD Sin@αD − ξP2 Cos@ψD Sin@αD + ηP2 ξP2 Cos@ψD Sin@αD + Sin@ψD + ηP2 Sin@ψD + ξP2 Sin@ψD + ηP2 ξP2 Sin@ψD − Cos@αD Sin@ψD + ηP2 Cos@αD Sin@ψD + ξP2 Cos@αD Sin@ψD − ηP2 ξP2 Cos@αD Sin@ψDL
EliminationOrder] /. tan -> Tan Out[9]= 8−ηP ξP Sin@αD + ηP3 ξP Sin@αD + ηP ξP3 Sin@αD − ηP3 ξP3 Sin@αD − ηP ξP Tan@ψD − ηP3 ξP Tan@ψD − ηP ξP3 Tan@ψD − ηP3 ξP3 Tan@ψD + ηP ξP Cos@αD Tan@ψD − ηP3 ξP Cos@αD Tan@ψD − ηP ξP3 Cos@αD Tan@ψD + ηP3 ξP3 Cos@αD Tan@ψD< In[10]:= Solve[%[[1]] == 0, Tan[ψ]] /. {ξP -> Exp[ξ], ηP -> Exp[η]} //
FullSimplify 1 Cot@αD − Coth@ηD Coth@ξD Csc@αD
Out[10]= 99Tan@ψD → ==
e) Because we will work with time-dependent vectors, we will use the built-in function Dot in the following. We start adding the Orderless attribute to Dot because we will only deal with products of vectors and not matrices. In[1]:= Unprotect[Dot];
SetAttributes[Dot, Orderless];
Next, because we work with symbolic vectors, we teach Dot linearity and distributivity over nonvector quantities. We will use the doublestruck letters and for vectors. In[3]:= (* distribute over sums *)
Dot[a_Plus, b_] := Dot[#, b]& /@ a (* extract nonvector prefactors *) Dot[f_ a_, b_] := f Dot[a, b] /; Not[MatchQ[f, _. ([_] | [_] | | | Derivative[_][ | ][_] | Derivative[_][ | ])]]
The next definition implements the scalar product for two Taylor series, both having vector-valued coefficients. In[7]:= Dot[s_SeriesData, σ_SeriesData] :=
(* calculate components *) ExpandAll[Normal[s]].ExpandAll[Normal[σ]] + (* make series again *) O[s[[1]]]^Min[s[[-2]], σ[[-2]]] /; First[s] === First[σ]
For uniformity, we write higher-order derivatives of as derivatives of . In[8]:= Derivative[k_][][τ_] := -Derivative[k - 1][][τ]
The basic identity to be used repeatedly in the following is the t-derivative of rHtL. It is easily derived from the defining equations [1624], [204]. In[9]:= r'[τ_] := -[τ].[τ]/r[τ]
To obtain an expansion for the potential j in inverse powers of c, we start by expressing the implicitly defined tHtL k k k (parametrically depending on g) in inverse powers of c. Using g = 1 ê c, we have tHtL = ⁄¶ k=0 g ê k ! ∑ tHtL ê ∑g »g=0 . The 0th-order time represents an infinite speed of light, meaning t = t. By solγ[k], we denote the replacement rule for ∑k tHtL ê ∑ gk »g=0 . In[10]:= solγ[0] = {τ[t][0] -> t};
Symbolic Computations
630
The higher derivatives of tHtL with respect to g can be obtained through implicit differentiation. Here this is done for the first order. In[11]:= eq[0] = τ[t][γ] == (t - γ r[τ[t][γ]]); In[12]:= eq[1] = D[eq[0], γ]
γ @τ@tD@γDD.@τ@tD@γDD τ@tD @γD r@τ@tD@γDD
Out[12]= τ@tD @γD −r@τ@tD@γDD + In[13]:= sol[1] = Solve[eq[1], τ[t]'[γ]][[1]]
r@τ@tD@γDD2 γ @τ@tD@γDD.@τ@tD@γDD − r@τ@tD@γDD
Out[13]= 9τ@tD @γD → = In[14]:= solγ[1] = sol[1] /. γ -> 0 /. solγ[0] Out[14]= 8τ@tD @0D → −r@tD
0, Table[solγ[j], {j, k - 1, 0, -1}]] // Simplify, {k, 2, o}]
Here are the first few terms of the resulting power series for t. Because now all quantities depend only on the unretarded time t, we suppress all time dependencies for brevity. In[17]:= τ = Sum[γ^k/k! solγ[k][[1, 2]], {k, 0, o}] + O[γ]^(o + 1) /. x_[t] :> x
i H.L2 2r k
1 2
r . y 2 {
Out[17]= t − r γ − . γ2 + j j− + r . − z z γ3 +
1 1 J. . − r2 . − . . + r2 . N γ4 + 6 2 H.L4 3 H.L2 . 3 1 1 3 H.L2 . i 2 j + − r H. L − r . . + r3 .H3L − + j 4r 8 2 24 4r k 8 r3 3 3 3 1 1 z r . . − r H.L2 + r . . − r3 . − r3 . y z γ5 + O@γD6 4 8 2 6 8 {
Having a series expansion for t, we can easily calculate series expansions for HtL, HtL, and rHtL. In[18]:= r = (t - τ)/γ;
{, } = {[τ], [τ]} + O[γ]^(o + 1) /. x_[t] :> x // Simplify; (* show first two terms *) {, } + O[γ]^3 r2 y 2 r2 z i . − i Out[20]= 9 + r γ + j y j z γ2 + O@γD3 , − r γ + j j−. + z z γ + O@γD3 = 2 { 2 { k k
So, we finally arrive at the following first terms for in g = 1 ê c. The 0th-order term is just the Newtonian distance; a first order term is absent. The higher-order terms are relatively complicated expressions, involving scalar products between the various vectors. In[21]:= ϕ = 1/(r - γ .) // Simplify Out[21]=
1 HH.L2 + r2 H. − .LL γ2 1 − + H. − 3 . L γ3 + r 2 r3 3 1 4 2 2 HH3 H.L + 6 r H.L H. − .L + 4 r4 . H. − 3 . L + 8 r5 r4 H3 H. L2 − r2 .H3L − 6 . . + 3 H.L2 + 4 r2 . + 3 r2 . LL γ4 L + O@γD5
For the non-Abelian case, see [1559]. f) Because we have to test various possible nonvanishing field component arrangements (such as HrL = r er , HrL = J eJ + j ej or HrL = J eJ , HrL = r er + j ej ) where the r,J,j and r,J,j are functions of r and J), we first define a set of functions and then deal with the six possible field sets at once. We start by expressing the unit vectors of a spherical coordinate system through Cartesian coordinates. In[1]:= er := {Cos[ϕ] Sin[ϑ], Sin[ϕ] Sin[ϑ], Cos[ϑ]}
eϕ := {-Sin[ϕ], Cos[ϕ], 0} eϑ := {Cos[ϕ] Cos[ϑ], Sin[ϕ] Cos[ϑ], -Sin[ϑ]}
Solutions
631
The function makeMaxwellEquations constructs the above given ansatz (with the coefficients c[, ir, irc, irs, irse, jJc, jJs, jJse]) for given field components, and plugs the ansatz into the four Maxwell equations [710]. We use some vector analysis functions for spherical coordinates from the package Calculus`VectorAnalysis`. In[4]:= Needs["Calculus`VectorAnalysis`"] In[5]:= makeMaxwellEquations[Components_, o_] :=
Module[{A, A}, (* the ansatz; ComponentsAnsatz is globally visible *) ComponentsAnsatz = Sum[c[#, ir, irc, irs, irse, jϑc, jϑs, jϑse] r^ir* Cos[irc r] If[irs === irse === 0, 0, Sin[irs r]^irse]* Cos[jϑc ϑ] If[jϑs === jϑse === 0, 0, Sin[jϑs ϑ]^jϑse], {ir, -3, -1}, {irc, 0, 1}, {irs, 0, 1}, {irse, 0, 1}, {jϑc, 0, o}, {jϑs, 0, o}, {jϑse, 0, 1}]& /@ Components; (* field definitions *) {A, A} = {#[[1]] Sin[t], #[[2]] Cos[t]}& @ Partition[ If[# === {}, 0, ComponentsAnsatz[[#[[1, 1]]]]]&[ Position[Components, #]]& /@ {r, ϑ, ϕ, r, ϑ, ϕ}, 3]; (* use ansatz in Maxwell equations *) {Div[A, Spherical[r, ϑ, ϕ]], Sin[ϑ] Div[A, Spherical[r, ϑ, ϕ]], Sin[ϑ] (Curl[A, Spherical[r, ϑ, ϕ]] + D[A, t]), Sin[ϑ] (Curl[A, Spherical[r, ϑ, ϕ]] - D[A, t])}]
The function makeMaxwellEquations returns a list of four (possibly quite large) unsimplified Poisson polynomials. To obtain a linear system of equations for the coefficients c[…], we write all trigonometric functions in exponential form and extract their coefficients. extractCoefficients takes the result of makeMaxwellEquations as its argument and returns a list with two elements—a list of rules for the coefficients that are obviously zero and a list of the nontrivial equations. In[6]:= extractCoefficients[mwes_] :=
(* trivial and nontrivial equations in the c[...] *) {zeroCoefficientsRules[#], nontrivialRelations[#]}&[ (* write equations in canonical form *) Join @@ (makecEquations /@ Expand[Map[TrigToExp, Cases[Expand[#], _Plus, {0, Infinity}], {2}]])]& /@ mwes; (* separate Poisson monomial and coefficient *) monomialsAndCoefficients[expr_] := With[{ = Times @@ DeleteCases[List @@ expr, _c | _?NumericQ, {1}]}, {, expr/}] (* collect with respect to Poisson monomials *) makecEquations[p_] := If[Head[p] =!= Plus, 0, Plus @@@ Map[Last, Split[Sort[monomialsAndCoefficients /@ (List @@ p)], #1[[1]] == #2[[1]]&], {2}]] (* make rules . -> 0 for coefficients that do not appear in sums *) zeroCoefficientsRules[l_] := With[{h = Cases[l, _?(Head[#] =!= Plus&)]}, (# -> 0)& /@ Union[(h/(h /. _c -> 1))]] (* extract equations that contain only a single coefficient *) nontrivialRelations[l_] := Cases[l, _?(Head[#] === Plus&)]
Next, we have to solve the linear system of equations that we obtained from the second argument of extractCoeffi cients. The function solveCoefficientEquations does this. It returns the solutions plugged into the ansatz ComponentsAnsatz. In[18]:= solveCoefficientEquations[ceqs_] :=
Module[{dpr, allEqs, allVars, sol}, (* use trivial zeros of the c[...] *) dpr = Dispatch[Join @@ (First /@ ceqs)]; (* all equations *) allEqs = Flatten[(Last /@ ceqs) //. dpr];
Symbolic Computations
632 (* all variables c[...] *) allVars = Union[Cases[allEqs, _c, Infinity]]; (* print number of equations and variables *) Print[Length[allEqs], " equations in ", Length[allVars], " variables."]; (* solve linear system of the c[...] *) sol = Solve[Take[allEqs, All] == 0, allVars]; (* substitute solution into ansatz *) ComponentsAnsatz //. dpr //. sol[[1]]]
The solutions we obtain at this point might not be realizable due to diverging field values at the origin. makeFiniteVal ueAtOrigin avoids divergent terms by making a series expansion around r = 0 and guaranteeing divergent terms to vanish. We start with o = 2 and, if needed, will use larger values of o later. In[19]:= makeFiniteValueAtOrigin[ComponentsR_] :=
Module[{zeroEqs, zeroCs, solFinite}, If[ComponentsR =!= {0, 0, 0}, (* series terms of the fields ~ r^-n *) zeroEqs = makecEquations /@ Flatten[ExpandAll[TrigToExp[finiteOriginValue /@ ComponentsR]]]; zeroCs = Union[Cases[zeroEqs, _c, Infinity]]; (* solve equations for the c[...] *) solFinite = Solve[zeroEqs == 0, zeroCs]; (* resulting field components; finite at the origin *) ComponentsR //. solFinite[[1]]] // Simplify] In[20]:= (* series terms that must vanish *)
finiteOriginValue[expr_] := With[{ser = Series[expr, {r, 0, 0}]}, If[(* expr is a constant *) Head[ser] =!= SeriesData, {}, Table[SeriesCoefficient[ser, k], {k, ser[[4]], -1}]]]
Finally, the function Result forms the resulting time-dependent vectors of the HrL and HrL fields in spherical coordinates. In[22]:= Result[fieldComponents_, res_] :=
Function[r, (* substitute subscripted c’s for c[...] *) r //. Table[#[[k]] -> Subscript[c, k], {k, Length[#]}]&[Union[Cases[r, _c, Infinity]]]][ (* add time dependence *) {Sin[t] #[[1]], Cos[t] #[[2]]}& @ (* make and field *) ((If[MemberQ[fieldComponents, #], res[[ Position[fieldComponents, #][[1, 1]]]], 0]& /@ #)& /@ {{r, ϑ, ϕ}, {r, ϑ, ϕ}})]
Now, we will search for nontrivial solutions for the six possible component assignments that guarantee HrL.HrL = 0. As a side effect, we print the number of linear equations and the number of variables. In[23]:= (* turn off message telling that not all coefficients can be
uniquely determined *) Off[Solve::svars] Function[fieldComponents, (* use ansatz in Maxwell equations *) mwes = makeMaxwellEquations[fieldComponents, 2]; (* form linear equations for the coefficients *) ceqs = extractCoefficients[mwes]; (* solve equations and form fields *) ComponentsR = solveCoefficientEquations[ceqs]; (* make finite field values at origin *) res = makeFiniteValueAtOrigin[ComponentsR] // TrigReduce // Simplify; (* the resulting field components *) {, } = Result[fieldComponents, res]] /@ (* the six field component assignments *) {{r, ϑ, ϕ}, {ϑ, r, ϕ}, {ϕ, r, ϑ}, {r, ϑ, ϕ}, {r, ϕ, ϑ}, {ϑ, ϕ, r}}
Solutions
633 2400 equations in 416 variables. 2530 equations in 402 variables. 1666 equations in 425 variables. 1848 equations in 414 variables. 2248 equations in 414 variables. 2682 equations in 404 variables. Out[25]= 9880, 0, 0 EliminationOrder] // Factor Out[5]= 9x@tD3 I−2 x @tD x @tD xH3L @tD + 2 x @tD x @tD3 xH3L @tD + 2
2
2 x@tD xH3L @tD − 3 x@tD x @tD2 xH3L @tD − x@tD x @tD xH4L @tD + x@tD x @tD3 xH4L @tDM
3
5
7
I2 x @tD − 4 x @tD + 2 x @tD − 2 x @tD x @tD xH3L @tD + 2 x @tD x @tD3 xH3L @tD + 2
2
2 x@tD xH3L @tD − 3 x@tD x @tD2 xH3L @tD − x@tD x @tD xH4L @tD + x@tD x @tD3 xH4L @tDM=
For the elimination of the time variable t, see [989], [1004], [391]. b) This is the original set of differential equations. In[1]:= eqs = {x'[t] - a y[t] z[t], y'[t] - b x[t] z[t], z'[t] - c x[t] y[t]} Out[1]= 8−a y@tD z@tD + x @tD, −b x@tD z@tD + y @tD, −c x@tD y@tD + z @tD
x, x'[t] -> x1, x''[t] -> x2, x'''[t] -> x3, y[t] -> y, y'[t] -> y1, y''[t] -> y2, y'''[t] -> y3, z[t] -> z, z'[t] -> z1, z''[t] -> z2, z'''[t] -> z3} Out[2]= 8x1 − a y z, y1 − b x z, −c x y + z1, x2 − a y1 z − a y z1, y2 − b x1 z − b x z1, −c x1 y − c x y1 + z2, x3 − a y2 z − 2 a y1 z1 − a y z2, y3 − b x2 z − 2 b x1 z1 − b x z2, −c x2 y − 2 c x1 y1 − c x y2 + z3
b x z, z1 -> c x y} Out[3]= 8x1 − a y z, x2 − a c x y2 − a b x z2 , −b c x2 y + y2 − b x1 z,
−c x1 y − b c x2 z + z2, x3 − 2 a b c x2 y z − a y2 z − a y z2, −2 b c x x1 y + y3 − b x2 z − b x z2, −c x2 y − c x y2 − 2 b c x x1 z + z3
arg[head] gets applied to the resulting expression Derivative[1][E][x] . Derivative[1][E] matches head and E matches arg. The result is x[E']. In[2]:= Block[{E}, Print[D[E[x], x] /. head_[arg_] :> arg[head]]]
x@E D
After leaving the Block, the constant E has again the attribute Constant and E' evaluates to 0&. In[3]:= Block[{E}, D[E[x], x] /. head_[arg_] :> arg[head]] Out[3]= x@0 &D
g) The function randomRationalFunction implements the generation of random rational functions in x, y, z. In[1]:= (* a random variable *)
randomVar := {x, y, z}[[Random[Integer, {1, 3}]]]; (* a random product of powers *) randomTerm := Product[randomVar^Random[Integer, {-5, 5}], {Random[Integer, {1, 3}]}];
Solutions
655 (* a random Laurent polynomial *) randomPoly := Sum[Random[Integer, {-5, 5}] randomTerm, {Random[Integer, {1, 3}]}]; (* a random rational function *) randomRationalFunction := randomPoly/randomPoly
Now, we search for a function such that Together does not act idempotent on it. In[9]:= SeedRandom[444];
While[2 = Together[1 = Together[ 0 = Sum[randomRationalFunction, {3}]]]; 2 === 1, Null]; {1, 2} 1 15 H−4 + 5 x − 4 yL y 45 x3 y9 − 12 y6 z + 15 x3 y6 z − 12 y7 z − 48 x4 y6 z5 + 60 x7 y6 z5 − 48 x4 y7 z5 L, 1 − H−100 x3 + 125 x6 − 100 x3 y + 80 x3 y6 − 100 x6 y6 + 80 x3 y7 + 15 y5 H4 − 5 x3 + 4 yL 45 x3 y9 − 12 y6 z + 15 x3 y6 z − 12 y7 z − 48 x4 y6 z5 + 60 x7 y6 z5 − 48 x4 y7 z5 L=
Out[12]= 9 5 H−100 x3 + 125 x6 − 100 x3 y + 80 x3 y6 − 100 x6 y6 + 80 x3 y7 + 3
The nonuniqueness in the form of Together[Hx, y, zL] results often from the factorization of the denominator. h) Because of the last SameQ statement, the question is if the result will be either True or False. The result is False. In[1]:= f1 = Factor[(x[2] - x[1])^3];
f2 = Factor[(x[2] - x[3])^3]; x[1] = x[3]; f1 - f2 === 0 Out[4]= False
Here is what happens in detail: Because of the Orderless attribute of Plus, the summands of (x[2] - x[1])^3 become reordered. In[5]:= Clear[x];
{(x[2] - x[1])^3, (x[2] - x[3])^3} Out[6]= 8H−x@1D + x@2DL3 , Hx@2D − x@3DL3
False][[1, 2]]], Algebraics -> True] Out[2]= False
Here is another example. It uses the small difference between p and a high-order rational approximation to p. In[3]:= Developer`ZeroQ[E^(Pi - FromContinuedFraction[
ContinuedFraction[Pi, 200]]) - 1] Out[3]= True
Because in the last example the transcendental number ep occurred, the Algebraics option cannot cure the last wrong result. In[4]:= Developer`ZeroQ[E^(Pi - FromContinuedFraction[
ContinuedFraction[Pi, 200]]) - 1, Algebraics -> True] Out[4]= True
But again, this is a relatively large input. So let us look for a short transcendental function. The following search gives some candidates. In[5]:= Select[Names["*"], (StringLength[#] Null. More… D::trace : ∂x @xD −−> Derivative@1D@D@xD. More… clearDef1::trace : clearDef1@Derivative, , 0D −−> ê: Derivative@1D@D ê; HclearDef1@Derivative, , 0D; makeDef2@Derivative, , 0D; FalseL =.. More… TagUnset::trace : ê: Derivative@1D@D ê; HclearDef1@Derivative, , 0D; makeDef2@Derivative, , 0D; FalseL =. −−> Null. More… makeDef2::trace : makeDef2@Derivative, , 0D −−> Derivative ê: HoldPattern@Derivative@1D@D@0DD := HclearDef2@Derivative, D; makeDef1@Derivative, , 0D; 0L. More… TagSetDelayed::trace : Derivative ê: HoldPattern@Derivative@1D@D@0DD := HclearDef2@Derivative, D; makeDef1@Derivative, , 0D; 0L −−> Null. More… CompoundExpression::trace : clearDef1@Derivative, , 0D; makeDef2@Derivative, , 0D; False −−> False. More… ReplaceAll::trace : ∂x @xD ê. x → 0 −−> Derivative@1D@D@xD ê. x → 0. More… ReplaceAll::trace : Derivative@1D@D@xD ê. x → 0 −−> Derivative@1D@D@0D. More… Derivative::trace : Derivative@1D@D@0D −−> clearDef2@Derivative, D; makeDef1@Derivative, , 0D; 0. More… clearDef2::trace : clearDef2@Derivative, D −−> Derivative ê: HoldPattern@Derivative@1D@D@0DD =.. More… TagUnset::trace : Derivative ê: HoldPattern@Derivative@1D@D@0DD =. −−> Null. More… makeDef1::trace : makeDef1@Derivative, , 0D −−> ê: Derivative@1D@D ê; HclearDef1@Derivative, , 0D; makeDef2@Derivative, , 0D; FalseL := Null. More… TagSetDelayed::trace : ê: Derivative@1D@D ê; HclearDef1@Derivative, , 0D; makeDef2@Derivative, , 0D; FalseL := Null −−> Null. More… CompoundExpression::trace : clearDef2@Derivative, D; makeDef1@Derivative, , 0D; 0 −−> 0. More… Out[15]= 0
After evaluating D[[x], x] /. x -> 0 we have again the same state of affairs for the definitions as before—the upvalue for and no definitions for Derivative. In[16]:= Off[];
?? Global` Derivative@1D@D ê; HclearDef1@Derivative, , 0D; makeDef2@Derivative, , 0D; FalseL ^:= Null In[18]:= ??Derivative
f' represents the derivative of a function f of one argument. Derivative@n1, n2, ... D@fD is the general form, representing a function obtained from f by differentiating n1 times with respect to the first argument, n2 times with respect to the second argument, and so on. More… Attributes@DerivativeD = 8NHoldAll, ReadProtected
0] stays unevaluated. In[1]:= := #[[Random[Integer, {1, Length[#]}]]]& @
{Exp, Log, x #&, -#&, #^2&, 1/#&, (# + 1)&, (# - 1)&} In[2]:= [n_] := Nest[[#]&, x, n]
Here are some examples of such functions.
Symbolic Computations
660 In[3]:= SeedRandom[1];
Table[[n], {n, 2, 16}] 2
2 3 1 1 Out[4]= 9x, −1 + x , 1 + x2 Log@xD2 , 2 + LogA E, x2 H1+xL , x LogA1 + −x E, −1 − 3 ,
1+x
2
−1 + x x
2
2
1 + H−2 + x2 Log@xDL , LogAH1 + Log@Log@−1−x DDL E, 1 + LogALogALogA−LogA EE EE, 1 2 H−2 + x2 Log@Log@xx DD2 L , LogALogAx J−1 + x J1 + NNEE, Log@xD
1 − LogAx LogA−x5 EE
1 , 1 + 1 LogA1 −
1 1+LogALogALogA EEE Log@xD
,
2 y2 2 i z j z j z j z j Log@1+Log@xDD z j z j −1+LogA E z xj z j z j z j z j z j z j { = k
xE
In[5]:= (* avoid messages *)
Off[N::meprec]; Off[General::ovfl]; Off[Power::infy]; notLimitableFunction[nestDepth_:20] := Module[{f}, While[f = Nest[[#]&, x, Random[Integer, {nestDepth/2, nestDepth}]]; TimeConstrained[Head[Limit[f, x -> 0]], 10] =!= Limit, Null]; f]
And here is a try to find an example of a function returned by notLimitableFunction. In[8]:= SeedRandom[123];
TimeConstrained[notLimitableFunction[], 1000] ∞::indet : Indeterminate expression ComplexInfinity encountered. More… 4 −4+2 LogA 12 E x EE
Out[9]= x LogALogA1 −
Here is an example of a function whose limit cannot be determined. In[10]:= Limit[E^((-1 + E^E^(1/(E^2 x^2 Log[Log[-x]^2]^2))) x), x -> 0]
Out[10]=
1 i j j j j 2 x2 Log@Log@−xD2 D2 j j j −1+ j j j j j j LimitAk
y z z z z z z z x z z z z z z { ,
x → 0E
n) If it is at all possible to find such functions, then the “right” choice of variables will surely be one that converts everything into rational functions. Assuming the trigonometric functions have integer arguments, we implement the following substitution of variables. In[1]:= myTrigIntegrate[int_, x_] :=
Module[{ξ}, intTξ = TrigToExp[int] //. Exp[c_ x] :> ξ^(c/I); Integrate[-I intTξ/ξ, ξ] /. ξ -> Exp[I x]]
The function myTrigIntegrate works as expected. In[2]:= myTrigIntegrate[(Cos[x]^2 + 2)/(Tan[x] + Sin[2x]), x]
1 2
1 4
Out[2]= − Log@ x D + Log@−1 + 2 x D − Log@1 + 4 2 x + 4 x D In[3]:= D[%, x] - (Cos[x]^2 + 2)/(Tan[x] + Sin[2x]) // Simplify Out[3]= 0
Next, we define a function randomTrigSum that returns a random sum of trigonometric function. The function random TrigRational returns the quotient of two random sum of trigonometric function—a rational trigonometric function. In[4]:= (* random sum of trigonometric functions *)
randomTrigSum[c_, n_, o_, p_] := Sum[Random[Integer, {-c, c}] {Cos, Sin, Csc, Sec, Tan, Cot}[[ Random[Integer, {1, 6}]]][ (2 Random[Integer] - 1)* Random[Integer, {1, c}] x]^Random[Integer, {-p, p}], {n}] (* random rational function of trigonometric functions *)
Solutions
661 randomTrigRational[c_, n_, o_, p_] := Module[{num, den}, While[den = randomTrigSum[c, n, o, p]; FreeQ[Simplify[den], x, Infinity], Null]; num = randomTrigSum[c, n, o, p]; num/den]
Here are some examples of random rational trigonometric functions. In[9]:= Table[randomTrigRational[3, 3, 3, 3], {3}]
Sin@xD − 3 Sin@xD3 + 2 Sin@3 xD3 −2 Cos@xD − 3 Tan@3 xD
Out[9]= 9 2 , 3
−2 − Cos@2 xD3 + Tan@3 xD3 3 Tan@xD , = 3 Cot@xD3 + 3 Csc@2 xD + 2 Tan@2 xD −Cot@xD + 3 Cot@2 xD2 − Sec@3 xD
Now, we generate random rational trigonometric functions and try to find an integrand that the built-in Integrate cannot integrate. The function findFunction, beginning with seeding the random number generator, does this. In[10]:= findFunction[seed_, {c_, n_, o_, p_}, maxTries_] :=
Module[{integrand, builtInIntegral, myIntegral, counter = 0}, (* seed random number generator *) SeedRandom[seed]; While[(counter++) < maxTries && (((* built-in integration *) integrand = randomTrigRational[c, n, o, p]; builtInIntegral = Integrate[integrand, x]; FreeQ[builtInIntegral, Integrate, {0, Infinity}, Heads -> True]) || ((* manual substitution of variables *) myIntegral = myTrigIntegrate[integrand, x]; MemberQ[ToRadicals[Normal[myIntegral]], Root, {0, Infinity}, Heads -> True])), Null]; Print[counter]; If[counter == maxTries + 1, (* no integrand found *) $Failed, (* found integrand *) integrand]]
Here is try to find a rational trigonometric function with the property we were looking for. We try 1000 functions. In[11]:= findFunction[1, {2, 2, 2, 2}, 1000]
1001 Out[11]= $Failed In[12]:= If[% =!= $Failed, {Integrate[#, x], myTrigIntegrate[#, x],
(* quick check of the result of myTrigIntegrate *) D[myTrigIntegrate[#, x], x] - % // Simplify}&[%], Null]
o) Mathematica will always find the correct solution for rational coefficients. If we allow nonrational coefficients, then we might find such an example. Because it is algorithmically undecidable if an expression is identical zero and because for a polynomial Solve will never stay unevaluated, we use such a “nearly zero” expression as the coefficient of the leading power. For a sufficient complex “nearly zero” expression Mathematica cannot determine if it is zero. When the coefficient is zero we might get more solutions than exist and when the leading coefficient is zero it might get found to be zero, and Mathematica will miss one solution. We do not have to search too hard to find an expression that is zero, but is not recognized as such by Mathematica. The expression zero is an example. In[1]:= zero = (# - Together[TrigToExp[#]])&[Sin[Pi/13]] Out[1]=
π 1 H−1L11ê26 H−1 + H−1L2ê13 L + SinA E 13 2
In[2]:= Simplify[zero] Out[2]=
1 π H−1L11ê26 H−1 + H−1L2ê13 L + SinA E 2 13
Using zero as the leading coefficient in a quadratic yields correctly one solution. In[3]:= Solve[zero x^2 + x - 1 == 0, x] Out[3]= 88x → 1
ω; res /; FreeQ[res, _Integrate, {0, Infinity}]];
Now, we get the expected result for w @ f HwLD HwL. In[5]:= myBetterFourierTransform[Exp[-ω^2], ω, ω, Assumptions -> Im[ω] == 0] ω2
Out[5]=
− 4 ! è!!!! 2
q) It is easy to find a function such that f H f -1 HzLL = f H f -1 HzLL = z. In[1]:= f[z_] := α z + β; fInv[z_] := (z - β)/α
{f[fInv[z]], fInv[f[z]]} Out[2]= 8z, z
Random[Complex, {-1 - I, 1 + I}, 20]}, {z -> Random[Real, {0, -4}, 20]}} Out[5]= 880. × 10−21 + 0. × 10−21 , 0. × 10−21 + 0. × 10−21 All]& /@ {f[fInv[#]]&, fInv[f[#]]&}]]
3 2 1 0 -5
5 2.5 0 -2.5
0
-2.5 2.5
5
15 10 5 0 -5
-5
5 2.5 0 -2.5
0
-2.5 2.5
5
-5
r) The two-argument form of Simplify with an assumption expressing equality of a variable to an expression can do nothing else then substituting the value for the variable in the expression (it cannot take any limit). Here is a simple example. In[1]:= Simplify[Sin[x]/x, x == 0]
Sin@xD Simplify::infd : Expression simplified to Indeterminate. More… x Out[1]= Indeterminate
And because of the rule for Times that 0×something evaluates to 0, we get in the example under consideration 0. In[2]:= Simplify[x DiracDelta'[x], x == 0] Out[2]= 0
Using the function Simplify`SimplifyPseudoFunctions instead, we get the mathematically correct result. In[3]:= Simplify`SimplifyPseudoFunctions[x DiracDelta'[x]]
Symbolic Computations
664 Out[3]= −DiracDelta@xD
s) The numerical integration gives a finite result for this diverging integral. Taking the steps of the method option setting Oscillatory into account, such a finite result is to be expected. For such-type integrals, the function is integrated between the zeros of the oscillatory function (here sin) and the resulting series of partial integrals is extrapolated. And, as discussed in the Numerics volume, the Wynn extrapolation method will give finite results for diverging series. In[1]:= NIntegrate[Sin[x^2] x^(3/2), {x, 0, Infinity}, Method -> Oscillatory]
SequenceLimit::seqlim : The general form of the sequence could not be determined, and the result may be incorrect. More… Out[1]= 0.418703
Using a larger setting for the WorkingPrecision option yields more digits. In[2]:= NIntegrate[Sin[x] x^(3/2), {x, 0, Infinity}, Method -> Oscillatory,
WorkingPrecision -> 20, PrecisionGoal -> 12] SequenceLimit::seqlim : The general form of the sequence could not be determined, and the result may be incorrect. More… Out[2]= −0.9399856030
Carrying out the symbolic integral and ignoring the given convergence condition gives for the exact value of this integral -3 ê 4 Hp ê 2L1ê2 . In[3]:= int1 = Integrate[Sin[x] x^α, {x, 0, Infinity}]
πα 2 Integrate@xα Sin@xD, 8x, 0, ∞ 3/2, N[int1[[2]] /. α -> 3/2, 12]}
3 "####### π 4
Out[4]= 9− 2 , −0.939985602987=
We obtain the same result by integrating up to a large finite upper limit X and ignoring terms of the form cosHX L X a and sinHX L X a . In[5]:= int2 = Integrate[Sin[x] x^(3/2), {x, 0, X}] Out[5]=
i y z 1 j 2 è!!!!! è!!!!! j−3 è!!!!!!!!! z j % X E + 2 X H−2 X Cos@XD + 3 Sin@XDLz 2 π FresnelSA$%%%%%%% z j z 4 j π k {
In[6]:= Off[Series::esss];
Series[Series[int2, {X, Infinity, 3 "####### π2 Cos@XD 3 1 Out[7]= − − + $%%%%%%% % Cos@XD − 3ê2 4 4 X H 1 L X
2}], {X, Infinity, 2}]
// Normal // Expand
3 Sin@XD 3 1 3ê2 9 1 5ê2 Cos@XD + + J N Sin@XD J N 1 8 X 16 X "####### 2 X
The exact form of the definite integral between consecutive zeros of the sin function is given by the following expression. In[8]:= intP[k_] = Integrate[Sin[x] x^(3/2), {x, k Pi, (k + 1) Pi}, Out[8]=
Assumptions -> k > 0] // Simplify[#, Element[k, Integers]]& 1 è!!!!! π 4 è!!!!!!!!!!!!!! è!!!!!!!!!!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! è!!!!!!!!!!!!!! I4 H−1Lk Ik3ê2 + 1 + k + k 1 + k M π + 3 2 FresnelS@ 2 k D − 3 2 FresnelS@ 2 1 + k DM
As mentioned above, the sequence limit of this series with alternating increasing in magnitude elements gives a finite result (the same as the above NIntegrate calculation). In[9]:= SequenceLimit[FoldList[Plus, 0, N[#, 30]& @ Table[intP[k], {k, 0, 30}]],
Method -> Fit] SequenceLimit::seqlim : The general form of the sequence could not be determined, and the result may be incorrect. More… Out[9]= −0.9399856029866251884
Solutions
665
Another way to obtain the result is the summation of the series with a convergence achieving factor expH-¶ kL and taking the limit ¶ Ø 0. We sum the tail through its asymptotic expansion and take the first term exactly into account. In[10]:= (ser = Series[intP[k], {k, Infinity, 8}] // Normal // PowerExpand //
Simplify[#, Element[k, Integers]]&) // Short[#, 3]& 1 è!!!!! i H−1Lk H99 − 144 k + 224 k2 − 384 k3 + 768 k4 − 2048 k5 + 12288 k6 + 49152 k7 + 65536 k8 L π + Out[10]//Short= π j j 4 8192 k13ê2 k 3 H 1L − 256 k17 1 1 π9 k H 1L H2027025 − 41580 H21 − 6 k + k2 L π2 + 1 − 1 + 256 k8 π8 L 1 H−1L è!!!!! i z zy j + y 3 2 j z z è!!!!! 8388608 2 k33ê2 π9 {{ k2 In[11]:= (sum = Sum[Evaluate[ser Exp[-∂ k]], {k, 15, Infinity}]) // Short[#, 3]& Out[11]//Short=
1 33554432 π17ê2 J67108864 π10 J−14
è!!!!!!!! 14
−14 ∂ + 13
è!!!!!!!! 13
−13 ∂ − 24
è!!!!! 3
3 −12 ∂ + 15 + −∂ + PolyLogA− , −−∂ EN + 2
96 + 25945920 π6 H 1LN In[12]:= Series[sum, {∂, 0, 0}] + Sum[intP[k], {k, 0, 14}] // N[#, 10]& Out[12]= −0.9399856030 + O@∂D1
33. 2D Newton–Leibniz Example, 1D Integral, Square Root of Differential Operator a) Mathematica can do the definite double integral immediately. In[1]:= Integrate[Sqrt[(x - y)^2], {x, 0, 1}, {y, 0, 1}] Out[1]=
1 3
This is the indefinite integral. In[2]:= int = Integrate[Sqrt[(x - y)^2], x, y] Out[2]=
1 è!!!!!!!!!!!!!!!!!!!!!!! x Hx − yL2 y 2
The integral is “correct”. In[3]:= D[%, x, y] // Simplify Out[3]=
è!!!!!!!!!!!!!!!!!!!!!! ! Hx − yL2
The 2D indefinite integral is a continuous (but not everywhere differentiable) function of x and y. In[4]:= Plot3D[int, {x, 0, 1}, {y, 0, 1}, PlotPoints -> 61]
0.1
1 0.8 0.6
0.05 0 0
0.2
0.4
0.4 0.6
0.2 0.8 0 8
1
0
But the substitution of limits gives the obviously wrong (a positive integrand should give a positive integral) result 0. In[5]:= ((# /. x -> 1) - (# /. x -> 0))&[(int /. y -> 1) - (int /. y -> 0)] Out[5]= 0
Carrying out the definite integration using Integrate too gives a wrong result. In[6]:= Integrate[Sqrt[(x - y)^2], {x, 0, 1}, {y, 0, 1}]
Symbolic Computations
666 Out[6]=
1 3
This means that the Newton–Leibniz theorem was not applicable because the indefinite integral did not fulfill all suppositions needed. Now, we do the two integrations step-by-step. In[7]:= int = Integrate[Sqrt[(x - y)^2], x] // Factor Out[7]=
è!!!!!!!!!!!!!!!!!!!!!!! x Hx − 2 yL Hx − yL2 2 Hx − yL
The integral has a jump for a generic value of In[8]:= (* suppress messages due to division by 0 *)
Off[Power::"infy"]; Off[Infinity::"indet"]; Off[Plot3D::"plnc"]; Off[Plot3D::"gval"] indefIntGraphics[int_] := Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {Plot[Evaluate[int /. y -> 0.3], {x, 0, 1}], Plot3D[Evaluate[int], {x, 0, 1}, {y, 0, 1}, PlotPoints -> {61, 61}, Mesh -> False]}]]]; In[12]:= indefIntGraphics[int]; 0.2 0.15 0.5 0.25 0 -0.25 -0.5 0
0.1 0.05
0.2
0.4
0.6
0.8
1 0.8 0.6 0.2
1
0.4
0.4 0.6
-0.05
0.2 0.8 0 8
1
0
Let us fix this jump by adding a function that makes everything together smooth. In[13]:= δ = (-x (x - 2y) /. x -> y)(Sqrt[(x - y)^2]/(x - y) + 1)/2 Out[13]=
! è!!!!!!!!!!!!!!!!!!!!!! 1 i Hx − yL2 y 2 j1 + z j z zy 2 j x−y k {
In[14]:= int1 = int + δ // Together // Factor Out[14]=
1 è!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!! Ix Hx − yL2 − Hx − yL2 y + y2 M 2
In[15]:= indefIntGraphics[int1]
0.25 0.2 0.4
0.15
1 0.8 0.6
0.2 0 0
0.1 0.05 0.2
0.4
0.6
0.8
0.2
0.4
1
Now let us deal with the second integration. In[16]:= int2 = Integrate[int1, y] // Together // Factor Out[16]=
è!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!! y I3 x2 Hx − yL2 − 3 x Hx − yL2 y + x y2 + Hx − yL2 y2 − y3 M 6 Hx − yL
Again, we have a jump.
0.4 0.6
0.2 0.8 0 8
1
0
Solutions
667 In[17]:= indefIntGraphics[int2] 0.07 0.06 0.05 0.2 0.15 0.1 0.05 0 0
0.04 0.03 0.02 0.01 0.2
0.4
0.6
0.8
1 0.8 0.6 0.2
0.4
0.4 0.6
1
0.2 0.8 0 8
1
0
We again add a function δ2 to obtain a smooth function of two variables. In[18]:= int2a = int2 // Expand Out[18]=
è!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!! ! x2 Hx − yL2 y x Hx − yL2 y2 Hx − yL2 y3 x y3 y4 − + + − 2 Hx − yL 2 Hx − yL 6 Hx − yL 6 Hx − yL 6 Hx − yL
In[19]:= int2a /. Sqrt[(x - y)^2]/(x - y) -> 1 Out[19]=
y3 x y3 y4 x2 y x y2 − − + + 2 6 6 Hx − yL 6 Hx − yL 2
In[20]:= Together[%] /. y -> x Out[20]=
x3 3
In[21]:= δ2 = x^3/3 (Sqrt[(x - y)^2]/(x - y) + 1)/2 Out[21]=
! è!!!!!!!!!!!!!!!!!!!!!! i 1 Hx − yL2 y j z x3 j z z j1 + 6 x−y k {
In[22]:= int3 = int2 - δ2 // Together // Factor
1 6
Out[22]= − Hx − yL Ix2 + x
! è!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!! Hx − yL2 + x y − Hx − yL2 y + y2 M
In[23]:= Collect[int3, Sqrt[(x - y)^2]] // Factor Out[23]=
1 3ê2 I−x3 − HHx − yL2 L + y3 M 6
Now, we have a nice, smooth, correct double indefinite result. In[24]:= indefIntGraphics[int3]
0.2
0.4
0.6
0.8
1
-0.02 0.1 0 -0.1 -0.2 -0.3
-0.04 -0.06
0
-0.08 -0.1
1 0.8 0.6 0.2
0.4
0.4 0.6
0.2 0.8 0 8
1
1ê2
Differentiation yields HHx - yL2 L . In[25]:= D[int3, x, y] // Together // Factor Out[25]=
è!!!!!!!!!!!!!!!!!!!!!! ! Hx − yL2
In[26]:= (int3 /. y -> 1) - (int3 /. y -> 0)
1 6
Out[26]= − H−1 + xL I1 −
è!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!! 1 è!!!!!!! H−1 + xL2 + x + H−1 + xL2 x + x2 M + x Ix2 + x x2 M 6
In[27]:= (% /. x -> 1) - (% /. x -> 0) Out[27]=
1 3
0
Symbolic Computations
668 This is the result we also get from numerical integration. In[28]:= NIntegrate[Sqrt[(x - y)^2], {x, 0, 1}, {y, 0, 1}] Out[28]= 0.333333
b) A direct evaluation of the definite integral gives the result g - 1 ê 2. In[1]:= Off[Series::esss];
Integrate[integrand = Exp[-2 x] (Coth[x] - 1/x), {x, 0, Infinity}] 1 2
Out[2]= − + EulerGamma
But we can also calculate the indefinite integral. In[3]:= indefInt = Integrate[integrand, x] // Simplify Out[3]=
−2 x − ExpIntegralEi@−2 xD + Log@−1 + −2 x D 2
The indefinite integral is a continuous function along the positive real line. Its value at x = 0 is g - 1 ê 2. In[4]:= Series[indefInt, {x, 0, 0}, Assumptions -> x < 0]
1 2
Out[4]= J − EulerGammaN + O@xD1
After making the indefinite integral real-valued along the positive real axis and expanding the function ExpIntegralEi, we see that the upper limit contribution to the integral vanishes. In[5]:= indefInt /. {Log[Exp[-2 x] - 1] -> -I Pi,
ExpIntegralEi[-2 x] :> (Normal[Series[ExpIntegralEi[ξ], {ξ, Infinity, 1}]] /. ξ -> -2x)} −2 x −2 x Out[5]= + 2 2x
Another possibility to calculate the integral is the following. We split the one convergent integral into two divergent integrals and use the option setting GenerateConditions -> False . This allows evaluating one of the integrals. We also multiply each term with a symbolic factor of the form x m to have a nontrivial parameter dependence. This again yields again the result g - 1 ê 2. Multiplying each term with a symbolic factor of the form x m yields again the result g - 1 ê 2. In[6]:= Integrate[x^µ #, {x, 0, Infinity},
GenerateConditions -> False]& /@
Expand[integrand]
Out[6]= −2−µ Gamma@µD + 2−1−µ Gamma@1 + µD H−1 + PolyLog@1 + µ, 1D + Zeta@1 + µDL In[7]:= Series[%, {µ, 0, 0}] // Simplify // Normal
1 2
Out[7]= − + EulerGamma
The value g - 1 ê 2 agrees with the result of a numerical integration. In[8]:= Off[General::unfl]; Off[General::ovfl];
{NIntegrate[Evaluate[integrand], {x, 0, Infinity}, WorkingPrecision -> 30], N[EulerGamma - 1/2, 30]} Out[9]= 80.077215664901532860607, 0.0772156649015328606065120900824
Times[ts]; (* solve for α[d] *) sol = Solve[zero == 0, α[k][x]]; (* new approximation for sqrt *) sqrt = sqrt + [α[k][x] /. sol[[1]], [k]], {k, -2, -10, -1}]
We implement some formatting rules to display the result in a concise form. In[22]:= With[{tf = TraditionalForm},
(* format x-dependent parts to the left of ∂’s *) MakeBoxes[[k_], tf] := SuperscriptBox["∂", MakeBoxes[k, tf]]; (* format ’s as ∂’s *) MakeBoxes[C[us_, [k_]], tf] := RowBox[{MakeBoxes[us, tf], MakeBoxes[[k], tf]}]; (* sort ’s in decreasing order *) MakeBoxes[List[args__], tf] := RowBox[Drop[Flatten[ Transpose[{MakeBoxes[#, tf]& /@ {args}, Table["+", {Length[{args}]}]}], 1], -1]]]
We now simplify and format the calculated first terms of the factorization of = ∑2 . ê ∑ x2 + uHxL.. In[23]:= res1 = Simplify[(* unite prefactors of equal [k] *)
(sqrt /. -> C) //. α_. C[a_, _] :> C[α a, ] //.
Symbolic Computations
670 C[a_, _] + C[b_, _] :> C[a + b, ]] /. {u[x] -> u, Derivative[j_][u][x_] :> Derivative[j][u]}; In[24]:= res2 = Sort[List @@ res1, Function[f, f[#1] > f[#2]][
Cases[#, [_], {0, Infinity}, Heads -> True][[1, 1]]&]&]; In[25]:= res2 // TraditionalForm Out[25]//TraditionalForm=
u u£ 1 3 u u£ uH3L ∑1 + ÅÅÅÅÅ ∑-1 + - ÅÅÅÅÅÅÅÅ ∑-2 + ÅÅÅÅÅ Hu££ - u2 L ∑-3 + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅ ∑-4 + 2 4 8 8 16 1 1 ÅÅÅÅÅÅÅÅÅ H2 u3 - 14 u££ u - 11 Hu£ L2 + uH4L L ∑-5 + ÅÅÅÅÅÅÅÅÅ H-30 u£ u2 + 30 uH3L u + 60 u£ u££ - uH5L L ∑-6 + 32 64 1 ÅÅÅÅÅÅÅÅÅÅÅÅ H-5 u4 + 110 u££ u2 + 170 Hu£ L2 u - 62 uH4L u - 91 Hu££ L2 - 148 u£ uH3L + uH6L L ∑-7 + 128 1 ÅÅÅÅÅÅÅÅÅÅÅÅ H140 u£ u3 - 350 uH3L u2 - 1400 u£ u££ u + 126 uH5L u - 350 Hu£ L3 + 490 u££ uH3L + 350 u£ uH4L - uH7L L ∑-8 + 256 1 ÅÅÅÅÅÅÅÅÅÅÅÅ I14 u5 - 700 u££ u3 - 14 H115 Hu£ L2 - 73 uH4L L u2 + H3178 Hu££ L2 + 4984 u£ uH3L - 254 uH6L L u 512 2 699 HuH3L L + 4718 Hu£ L2 u££ - 1262 u££ uH4L - 810 u£ uH5L + uH8L M ∑-9 + 1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å H-630 u£ u4 + 2940 uH3L u3 + 42 H420 u£ u££ - 67 uH5L L u2 + 6 H1470 Hu£ L3 - 2702 uH4L u£ - 4130 u££ uH3L + 85 uH7L L u 1024 18438 Hu£ L2 uH3L + 3780 uH3L uH4L + 3192 u££ uH5L - 42 u£ H543 Hu££ L2 - 44 uH6L L - uH9L L ∑-10
With some handwork one can, for the special differential operator = ∑2 . ê ∑ x2 + uHxL, even derive a closed-form nonlinear recursion relation for the a-k HxL = a-k HuHxL, u£ HxL, …, uHkL HxLL [1577] 1 ak HxL = - ÅÅÅÅÅ 2
-k-2 - j-k-1 ij yz -j yz i H-i- j-k-1L jja£ HxL + HxLzzzz z a- j HxL a-i ‚ ‚ jj jj k+1 -i - j - k - 1 { j=1 i=1 k k {
where the recursion starts with a-1 HxL = uHxL ê 2. In[26]:= α[-1] = u[x]/2;
α[k_] := α[k] = Factor[-(D[α[k + 1], x] + Sum[Binomial[-j, -k - 1 - j - i]* α[-j] D[α[-i], {x, -k - 1 - j - i}], {j, -k - 2}, {i, -k - 1 - j}])/2]
This recursion yields the just-calculated result. In[28]:= (* above calculated coefficients *)
Expand[Table[Cases[res1, C[_, [k]]][[1, 1]], {k, -1, -10, -1}] (* coefficients from the recursion relation *) (Table[α[k], {k, -1, -10, -1}] /. {u[x] -> u, Derivative[j_][u][x_] :> Derivative[j][u]})] Out[29]= 80, 0, 0, 0, 0, 0, 0, 0, 0, 0
250, DisplayFunction -> Identity, PlotStyle -> {{GrayLevel[0], Thickness[0.005]}}], Table[(* partial sums of the symbolic solution *) Plot[Evaluate[Sum[∂^i y[i][t], {i, 0, j}] /. solList], {t, 0, 8/∂}, PlotPoints -> 250, DisplayFunction -> Identity, PlotStyle -> {{Hue[0.8 j/5], Thickness[0.002]}}], {j, 0, 5}]}, DisplayFunction -> $DisplayFunction, Frame -> True, Axes -> False], (* show all solutions *) Show[Table[ Plot[(* display logarithm of squared error *) Evaluate[Log[10, Abs[diff[t] /. d[j]]]], {t, 0, 8/∂}, PlotPoints -> 250, DisplayFunction -> Identity, PlotStyle -> {{Hue[0.8 j/5], Thickness[0.002]}}], {j, 0, 5}], DisplayFunction -> $DisplayFunction, Frame -> True, Axes -> False]}]]] 4
2
2
-2
0
-4
0
-6
-2
-8 -10
-4 0
20
40
60
80
0
20
40
60
80
For more general perturbation methods of oscillators, see [106], [556], [1870], and [1386]. For the case of general initial conditions, we proceed similarly as above. We will impose general initial conditions to y0 HtL and vanishing boundary conditions to all other yk HtL. In[13]:= ∂ =.;
Y = Sum[∂^i y[i][t], {i, 0, 4}] + O[∂]^5; eqs = Factor[Numerator[Together[#]]]& /@ CoefficientList[Normal[D[Y, {t, 2}] + Y + ∂ Y^3], ∂];
For a more concisely written result, we define a function writeNice. It collects terms with respect to the initial conditions.
Solutions
691 In[16]:= writeNice
:= (a_ -> b_) :> (a -> Internal`FromDistributedTermsList[ Factor @ Internal`DistributedTermsList[b, {, }]])
Now the solution for the zeroth order is y0 HtL = cosHtL + sinHtL. In[17]:= solList = DSolve[{eqs[[1]] == 0, y[0][0] == , y[0]'[0] == },
y[0][t], t][[1]] Out[17]= 8y@0D@tD → Cos@tD + Sin@tD
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
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 (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 100150 200
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 100150 200
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 SinA ArcTan@er, eiDE SinAHei + er L CosA ArcTan@er, eiDEEN + 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 SinAHei + er L CosA ArcTan@er, eiDEE SinhAHei2 + er2 L SinA ArcTan@er, eiDEE 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 SinA ArcTan@er@eiD, eiDEE SinhAHei2 + er@eiD2 L 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 + 19z 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 CoshAHei + er@eiD L SinA ArcTan@er@eiD, eiDEE Hei2 + er@eiD2 L + 2 2 1 2 2 1ê4 SinA ArcTan@er@eiD, eiDE
14 + 4 er@eiD Hei + er@eiD L 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]=
π + LogA x + è!!!!!!!!!!!!!!!! 1 − x2 E 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
(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 1 H−H−1L −H−1L L H−H−1L +H−1L L HH−1L4ê9 − H−1L5ê9 L I H−H−1L7ê18 − H−1L11ê18 L − M 2 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 − H−1L5ê9 L j −1 − j j j H−H−1L j j j k k
y zy z H−H−1L4ê9 − H−1L5ê9 L H−H−1L7ê18 + H−1L11ê18 L z z z z z zz z 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 H−H−1L − H−1L L − M z 2 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 Subscript[f, n] 1 Abs@f1 D f20 1 H11 f1 H59520825 f92 − 150368400 f1 f72 f3 + 116953200 f21 f52 f23 − 30576000 f31 f32 f33 + 1911000 f41 f2 f43 + 29238300 f21 f62 f4 − 34398000 f31 f42 f3 f4 + 8599500 f41 f22 f23 f4 − 254800 f51 f33 f4 + 2149875 f41 f32 f24 − 573300 f51 f2 f3 f24 + 6825 f61 f34 − 4127760 f31 f52 f5 + 3439800 f41 f32 f3 f5 − 458640 f51 f2 f23 f5 − 343980 f51 f22 f4 f5 + 32760 f61 f3 f4 f5 + 9828 f61 f2 f25 + 429975 f41 f42 f6 − 229320 f51 f22 f3 f6 + 10920 f61 f23 f6 + 16380 f61 f2 f4 f6 − 504 f71 f5 f6 − 32760 f51 f32 f7 + 9360 f61 f2 f3 f7 − 360 f71 f4 f7 + 1755 f61 f22 f8 − 180 f71 f3 f8 − 60 f71 f2 f9 + f81 f10 L δ1 − 11 f21 H−28194075 f82 + 58476600 f1 f62 f3 − 34398000 f21 f42 f23 + 5733000 f31 f22 f33 −
Solutions
725 127400 f41 f43 − 10319400 f21 f52 f4 + 8599500 f31 f32 f3 f4 − 1146600 f41 f2 f23 f4 − 429975 f41 f22 f24 + 40950 f51 f3 f24 + 1289925 f31 f42 f5 − 687960 f41 f22 f3 f5 + 32760 f51 f23 f5 + 49140 f51 f2 f4 f5 − 756 f61 f25 − 114660 f41 f32 f6 + 32760 f51 f2 f3 f6 − 1260 f61 f4 f6 + 7020 f51 f22 f7 − 720 f61 f3 f7 − 270 f61 f2 f8 + 5 f71 f9 L δ2 + 55 f31 H1670760 f72 − 2751840 f1 f52 f3 + 1146600 f21 f32 f23 − 101920 f31 f2 f33 + 429975 f21 f42 f4 − 229320 f31 f22 f3 f4 + 10920 f41 f23 f4 + 8190 f41 f2 f24 − 45864 f31 f32 f5 + 13104 f41 f2 f3 f5 − 504 f51 f4 f5 + 3276 f41 f22 f6 − 336 f51 f3 f6 − 144 f51 f2 f7 + 3 f61 f8 L δ3 − 55 f41 H−343980 f62 + 429975 f1 f42 f3 − 114660 f21 f22 f23 + 3640 f31 f33 − 57330 f21 f32 f4 + 16380 f31 f2 f3 f4 − 315 f41 f24 + 4914 f31 f22 f5 − 504 f41 f3 f5 − 252 f41 f2 f6 + 6 f51 f7 L δ4 + 231 f51 H12285 f52 − 10920 f1 f32 f3 + 1560 f21 f2 f23 + 1170 f21 f22 f4 − 120 f31 f3 f4 − 72 f31 f2 f5 + 2 f41 f6 L δ5 − 231 f61 H−1365 f42 + 780 f1 f22 f3 − 40 f21 f23 − 60 f21 f2 f4 + 2 f31 f5 L δ6 + 330 f71 H78 f32 − 24 f1 f2 f3 + f21 f4 L δ7 − 165 f81 H−9 f22 + f1 f3 L δ8 + 55 f91 f2 δ9 + f10 1 δ10 + 8 2 6 2 3 4 3 4 2 H654729075 f10 2 − 1964187225 f1 f2 f3 + 1929727800 f1 f2 f3 − 714714000 f1 f2 f3 + 84084000 f1 f2 f43 − 1401400 f51 f53 + 413513100 f21 f72 f4 − 643242600 f31 f52 f3 f4 + 252252000 f41 f32 f23 f4 − 21021000 f51 f2 f33 f4 + 47297250 f41 f42 f24 − 23648625 f51 f22 f3 f24 + 1051050 f61 f23 f24 + 525525 f61 f2 f34 − 64324260 f31 f62 f5 + 75675600 f41 f42 f3 f5 − 18918900 f51 f22 f23 f5 + 560560 f61 f33 f5 − 9459450 f51 f32 f4 f5 + 2522520 f61 f2 f3 f4 f5 − 45045 f71 f24 f5 + 378378 f61 f22 f25 − 36036 f71 f3 f25 + 7567560 f41 f52 f6 − 6306300 f51 f32 f3 f6 + 840840 f61 f2 f23 f6 + 630630 f61 f22 f4 f6 − 60060 f71 f3 f4 f6 − 36036 f71 f2 f5 f6 + 462 f81 f26 − 675675 f51 f42 f7 + 360360 f61 f22 f3 f7 − 17160 f71 f23 f7 − 25740 f71 f2 f4 f7 + 792 f81 f5 f7 + 45045 f61 f32 f8 − 12870 f71 f2 f3 f8 + 495 f81 f4 f8 − 2145 f71 f22 f9 + 220 f81 f3 f9 + 66 f81 f2 f10 − f91 f11 L δ@x − ξDL
For f being the identity function, the last expression simplifies to dH10L Hx - xL. In[19]:= Derivative[10][δ][f] /. f -> Function[x, x] Out[19]= δH10L @x − ξD
Let us check a second example numerically, dH6L HxL. Here is the exact result for f HxL = x3 - 1. In[20]:= Integrate[Derivative[6][δ][f] /. f -> Function[x, x^3 - 1] /.
ξ -> 1 /. δ -> DiracDelta, {x, 0, 3}] // N Out[20]= 95.7659
Here is a plot of the smoothed function. The function values are in the order 1019 ; so to find an integral of the order 102 we cannot use machine arithmetic to carry out the integration. In[21]:= With[{δ = 10^-5},
Plot[Evaluate[Derivative[6, 0][smoothδ][x^3 - 1, δ]], {x, 0.995, 1.005}, PlotRange -> All, Frame -> True, Axes -> False]] 1.5 µ 1019 1 µ 1019 5 µ 1018
0 -5 µ 1018 -1 µ 1019
-1.5 µ 1019 -2 µ 1019 0.996
0.998
1
1.002
1.004
Using high-precision arithmetic, we obtain a good agreement with the exact value. In[22]:= With[{δ = 10^-5},
NIntegrate[Evaluate[Derivative[6, 0][smoothδ][x^3 - 1, δ]], {x, 0, 2}, MaxRecursion -> 15, PrecisionGoal -> 6, WorkingPrecision -> 30]] Out[22]= 95.7781
d) We start by implementing a function θSimplify for simplifying products of UnitStep functions. In[1]:= θSimplify[expr_] :=
With[{θ = UnitStep}, Expand[expr] /. θ[x_, y_] :> θ[x] θ[y] /.
Symbolic Computations
726 θ[x_]^n_ :> θ[x] //. θ[z + n1_.] θ[z + n2_.] :> θ[z + Min[n1, n2]] //. θ[n1_. - z] θ[n2_. - z] :> θ[Min[n1, n2] - z] //. (θ[z + n1_.] θ[n2_. - z] :> 0 /; n2 ξ < z < ξ + 1], {ξ, 0, n - 1}]]; (* write result in nice form *) Collect[res, Union[#/(# /. _UnitStep -> 1)&[List @@ res]], Factor]]
Finally, for better readability of the result, we introduce the characteristic function ca,b that is 1 inside the interval @a, bD and zero everywhere else. In[7]:= toχRule = UnitStep[n1_ - z] UnitStep[z + n2_.] :> Subscript[χ, -n2, n1];
So, we arrive at the following expressions for the probability densities for n random variables with uniform distribution. In[8]:= [2][z] /. toχRule Out[8]= z χ0,1 + H2 − zL χ1,2 In[9]:= [3][z] /. toχRule Out[9]=
1 1 1 z2 χ0,1 + H−3 + 6 z − 2 z2 L χ1,2 + H−3 + zL2 χ2,3 2 2 2
In[10]:= [4][z] /. toχRule Out[10]=
1 1 1 1 z3 χ0,1 + H4 − 12 z + 12 z2 − 3 z3 L χ1,2 + H−44 + 60 z − 24 z2 + 3 z3 L χ2,3 − H−4 + zL3 χ3,4 6 6 6 6
In[11]:= [5][z] /. toχRule Out[11]=
1 1 1 z4 χ0,1 + H−5 + 20 z − 30 z2 + 20 z3 − 4 z4 L χ1,2 + H155 − 300 z + 210 z2 − 60 z3 + 6 z4 L χ2,3 + 24 24 24 1 1 H−655 + 780 z − 330 z2 + 60 z3 − 4 z4 L χ3,4 + H−5 + zL4 χ4,5 24 24
All probability densities are properly normalized. In[12]:= Table[Integrate[[k][z], {z, 0, k}], {k, 1, 5}] Out[12]= 81, 1, 1, 1, 1
True, Axes -> False, PlotRange -> All, DisplayFunction -> Identity], {k, 1, 5}]]] 1 0.8 0.6 0.4 0.2 0
-1-0.50 0.5 1 1.5 2
1 0.8 0.6 0.4 0.2 0
-1
0
1
2
3
0.7 0.6 0.5 0.4 0.3 0.2 0.1 0
-1 0
1
2
3
4
0.6 0.5 0.4 0.3 0.2 0.1 0
-1 0 1 2 3 4 5
0.6 0.5 0.4 0.3 0.2 0.1 0
-1 0 1 2 3 4 5 6
Solutions
727
We could, of course, also express the functions using Piecewise instead of UnitStep. Here this is done. In[14]:= [1][z_] := Piecewise[{{1, 0 < z < 1}}]
[n_][z_] := [n][z_] = Integrate[[1][y] [n - 1][z - y], {y, -Infinity, Infinity}] //. (* do not care about individual points *) HoldPattern[Piecewise[{a___, {_, z == _}, b___}, c_]] :> Piecewise[{a, b}, c] In[16]:= Do[[k][z], {k, 6}]
[6][z] Ø − 1 H−6 + zL5 ≤ ≤ 120 ≤ ≤ ≤ ≤ ≤ z5 ≤ ≤ ≤ ≤ ≤ 120 ≤ ≤ ≤ 1 ≤ H6 − 30 z + 60 z2 − 60 z3 + 30 z4 − 5 z5 L ≤ ≤ 120 Out[17]= ∞ ≤ 1 ≤ ≤ H2193 − 3465 z + 2130 z2 − 630 z3 + 90 z4 − 5 z5 L ≤ ≤ 60 ≤ ≤ ≤ ≤ 1 ≤ ≤ H−10974 + 12270 z − 5340 z2 + 1140 z3 − 120 z4 + 5 z5 L ≤ ≤ 120 ≤ ≤ ≤ ≤ 1 2 3 4 5 ≤ ± 60 H−237 + 585 z − 570 z + 270 z − 60 z + 5 z L
5 {Thickness[0.006], Hue[0]}] 2 1.5 1 0.5 0 -1.5
-1
-0.5
0
0.5
1
1.5
6
We carry out a numerical simulation using 10 random 2 µ 2 matrices. The data agree very well with the theoretical distribution. In[7]:= Module[{data = Table[Det[Table[Random[], {2}, {2}]], {10^6}],
binSize = (* optimal bin size *) 0.0084}, Show[{Graphics[(* make histogram *) Apply[Polygon[{{#1, 0}, {#1, #3}, {#2, #3}, {#2, 0}}]&, (* bin the data *) {First[#] binSize, (First[#] + 1) binSize, Length[#]/Length[data]/binSize}& /@ Split[Quotient[Sort[data], binSize]], {1}], Frame -> True], (* exact distribution *) exactPdfGraphic}, PlotRange -> {-0.2, 2.2}]] 2 1.5 1 0.5 0 -1.5
-1
-0.5
0
0.5
1
1.5
For probability densities of determinants of matrices with Gaussian distributions, see [374]. f) After carrying out the integration over xn using the Dirac delta function, we are left with an n - 1 dimensional integral. It is straightforward to implement the remaining integrations. Unfortunately, this is relatively slow. In[1]:= iDomains[n_] := Table[{t[k + 1], 0, 1 - Sum[t[i], {i, k}]},
{k, n - 2, 0, -1}] In[2]:= startIntegrand[n_] :=
Derivative[n - 1][f][Array[t, n].Array[x, n]] /. t[n] -> 1 - Sum[t[i], {i, n - 1}] In[3]:= Int1[x_, n_] := Fold[Integrate, startIntegrand[n], iDomains[n]] In[4]:= ((Int1[x, 5] // Timing) /. x[k_] :> Subscript[x, k]) // Short[#, 6]& f@x1 D−f@x2 D −f@x1 D+f@x5 D i Hx − x L I + M
3 4 j 1 x1 −x2 x1 −x5 j + Out[4]//Short= 96.58 Second, j j j
Hx3 − x4 L Hx3 − x5 L Hx4 − x5 L j k
f@x1 D−f@x2 D I x1 −x2
−f@1D+1 + M Hx4 − x5 L x1 −x3 x2 − x3
x2 − x5
f@x1 D−f@x2 D I x1 −x2
−f@x1 D+f@x4 D + M H−x3 + x5 L y z x1 −x4 z + z z z= x 2 − x4 {
We can speed up the integration by a substantial factor by calculating only the indefinite integral and substituting the limits. In[5]:= integrate[f_, {x_, xl_, xu_}] :=
((# /. x -> xu) - (# /. x -> xl))&[Integrate[f, x]] In[6]:= Int2[x_, n_] := Fold[integrate, startIntegrand[n], iDomains[n]]
Symbolic Computations
730 In[7]:= Int2[x, 5]; // Timing Out[7]= 80.61 Second, Null
False] // FullSimplify[#, 0 < ∂ < 1]&
Out[5]= 1 ¶
This means Ÿ-¶ f¶HxL HxL hHxL dx tends to hHxL as ¶ Ø 1. So, we have lim¶Ø1 f¶HxL HxL = dHx - xL. Now let us look for differential equations for f¶HxL HxL. The first-order differential equation i H2 x ¶ - 2 xL HxL £ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ f¶ HxL f¶HxL HxL = - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 H1 - ¶L follows immediately after differentiation. In[6]:= D[f[∂, ξ][x], x]/f[∂, ξ][x]
H2 x ∂ − 2 ξL 2 H1 − ∂L
Out[6]= −
To derive an x-free differential equation, we differentiate f¶HxL HxL multiple times. Then we algebraize the resulting equations by replacing exponentials involving x by new variables ε1 and ε2. In[7]:= eqs = Table[Numerator[Together[Derivative[j][[∂, ξ]] - D[f[∂, ξ][x], {x, j}]]],
{j, 0, 3}] /. (* make algebraic system *) {Exp[I x ξ/(1 - ∂)] :> ε1, Exp[I x^2 ∂/(2 (1 - ∂)) + r_] :> ε2 Exp[r]} ∂ ξ2
Out[7]= 9−H−1L1ê4 ε1 + 2 2 H1−∂L
è!!!!! è!!!!!!!!!!!!!! π 1 − ∂ ε2 @∂, ξD, ∂ ξ2
−H−1L3ê4 x ∂ ε1 + H−1L3ê4 ε1 ξ − 2 2 H1−∂L 2
∂ ξ2 2 H1−∂L
è!!!!! è!!!!!!!!!!!!!! π 1 − ∂ ε2 @∂, ξD +
è!!!!! è!!!!!!!!!!!!!! π 1 − ∂ ∂ ε2 @∂, ξD , H−1L3ê4 ∂ ε1 − H−1L3ê4 ∂2 ε1 + H−1L1ê4 x2 ∂2 ε1 − ∂ ξ2
2 H−1L1ê4 x ∂ ε1 ξ + H−1L1ê4 ε1 ξ2 + 2 2 H1−∂L ∂ ξ2 2 H1−∂L
è!!!!! è!!!!!!!!!!!!!! π 1 − ∂ ε2 @∂, ξD −
∂ ξ2 2 H1−∂L
è!!!!! è!!!!!!!!!!!!!! è!!!!! è!!!!!!!!!!!!!! 2 π 1 − ∂ ∂ ε2 @∂, ξD + 2 π 1 − ∂ ∂ ε2 @∂, ξD , 4 −3 H−1L1ê4 x ∂2 ε1 + 3 H−1L1ê4 x ∂3 ε1 + H−1L3ê4 x3 ∂3 ε1 + 3 H−1L1ê4 ∂ ε1 ξ − 3 H−1L1ê4 ∂2 ε1 ξ − 3 H−1L3ê4 x2 ∂2 ε1 ξ + 3 H−1L3ê4 x ∂ ε1 ξ2 − H−1L3ê4 ε1 ξ3 − ∂ ξ2
∂ ξ è!!!!! è!!!!!!!!!!!!!! è!!!!! è!!!!!!!!!!!!!! π 1 − ∂ ε2 @∂, ξDH3L + 6 2 H1−∂L π 1 − ∂ ∂ ε2 @∂, ξDH3L −
∂ ξ2
∂ ξ è!!!!! è!!!!!!!!!!!!!! 2 è!!!!! è!!!!!!!!!!!!!! π 1 − ∂ ∂ ε2 @∂, ξDH3L + 2 2 H1−∂L π 1 − ∂ ∂3 ε2 @∂, ξDH3L =
2 2 H1−∂L 6 2 H1−∂L
2
2
Eliminating ε1, ε2, and x yields the following polynomials. In[8]:= gb = GroebnerBasis[(* eliminate ε1 *)
Cases[Factor[Resultant[First[eqs], #, ε1]& /@ Rest[eqs]], _Plus, {2}], {}, (* eliminate ε2 and x *){ε2, x}, MonomialOrder -> EliminationOrder] // Factor;
Here are two of the possible differential equations, a second-order and a third-order one. In[9]:= {gb[[1, -1]], gb[[3, -1]]} // Simplify Out[9]= 8∂ @∂, ξD2 − H−1 + ∂L H@∂, ξD L2 + H−1 + ∂L @∂, ξD @∂, ξD ,
2 ∂ H@∂, ξD L2 + @∂, ξD H−∂ @∂, ξD − H−1 + ∂L @∂, ξD L + H−1 + ∂L @∂, ξD @∂, ξDH3L
D[f[∂, ξ][x], {x, j}] /. [∂, ξ] :> f[∂, ξ][x] // Simplify
Symbolic Computations
732 Out[10]= 80, 0
L > 0] // Simplify, c[L_][0] i j j j k
n2 π2 − 4 L2
Out[2]= 9j j j
= 1/(2L) Integrate[f[x] Exp[I 0 x/L Pi], {x, -L, L}, Assumptions -> L > 0] // Simplify} i j nπ 2 è!!!!! j "###################################### 2 2# 2 π j JL − N E + j jH2 L − n πL H2 L + n πL ErfA$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% j 2L k
y yz nπ 2 z "###################################### z z z JL + N Ez H2 L2 − n πL2 # H2 L2 + n πL ErfA$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% z z zì zz z 2L {{ è!!!!! π Erf@LD # "###################################### # J4 L "###################################### = H2 L2 − n πL2 H2 L2 + n πL2 N, 2L
F HLL HkL is defined similarly. Formally, we have cHLL n = In[3]:= F[L_][k_]
è!!!!!!!!!!! p ê 2 ë L F HLL Hn p ê LL. (Here cHLL n is defined for integer n only.)
= 1/Sqrt[2 Pi] Integrate[f[x] Exp[I k x], {x, -L, L}, Assumptions -> L > 0] // Simplify;
The formula for FoHLL HkL contains the oscillating function cscHxL sinHx hL. In[4]:= δ[ξ_, η_] := Csc[ξ] Sin[ξ η]
F[L_][o_, k_] = δ[k L, 2 o + 1] F[L][k];
The left graphic shows the original functions f HxL together with its truncated Fourier sum. The right graphic shows the logarithm of the relative error. The error is quite small in the interval @-5, 5D and increases outside because the Fourier sum defines a periodic function versus the single-bump function f HxL. In[6]:= Show[GraphicsArray[
Block[{L = 4, m = 12, $DisplayFunction = Identity}, {(* original function and Fourier sum *) Plot[Evaluate[{f[x], (* Fourier sum in red *) Sum[c[L][n] Exp[-I n x/L Pi], {n, -m, m}]}], {x, -2L, 2L}, PlotStyle -> {GrayLevel[0], Hue[0]}, PlotRange -> All, Frame -> True, Axes -> False], (* relative error plot *) Plot[Evaluate[Log[Abs[f[x] Sum[c[L][n] Exp[-I n x/L Pi], {n, -m, m}]]]], {x, -2L, 2L}, PlotRange -> All, Frame -> True, Axes -> False]}]]]
Solutions
733 1
0
0.8
-5
0.6
-10
0.4
-15 -20
0.2
-25
0 -7.5
-5
-2.5
0
2.5
5
7.5
-7.5
-5
-2.5
0
2.5
5
7.5
HLL The next two graphics show 25 Fourier series coefficients cHLL n and †Fo HkL§ for L = 4 and o = 4. A qualitative similarity between the two graphics exists, but the scales in horizontal and vertical direction disagree.
In[7]:= Show[GraphicsArray[
Block[{L = 4, m = 12, o = 4, $DisplayFunction = Identity}, {(* the Fourier series coefficients *) fourierSeriesGraphic = Graphics[{Hue[0], Table[Line[{{n, 0}, {n, Abs[c[L][n]]}}], {n, -m, m}]}, PlotRange -> All, Frame -> True, Axes -> False], (* the Fourier transform *) Plot[Abs[F[L][o, k]], {k, -o, o}, PlotPoints -> 200, PlotRange -> All, Frame -> True, Axes -> False]}]]] 6
0.2
5 0.15
4 3
0.1
2
0.05
1
0 -10
-5
0
5
0
10
-4
-2
0
2
4
Now, we will consider the limit o Ø ¶. The function dHx, hL = cscHxL sinHx hL converges to a sequence of delta functions in pê2 the limit h Ø ¶. This can be most easily seen by observing that limhض dH0, hL = ¶ and limhض Ÿ-pê2 dHx, hL dx = p. The following two graphics demonstrate this. In[8]:= Show[GraphicsArray[
Block[{$DisplayFunction = Identity}, {(* δ[ξ, η] gets large spikes at ξ - j π *) Plot3D[δ[ξ, η], {ξ, -3, 3}, {η, 0, 12}, PlotPoints -> 200, Mesh -> False, ClipFill -> None, PlotRange -> {-5, 12}], (* the integral converges to π *) Plot[Evaluate[Integrate[δ[ξ, η], {ξ, -Pi/2, Pi/2}]], {η, 10, 200}, PlotPoints -> 200]}]]]
10 5 0 -5
10 7.5 5
-2 0
2.5 2
3.225 3.2 3.175 3.15 3.125 3.075 3.05
50
100
150
200
0
¶ Using ⁄¶ j=-¶ expH-2 i k j LL = p ⁄n=-¶ dH k L - n pL, we see that in the limit o Ø ¶ the following identity holds:
Symbolic Computations
734
¶
HLL F¶ HkL = p ‚ dH k L - n pL F HLL HkL = n=-¶
¶ np è!!!!!!!! 2 p ‚ dJ k - ÅÅÅÅÅÅÅÅÅÅÅ N cHLL n . L n=-¶
This means that in the large o limit FoHLL HkL converges to a series of delta functions. These delta functions are located at n p ê L and their strength is exactly the Fourier series coefficient. Using the inverse Fourier transform and integrating out the Dirac delta functions shows that we recover the Fourier series representation: ¶ ¶ 1 x HLL f HxL = ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ ‡ e-i k x F¶ HkL = ‚ expJ-i n p ÅÅÅÅÅÅ N cHLL n . è!!!!!!!! L -¶ 2p n=-¶
For small x we have dHx, hL º h. This enables us to normalize FoHLL HkL in such a way that the maxima of FoHLL Hn p ê LL ê H2 o + 1L are located at integer n and the height of the maxima approaches the values cHLL n . In[9]:= Block[{L = 4, m = 6, o = 4},
Show[{Plot[Abs[Sqrt[Pi/2] F[L][o, n Pi/L]/L/(2o + 1)], {n, -m, m}, PlotPoints -> 500, DisplayFunction -> Identity], (* discrete Fourier transform *) fourierSeriesGraphic}, DisplayFunction -> $DisplayFunction, PlotRange -> {{-6, 6}, All}, Frame -> True, Axes -> False, AspectRatio -> 1/4]] 0.2 0.15 0.1 0.05 0 -4
-2
0
2
4
6
i) The implementation of the definition is straightforward. We substitute the e-dependent term f HxL + e dHx - yL as a pure function to avoid any possible variable conflict with respect to the (dummy) variable x. The function [F@ f HxLD, f HyL] tries to calculate d F@ f HxLD ê d f HyL. We add an optional simplifying function . In[1]:= [functional_, f_[y_], SimplifyFunction -> _] :=
Module[{x, s1, s2, s3}, Assuming[(* for integration purposes *) Element[y, Reals], (* definition *) s1 = ((functional /. f :> Function[x, f[x] + ∂ DiracDelta[x - y]]) - functional)/∂; (* carry out and simplify integrals *) s2 = s1 //. Integrate[a_, b_List] :> Integrate[a, b, Assumptions -> Element[y, Reals]] //. α_. Integrate[a_, b_, as_] + β_. Integrate[c_, b_, as_] :> Integrate[Expand[α a + β c], b, as] //. Integrate[a_ (∂ d_DiracDelta + c_), b_, as_] :> Integrate[Expand[a ∂ d], b, as] + Integrate[a c, b, as]; (* expand around ∂ == 0 *) s3 = Limit[Normal[Series[#, {∂, 0, 1}]]& //@ s2, ∂ -> 0] ; (* (maybe) simplify result *) [s3]]]
By default, we will not carry out any simplification. In[2]:= (* no simplification by default *)
[functional_, f_[y_]] := [functional, f[y], SimplifyFunction -> Identity] ¶
Here is a first example, the functional derivative of Ÿ-¶ f HxL2 dx with respect to f HyL. In[4]:= [Integrate[f[y]^2, {y, -Infinity, Infinity}], f[x]] Out[4]= 2 f@xD
Solutions
735
For the identity functional F@ f HxLD = f HxL we get d f HxL ê d f HyL = dHx - yL. In[5]:= [f[y], f[x]] Out[5]= DiracDelta@−x + yD ¶
For a functional of the form F@ f HxLD = Ÿ-¶ LH f HxL, f £ HxLL dx, the functional derivative is, of course, just the classical Euler–Lagrange equation ∑ L ê ∑ f HxL - ∑H∑ L ê ∑ f £ HxLL ê ∑ x [1381]. In[6]:= [Integrate[F[f[y], f'[y]], {y, -Infinity, Infinity}], f[x]] -
(* the Lagrange equations *) (D[F[f[x], f'[x]], f[x]] - D[D[F[f[x], f'[x]], f'[x]], x]) Out[6]= 0
Here is a special case—the equation for the density of 1D quantum system [1401], [1548], [1549]. In[7]:= [Integrate[1/4 '[y]^2/[y] + 1/4/[y] - ν[y] [y],
{y, -Infinity, Infinity}], [x]] // Expand @xD2 @xD 2 @xD 4 @xD
1 4 @xD
Out[7]= − 2 − ν@xD + 2 − b
For the functional F@ f HxLD = Ÿa f HxL2 dx, the functional derivative is nonvanishing only in the interval @a, bD; this corresponds to the two Heaviside functions in the next result. In[8]:= [Integrate[f[x]^2, {x, a, b}], f[y]] Out[8]= 2 f@yD UnitStep@y − b UnitStep@a − bD − a UnitStep@−a + bDD
UnitStep@−y + a UnitStep@a − bD + b UnitStep@−a + bDD
The Lagrange equation for a point mass in a potential V HxL follow from the functional F@xHtLD = T@xHtLD - V HxHtLL. In[9]:= [Integrate[1/2 x'[t]^2 - V[x[t]],
{t, -Infinity, Infinity}], x[τ]] Out[9]= −V @x@τDD − x @τD
Here are some inequivalent Lagrangians for the harmonic oscillator [1160], [722], [1161]. In[10]:= Table[[Integrate[1/2 Sum[Binomial[n, k] (ω^2 x[t]^2)^(n - k) x'[t]^(2k)/(2k - 1),
{k, 0, n}], {t, -Infinity, Infinity}], x[τ]] // Factor, {n, 5}] Out[10]= 9−ω2 x@τD − x @τD, −2 Hω2 x@τD2 + x @τD2 L Hω2 x@τD + x @τDL, 2
−3 Hω2 x@τD2 + x @τD2 L Hω2 x@τD + x @τDL, 2
2
2 3
4
−4 Hω x@τD + x @τD L Hω2 x@τD + x @τDL, −5 Hω2 x@τD2 + x @τD2 L Hω2 x@τD + x @τDL=
Now let us deal with F@ f HxLD = f HxL3 f £ HxL2 f ££ HxL. Without explicit simplification, we get an integral containing derivatives of the Dirac delta function. In[11]:= [Integrate[f[x]^3 f'[x]^2 f''[x],
{x, -Infinity, Infinity}], f[ξ]] Out[11]= 6 f@ξD f @ξD2 Hf @ξD2 + 2 f@ξD f @ξDL
Because such-type integrals can be evaluated via partial integration, we implement a corresponding rule: ¶ n HnL HnL Ÿ-¶ f HxL d Hx - xL dx = H-1L f HxL. In[12]:= δIntegrateSimplify = (ExpandAll[#] //.
{Integrate[p_Plus, d_] :> (Integrate[#, d]& /@ p), Integrate[f_ Derivative[n_][DiracDelta][x_ + ξ_.], {x_, -Infinity, Infinity}] :> ((-1)^n D[f, {x, n}] /. x -> -ξ)})&;
Now, we get a fully integrated result. In[13]:= [Integrate[f[x]^3 f'[x]^2 f''[x],
{x, -Infinity, Infinity}], f[ξ], SimplifyFunction -> δ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 ˆ2 ˆ2 1 ˆ3 1 ˆ4 1 ˆ ˆ3 1 t4 B ⊗ A ω26 ω27 + t3 ⊗ A ω37 + t4 ⊗ A ω1 ω37 + t4 B ⊗ A ω2 ω37 + 6 6 6 4 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 24 6
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 ˆ3 ˆ3 ˆ ˆ2 ˆ2 ˆ ˆ ˆ2 ˆ2 ˆ ˆ ˆ ˆ ˆ ˆ ˆ 1 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 ˆ4 1 ˆ ˆ2 1 ˆ ˆ ˆ2 1 ˆ2 ˆ2 1 t4 ⊗ A ω25 ω27 + t3 B ⊗ A ω6 ω27 + t4 A ⊗ B ⊗ A ω1 ω6 ω27 + t4 B ⊗ A ω2 ω6 ω27 + 2 2 2 4 ˆ ˆ ˆ2 1 ˆ2 ˆ2 1 ˆ ˆ ˆ2 1 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 24 6
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
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
1.5
0.5
2
P2 Hz L
1
1 0.8 0.6 0.4 0.2
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
{"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 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 ji zy 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 y 2 ij n n z -r ê2 H HyL LHn-3+1 Hn-1L l nLê2 Hr2 - y2 L jj lz yHlL Hx , …, x L = jj‰ ‰ Hxk - x j L zzz e n m n,m 1 n { k j=1 k= j+1 where r = H⁄nj=1 x2j L
1ê2
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 Here are the eigenfunctions yn,m Hx1 , …, xn L, the Calogero–Sutherland Hamiltonian and the energy eigenvalues ¶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 -1ê2
with fn HzL = cn expH-z2 ê 2L Hn HzL and cn = Hp1ê2 2n n!L 1
.
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 explicitly, we will rewrite expressions of the form zm Hn HzL as linear combinations ⁄m k=-m bk Hn+k HzL, where the 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
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 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 ζ'[ϕ]/D[q0 + r Exp[I ϕ], ϕ] /. q -> q0 + r Exp[I ϕ]], {n, 3, 6}]
Now let us deal with the branch points of zHqL. As discussed in Subsection 1.11.1 of the Numerics volume [567], a necessary HqL condition for zHqL to be a branch point is H HqL n HzL = 0 and ∑ H n HzHqLL ê ∑ z = 0. In[10]:= disc[p_, z_] := With[{f = Numerator[Together[p]]},
Factor[Resultant[f, D[f, z], z]]]
Fortunately, for the numerical solution of the equations, the resulting univariate polynomials in q that define the branch points factor nicely. In[11]:= Table[disc[qHermite[n, q, x], x], {n, 6}] 3
3
2 3
2 3
Out[11]= 92, −128 q, −16384 q3 H1 − q + q2 L H1 + q + q2 L , 10
67108864 q
2 2
22
549755813888 q 2
2
H1 + q L H1 − q + q L H1 + q + q L H1 − q4 + 3 q6 + q10 L , 2 2
2 3
4
10
H1 + q + q + q + q L H1 − q + 3 q 6
5
5
2
5
H1 + q L H1 − q + q L H1 + q + q L H1 − q + q − q + q4 L 4 5
3
2 3
3
14 2
43
+ q L , −144115188075855872 q 5
5
H1 + q2 L H1 − q + q2 L H1 + q + q2 L H1 − q + q2 − q3 + q4 L H1 + q + q2 + q3 + q4 L H1 − q2 − q4 + 5 q6 − 6 q8 + 6 q10 + 2 q12 − 14 q14 + 21 q16 − 15 q18 + 9 q20 + 7 q22 − 14 q24 + 2
26 q26 − 22 q28 + 30 q30 − 18 q32 + 20 q34 − 7 q36 + 7 q38 − q40 + q42 L = HqL
HqL
Here are the branch points for the q-Hermite polynomials H 2 HzL to H 10 HzL. In[12]:= Show[Graphics[Reverse @
Table[qPoly = disc[qHermite[n, q, x], x]; (* solve for zeros of the discriminant *) sol = N[q /. Solve[qPoly == 0, q]]; {Hue[(n - 2)/10], PointSize[0.01], Point[{Re[#], Im[#]}]& /@ sol}, {n, 2, 10}]], PlotRange -> All, Frame -> True, AspectRatio -> Automatic] 1 0.5 0 -0.5 -1 -1
-0.5
0
0.5
1
Because of the high powers of q that appear in the q-Hermite polynomials, the order of the branch points is most easily determined not symbolically, but rather numerically. Starting from an initial point qinit , we solve the above-calculated differential equation ode[n][z, {q0, r, ϕ}] around each branch point q0. After one round we return either qinit or to another solution of the discriminant equation. We count how many rounds we need to return to qinit —this is the order of the branch point. The function branchPointOrders implements this procedure. In[13]:= (* make cycles from a permutation *)
toCycles[l_] := MapIndexed[{#2[[1]], #1}&, {{a___, {b_, A___, c_}, d___, {c_, B___, {a, {b, A, c, B, e}, d, f}, {a___, {b_, A___, c_}, d___, {e_, B___, {a, {e, B, b, A, c}, d, f}} //. {a___, {b_, c___, b_}, d___} :> {a, {b,
l] //. e_}, f___} :> b_}, f___} :> c}, d}
In[15]:= branchPointOrders[n_] :=
Module[{, qPoly, q0, r, F, qBcs, nqBcs, z0s, tab}, (* the discriminant *) = disc[qHermite[n, q, z], z]; (* the implicit definition for z[q] *) qPoly = Numerator[Together[qHermite[n, q, z]]];
Solutions
927 (* ODE for z[q] around a branch point *) ODE[0_, _] = D[qPoly /. z -> z[q], q] /. z[q] -> F[ϕ] /. z'[q] :> F'[ϕ]/D[0 + Exp[I ϕ], ϕ] /. q -> 0 + Exp[I ϕ]; (* the potential branch points *) qBcs = Union[q /. Solve[ == 0, q]]; nqBcs = N[qBcs, 30]; (* encircling each branch point on each sheet *) {First[#], Length[#]}& /@ Split[Sort[ Table[q0 = nqBcs[[k]]; r = Min[Abs[nqBcs[[k]] - Delete[nqBcs, k]]]/2; z0s = z /. {ToRules[NRoots[qPoly == 0 /. q -> q0 + r, z]]}; (* solve differential equation around branch points *) tab = Table[ζ[2Pi] /. NDSolve[{ode[n][ζ, {q0, r, ϕ}] == 0, ζ[0] == z0s[[j]]}, ζ, {ϕ, 2Pi, 2Pi}, PrecisionGoal -> 12][[1]], {j, n}]; (* match sheet numbers *) Sort[Length /@ toCycles[Flatten[ Position[#, Min[#]]&[Abs[# - z0s]]& /@ tab]]], {k, Length[qBcs]}]]]] HqL
The branch points of H 3 HzL are all of square root-type. In[16]:= branchPointOrders[3] Out[16]= 8881, 2 {Thickness[0.002]}, PlotRange -> All, Frame -> True, Axes -> False, FrameTicks -> None, PlotPoints -> 1000, PlotPoints -> 1000, AspectRatio -> Automatic]] HqL
The following animation shows the dependence of z0 Hrq expHi jq LL as a function of rq for H 5 Hz0 HqLL. In[22]:= Show[GraphicsArray[
zerosGraphic[5, #, DisplayFunction -> Identity]& /@ #]]& /@ Partition[Table[r, {r, 1/2, 3/2, 1/15}], 4]
Solutions
929
Make Input
Do[zerosGraphic[5, r], {r, 1/2, 3/2, 1/51}]
c) We will proceed as we did in Section 2.10 when calculating a high-precision approximation of the quartic oscillator ground-state. The only difficulty compared to the nonrelativistic harmonic oscillator is the pseudodifferential operator è!!!!!!!!!!!!!!!!!!!!! m2 + ∑x x . Differentiation transforms into multiplication by Fourier transformation [136], [439], [255]. This suggests to deal with this operator in a Fourier transformed space. Luckily, the most natural orthogonal polynomials for the harmonic oscillator problem—the Hermite polynomials—are eigenfunctions of the Fourier transform (see Exercise 44a) of Chapter 1): x @fn HxLD HxL = in fn HxL. (Here the fn HxL are the normalized harmonic oscillator eigenfunctions.) This allows the straightforward (numeric) calcula1ê2 1ê2 tion of the matrix elements of Yfn … Hm2 + ∑x x L - m … fm ] = in H-iLm Yfn … Hm2 + x2 L - m … fm ]. The condition y¶ H0L = 0 is easy to fulfill because the odd harmonic oscillator eigenfunctions are a complete system for all odd functions. In[1]:= φ[n_, z_] := Exp[-z^2/2] HermiteH[n, z]/c[n]
c[n_] := Sqrt[Sqrt[Pi] 2^n n!]
The matrix elements of the potential term Xfn » x2 » fm \ can be easily evaluated exactly. The matrix elements è!!!!!!!!!!!!!!!!!!! Yfn … m2 + x2 - m … fm ] we have to calculate numerically. To get them with a sufficient precision we could either let the integrand be unevaluated and call the built-in Hermite polynomials or evaluate the integrand and use high-precision è!!!!!!!!!!!!!!!!!!!!! arithmetic. We choose the latter approach. So, we can define the matrix elements [{i, j}]=Yfn … m2 + ∑x x - m … fm ] 2 and [{i, j}]=Xfn » x » fm \ in the following way. In[3]:= opts = Sequence[PrecisionGoal -> 10, AccuracyGoal -> 10,
MaxRecursion -> 10, WorkingPrecision -> 32]; [{i_, j_}, m_] := ([{i, j}, m] = [{j, i}, m] = I^i (-I)^j NIntegrate[Evaluate[φ[i, ξ] (Sqrt[m^2 + ξ^2] - m) φ[j, ξ]], {ξ, -Infinity, Infinity}, Evaluate[opts]]) [{i_, j_}] := ([{i, j}] = [{j, i}] = c[i]/c[j]/4 (4 (j - 1) j KroneckerDelta[i, j - 2] + (4 j + 2) KroneckerDelta[i, j] + KroneckerDelta[i, j + 2]))
We now form the Hill determinant and calculate its lowest eigenvalue until we are sure about the first five digits. In[7]:= With[{m = 1},
Do[tab = Table[[{i, j}, m] + [{i, j}], {i, 1, dim, 2}, {j, 1, dim, 2}]; Print[{dim, InputForm @ Eigenvalues[tab][[-1]]}], {dim, 10, 40, 10}]] 810, 1.6661545551936488102`8.795715336376436
6, MaxRecursion -> 8];
We fix the matrix dimension to be 13 and calculate the lowest eigenvalue for 10-2 § m § 102 . For m Ø 0 we get a purely “photonic” state (with a linear dispersion relation) and, for m Ø ¶, the matrix elements [{i, j}] approach zero so that only the potential term survives. In[9]:= dim = 25;
data = Table[m = 10^log10m; tab = Table[[{i, j}, m] + [{i, j}], {i, 1, dim, 2}, {j, 1, dim, 2}] // Chop; 1.{m, Eigenvalues[tab][[-1]]}, {log10m, -2, 2, 4/20}]; In[11]:= ListPlot[data, PlotJoined -> True]
2 1.5 1 0.5
10
20
30
40
50
60
For convenient 3D system of functions that vanish at the origin, see [613], [444], [584], [250], [249], [135], [254], [346]. For a general discussion of square roots of Laplacians, see [429], [578]; for more general potentials, see [90]. For the inappropriateness of such-type Hamiltonians to generate time developments, see [540]. For fractional powers of more general operators, see [116]. For the transformation of nonrelativistic wave functions into relativistic ones, see [404]. d) For any given m and n, we can calculate mm HnL numerically to any desired precision. For a fixed m, calculating the moments for sufficiently many n allows determining all of the cHmL j . Using enough digits allows reconstructing the rational from the calculated high-precision approximation. The following function HermiteZeroMoment implements these cHmL j steps; we calculate the polynomial roots by default with 50-digit precision. (By symmetry, the moments for odd m vanish.) In[1]:= HermiteZeroMoment[m_Integer?(Positive[#] && EvenQ[#]&),
_, prec_:50] := Module[{c, ansatz, eqs, sol}, (* ansatz for the moments *) ansatz[ν_] = Sum[c[j] ν^j, {j, 0, m/2}]; (* m/2 + 1 equations for the m/2 + 1 unknowns c[j] *) eqs = Table[ansatz[n] == (* numerical moments *) 1/n Plus @@ ((z /. {ToRules[ N[Roots[HermiteH[n, z] == 0, z], prec]]})^m), {n, 1, m/2 + 1}]; (* solve equations *) sol = Solve[(* make rational equations *) Rationalize[eqs], Table[c[k], {k, 0, m/2}]]; (* factor and return answer *) Factor[ansatz[] /. sol]]
Here are the first six nontrivial moments. In[2]:= Table[Subscript[µ, m] == HermiteZeroMoment[m, n],
{m, 2, 12, 2}] // TraditionalForm
Solutions
931 n-1 1 1 2 4 8 1 1 m8 : ÅÅÅÅÅÅÅÅÅ Hn - 1L H14 n3 - 79 n2 + 155 n - 105L>, m10 : ÅÅÅÅÅÅÅÅÅ Hn - 1L H42 n4 - 344 n3 + 1106 n2 - 1644 n + 945L>, 16 32 1 m12 : ÅÅÅÅÅÅÅÅÅ Hn - 1L H132 n5 - 1454 n4 + 6724 n3 - 16226 n2 + 20274 n - 10395L>> 64
Out[2]//TraditionalForm= :m2 : ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ >, m4 : ÅÅÅÅÅ Hn - 1L H2 n - 3L>, m6 : ÅÅÅÅÅ Hn - 1L H5 n2 - 17 n + 15L>,
To calculate m100 HnL we have to determine 50 coefficients in a linear system of equations. To uniquely form the rational numbers corresponding to the floating-point solutions, we now calculate the zeros with 500 digits. The resulting expression for m100 HnL contains quite large integers (with up to 80 digits). In[3]:= µ100[n_] = HermiteZeroMoment[100, n, 500]; In[4]:= Short[µ100[n], 20]
1 1125899906842624 H−272539213975072950298071324540091863329079633054580341 3734328823443106201171875 + 11370716165383292800132861417780131170117718928305211392101 943204661907519531250 n − 22840815550596175958022839860609214892757186947809935715744 905708612358278125000 n2 + 29502992038448058186265925463417717912284910820498636715887 475004392077542187500 n3 − 27606671392311512836110050975819693355703104071304043159201 452215350277052000000 n4 +
60 + 782552966682142631130864007551994316 n45 − 9467892698771941068378701496412404 n46 + 89088497301532774900521958400096 n47 − 581401366183576443427321579604 n48 + 1978261657756160653623774456 n49 LL=
Out[4]//Short= 9 HH−1 + nL
As a quick check of the result, we calculate m100 H120L directly using 1000 digits and compare with the last result. In[5]:= With[{m = 100, n = 120}, 1 - µ100[n]/(Plus @@ ((Last /@
List @@ N[Roots[HermiteH[n, z] == 0, z], 1000])^m)/n)] Out[5]= 80. × 10−999
p[n]]&, (* the initial polynomial *) Sum[z^i, {i, 0, degree}], iter], _?NumberQ, {-1}]}], opts, AspectRatio -> 1, PlotRange -> Automatic, Frame -> True, FrameTicks -> None]]
Here are a few pictures of the resulting roots for polynomials of various degrees. In[2]:= Show[GraphicsArray[#, GraphicsSpacing -> 0.02]]& /@
Partition[Table[iteratedRootPicture[100, i, DisplayFunction -> Identity], {i, 4, 26, 2}], 4]
Classical Orthogonal Polynomials
932
Next, we modify the definition of iteratedRootPicture to iterate the substitution of orthogonal polynomials. In[3]:= iteratedOPRootPicture[poly_, α_, iter_, degree_, opts___] :=
Module[{p, c = 0.}, (* the polynomials used in the replacement *) Do[p[j, z_] = poly[j, z], {j, degree}]; (* show graphics *) Show[Graphics[{PointSize[0.002], Point[{Re[#], Im[#]}]& /@ Cases[(* roots *) NRoots[# == 0, z]& /@ (* nesting the replacement *) (nl = NestList[Expand[#/Max[Abs[CoefficientList[#, z]]]]&[ Expand[# /. z^n_. :> p[n, (* nontrivial phase *) Exp[I (c++)^α] z]]]&, (* the initial polynomial *) p[degree, z], iter]), _?NumberQ, {-1}]}], opts, AspectRatio -> 1, PlotRange -> Automatic, Frame -> True, FrameTicks -> None]]
Here are some examples. In[4]:= Show[GraphicsArray[#]]& @
Block[{$DisplayFunction = Identity}, iteratedOPRootPicture[##, 200, 24]& @@@ (* four examples *) {{ChebyshevU, 0.25}, {HermiteH, 0.5}, {LegendreP, 0.75}, {GegenbauerC, 1.0}}]
Solutions
933
9. Hermite Polynomials, Coherent States, Isospectral Potentials, Wave Packets a) These are the normalized harmonic oscillator wavefunctions. In[1]:= φ[n_, x_] := Exp[-x^2/2] HermiteH[n, x]/Sqrt[Sqrt[Pi] 2^n n!]
This is the norm of the function YHa; xL. In[2]:= normS = Integrate[Exp[-α x^4]^2, {x, -Infinity, Infinity},
Assumptions -> (α > 0)] 23ê4 Gamma@ 54 D Out[2]= α1ê4
Next, we implement the overlap integral. In[3]:= int[n_] := int[n] =
Integrate[1/Sqrt[normS] Exp[-α x^4] φ[n, x], {x, -Infinity, Infinity}, Assumptions -> (α > 0)] In[4]:= int[0] 1
Out[4]=
1 1 32 α BesselK@ , D 4 32 α 5 Gamma@ D 2 27ê8 π1ê4 α3ê8 "############################# 4
For n = 0, a plot of the overlap integral suggests that a º 0.2. In[5]:= Plot[int[0], {α, 0, 1}] 0.98 0.96 0.94 0.92 0.2
0.4
0.6
0.8
1
0.88
Here is the exact value for the maximal overlap integral. In[6]:= MapAt[-#&, FindMinimum[-int[0], {α, 0.2}], 1] Out[6]= 80.990834, 8α → 0.203947
N[Sqrt[2]/E^Pi, 1000] 0. × 10−1000
Slight modifications to the above definitions for the numerical evaluation allow the continuation into the complex q-plane. Here this is done for aHqL. In[38]:=
RamanujanEllipticC[q_Complex?InexactNumberQ] := With[{ϑ = EllipticTheta}, (* use sector-dependent different representations *) Which[0 False, PlotRange -> All, BoxRatios -> {1, 1, 2/3}]] @@@ (* value and color value *) {{Re, Im}, {Im, Re}}]]]
Using Mathematica’s symbolic functions allows to derive identities for the functions aHqL, bHqL, and cHqL. As an example let us look for modular equations of the form ‚ ak1 ,ake ,bk1 ,bke ,ck1 ,cke
aak1 ,ake ,bk1 ,bke ,ck1 ,cke aHqLak1 aHqe Lake bHqLbk1 bHqe Lbke cHqLck1 cHqe Lcke = 0
with e a fixed positive integer, ak1 + ake + bk1 + bke + ck1 + cke § d and the aak1 ,ake ,bk1 ,bke ,ck1 ,cke integer. We will search for identities of this form in the following way. First, we generate all monomials a b c aHqLak1 aHq5 L k5 bHqLbk1 bHq5 L k5 cHqLck1 cHq5 L k5 . Then, we form series expansions of these monomials. Taking sufficiently many series terms results in an overdetermined system of linear equations. Using NullSpace we find all nontrivial solutions of this overdetermined system. We start by constructing all monomials. (Here we choose e = 5 and d = 4.) In[40]:=
basis = Module[{d = 4, e = 5, vars}, vars = {A[q], B[q], C[q], A[q^e], B[q^e], C[q^e]}; Flatten[Table[Evaluate[Times @@ (vars^Table[ε[j], {j, 6}])], Evaluate[Sequence @@ Table[{ε[j], 0, d - Sum[ε[i], {i, j - 1}]}, {j, 6}]]]]];
There are 210 monomials in the basis. The set of rules serRules generates the series expansions for the monomials. To avoid fractional powers, we use the third powers of aHqL, bHqL, and cHqL. In[41]:=
(* number of terms in the q-series *) o = Round[1.5 Length[basis]]; serRules = With[{(* avoid fractional series with zero coefficients *) = Series[Normal[Series[#1, {q, 0, o}]^#2] /. q -> q^#3, {q, 0, o}]&}, {A[q] -> [RamanujanEllipticA[q], 3, 1], B[q] -> [RamanujanEllipticB[q], 3, 1],
The Classical Special Functions
988 C[q] -> [RamanujanEllipticC[q], 3, 1], A[q^5] -> [RamanujanEllipticA[q], 3, 5], B[q^5] -> [RamanujanEllipticB[q], 3, 5], C[q^5] -> [RamanujanEllipticC[q], 3, 5]}]; In[44]:=
basisSeries = Table[basis[[k]] /. serRules, {k, Length[basis]}];
For each series from basisSeries, we extract the coefficients with respect to q and calculate the null space of the resulting matrix. (For speed reasons, we use a modular null space computation here.) In[45]:=
coeffMat = If[Length[#] < o, Join[#, Table[0, {o - Length[#]}]], Take[#, o]]& /@ (CoefficientList[Normal[#], q]& /@ basisSeries); ns = NullSpace[Transpose[coeffMat], Modulus -> Prime[10^6]];
153 null spaces were found. Here is their distribution as a function of their dimensions. In[48]:= Out[48]=
{First[#], Length[#]}& /@ Split[Sort[Length[DeleteCases[#, 0]]& /@ ns]] 883, 53 True]], z | C | _?NumericQ | List | Power | Log | _?(MemberQ[elementaryFunctions, #]&)] 8CoshIntegral, CosIntegral, EllipticE, EllipticF, Erf, Erfi, ExpIntegralEi, FresnelC, FresnelS, Gamma, Hypergeometric2F1, LogIntegral, PolyLog, SinhIntegral, SinIntegral
True]&)] 324
We now apply FunctionsExpand to the results of integration. In[15]:=
functionExpandedDoneIntegrals = {#[[2]], FunctionExpand[#[[2]]]}& /@ allDoneIntegrals;
For further use, we keep only the results that really were expanded. In[16]:=
interestingFunctionExpandedDoneIntegrals = Select[functionExpandedDoneIntegrals, (UnsameQ @@ #)&];
In[17]:=
Length[interestingFunctionExpandedDoneIntegrals]
Out[17]=
331
In most cases, the application of FunctionExpand results in an increase of the size of the expressions, but sometimes the expressions might shrink. The following picture shows the size ratio (measured with Byte Count) of the expanded expression versus the unexpanded expression. In[18]:=
ListPlot[Sort[Apply[#2/#1&, Map[ByteCount, interestingFunctionExpandedDoneIntegrals, {2}], {1}]], PlotRange -> All, Frame -> True, Axes -> False]
The Classical Special Functions
994 3.5 3 2.5 2 1.5 1 0.5 0
50
100
150
200
250
300
è!!!!!!!!!!!!!!!!!!! Here are the first few results of the application of FunctionExpand. We see that product was rewritten in è!!!!!!!!!!!!!!!!!!!!!!!!!!! the form ¤k factorsk and logH productL as ⁄k logH factorsk L. Here, the functions Power and Log remain unchanged, but their arguments get “expanded” (linearized as much as possible). In[19]:=
Take[interestingFunctionExpandedDoneIntegrals, 5] // TableForm
Out[19]//TableForm=
è!!!!!!!!!!!!!! 1 − z2 + z ArcSin@zD è!!!!!!!!!!!!!! − 1 − z2 + z ArcCos@zD
è!!!!!!!!!!!! è!!!!!!!!!!!! 1 − z 1 + z + z ArcSin@zD è!!!!!!!!!!!! è!!!!!!!!!!!! − 1 − z 1 + z + z ArcCos@zD è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
−1+z z ArcSec@zD − LogAz J1 + "############## NE z2
H−1+zL H1+zL z ArcSec@zD − LogAz I1 + ! ME è!!!!!!!!!!!!! è!!!!!!!!! − z z
−1+z z ArcCsc@zD + LogAz J1 + "############## NE z2
H−1+zL H1+zL z ArcCsc@zD + LogAz I1 + ! ME è!!!!!!!!!!!!! è!!!!!!!!! − z z
1 z ArcTan@zD − Log@1 + z2 D 2
1 z ArcTan@zD + H−Log@ H− + zLD − Log@− H + zLD 2
2 2
è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
In some cases, FunctionExpand also expanded special functions into simpler functions. In[20]:=
changedInterestingFunctionExpandedDoneIntegrals = Select[Select[interestingFunctionExpandedDoneIntegrals, DeleteCases[Union[Level[First[#], {-1}, Heads -> True]], z | C | _?NumericQ | List | Power | Log | _?(MemberQ[elementaryFunctions, #]&)] =!= {}&], (* any change? *) DeleteCases[Union[Level[First[#], {-1}, Heads -> True]], z | C | _?NumericQ | List | Power | Log | _?(MemberQ[elementaryFunctions, #]&)] =!= DeleteCases[Union[Level[Last[#], {-1}, Heads -> True]], z | C | _?NumericQ | List | Power | Log | _?(MemberQ[elementaryFunctions, #]&)]&];
In[21]:=
Length[changedInterestingFunctionExpandedDoneIntegrals]
Out[21]=
51
Here are some of these cases before and after expansion. In[22]:= Out[22]=
Take[changedInterestingFunctionExpandedDoneIntegrals, 3] 1 H−1−CL 1 1−C 3 99−Cos@zD Hypergeometric2F1A , , , Cos@zD2 E Sin@zD1+C HSin@zD2 L 2 , 2 2 2 1 H−1−CL
1 1 Beta@Cos@zD2 , , 1 + H−1 + CLD Cos@zD Sin@zD1+C HSin@zD2 L 2 2 2 − =, è!!!!!!!!!!!!!!!!!!!! 2 Cos@zD2 1+C 1 3+C Cos@zD1+C Hypergeometric2F1@ , , , Cos@zD2 D Sin@zD 2 2 2 9− , è!!!!!!!!!!!!!!!!!!!! 2 H1 + CL Sin@zD
3.1 Introduction
995 1 H−1−CL
1+C 1 Beta@Cos@zD2 , , D Cos@zD1+C HCos@zD2 L 2 Sin@zD 2 2 − =, è!!!!!!!!!!!!!!!!!!!! 2 Sin@zD2
è!!!!!!!!!!!!!!!!!!!! 1−C 1 3−C Csc@zD Hypergeometric2F1@ , , , Cos@zD2 D Sec@zD−1+C Sin@zD2 2 2 2 9 , −1 + C 1 è!!!!!!!!!!!!!!!!!!!! H−1+CL 1−C 1 H1 − CL Beta@Cos@zD2 , , D HCos@zD2 L 2 Csc@zD Sec@zD−1+C Sin@zD2 2 2 == 2 H−1 + CL
Using FullSimplify, we can check the transformation carried out by FunctionExpand. In[23]:= Out[23]=
Table[FullSimplify[Subtract @@ interestingFunctionExpandedDoneIntegrals[[i]]], {i, 12}] 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
False] 1
1
n
8 IntegrateAH1 − xn L n J1 − xn − IH1 − xn L n M N
1 n
−1ên
1 1 i y IH1 − xn L n M z IH1 − xn L n M j 1 1 1 j z j z 1 + Hypergeometric2F1A , − , 1 + , − E, j z n n j z −1 + x n n n −1 + x k { 8x, 0, 1 0 && 0 < x < 1}, FullSimplify[#, conds]& @ FullSimplify[%, cond, TransformationFunctions -> (* extract finite part *) {(# //. (α_ a_^e_ b_^f_) :> α (a/b)^e /; e/f == -1 &&
The Classical Special Functions
996
Out[31]=
((Together //@ PowerExpand //@ {a, b}) === {0, 0}))&, Together}]] 1 2 1 8 Gamma@1 + D Gamma@ D n n 3 3 Gamma@ D n
For n = 2, we get from 8 GH1 + 1 ê nL2 GH1 ê nL ê H3 GH3 ê nLL the well-known volume of a sphere. In[32]:= Out[32]=
% /. n -> 2 4π 3
Similar remarks apply to the function FunctionExpand. The following sum [66] containing the function Factorial2 stays unevaluated. In[33]:=
Out[33]=
Sum[Evaluate[(-1)^k (r)^(2k)/((2k)!! ( + 2k - 2)!!)], {k, 0, Infinity}] ∞ H−1Lk r2 k ‚ H2 kL !! H−2 + 2 k + L !! k=0
Rewriting the summand in Gamma functions allows to carry out the sum. In[34]:=
Out[34]=
MapAt[Evaluate, MapAt[Simplify[FunctionExpand[#], Element[k, Integers]]&, 1 1 1 π 2 1 2− 4 + 4 Cos@π D π 2 SinA 2 E r1− 2 BesselJA H−2 + L, rE 2
%, 1], 1]
The same happens in the following sum [1102], [1182]. In[35]:=
Sum[Evaluate[(-1)^k/( - k)! (2k + 1)!!/(k! (k + 1)!)], {k, 0, }]
Out[35]=
H−1Lk H1 + 2 kL !! ‚ k! H1 + kL ! H−k + L!
k=0
In[36]:=
Out[36]=
MapAt[Evaluate, MapAt[Simplify[FunctionExpand[#], Element[k, Integers]]&, 3 Hypergeometric2F1@ , −, 2, 2D 2 Gamma@1 + D
%, 1], 1]
FullSimplify tries to write the result in functions with fewer arguments. In the following the two-argument expression PolyGamma[2,1] is converted to the one-argument function Zeta[3]. In[37]:=
Out[37]=
Series[1/(2 ∂^3) Log[Gamma[1 + ∂]^3 Gamma[1 - ∂]/Gamma[1 + 2∂]], {∂, 0, 0}] // (Together //@ #)& 1 − PolyGamma@2, 1D + O@∂D1 2
In[38]:=
FullSimplify[%]
Out[38]=
Zeta@3D + O@∂D1
The function FullSimplify has one more option than Simplify. In[39]:= Out[39]=
Complement[Sort[First /@ Options[FullSimplify]], Sort[First /@ Options[Simplify]]] 8ExcludedForms
{_}] −1 + x2 f@1 + xD + A E −1 + x
In addition to the option ExcludedForms, there is one other difference with respect to the options of Sim plify and FullSimplify: the default setting of the value TimeConstraint. Simplify will use each single rule not longer than 5 minutes, whereas FullSimplify has no time constraints. (This means that the result of Simplify[expr] may depend on the computer used, but the result of FullSimplify[expr] does not.) In[41]:= Out[41]=
Options[#, TimeConstraint]& /@ {Simplify, FullSimplify} 88TimeConstraint → 300 True], newExprs}, (* recursive call to FullSimplify; use different TransformationFunctions option setting *) FullSimplify[expr, TransformationFunctions -> (Function[r, Together[expr /. r]&] /@ ((# -> TF[#])& /@ Ls))]]
Now δ simplifies to 0. In[58]:= Out[58]=
FullSimplify[δ, TransformationFunctions -> {TF1}] 0
FullSimplify uses a large repertory of rules. Here is a complicated zero (the Fibonacci identity comes from [880]). In[59]:=
Out[59]=
Sin[Pi/24] - FunctionExpand[Sin[Pi/24]] + Beta[1, 2, 3, 4] - FunctionExpand[Beta[1, 2, 3, 4]] + Root[#^3 + 4# - 7&, 2] - ToRadicals[Root[#^3 + 4# - 7&, 2] + Fibonacci[n + 2]^3 + Fibonacci[n + 1]^3 Fibonacci[n]^3 - Fibonacci[3n + 3]] // (id = #)& "################# è!!!! 1ê3 2+ 2 49 1 "########################## 2 y è!!!! # è!!!! i + 3 H2 − 2 L − − 2 H1 − 3 L j ! z + j z è!!!!!!!!!!!! 60 4 4 k 3 H63 + 4737 L { è!!!! è!!!!!!!!!!!!! 1ê3 1 H1 + 3 L H H63 + 4737 LL 2 + Beta@1, 2, 3, 4D + Fibonacci@nD3 − Fibonacci@1 + nD3 − 2ê3 23 π Fibonacci@2 + nD3 + Fibonacci@3 + 3 nD + Root@−7 + 4 #1 + #13 &, 2D + SinA E 24
will carry out the complicated simplification of id. As a side effect, we count the number of transformations applied (count1), the number of transformations resulting in an expression not larger than the original one (count2), and the number of transformations resulting in a smaller expression (count3). Here, we measure the size of an expression with LeafCount. In[60]:=
:= (count1 = 0; count2 = 0; count3 = 0; lf = LeafCount[id]; (* simplify and keep track of intermediate results *) FullSimplify[id, Element[n, Integers] && n > 0, ComplexityFunction -> ((count1++; Which[# === lf, count2++, # < lf, lf = #; count2++; count3++]; #)&[LeafCount[#]]&)])
FullSimplify is able to show that id equals 0. More than 5000 transformations were attempted, only 8 of them resulted in smaller expressions.
The Classical Special Functions
1000 In[61]:= Out[61]= In[62]:= Out[62]=
// Timing 870.13 Second, 0< {count1, count2, count3} 814326, 65, 8
(Count[#, _HermiteH, Infinity]&)] 1−ν 1−ν 3 è!!!! AJ2ν π J−2 z GammaA E Hypergeometric1F1A , , z2 E + 2 2 2 ν ν 1 1−ν ν 2 GammaA− E Hypergeometric1F1A− , , z ENN í JGammaA E GammaA− ENE 2 2 2 2 2
By counting already-encountered functions, we can transform HermiteH[n, z] into a variety of equivalent forms. Here is one more example. In[66]:=
Out[66]=
FullSimplify[%, ComplexityFunction -> (Count[#, _HermiteH | _Hypergeometric1F1, Infinity]&)] 1 1−ν 1 ν 3 A J−2 z GammaA E HypergeometricPFQA9 − =, 9 =, z2 E + 2 Gamma@−νD 2 2 2 2 ν ν 1 2 GammaA− E HypergeometricPFQA9− =, 9 =, z ENE 2 2 2
FullSimplify and FunctionExpand use transformations that are correct for generic values of the occurring variables. This means, the simplified expression can have different values at lower-dimensional subsets of some variable values. Here is an example: the function F[n, z] is a polynomial for integer n. For generic complex values of n, F[n, z] does not have a finite value. In[67]:= Out[67]= In[68]:=
F[n_, z_] = GegenbauerC[2n, -n - 1, z] GegenbauerC@2 n, −1 − n, zD {F[n, z] // FullSimplify, F[n, z] // FunctionExpand} FullSimplify::infd : Expression GegenbauerC@2 n, −1 − n, zD simplified to ComplexInfinity. More…
Out[68]=
8ComplexInfinity, ComplexInfinity
All, ColorFunction -> (Hue[0.8#]&)]}]]] 7.5 0.4
5 2.5
0.2
0 -15
-10
-5
5 -0.2
-2.5 -5 -7.5
-0.4
AiHzL can also be written in integral form:
-7.5
-5
-2.5
0
2.5
5
7.5
3.5 Bessel and Airy Functions
1037
3-1ê3 p AiH3-1ê3 zL = ‡
¶
cosHt3 + z tL dt.
0
This integral can be computed by Mathematica and expressed in terms of Bessel functions of order 1 ê 3 and H1ê4L -1 ê 3. (Note that one has to use use constructions like Hz6 L instead of z2ê3 to avoid branch cut problems.) Mathematica can calculate many definite integrals that contain Airy functions. Here are two examples [1255], [1054]. In[80]:= Out[80]=
FourierTransform[AiryAi[x^2], x, y] // FullSimplify[#, y > 0]& 1 y y y y J48 21ê6 π I3 AiryAiA− E AiryAiA E + AiryBiA− E AiryBiA EM + 22ê3 22ê3 22ê3 22ê3 288 è!!!! π 4 3 5 y6 è!!!! 4 6 y HypergeometricPFQA8 False] // FullSimplify 1 1 7 18 π3ê2 Gamma@ D Gamma@ D 3 3 1 3 7 7 è!!!! π J−4 GammaA E Hypergeometric2F1A1, , , 4E + GammaA E 3 2 3 3 11 8 J−3 + 6 Hypergeometric2F1A1, , , 4ENN + 6 3 1 7 7 GammaA E GammaA E GammaA E Root@2916 + #16 &, 5DN 3 6 3
J31ê6
The Airy function AiHzL allows for a very interesting solution of the one-dimensional (1D) Schrödinger equation: a nonspreading wave “packet” [140], [1250], [1172], [933]. In[82]:=
ψ[x_, t_, β_] := Exp[I β^3 t/2(x - β^3 t^2/6)] AiryAi[β(x - β^3 t^2/4)]
In[83]:=
(* quick check that ψ fulfills Schrödinger equation *) freeParticleSchrödingerOperator[x_, t_] := (I D[#, t] + 1/2 D[#, x, x])& freeParticleSchrödingerOperator[x, t] @ ψ[x, t, β] // Simplify 0
Out[85]=
Here, the real part, the imaginary part, and the absolute value of such a wave packet are shown. In[86]:=
Module[{pp = 220, data}, data = Table[ψ[x, t, 1], {t, -5, 5, 10/pp}, {x, -8, 12, 20/pp}]; Show[GraphicsArray[ListPlot3D[#[data], Mesh -> False, DisplayFunction -> Identity]& /@ {Re, Im, Abs}]]]
0.5 0.25 0 -0.25 -0.5
200 150 50
100 100
150
50 200
0.5 0.25 0 -0.25 -0.5
200 150 50
100 100
150
50 200
Mathematical Remark: Uniform Approximation of Linear Turning Point Problems In applications, one often encounters the following differential equation:
0.4 0.2 0
200 150 50
100 100
150
50 200
The Classical Special Functions
1038
y££ HxL = l2 f HxL yHxL where l2 is a large parameter and f HxL is a real-valued function. A typical example for this type of equation is the Schrödinger equation. In many cases of interest for a given f HxL, an exact solution cannot be found and one has to use approximative methods. A very popular case is the so-called WKB approximation (see [893], [607], [455], [1157], [1151], [417], [289], [1163], [989], [979], [1071], [125], [52], [911], [1283], [579], [339], [1268], [138], [980], [1043], [1066], [292], [1149], [318], [1152], [482], [1192], [510], [481], [1284], [376], [1099], and [855]; for the use of Airy functions for uniform approximation of Wigner functions, see [462]). It consists of the following: We change the independent and dependent variable via x
z HxL = ‡
1 è!!!!!!!!!!! f HxL dx wHzL = f ÅÅ4ÅÅ HxL yHxL.
Then, the differential equation in wHzL is 3 1 d2 i y w££ HzL = jjl2 - f - ÅÅ4ÅÅ HxHzLL ÅÅÅÅÅÅÅÅÅ2ÅÅÅ f - ÅÅ4ÅÅ HxHzLLzz wHzL. dx k {
Neglecting the second term, we get the following two linearly independent solutions: 1
y1 HxL = f - ÅÅ4ÅÅ HxL expJ+l ‡ 1
y2 HxL = f - ÅÅ4ÅÅ HxL expJ-l ‡
x
x
è!!!!!!!!!!! f HxL dxN è!!!!!!!!!!! f HxL dxN.
We see that neglecting the above term is not possible if l2 is not large or if x is near a zero of f HxL. In the case of a simple zero of f HxL (the so-called linear turning point problem), a similar change of variables yHxLöwHzL 1
x 2 3 f HxL ÅÅ4ÅÅ è!!!!!!!!!!! ÅÅÅÅÅÅ z ÅÅ2ÅÅ HxL = ‡ f HxL dx, wHzL = J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N yHxL 3 zHxL
yields f HxHzLL -3ê4 d 2 f HxHzLL -1ê4 yz i w££ HzL = jjjl2 z + J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N ÅÅÅÅÅÅÅÅÅ2Å Å J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N zz wHzL. z z dx k { Neglecting again the second term on the right-hand side containing a second derivative, we obtain the following two solutions this time: 1
x 2 zHxL ÅÅ4ÅÅ è!!!!!!!!!!! y1 HxL = J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N AiJl ÅÅ3ÅÅ ‡ f HxL dxN f HxL 1
x 2 zHxL ÅÅ4ÅÅ è!!!!!!!!!!! y2 HxL = J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N BiJl ÅÅ3ÅÅ ‡ f HxL dxN. f HxL
To make the solutions also sensible at the turning points, we modify the transformation from x to z in the following way: If x0 is a zero of f HxL, and (without loss of generality) assuming f Hx > x0 L > 0, we choose the following:
3.5 Bessel and Airy Functions
1039
x 2 3 è!!!!!!!!!!! ÅÅÅÅÅÅ z ÅÅ2ÅÅ HxL = ‡ f HxL dx x ¥ x0 3 x0
x 3 2 è!!!!!!!!!!!!!! ÅÅÅÅÅ H-zL ÅÅ2ÅÅ HxL = ‡ - f HxL dx x § x0 . 3 x0
For large l2 , this is also a nondivergent solution around x0 . Using the asymptotic expansions for the Airy functions, the WKB solutions are the limit of appropriate linear combinations of these solutions. 1
Before looking at an explicit example, let us use Mathematica to change the independent and dependent variables in the differential equation y££ HxL = l2 f HxL yHxL. The first of the above transformations gives the following differential equation. In[87]:=
Remove[z, x, f, w, λ]; z[x_] := Integrate[Sqrt[f[x]], x]
Out[89]=
Collect[Expand[#/Coefficient[#, w''[z]]]&[ Numerator[Together[ (* use z = z[x] *) (D[#, {x, 2}] - λ^2 f[x] #)&[f[x]^(-1/4) w[z[x]]]] //. Integrate[Sqrt[f[x]], x] -> z]], w[z]] 5 f @xD2 f @xD y 2 j w@zD i + − z j−λ z + w @zD 16 f@xD3 4 f@xD2 { k
The coefficient of the term wHzL can be rewritten in the way given above by using the following identity. In[90]:= Out[90]=
Expand[f[x]^(-3/4) D[f[x]^(-1/4), {x, 2}]] 5 f @xD2 f @xD − 2 16 f@xD3 4 f@xD
In a similar way, the second of the above changes of variables yields the following result. In[91]:=
Out[92]=
z[x_] := (3/2 Integrate[Sqrt[f[x]], x])^(2/3) Collect[Expand[#/Coefficient[#, w''[z]]&[(* write nicely *) Numerator[Together[PowerExpand[(D[#, {x, 2}] - λ^2 f[x] #)&[ f[x]^(-1/4) z[x]^(1/4) w[z[x]]] //. Integrate[Sqrt[f[x]], x] -> 2/3 z^(3/2)]]]]], w[z]] 5 5 z f @xD2 z f @xD y i w@zD j 2 − z λ2 + − 2 z j− z + w @zD 16 f@xD3 4 f@xD { k 16 z
This can be transformed into the form above used. In[93]:=
Out[93]=
PowerExpand[Expand[(f[x]/z[x])^(-3/4) * D[(f[x]/z[x])^(-1/4), {x, 2}]] //. Integrate[Sqrt[f[x]], x] -> 2/3 z^(3/2)] 5 5 z f @xD2 z f @xD − 2 + − 2 16 z 16 f@xD3 4 f@xD
As an example, let us investigate the well-known harmonic oscillator as an eigenvalue problem. (We set l = 1, which can always be done, after a suitable change of variables.) The straightforward change of variables gives y££ HxL = Hx2 - ¶L yHxL. The eigenvalues are ¶n = 2 n + 1 and the normalized solutions that go to zero as x goes to infinity are
The Classical Special Functions
1040
x2 1 yn HxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ e- ÅÅÅÅ2ÅÅÅ Hn HxL. "##################### è!!!! n # p 2 n!
where n = 0, 1, 2, … and Hn HxL are the Hermite polynomials, as discussed in Section 2.2. We implement this. In[94]:=
Remove[z, x, f, y, n, ∂, w, λ, ξ]; exactSolutionHO[n_, x_] := 1/Sqrt[Sqrt[Pi] 2^n n!] Exp[-x^2/2] HermiteH[n, x]
è!!!! Let us now investigate the uniform approximation near the right turning point x0 = ¶ . We carry out the relevant integrations needed in z = zHxL. (We do not use definite integrals here to make sure we get a real-values branch of the integral.) In[96]:=
f[∂_, x_] := x^2 - ∂;
In[97]:=
{#, Limit[#, y -> Sqrt[∂]]}&[Integrate[Sqrt[+f[∂, y]], y]] 1 è!!!!!!!!!!!!!! 1 1 è!!!!!!!!!!!!!! 9 y y2 − ∂ − ∂ LogAy + y2 − ∂ E, − ∂ Log@∂D= 2 2 4
Out[97]= In[98]:=
Out[98]= In[99]:= In[100]:=
{#, Limit[#, y -> Sqrt[∂]]}&[Integrate[Sqrt[-f[∂, y]], y]] // FullSimplify[#, ∂ > 0]& 1 j y π∂ i è!!!!!!!!!!!!!!!!! y 2 z 9 jy −y + ∂ + ∂ ArcTanA Ez, − = è!!!!!!!!!!!!!!!!! 2 k 4 −y2 + ∂ { gl = (2 ∂ Log[x + Sqrt[x^2 - ∂]] - 2 x Sqrt[x^2 - ∂] - ∂ Log[∂])/4; gr = (Pi ∂ + 2 x Sqrt[∂ - x^2] + 2 ∂ ArcTan[x/Sqrt[∂ - x^2]])/4;
Then, we can also implement the uniform approximations. In[101]:=
ξ[∂_, x_] := (3/2)^(2/3) ((∂ Log[Sqrt[∂]])/2 + (x Sqrt[x^2 - ∂] ∂ Log[x + Sqrt[x^2 - ∂]])/2)^(2/3) /; x >= Sqrt[∂] ξ[∂_, x_] := (-(3/2)^(2/3) (∂ Pi/4 + (∂ ArcTan[(x Sqrt[∂ - x^2])/(x^2 - ∂)] (x Sqrt[∂ - x^2]))/2)^(2/3)) /; x < Sqrt[∂]
To fulfill the boundary condition yHx Ø ¶L = 0, we have to choose the solution containing the Airy function AiHxL. In[103]:=
uniformApproximationHO[n_, x_] := (ξ[2n + 1, x]/f[2n + 1, x])^(1/4) AiryAi[ξ[2n + 1, x]]
The expression zHxL ê f HxL, which appeared in the neglected terms of the above differential equation, remains finite as x approaches x0 . In[104]:=
Simplify[Normal[Series[((3/2 gr)^(2/3)/f[∂, x])^(1/4), {x, Sqrt[∂], 0}]]] // PowerExpand
3.5 Bessel and Airy Functions
Out[104]=
1041
i j j 1ê4 1 j 2 è!!!! j Hx − 4 x ∂ + 7 ∂L j j 1ê4 j 2 25ê12 Hx ∂3ê2 − ∂2 L j k è!!!!!
2 è!!!!! x −2 x2 +x ∂ +∂ i ij i π+ArgAx− ∂ E−ArgA− E ArgA E y è!!!!! è!!!!! j j x+ ∂ E 2 FloorA x+ ∂ E z j j j z "################# è!!!! è!!!! FloorA 1ê4 j j j z 2 π 2 π j j j z 2 x x − ∂ ∂ + 6 − 6 H−1L π− j jj z j j j z j jj z k kk {
1ê6
è!!!! "################# è!!!! y y 2 x− ∂ z z z z z z z ∂z z z z ∂1ê4 z z z { {
y z z z z z z z z {
To compare the two solutions exactSolutionHO and uniformApproximationHO quantitatively, we match them at x0 . In[105]:=
scaling[n_] := scaling[n] = 1/(2^(1/6) (2n + 1)^(1/12)) AiryAi[0]/exactSolutionHO[n, Sqrt[2n + 1]]
For comparison, let us implement the last WKB solutions. We get them by the expansion of the Airy function for large positive and negative arguments. In[106]:=
(* turn of message for essential singularities in Series *) Off[Series::esss]; asympRight[x_] = Series[AiryAi[x], {x, Infinity, 0}] // Normal 2 x3ê2
Out[108]= In[109]:= Out[109]= In[110]:=
1ê4
1
− 3 H L x è!!!! 2 π
asympLeft[x_] = Series[AiryAi[x], {x, -Infinity, 0}] // Normal π 2 Sin@ + H−xL3ê2 D 4 3 è!!!! π H−xL1ê4
WKBsolHO[n_, x_] := (ξ[2n + 1, x]/f[2n + 1, x])^(1/4) * If[x > Sqrt[2n + 1], asympRight[ξ[2n + 1, x]], asympLeft[ξ[2n + 1, x]]]
(As these formulas arise from one solution, they also solve the so-called “connection” associated with the WKB solutions, which, because of their singularity at x0 , cannot be joined smoothly together there.) Now, let us graphically show the various solutions. (We use a form that is mostly used for visualizations of time-independent states in quantum mechanics textbooks.) In[111]:=
With[{nMax = 5}, Show[Graphics[{ (* the potential x^2 *) {Thickness[0.01], Plot[x^2, {x, -1.1 Sqrt[2nMax + 1], 1.1 Sqrt[2nMax + 1]}, DisplayFunction -> Identity][[1, 1, 1]]}, {Thickness[0.003], GrayLevel[0.2], Dashing[{0.002, 0.002}], (* the scaled WKB solutions (not shown to the left of the left turning point) *) Table[Plot[1/scaling[n] WKBsolHO[n, x] + (2n + 1), {x, #1 Sqrt[2n + 1], #2 Sqrt[2n + 1]}, PlotPoints -> 60, DisplayFunction -> Identity][[1, 1, 1]], {n, 0, nMax}]& @@@ (* middle and right region *) {{-0.99, 0.99}, {1.01, 1.60}}}, (* the eigenvalues *) {Thickness[0.002], GrayLevel[0.8], Table[Line[{# 1.8 Sqrt[2n + 1], 2n + 1}& /@ {-1, 1}], {n, 0, nMax}]},
The Classical Special Functions
1042
(* the exact solutions *) {Thickness[0.002], Table[Plot[exactSolutionHO[n, x] + (2n + 1), {x, -1.8 Sqrt[2n + 1], 1.8 Sqrt[2n + 1]}, PlotPoints -> 60, DisplayFunction -> Identity][[1, 1, 1]], {n, 0, nMax}]}, (* the scaled uniform approximation solutions, not shown to the left of the left turning point *) {Thickness[0.002], GrayLevel[0.5], Dashing[{0.01, 0.01}], Table[Plot[1/scaling[n] uniformApproximationHO[n, x] + (2n + 1), {x, -0.99 Sqrt[2n + 1], 1.8 Sqrt[2n + 1]}, PlotPoints -> 60, DisplayFunction -> Identity][[1, 1, 1]], {n, 0, nMax}]}}], Frame -> True, AspectRatio -> 0.7, FrameLabel -> None]] 12 10 8 6 4 2 0 -6
-4
-2
0
2
4
6
The WKB solutions diverge at the right turning point [1045], [1191] and are not useful approximations there, whereas the uniform approximation coincides to the accuracy of the plot with the exact solution, including at the è!!!! turning point itself, as long as we stay away from the second turning point x0 = ¶ . To get a solution that is also valid there, one can use a more general transformation z = zHxL; see the cited references for details. For the uniform approximation of the xn -potential, see [36]. As a second example with only one turning point, let us treat the smoothed step potential [467], [15], [16], [479]: 1 y££ HxL = J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ-x ÅÅÅÅÅÅ - ¶N yHxL. 1-e We implement this by proceeding exactly in the same way as above. In[112]:=
Clear[f, gr, gl, ξ, ∂, x, scaling] f[∂_, x_] := 1/(1 + Exp[-x]) - ∂; (* f[∂, x] == 0 for x -> Log[∂/(1 - ∂)] *)
In[115]:=
{gr[∂_, x_], gl[∂_, x_]} = With[{ = Exp[x], = Sqrt[1 - ∂]}, {(* right side *) x - Log[-1 + 1/∂] - Log[∂/(1 - ∂)] + Log[2 - 2 ∂ + 1/ - 2 ∂ 1/ + 2 Sqrt[(-∂ + - ∂ )/(1 + )] + 2/ Sqrt[1 - ∂]* Sqrt[(-∂ + - ∂ )/(1 + )]] - ArcTan[((-1 + 2 ∂ + 2 ∂ 1/)* Sqrt[(-∂ + - ∂ )/(1 + )])/(2 (-1 + ∂ + ∂ 1/) Sqrt[∂])] Sqrt[∂] + (Pi (-1 + ∂) ∂ Sqrt[1/(1 - ∂)])/(2 Sqrt[(1 - ∂) ∂]), (* left side *) -(ArcTan[((1 - 2 ∂ + 2 - 2 ∂ ) Sqrt[(∂ - + ∂ )/ (1 + )])/(2 (-1 + ∂) (∂ - + ∂ ))] ) + Log[-1 + 2 ∂ +
3.5 Bessel and Airy Functions
1043
2∂/ + 2 Sqrt[∂] Sqrt[(∂ - + ∂ )/(1 + )] + 2/ Sqrt[∂] * Sqrt[(∂ - + ∂ )/(1 + )]] Sqrt[∂] + (Pi (-1 + ∂) ∂ * Sqrt[1/∂])/(2 Sqrt[(1 - ∂) ∂])}]; In[116]:=
(* ξ in the classically allowed and forbidden region *) ξ[∂_, x_] := ( (3/2)^(2/3) gr[∂, x]^(2/3)) /; x >= Log[∂/(1 - ∂)]; ξ[∂_, x_] := (-(3/2)^(2/3) gl[∂, x]^(2/3)) /; x < Log[∂/(1 - ∂)];
In[119]:=
uniformApproximationStep[∂_, x_] := (ξ[∂, x]/f[∂, x])^(1/4) AiryAi[ξ[∂, x]]; (* the exact solution can be expressed through hypergeometric functions; see below *) exactSolutionStep[∂_, x_] = ∂^(-1/4)(* normalize to DiracDelta[∂ - ∂'] *) * (1/(1 + Exp[x]))^Sqrt[1 - ∂] (1 - 1/(1 + Exp[x]))^(I Sqrt[∂])* Hypergeometric2F1[I Sqrt[∂] + Sqrt[1 - ∂], I Sqrt[∂] + Sqrt[1 - ∂] + 1, 2 Sqrt[1 - ∂] + 1, 1/(1 + Exp[x])]; (* for better comparison scale the solution *) scaling[∂_] := scaling[∂] = uniformApproximationStep[∂ (1 + 10^-8)(* for the picture *), Log[∂/(1 - ∂)]]/ exactSolutionStep[∂, Log[∂/(1 - ∂)]];
Again, the uniform approximation agrees well with the exact solutions [228]. Here is a sketch of the potential and five solutions at different energies. In[124]:=
Module[{pic2, max}, Table[(* the exact wave functions *) pic1[∂] = (* the exact solutions *) Plot[exactSolutionStep[∂, x], {x, -30, 10}, DisplayFunction -> 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
]; If[ns === {}, {}, (* lift coefficients and form equation *) Mod[Last[ns], , -Floor[ /2]].cs /. c[i_, j_] :> 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 J− 1 − 1 − m + 1 + 1 − m N m1ê4 1+ 1−m "################# è!!!! è!!!! "################# è!!!! 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 , 1, , =, 9 , è!!!! , è!!!! m1ê4 m1ê4 "######################### "######################### è!!!!!!!!!!!! è!!!!!!!!!!!! m m 1− 1−m 1− 1−m "################# è!!!! è!!!! "################# è!!!! 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ê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 ij g ƒƒƒƒ j0 j0 2 yzyz jHtL = 2 arcsinjjjjsinJ ÅÅÅÅÅÅÅÅÅ N snjjjj$%%%%%% ÅÅÅÅÅ % t§ƒ sinJ ÅÅÅÅÅÅÅÅÅ N zzzzzzzz 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 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 o sen Hqs , 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 qcs n j ê c , cs = c or s. To fulfill the boundary condition nj =2 RHr0 L = 0 we must have cen Hqcn j , i r0 L = 0 or sen Hqsn j , i r0 L = 0. For a given n and r0 , this implicitly defines a countable infinite number of values qcn 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 small values of n, the qcs are well separated. (We take into account that the functions are purely imaginary for an 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 qcs n j. 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 HoldPattern@qc@0D@3DD HoldPattern@qc@1D@2DD HoldPattern@qc@2D@1DD HoldPattern@qc@4D@2DD HoldPattern@qc@5D@1DD HoldPattern@qc@6D@1DD
3.17779, 60.4245, 27.5324, 8.39973, 46.2685, 22.6667, 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, this is r0 . Varying this parameter allows for degenerate eigenvalues. For r0 º 0.495, the two states yc1, 3 and ys5, 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 {{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 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
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
0
3
-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
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))]} 11 H−5 + 15552 zL2 i j + − j− 2 H−1 + 1800 z 1728 zL 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
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: 24 n+2 Hn + 1L !4 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 Sums of the form s j = ⁄¶ Hk - 1 ê 2L! , k = 0, 1, … occur in the perturbation expansion of the quartic 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 VHzL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . 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 i yz yz jiij 3 Ljjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z + 3 Ljjjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z p ÅÅÅÅÅ z p ÅÅÅÅÅ z 2 cosH ÅÅÅÅ Å L 2 cosH ÅÅÅÅ Å L 9 { 9 { k kk
3 1 7 2 yz zy zyz - Ljijijj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅ p zz jjj z zzz = ÅÅÅÅ p ÅÅÅÅÅ z 18 2 cosH ÅÅÅÅ Å L 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 ƒHu + v; g2 , g3 L = ÅÅÅÅÅÅ J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N - ƒHu; g2 , g3 L - ƒHv; g2 , g3 L. 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 1 ∑ zHx; g2 , g3 L 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 5g g2 g3 g3 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 yl HxL = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ex zHl;g2 ,g3 L 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 sHx; g2 , g3 L = expij‡ JzHx; g2 , g3 L - ÅÅÅÅÅÅ N dxyz 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 sHz; g2 , g3 L = „ „ am,n ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z 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 ij ¶ yz yzz gk-1 jj zz zz 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 GHcL GHb - aL 1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 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 GHcL GHb - aL 1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ H1 - zL-a 2 F1 Ja; c - b, a - b + 1; ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N GHbL GHc - aL 1-z 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 GHcL GHc - a - bL -a 1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z 2 F1 Ja; a - c + 1, a + b - c + 1; 1 - ÅÅÅÅÅÅ N z GHc - aL GHc - bL GHcL GHa + b - cL 1 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 - z2 L z2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å ÅÅÅÅÅÅÅ Å ÅÅ Å + H1 z L z ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + 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 a+bk 1 1 2 ÅÅÅÅÅÅ = ‚ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ J ÅÅÅÅÅÅ N J ÅÅÅÅÅÅ N J ÅÅÅÅÅÅ N ck 3 p k=0 k ! 2 k 3 k 3 k 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 i y y y 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 ∑t 2 ∑t 2 ∑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 ¶ ij ⁄ expH-k 2 p pL yzzz j j J3 H0, expH- p pLL jj k=-¶ z J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ N = jjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zzzz J3 H0, expH-q pLL jj ¶ z j ⁄ expH-k 2 q pL zz k k=-¶ { r
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 "##### jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 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 GH ÅÅÅÅ ÅÅ L 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 GHn zL = nn z-1ê2 H2 pL
H1-nLê2
n
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] 3ê2
Out[20]=
2 z è!!!!!!!!!!!! 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}] 3 5 1 2 1 4 385 I M 85085 I 1ζ M 37182145 I M 5391411025 I 1ζ M 5 ζ ζ Out[9]= 1 − + − + − + 72 ζ 10368 2239488 644972544 46438023168 6
7
8
5849680962125 I 1ζ M 1267709431363375 I 1ζ M 2562040760785380875 I 1ζ M − + − 20061226008576 1444408272617472 831979165027663872 9
10
1 6653619855759634132375 I 1ζ M 4318199286388002551911375 I 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 + mL H2 + mL H1 + mL H1 + nL H1 + nL H2 + nL Γ@3 + mD 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 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 2d B r2 I ÅÅÅÅ Å2ÅÅÅÅÅ , ÅÅÅÅ2ÅÅÅÅÅÅ M - rd B r2 I ÅÅÅÅ12 , ÅÅÅÅ ÅÅÅÅÅÅ M 2 ÅÅÅÅÅÅÅÅÅÅÅ
ÅÅÅÅÅÅÅÅÅÅÅ
4 4 r + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ d+1 1 BI ÅÅÅÅ ÅÅÅÅÅÅ , ÅÅ2ÅÅ M 2 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 d d 2d d2 Gamma@1 + D Gamma@ D 2 2 è!!!!! 3 H1 + dL π Gamma@ + dD 2
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 1+n i x BetaA , , E y j 1 z n j 4 r2 2 2 z z r j j z UnitStep@2 r − xD n − è!!!!!!! è!!!! ! j 1+n 2 Gamma@ Gamma@1 + D π x D z 2 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 j−x GammaA1 + E Hypergeometric2F1A , − , , 2 E + 2 2 2 2 2 4r k k
1+n n 1+n è!!!!! yy ì JGammaA1 + π r GammaA E Sign@rD UnitStep@2 r − xDz E GammaA EN 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−20 H30 x + H19 − 18 EulerGammaL x3 + 18 x Cos@xD − 66 Sin@xDL + x2 j j−360 x CosIntegral@xD + 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 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
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 a−a c Gamma@aD Hb ξ − Log@aD + PolyGamma@0, aDL 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 "###################### ‰ yH1L HaL x+yH0L HaL yz 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]=
1 j 3 1 3 yz i y i jπ Coth@n πD + j j− + OA E z zz 2 k n {{ 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 z z z z z z z z ij ÅÅÅÅk - 1 z logHkL yzz ÅÅzÅÅÅ -1 ÅÅÅÅÅ -1 ÅÅÅÅÅ -2 Out[7]//TraditionalForm= :w - k k GJ ÅÅÅÅÅ N, -GJ ÅÅÅÅÅ N logHkL k k - GJ ÅÅÅÅÅ N yH0L J ÅÅÅÅ N k ÅÅkÅÅÅ -2 + wz , z GJ ÅÅÅÅÅ N yH0L J ÅÅÅÅÅ N k ÅÅkÅÅÅ -3 - GJ ÅÅÅÅÅ N jjj ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ z k k + wk , k k k k k k k k k k2 z{ 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 z 2 z z z z ji ÅÅÅÅk - 3 z logHkL zyz H0L z ÅÅzÅÅÅ -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 + k k k k k k k k2 z{ k
z z 2 ÅÅÅÅkz - 1 yz ÅÅzÅÅÅ -1 z ij ÅÅkÅÅ - 1 z logHkL yzz H0L z ÅÅzÅÅÅ -3 z ijj ÅÅkÅÅ - 1 z logHkL yzz ÅÅzÅÅÅ -1 z ijj 2 logHkL z 2z k k z GJ ÅÅÅÅ N jjj ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅ z y J ÅÅÅÅ Å N k GJ ÅÅ Å Å N j ÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅÅ Å ÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅ z k GJ ÅÅÅÅ Å N j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅ ÅÅÅÅ Å Å ÅÅ Å ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅ zz k k + z j z j k2 { k2 { k3 k3 k 2 z{ 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 ji ÅÅkÅÅ - 1 z logHkL zyz H0L z ÅÅzÅÅÅ -2 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 k2 - w z, wk,k k3 + 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 k2 + z wk,z k + w + H3 k - zL wk + z wz , wk wz,z k3 - 2 w2z k2 + wz H-wk,z k3 - wk k2 L + w Hz wz + k Hk - zL wz,z L, wk,k k2 + 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 k2 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
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. ∑3 PHn; f » mL ∑2 PHn; f » mL 4 H-1 + mL m Hm - nL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + 2 H-7 m + 11 m2 + 2 n - 6 m 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
Out[9]= 99α0 → − , αC → − 3 ,
Hm − nL H−1 + nL n α1 H−3 m + 8 n + 8 m n − 13 n2 L α1 α3 → , α2 → == 2 H1 + m − 4 nL 4 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. ∑3 PHn; f » mL ∑2 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 16 Hm - 1L Hm - nL6 Hn - 1L2 ijj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz ∑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 { ij ij i ∑2 PHn; f » mL zy2 y y jj-8 jj2 - jjjjij ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z - 27 n + 27zzzz Hn - 1L nzzzz m6 + j j j 2 ∑f { k k kk { { 2 i y i ∑2 PHn; f » mL yz n jjjj3 H9 n Hn H51 n - 94L + 35L + 176L - 8 jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z Hn - 1L H5 n + 1Lzzzz m5 2 ∑f k { k { 2 i y i ∑2 PHn; f » mL yz n2 jjjj40 H-2 n2 + n + 1L jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z + 3 H27 n H8 n2 + n - 26L + 755Lzzzz m4 + 2 ∑f k { k { 2 i y 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 i y i ∑2 PHn; f » mL yz 8 n4 jjjj5 Hn2 + n - 2L jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z - 27 Hn - 2L n - 84zzzz m2 2 ∑ f k { k {
ii ∑2 PHn; f » mL yz2 y ii ∑2 PHn; f » mL yz2 y y 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 yzz ji ∑PHn; f » mL zy8 j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z zz j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z + 2 ∑f ∑f { k { {k
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
ij ∑2 PHn; f » mL yz 2 i ∑2 PHn; f » mL yz 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 ji ∑ PHn; f » mL zy4 j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z m n jj243 n m2 + Hm - nL2 Hm H9 n - 8L - 10 nL jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z zz j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z 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 27 jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z m n j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ - j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ z m n = 0 ∑f2 ∑f ∑f2 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 Out[5]= ‡ ! x è!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 z EllipticPiA I3 + 3 M, ArcSinA ì z z è!!!!!!!!!!!!!!!!!!!!!!!! ! E, 2 + 3 Ez z 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]}] è!!!!! è!!!!! Out[23]= 9− $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I3 + 3 M% , − $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I3 + 3 M% = 1 6
1 2
1 6
1 2
In[24]:= fPart = (cfu (elliptics[[1]] /. FRule) -
cfl (elliptics[[1]] /. x -> lowerLimit)) // FullSimplify 1 1 è!!!!! è!!!!! Out[24]= $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I3 − 3 M% EllipticK@2 − 3 D 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 è!!!!! è!!!!! Out[33]= 9 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I3 + 3 M% , $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I3 + 3 M% = 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"################### è!!!!!# è!!!!! Out[41]= ! j 3 − 3 EllipticK@2 − 3 D − ! è!!!! è!!!! 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"################### ij 1 - è!!!! 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 ! − , è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1 zH0,1L @x, yD ! − = è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 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
3 5 4 r2 r02 i 3 r3 r02 µ µ0 Hypergeometric2F1A , , 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
3 4 r r0 r r02 µ µ0 Hypergeometric2F1A , 54 , 2, E 4 Hr2 +r02 +z2 L2 + 3ê2 2 Hr2 + r02 + z2 L 16 r3 r02 8 r r02 7 9 4 r2 r02 y 15 r2 r02 J− + N µ µ0 Hypergeometric2F1A , , 3, E z z 4 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
3 4 r r0 3 r r02 z µ µ0 Hypergeometric2F1A , 54 , 2, E 4 Hr2 +r02 +z2 L2 + 5ê2 2 2 2 4 Hr + r0 + z L 2
2
7 9 4 r r0 15 r3 r04 z µ µ0 Hypergeometric2F1A , , 3, E 4 4 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]=
r0 µ µ0 Cos@ϕD r02 µ µ0 Cos@ϕD2 3 r0 µ µ0 Cos@ϕD Hr02 − 2 z2 + 3 r02 Cos@2 ϕDL r + + + è!!!!!!!!!!!!!!!!!!!!!! 2 π Hr02 + z2 L3ê2 16 π Hr02 + z2 L5ê2 4 π r02 + z2 r r02 µ µ0 Cos@ϕD2 H−3 Hr02 + z2 L + 5 r02 Cos@ϕD2 L r2 + 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]=
r02 µ µ0 3 r02 Hr02 − 4 z2 L µ µ0 r2 + + O@rD4 2 Hr02 + z2 L3ê2 8 Hr02 + z2 L7ê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) 2 ij i 8 "####### i 432 "####### y 1152 "####### 25 z4 25 177408 "####### 25 z2 1257984 "####### 25 z4 z j 1 j jj j j z Out[18]= j 5 − + r4 j − + − z + j j j z j j 4 j 4 6 z r0 jj 5 j 625 r0 z 625 r0 15625 r0 78125 r08 kk k { i y 3456 "####### 25 z2 236544 "####### 25 z4 y j zy z z j z z z z r2 j − z j z z µ µ0z z j z z j zz z z 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
0.4 0.2
-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 g3 g22 3 g2 g3 49 g23 + 750 g32 g22 g3 g2 H539 g23 + 18000 g32 L 20 28 1200 6160 7644000 184800 11435424000 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 3 ∑ g3 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 è!!!!! 6 è!!!!! Σ@3D 3 I2 + 3 M è!!!!! è!!!!! Σ@4D 3 + 2 3 + 2 2 33ê4 è!!!!! Σ@6D 3 I3 + 2 2 M Σ@2D 5 + 2
"################### è!!!!! è!!!!! # 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 è!!!!!!!! 9 15 3 è!!!!!!!! Σ@15D 18 + + "######################################### 5 I31 + 8 15 M 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
Σ@78D 3 J867 + 170
è!!!!!!!! è!!!!!!!! 26 + 12 "######################################################### 2 I5201 + 1020 26 M N
Σ@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
(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]=
H−1 + νL2 −1 + ν 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 E−LogGammaA 3 + 3 E −EulerGamma−LogGammaA 2 2 2 2
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 è!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!! ! 1 1 2 − 4 b! ME GammaA GammaA I2 + a − a I2 + a + a2 − 4 b ME 2 2
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 + 1ê3 − 22ê3 1ê3 z j6 + 2 a − zE 6 k 1ê3 { k è!!!!! è!!!!! è!!!!! 1ê3 2 1ê3 1ê3 1ê3 22 H1 + 3 L a − 6 2 b−62 3 b + 12 + 4 a 1ê3 + 22ê3 2ê3 − 22ê3 3 2ê3 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 1 1 1 z2 j C@2D j 2 % GammaA + H−1 + ∂LE + jH−1L 4 $%%%%%%%%%% j z 2 4 k
1−∂ yz y y z 1 2 1−∂ z 1 1 1−∂ z z z ì JGammaA z J 2 N GammaA Ez + H−1 + ∂LE GammaA ENz z z zz z z z 4 2 4 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 − D Gamma@ D Gamma@ − D 4 4 4 4 1 1 è!!!!! è!!!!! 1 H + L 2 2 H−1+∂L π ∂ H 13 + 3 L 2 2 H−7+∂L π H−1 + ∂2 L 3 3 , , 1−∂ Gamma@ 4 D Gamma@ 34 − ∂4 D 1 1 è!!!!! è!!!!! 1 1 H + L 2 2 H−5+∂L π H−9 + ∂2 L H + L 2 2 H−9+∂L π H30 − 31 ∂ + ∂3 L 15 15 45 45 − , − , 1−∂ Gamma@ 4 D Gamma@ 34 − ∂4 D 1 1 è!!!!! è!!!!! 1 1 H + L 2 2 H−7+∂L π H210 − 79 ∂ + ∂3 L H + L 2 2 H−11+∂L π H−9 + ∂L H−5 + ∂L H−1 + ∂L 315 315 45 45 , , 1−∂ Gamma@ 4 D Gamma@ 34 − ∂4 D 1 è!!!!! 1 H + L 2 2 H−9+∂L π H−11 + ∂L H−7 + ∂L H−3 + ∂L 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 z/n}]; Short[myAsymptoticBesselJ[n, z], 12]
Out[16]//Short=
1 Gamma@1 + nD
2 +
i z 2 I4 j j n j j j jn expA 16 n4 I 1 k
+
−
−
1 4
i j k
π +
LogA− 1 +
M
z2 n2 z2 + n2
z2 n2
M
3
+
z2 I32 +
288 z2 n2
128 n6
I
232 z4 n4 z2 −1 + n2 +
+
13 z6 n6
6
M
M
+
y i y z z2 % z z2 % z y nj z j j z Ez 1 LogA E LogA1 $%%%%%%%%%%%%%%%%%%% 1 Ez z j z j 1 $%%%%%%%%%%%%%%%%%%% zEz n2 n n2 z z { k { { +
−
+
−
+
−
+
−
Here is the value calculated with this expansion. It agrees well with the value from the built-in command. In[18]:= {N[myAsymptoticBesselJ[1000, 100], 22], N[BesselJ[1000, 100.]]} Out[18]=
81.902621040949654807218 10−870 0. 10−892 , 1.90262104095027 10−870 < ×
+
×
×
c) This is a straightforward definition for the intensity. Because we are interested in a picture only, the relatively low precision goal of 4 is enough. In[1]:= int[u_, v_] := Abs[NIntegrate[BesselJ[0, v ρ] Exp[-I u ρ^2/2] ρ, {ρ, 0, 1}, Compiled -> 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 (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
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 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 VHxL = -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 Out[2]= 9LogA∂ j ! E z j z è!!!! j zE= 2 k { In[3]:= X[t_, ∂_] = Log[∂ (Tanh[(t Sqrt[∂])/Sqrt[2]]^2 - 1)]
i
è!!!!!
k
2
2
y
t ∂ j−1 + TanhA z zE Out[3]= LogA∂ j j è!!!! ! E z j z {
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
(HoldForm[D[deter, {λ, ii}, {α, jj}]] /. {ii -> i, jj -> j}) Out[8]= 999λ @αD → 2∂
deter ∂
I∂
deterM2 ∂
8λ,0 0). In[21]:= rootRules =
{Sqrt[α^(2/3)/(2λ + α l)] -> α^(1/3)(2λ + α l)^(-1/2), Sqrt[(-2 α^(2/3))/(-2λ + α l)] -> Sqrt[2] α^(1/3)(2λ - α l)^(-1/2)}; In[22]:= (deterAsymp5 = deterAsymp4 //. rootRules // Expand)
α2ê3 lα−2λ
l3 α2 96 λ
α2ê3 lα−2λ
l3 α2 96 λ
è!!!!! è!!!!! Out[22]= −120 l α5ê3 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%% − CosA 3ê2 − l λ E − 240 α2ê3 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%% − λ CosA 3ê2 − l λ E − è!!!!! è!!!!! l3 α2 l3 α2 120 l α2 CosA − l λ E 240 α λ CosA − l λ E l3 α2 è!!!!! è!!!!! 96 λ3ê2 96 λ3ê2 + − 288 2 l2 α2 SinA 3ê2 − l λ E + è!!!!!!!!!!!!!!!!!!!!!! ! è!!!!!!!!!!!!!!!!!!!!!! ! 96 λ lα+2λ lα+2λ è!!!!! è!!!!! l3 α2 25 2 α2 SinA − l λ E l3 α2 è!!!!! è!!!!! 96 λ3ê2 1152 2 λ2 SinA 3ê2 − l λ E + è!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!! ! 96 λ −l α + 2 λ l α + 2 λ
additionalRootRules calculates series expansions for Hl ≤ a lL1ê2 . In[23]:= ord3 = 2;
additionalRootRules = {(2 λ + α l)^(-1/2) -> Normal[Series[(2 λ + α l)^(-1/2), {α, 0, ord3}]], (2 λ - α l)^(-1/2) -> Normal[Series[(2 λ - α l)^(-1/2), {α, 0, ord3}]]} 1 3 l2 α2 lα 1 Out[24]= 9 ! → ! , è!!!!!!!!!!!!!!!!!!!!!! è!!!!! − è!!!!! + è!!!!! è!!!! lα+2λ 32 2 λ5ê2 4 2 λ3ê2 2 λ 1 3 l2 α2 lα 1 → ! = è!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! + è!!!!! + è!!!!! è!!!! −l α + 2 λ 32 2 λ5ê2 4 2 λ3ê2 2 λ In[25]:= deterAsymp6 = Expand[deterAsymp5 //. additionalRootRules]
α2ê3 lα−2λ
l3 α2 96 λ
3 2
l α 45 l3 α4 CosA − l
è!!!!! λE
è!!!!! 96 λ3ê2 Out[25]= −120 l α5ê3 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%% − CosA 3ê2 − l λ E − + è!!!! ! 4
2
λ5ê2
è!!!!! è!!!!! è!!!!! l3 α2 l3 α2 105 l2 α3 CosA − l λ E 90 2 l α2 CosA − l λ E 96 λ3ê2 96 λ3ê2 − + è!!!! ! 3ê2 è!!!!! 2 2 λ λ 120
l3 α2 α2ê3 l3 α2 è!!!!! è!!!!! è!!!!! è!!!!! 2 α λ CosA 3ê2 − l λ E − 240 α2ê3 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%% − λ CosA 3ê2 − l λ E − 96 λ lα−2λ 96 λ
288
è!!!!! l3 α2 225 l4 α6 SinA − l λ E l3 α2 è!!!!! 2 2 è!!!!! 96 λ3ê2 2 l α SinA 3ê2 − l λ E + + è!!!!! 96 λ 1024 2 λ5
è!!!!! è!!!!! l3 α2 l3 α2 25 l2 α4 SinA − l λ E 25 α2 SinA − l λ E l3 α2 ! è!!!!! 96 λ3ê2 96 λ3ê2 + 1152 è!!!! + 2 λ2 SinA 3ê2 − l λ E è!!!! ! 3 è!!!! ! 96 λ 8 2 λ 2 λ
This is our simplified result for deter. First, we now consider the limiting case a Ø 0. In[26]:= Limit[deterAsymp6, α -> 0, Direction -> -1] Out[26]= −1152
è!!!!! 2 è!!!!! 2 λ Sin@l λ D
è!!!! Thus, l l = j p, j = 1, 2, …, which can also be seen more or less directly from the differential equation for a = 0. Now, we turn to the computation of ci 1 , ci 2 . Because the first derivative of deterAsymp6 with respect to α vanishes, we have ci 1 = 0 (this was to be expected from the symmetry of the problem), and the computation of ci 2 simplifies. In[27]:= Simplify[Normal[Series[D[deterAsymp6, α], {α, 0, 0}]]] // PowerExpand Out[27]= 0
Solutions
1271 In[28]:= PowerExpand[Normal[
Series[-1/2 (D[deterAsymp6, {α, 2}]/D[deterAsymp6, λ]), {α, 0, 0}]]] è!!!!! è!!!!! è!!!!! è!!!!! 360 2 l CosAl λ E è!!!!! è!!!!! è!!!!! è!!!!! è!!!!! 25 2 SinAl λ E − + 24 2 l3 λ Cos@l λ D + 576 2 l2 Sin@l λ D − è!!!!! λ λ Out[28]= − è!!!! ! è!!!! ! è!!!! ! è!!!! ! 2 H−576 2 l λ3ê2 Cos@l λ D − 2304 2 λ Sin@l λ DL
We now take account of the eigenvalue equation for a = 0 [47], [1174], [398], [485], [1244]. In[29]:= % //. {Sin[l Sqrt[λ]] -> 0} // Simplify Out[29]=
−15 + l2 λ 48 λ2
We finally obtain the following expression for the eigenvalue of a = 0. In[30]:= % /. λ -> (i Pi/l)^2 Out[30]=
l4 H−15 + i2 π2 L 48 i4 π4
We now examine the quality of the approximation for the three smallest eigenvalues in comparison with the exact results (computed numerically). Let l = 1. In[31]:= Show[GraphicsArray[Table[
(* the approximations *) Plot[i^2 Pi^2 + (-15 + i^2 Pi^2)/(48 i^4 Pi^4) α^2, {α, 0, 101}, Epilog -> {PointSize[0.03], (* the exact values *) Point /@ Table[{α, λ /. FindRoot[(deter /. l -> 1) == 0, {λ, i^2 N[Pi^2]}]}, {α, 0.01, 100.01, 10.0}]}, PlotRange -> All, DisplayFunction -> Identity, AxesLabel -> (StyleForm[#, "Input", FontSize -> 5]& /@ {α, λ}), PlotLabel -> StyleForm["i = " ToString[i], FontSize -> 6]], {i, 1, 3}], GraphicsSpacing -> 0]] 10
l
i=1
l
l
i=2
42.5
8
90.5
42
6
41.5
4
41
90 89.5
40.5
2 20
40
60
80
100
a
39.5
i=3
20
40
60
80
100
a 20
40
60
80
100
a
Let us compare the result l4 Hi2 p2 - 15L ê H48 i4 p4 L with the perturbation theory result obtained from the sum given above. This is a simplified form of the matrix element. In[32]:= Clear[a, l, m, n];
int1 = Simplify[2 Integrate[ Expand[Sin[n Pi x/l] (a x - a l/2) Sin[m Pi x/l]], {x, 0, l}], Element[{n, m}, Integers]] 4 H−1 + H−1Lm+n L a l2 m n Out[33]= Hm2 − n2 L2 π2
ev is the eigenvalue of the unperturbed problem. In[34]:= ev[n_] := (n^2 Pi^2)/l^2
term[n, m] are the summands in the infinite sum. In[35]:= term[n_, m_] = int1^2/(ev[n] - ev[m]) /. {a -> 1, l -> 1} Out[35]=
16 H−1 + H−1Lm+n L2 m2 n2 Hm2 − n2 L4 π4 H−m2 π2 + n2 π2 L
To evaluate the infinite sum symbolically, we split the sum part in the terms less than and greater than n. In[36]:= sum[n_] := Together[Sum[Evaluate[term[n, m]], {m, n - 1}] +
(Sum[#, {m, n + 1, Infinity}]& /@ Apart[term[n, m]])]
The classical perturbation theory result agrees with the one from above.
The Classical Special Functions
1272 In[37]:= f[i_] := Cancel[((-15 + i^2 Pi^2))/(48 i^4 Pi^4)]; In[38]:= Table[{sum[i], f[i]}, {i, 3}]
−15 + π2 48 π
−15 + π2 48 π
−15 + 4 π2 768 π
−15 + 4 π2 768 π
−5 + 3 π2 1296 π
−5 + 3 π2 1296 π
Out[38]= 99 4 , 4 =, 9 4 , 4 == 4 , 4 =, 9
By increasing ord1, ord2, and ord3, and the corresponding expressions for ∑2n li HaL ê ∑ a2n §a=0 a2n and applying repeated implicit differentation of the exact eigenvalue equation, it is straightforward to find a correction term of higher order in a. (The odd order terms all vanish identically for the example treated here because of symmetry.) b) Here, we follow the same spirit as in Part a). This means we calculate an implicit equation for the eigenvalue and then get the coefficient c2 by differentiation with respect to a and l. This ignores exponentially small lifetime effects [197], [35], [377], [981]. These are the three solutions of the governing differential equation in the three regions z < -l ê 2, -l ê 2 < z < l ê 2, and z > l ê 2. In[1]:= (* -l/2 < z < l/2 *)
DSolve[-y''[z] + α z y[z] == λ y[z], y[z], z, GeneratedParameters -> B][[1, 1, 2]] zα−λ zα−λ Out[2]= AiryAiA E B@1D + AiryBiA E B@2D α2ê3 α2ê3
We rewrite the solution in a form slightly easier to use later. In[3]:= solMiddle = B[1] AiryBi[α^(1/3) (z - λ/α)] +
B[2] AiryAi[α^(1/3) (z - λ/α)];
In[4]:= (* z > l/2 *)
DSolve[-y''[z] + α z y[z] + v0 y[z] == λ y[z], y[z], z, GeneratedParameters -> C][[1, 1, 2]] /. (* use at +Infinity vanishing solution only *) _AiryBi -> 0 v0 + z α − λ Out[5]= AiryAiA E C@1D α2ê3 In[6]:= solRight = C[2] AiryAi[α^(1/3) (z + (v0 - λ)/α)]; In[7]:= (* z < -l/2 *)
solLeft = DSolve[-y''[z] + α z y[z] + v0 y[z] == λ y[z], y[z], z, GeneratedParameters -> A][[1, 1, 2]] v0 + z α − λ v0 + z α − λ Out[8]= A@1D AiryAiA E + A@2D AiryBiA E α2ê3 α2ê3
Taking into account the asymptotics of the Airy functions, we achieve a purely outgoing wave (Sommerfeld’s radiation condition) in the far left by using the following linear combination of AiryAi and AiryBi (see [458], [296], [914], [19], [35], [270], [459], [1041], [1111], [610]). In[9]:= solLeft = A[1] (
AiryBi[α^(1/3) ((-λ + v0)/α + z)] I AiryAi[α^(1/3) ((-λ + v0)/α + z)]) v0 − λ v0 − λ Out[9]= A@1D J− AiryAiAα1ê3 Jz + NE + AiryBiAα1ê3 Jz + NEN α α
Integrating the differential equation under consideration over an infinitesimal neighborhood around z = -l ê 2 or z = l ê 2, we obtain the condition that the function yHzL as well its first derivative y£ HzL must be continuous at z = -l ê 2 and z = l ê 2. So we have the following equations connecting the three solutions solLeft, solMiddle, and solRight at z = -l ê 2 and z = l ê 2. In[10]:= eq1 = (solLeft
/. z -> -l/2) - (solMiddle /. z -> -l/2) l 2
v0 − λ α
l 2
v0 − λ α
Out[10]= A@1D J− AiryAiAα1ê3 J− + NE + AiryBiAα1ê3 J− + NEN −
l λ l λ AiryBiAα1ê3 J− − NE B@1D − AiryAiAα1ê3 J− − NE B@2D 2 α 2 α In[11]:= eq2 = (solMiddle /. z -> +l/2) - (solRight 1ê3
Out[11]= AiryBiAα
/. z -> +l/2)
l λ l λ l v0 − λ J − NE B@1D + AiryAiAα1ê3 J − NE B@2D − AiryAiAα1ê3 J + NE C@2D 2 α 2 α 2 α
In[12]:= eq3 = (D[solLeft,
z] /. z -> -l/2) - (D[solMiddle, z] /. z -> -l/2)
Solutions
1273 l 2
v0 − λ α
l 2
v0 − λ α
Out[12]= A@1D J− α1ê3 AiryAiPrimeAα1ê3 J− + NE + α1ê3 AiryBiPrimeAα1ê3 J− + NEN −
l λ l λ α1ê3 AiryBiPrimeAα1ê3 J− − NE B@1D − α1ê3 AiryAiPrimeAα1ê3 J− − NE B@2D 2 α 2 α In[13]:= eq4 = (D[solRight, z] /. z -> +l/2) - (D[solMiddle, z] /. z -> +l/2)
l λ 2 α l λ l v0 − λ J − NE B@2D + α1ê3 AiryAiPrimeAα1ê3 J + NE C@2D 2 α 2 α
Out[13]= −α1ê3 AiryBiPrimeAα1ê3 J − NE B@1D −
α1ê3 AiryAiPrimeAα1ê3
These are four equations in the four unknown coefficients of the various Airy functions. These four equations have a nontrivial solution if and only if the corresponding coefficient determinant vanishes. In[14]:= (* we extract the coefficient in such a complicated manner because the
numbering 1 or 2 of the constants might depend on the Mathematica version *) abc = Cases[{solLeft, solMiddle, solRight}, _A | _B | _C, {0, Infinity}] // Union Out[15]= 8A@1D, B@1D, B@2D, C@2D< In[16]:= mat = Outer[Coefficient, Expand /@ {eq1, eq2, eq3, eq4}, abc]
l v0 − λ 2 α l λ l λ −AiryBiAα1ê3 J− − NE, −AiryAiAα1ê3 J− − NE, 0=, 2 α 2 α l λ l λ l v0 − λ 90, AiryBiAα1ê3 J − NE, AiryAiAα1ê3 J − NE, −AiryAiAα1ê3 J + NE=, 2 α 2 α 2 α l v0 − λ l v0 − λ 9− α1ê3 AiryAiPrimeAα1ê3 J− + NE + α1ê3 AiryBiPrimeAα1ê3 J− + NE, 2 α 2 α l λ l λ −α1ê3 AiryBiPrimeAα1ê3 J− − NE, −α1ê3 AiryAiPrimeAα1ê3 J− − NE, 0=, 2 α 2 α l λ l λ 90, −α1ê3 AiryBiPrimeAα1ê3 J − NE, −α1ê3 AiryAiPrimeAα1ê3 J − NE, 2 α 2 α l v0 − λ α1ê3 AiryAiPrimeAα1ê3 J + NE== 2 α l 2
v0 − λ α
Out[16]= 99− AiryAiAα1ê3 J− + NE + AiryBiAα1ê3 J− + NE,
In[17]:= deter = Factor[Det[mat] // PowerExpand]/ α^(2/3);
This coefficient determinant is the implicit equation for the eigenvalues lHaL. Because the problem under consideration has a continuous spectrum for l in H-¶, ¶L, the solutions of deter for a given a are, in general, complex valued. In the limit a Ø 0, some of them (at least one) become real. These real solutions are the solutions we are looking for, an expansion dependent of a. In[18]:= Short[deter, 12]
v0 − λ α l v0 − λ l λ AiryAiPrimeAα1ê3 J + NE AiryBiAα1ê3 J− − NE − 2 α 2 α l v0 − λ l v0 − λ l λ AiryAiAα1ê3 J + NE AiryAiPrimeAα1ê3 J− + NE AiryAiPrimeAα1ê3 J − NE 2 α 2 α 2 α l λ l λ l v0 − λ AiryBiAα1ê3 J− − NE − AiryAiAα1ê3 J− − NE AiryAiPrimeAα1ê3 J− + NE 2 α 2 α 2 α l v0 − λ l λ AiryAiPrimeAα1ê3 J + NE AiryBiAα1ê3 J − NE + 13 + 2 α 2 α l v0 − λ l λ l v0 − λ AiryAiAα1ê3 J + NE AiryAiAα1ê3 J− − NE AiryAiPrimeAα1ê3 J− + NE 2 α 2 α 2 α l λ l v0 − λ AiryBiPrimeAα1ê3 J − NE − AiryAiAα1ê3 J− + NE 2 α 2 α l v0 − λ l λ l λ AiryAiAα1ê3 J + NE AiryAiPrimeAα1ê3 J− − NE AiryBiPrimeAα1ê3 J − NE + 2 α 2 α 2 α l v0 − λ l λ l v0 − λ AiryAiAα1ê3 J + NE AiryAiPrimeAα1ê3 J− − NE AiryBiAα1ê3 J− + NE 2 α 2 α 2 α l λ l v0 − λ l λ AiryBiPrimeAα1ê3 J − NE − AiryAiAα1ê3 J + NE AiryAiAα1ê3 J− − NE 2 α 2 α 2 α l v0 − λ l λ AiryBiPrimeAα1ê3 J− + NE AiryBiPrimeAα1ê3 J − NE 2 α 2 α l 2
λ α
l 2
Out[18]//Short= AiryAiAα1ê3 J − NE AiryAiPrimeAα1ê3 J− + NE
To manipulate the terms of deter individually and to avoid possible reorderings caused by the attribute Orderless, we change the head of deter from Plus to List.
The Classical Special Functions
1274 In[19]:= deter = List @@ deter;
Similar to part a) of this solution, we now need the derivative of this implicit equation for l = lHaL for vanishing a. Again, a direct calculation via implicit differentiation of deter with respect to a fails. So we have to take care of the singularities by hand that come up in taking this limit to eliminate all oscillatory terms and to get smooth dependencies on a. First, we construct a replacement table of all Airy functions that appear in deter by their asymptotic terms. We write all terms of the asymptotic expansion in a form appropriate for later calculation by collecting them with respect to trigonometric or exponential functions. In[20]:= (* turn off messages *) Off[Series::"esss"];
asympAiryRules = Function[airy, airy -> Module[{asy, ll, z, coll, pm}, (* is the expansion point +Infinity or -Infinity? *) pm = If[MemberQ[airy, v0, {-1}], +1, -1]; asy = Expand[Normal[Series[Head[airy][z], {z, pm Infinity, If[pm == 1, 3, 2]}]]]; (* collect with respect to Cos, Sin, and Exp functions *) ll = Union[Cases[asy, _Cos | _Sin | Power[E, _], {0, Infinity}]]; coll = Plus @@ (Coefficient[asy, #] #& /@ ll); coll /. z -> airy[[1]]]] /@ (* all Airy functions occurring in deter *) Union[Cases[deter, AiryAi[_] | AiryAiPrime[_] | AiryBi[_] | AiryBiPrime[_], {0, Infinity}]]; In[22]:= asympAiryRules = (* explicit form of the asymptotic expansion *)
Module[Evaluate[Table[ToExpression["c" ToString[k]], {k, 70}]], c1 = α^(1/3); c2 = -l/2; c3 = 1/α; c4 = -λ; c5 = v0 + c4; c6 = c3 c5; c7 = c2 + c6; c8 = c1 c7; c9 = Sqrt[c8]; c10 = c8 c9; c11 = -2 c10/3; c12 = E^c11; c13 = Sqrt[Pi]; c14 = 1/c13; c15 = 1/c1; c16 = 1/c7; c17 = c15 c16; c18 = c17^(1/4); c19 = l/2; c20 = c19 + c6; c21 = c1 c20; c22 = Sqrt[c21]; c23 = c21 c22; c24 = -2 c23/3; c25 = E^c24; c26 = 1/c20; c27 = c15 c26; c28 = c27^(1/4); c29 = -λ c3; c30 = c2 + c29; c31 = c1 c30; c32 = c1^2; c33 = 1/c32; c34 = 1/c30; c35 = -c15 c34; c36 = Sqrt[c35]; c37 = c30^2; c38 = 1/c37; c39 = -c1 c30; c40 = c39^(1/4); c41 = c40^2; c42 = c40 c41; c43 = Pi/4; c44 = Sqrt[c39]; c45 = c39 c44; c46 = 2 c45/3; c47 = c43 + c46; c48 = Cos[c47]; c49 = Sin[c47]; c50 = c19 + c29; c51 = c1 c50; c52 = 1/c50; c53 = -c15 c52; c54 = Sqrt[c53]; c55 = c50^2; c56 = 1/c55; c57 = -c1 c50; c58 = c57^(1/4); c59 = c58^2; c60 = c58 c59; c61 = Sqrt[c57]; c62 = c57 c61; c63 = 2 c62/3; c64 = c43 + c63; c65 = Cos[c64]; c66 = Sin[c64]; c67 = 1/c18; c68 = c17 c18; c69 = 2 c10/3; c70 = E^c69; (* the 14 rules *) {AiryAi[c8] -> c12 c14 c18/2, AiryAi[c21] -> c14 c25 c28/2, AiryAi[c31] -> -5/48 c14 c33 c36 c38 c42 c48 - c14 c15 c34 c42 c49, AiryAi[c51] -> -5/48 c14 c33 c54 c56 c60 c65 - c14 c15 c52 c60 c66, AiryAiPrime[c8] -> c12 (-c14 c67/2 - 7 c14 c68/96), AiryAiPrime[c21] -> c25 (-c14/2/c28 - 7 c14 c27 c28/96), AiryAiPrime[c31] -> -c14 c40 c48 - 7/48 c14 c15 c34 c36 c40 c49, AiryAiPrime[c51] -> -c14 c58 c65 - 7/48 c14 c15 c52 c54 c58 c66, AiryBi[c8] -> c14 c18 c70, AiryBi[c31] -> -c14 c15 c34 c42 c48 + 5/48 c14 c33 c36 c38 c42 c49, AiryBi[c51] -> -c14 c15 c52 c60 c65 + 5/48 c14 c33 c54 c56 c60 c66, AiryBiPrime[c8] -> (c14 c67 - 7 c14 c68/48) c70, AiryBiPrime[c31] -> -7/48 c14 c15 c34 c36 c40 c48 + c14 c40 c49, AiryBiPrime[c51] -> -7/48 c14 c15 c52 c54 c58 c65 + c14 c58 c66}];
Applying asympAiryRules, we have the following form of the determinant. In[23]:= deter1 = deter //. asympAiryRules;
We have two kinds of exponential functions inside of deter1. In[24]:= Cases[deter1, Power[E, _], {0, Infinity}] // Union
Solutions
1275 2 α1ê3 I− l + v0−λ l + v0−λ l + v0−λ l + v0−λ 1ê3 I− 1ê3 I $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2 α1ê3 I $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% − 3 2 α M α 2 α M − 3 2 α M α 2 α M
Out[24]= 9
2 α1ê3 I− l + v0−λ l + v0−λ l + v0−λ l + v0−λ 1ê3 I− 1ê3 I $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2 α1ê3 I $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 2 α M α 2 α M − 3 2 α M α 2 α M
,
=
In the limit a Ø 0, the second of them vanishes exponentially fast. (Physically speaking, this means that finite lifetime effects are nonperturbative and cannot be caught in a perturbation expansion done here.) We now approximate the arguments of the exponential functions by their series. In[25]:= % /. {Exp[x_] :> Exp[Expand[Normal[Series[x, {α, 0, 2}]]]]} è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! l2 α − 4 v0 v0−λ 4 v0−λ − λ 3 α + 3α
è!!!!!!!!!!!!!!!! Out[25]= 9 8 v0−λ
! l3 α2 −l è!!!!!!!!!!!!!!! v0−λ
, 96 Hv0−λL3ê2
=
Because of the exponential decay of these terms, we can replace all such terms by 0 because after the differentiation with respect to a at the end to get c2 , these terms would vanish anyway. In[26]:= deter2 = deter1 //. {(* the term of the form Exp[-1/α +...] vanishes *)
Select[%%, Exponent[Normal[Series[#[[2]], {α, 0, 0}]], α] === -1&][[1]] -> 0};
This reduces the number of nontrivial terms in the determinant to 8. In[27]:= deter2 = DeleteCases[deter2, 0]; In[28]:= Length[deter2] Out[28]= 8
Starting now, let us massage each term in the remaining sum individually by introducing the variables aux[i], i = 1, …, 8. In[29]:= Do[aux1[i] = deter2[[i]], {i, Length[deter2]}]
All terms have one factor in common, the second exponential term. So we can drop this one, too, because we have to equate the whole deter2 to 0. In[30]:= Cases[Table[aux1[i], {i, Length[deter2]}], Exp[_], {0, Infinity}] // Union Out[30]= 9
2 1ê3 l v0−λ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% l v0−λ % 2 1ê3 l v0−λ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% l v0−λ 1ê3 I− 1ê3 I I− I 3 α 2 + α M α 2 + α M − 3 α 2 + α M α 2 + α M
=
In[31]:= Intersection @@ Table[List @@ aux1[i], {i, Length[deter2]}] Out[31]= 9
2 α1ê3 I− l + v0−λ l + v0−λ l + v0−λ l + v0−λ 1ê3 I− 1ê3 I $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2 α1ê3 I $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 2 α M α 2 α M − 3 2 α M α 2 α M
=
In[32]:= Do[aux2[i] = aux1[i]/%[[1]], {i, Length[deter2]}]
The resulting terms contain the following trigonometric functions. In[33]:= allTrigs = Cases[Table[aux2[i], {i, Length[deter2]}], _Cos | _Sin,
{0, Infinity}] // Union π 2 l λ l λ π 2 l λ l λ Out[33]= 9CosA − α1ê3 J− − N $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% −α1ê3 J− − N E, CosA − α1ê3 J − N $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% −α1ê3 J − N% E, 4 3 2 α 2 α 4 3 2 α 2 α π 2 l λ l λ π 2 l λ l λ SinA − α1ê3 J− − N $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% −α1ê3 J− − N E, SinA − α1ê3 J − N $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% −α1ê3 J − N% E= 4 3 2 α 2 α 4 3 2 α 2 α
In the limit of vanishing a, these trigonometric functions oscillate more and more because of the a in the denominators of their arguments. To get a sensible limit, we have to combine appropriate combinations of these trigonometric functions to cancel the singular denominators. For shortness of the following code, let us define a function trigRule that expands the arguments of trigonometric functions into a series. In[34]:= ord3 = 2;
trigRule = {Sin[x_] :> Sin[Normal[Series[x, {α, 0, ord3}]]], Cos[x_] :> Cos[Normal[Series[x, {α, 0, ord3}]]]};
The Classical Special Functions
1276
For a later application of PowerExpand to simplify all expressions and to write them in a canonical form, we define some rules that make sure that all arguments of power functions are positive. (We are only interested in the regime l < v0 , so all powers with bases l - v0 should be transformed.) In[36]:= rule1 = {
a_ a_ a_ a_ a_ a_
(λ - v0)^e1_ -> a (-1)^e1 (v0 - λ)^e1, (-(1/(λ - v0)))^e1_ -> a (v0 - λ)^(-e1), (λ - v0)^e1_ (v0 - λ)^e2_ -> a (-1)^e1 (v0 - λ)^(e1 + e2), ((-λ + v0)^(-1))^e1_ (-λ + v0)^e2_ -> a (-λ + v0)^(e2 - e1), (-1/(λ - v0))^e1_ (-λ + v0)^e2_ -> a (-λ + v0)^(-e1 + e2), (-1/(λ - v0))^e1_ (λ - v0)^e2_ -> a (-λ + v0)^(-e1 + e2) (-1)^e2};
The two functions f1 and f2 will do all of the expansion for small a in the following main calculation. In[37]:= (* for dealing with the trigonometric functions *)
f1[x_] := TrigReduce[x] //. trigRule // PowerExpand In[39]:= ord4 = 3;
(* for dealing with the remaining (prefactor) terms *) f2[x_] := Together[(Normal[Series[Expand[x], {α, 0, ord4}]] // Expand) //. rule1];
Now comes the main calculation. Inside this main calculation, we do the following: For every term from deter2, we extract the trigonometric functions, combine all products of two trigonometric functions into one, and expand the resulting argument for small a. The same expansion for a is done for the corresponding prefactors of the resulting trigonometric functions. In[42]:= Module[{sc1, sc2, withoutSC, sinCos1, sinCos2, coeffs1, coeffs2,
preFac11, preFac12, preFac21, preFac22, tr11, tr12, tr21, tr22}, Do[(* extract trigonometric functions *) {sc1, sc2} = Cases[aux2[i], _?(MemberQ[#, Cos[_] | Sin[_], {0, Infinity}]&), {1}]; (* the terms not containing trigonometric functions *) withoutSC = aux2[i]/(sc1 sc2); (* the prefactors of the trigonometric functions *) sinCos1 = Cases[sc1, #[_], {0, Infinity}][[1]]& /@ {Cos, Sin}; sinCos2 = Cases[sc2, #[_], {0, Infinity}][[1]]& /@ {Cos, Sin}; coeffs1 = Coefficient[sc1, #]& /@ sinCos1; coeffs2 = Coefficient[sc2, #]& /@ sinCos2; (* combine trigonometric functions into one and expand in series *) tr11 = f1[sinCos1[[1]] sinCos2[[1]]]; tr12 = f1[sinCos1[[1]] sinCos2[[2]]]; tr21 = f1[sinCos1[[2]] sinCos2[[1]]]; tr22 = f1[sinCos1[[2]] sinCos2[[2]]]; (* here, most time is spent in evaluating these four series *) preFac11 = f2[coeffs1[[1]] coeffs2[[1]] withoutSC]; preFac12 = f2[coeffs1[[1]] coeffs2[[2]] withoutSC]; preFac21 = f2[coeffs1[[2]] coeffs2[[1]] withoutSC]; preFac22 = f2[coeffs1[[2]] coeffs2[[2]] withoutSC]; (* add all contributions together *) aux3[i] = (preFac11 tr11 + preFac12 tr12 + preFac21 tr21 + preFac22 tr22), {i, 1, Length[deter2]}]];
After this calculation, the following trigonometric expressions are present in the result. In[43]:= trigos1 =
Union[Flatten[Table[Cases[aux3[i], Sin[_] | Cos[_], {0, Infinity}], {i, Length[deter2]}]]] l3 α2 l2 α 4 λ3ê2 l3 α2 l2 α 4 λ3ê2 è!!!!! è!!!!! Out[43]= 9CosA 3ê2 − l λ E, CosA ! + E, SinA 3ê2 − l λ E, SinA ! + E= è!!!! è!!!! 96 λ 3α 96 λ 3α 8 λ 8 λ
Here, we still have trigonometric functions with highly oscillating terms in the limit a Ø 0. After collecting with respect to these trigonometric functions, we see that these (bounded) terms do not matter because of the vanishing of their prefactor. In[44]:= eve1 = Together /@ Collect[
Expand[Sum[aux3[i], {i, 1, Length[deter2]}]], trigos];
We are left with trigonometric functions that do not have a in the denominator of their arguments. All remaining terms behave smoothly in the limit a Ø 0.
Solutions
1277 In[45]:= Union[Cases[eve1, Sin[_] | Cos[_], {0, Infinity}]]
l3 α2 96 λ
Out[45]= 9CosA 3ê2 − l
l3 α2 è!!!!! è!!!!! λ E, SinA 3ê2 − l λ E= 96 λ
So this is how the result looks in the moment. In[46]:= Short[eve1, 12] Out[46]//Short=
7ê2 è!!!!! è!!!!! è!!!!! 1 l3 α2 l3 α2 l3 α2 7 l v0 α2 H L CosA − l λ E v03 CosA − l λ E 35 v0 α2 CosA − l λ E v0−λ 96 λ3ê2 96 λ3ê2 96 λ3ê2 − + − 3 2 2 3 2 48 π 2304 π Hv0 − λL λ π Hv0 − λL 5ê2 "####### è!!!!! è!!!!! 1 1 l3 α2 l3 α2 5 l v03 α2 H L CosA − l λ E l2 v03 α2 CosA − l λ E v0−λ λ 96 λ3ê2 96 λ3ê2 − − 3 2 5ê2 2 2 64 π λ 32 π Hv0 − λL λ 5ê2 "####### è!!!!! è!!!!! 1 l3 α2 l3 α2 l v02 α2 H L 1λ CosA − l λ E 35 α2 CosA − l λ E v0−λ 96 λ3ê2 96 λ3ê2 + − 2 2 2 3ê2 2304 π Hv0 − λL λ 8π λ 7ê2 è!!!!! è!!!!! 1 l3 α2 l3 α2 2 v02 α2 CosA 7 l v02 α2 H L CosA − l λ E l − l λ E v0−λ 96 λ3ê2 96 λ3ê2 + − 3 2 192 π2 λ 32 π Hv0 − λL λ 5ê2 "####### 5ê2 "####### è!!!!! è!!!!! l3 α2 1 1 è!!!!! l3 α2 l v0 α2 H 1 L 1λ CosA − l λ E l α2 H L λ CosA − l λ E v0−λ 96 λ3ê2 v0−λ λ 96 λ3ê2 − − è!!!! ! 2 2 32 π 64 π λ 7ê2 è!!!!! 1 l3 α2 7 l α2 H L λ CosA − l λ E 3 3 3 3 1 v0 1 1 96 λ3ê2 + − + 1 + − 2 64 π 1 1 1 π2 H1L3
è!!!!! è!!!!! 1 # l3 α2 l3 α2 25 v0 α2 "############# SinA − l λ E l v02 α2 H1L5ê2 SinA − l λ E 1 v0−λ 96 λ3ê2 96 λ1 − + − 2 2 2 7ê2 2 192 π 4608 π λ 32 π Hv0 − λL 5ê2 è!!!!! 1 # l3 α2 l3 α2 37 α2 "############# SinA − l è!!!! λ! E l2 v03 α2 H 1 L SinA − l λ E v0−λ 96 λ3ê2 v0−λ 96 λ3ê2 + − 2 5ê2 2 5ê2 2304 π λ 32 π λ 5ê2 5ê2 è!!!!! è!!!!! 1 l3 α2 1 l3 α2 2 2 2 3 l v0 α H L SinA − l λ E v0 H L SinA − l λ E v0−λ 96 λ3ê2 v0−λ 96 λ3ê2 + − è!!!!! 16 π2 λ3ê2 2 π2 λ 5ê2 è!!!!! è!!!!! 1 l3 α2 l3 α2 49 α2 H L SinA − l λ E 7 l α2 SinA − l λ E v0−λ 96 λ3ê2 96 λ3ê2 − − 4608 π2 è!!!! λ! 64 π2 Hv0 − λL2 è!!!! λ! 5ê2 è!!!!! 5ê2 3ê2 è!!!!! è!!!!! 1 l3 α2 l3 α2 2 v02 H L λ SinA − l λ E 5 v0 H 1 L λ SinA − l λ E v0−λ 96 λ3ê2 v0−λ 96 λ3ê2 + − π2 2 π2 3 2 3 2 è!!!! ! 5ê2 è!!!! ! 1 l α l α l α2 "####### SinA − l λ E H 1 L λ5ê2 SinA − l λ E λ 96 λ3ê2 v0−λ 96 λ3ê2 + π2 32 π2 H−v0 + λL2
We again apply PowerExpand to canonicalize the form of the eigenvalue equation. In[47]:= eve2 = PowerExpand[eve1];
Taking the numerator, we finally get the eigenvalue equation up to second order in a. (Because we are only interested in corrections of the “eigenvalues” to second order in a, we only keep terms up to second order in a here.) In[48]:= Short[eve3 = Numerator[Factor[eve2]], 4]
l3 α2 l3 α2 è!!!!! è!!!!! è!!!!! è!!!!! λ CosA 3ê2 − l λ E + 70 v02 α2 Hv0 − λL7ê2 λ CosA 3ê2 − l λ E + 46 + 96 λ 96 λ l3 α2 l3 α2 l3 α2 è!!!!! è!!!!! è!!!!! 57600 v02 λ7 SinA 3ê2 − l λ E − 25344 v0 λ8 SinA 3ê2 − l λ E + 4608 λ9 SinA 3ê2 − l λ E 96 λ 96 λ 96 λ
Out[48]//Short= −360 l v06 α2
Let us check the resulting eigenvalue equation in the limit a Ø 0. In[49]:= eveAlphaZero1 = Simplify[eve3 /. α -> 0] Out[49]= −2304 Hv0 − λL2 λ3 I2 Hv0 − λL7ê2
è!!!!! è!!!!! è!!!!! λ Cos@l λ D + Hv0 − 2 λL Hv0 − λL3 Sin@l λ DM
In the tradition typically used in physics, we use abbreviations for the wave vectors k and k in favor of l and v0 for the classically allowed and forbidden regions via the following substitutions: k 2 öl and k2 ö v0 - l. So we can derive the following replacement rules. In[50]:= waveVectorRule =
{λ^e_. -> k^(2 e), (v0 - λ)^e_. -> κ^(2 e), v0^e_. -> k^(2 e) + κ^(2 e)};
Now, the above eveAlphaZero1 can be rewritten as follows.
The Classical Special Functions
1278
In[51]:= eveAlphaZero2 = eveAlphaZero1 /. waveVectorRule // Expand // Factor Out[51]= 2304 k6 κ10 H−2 k κ Cos@k lD + k2 Sin@k lD − κ2 Sin@k lDL
The last factor of this equation -2 k k cosHk lL + Hk 2 - k2 L sinHk lL = 0 is the well-known eigenvalue equation for the bound states of a quantum well (see [1003], [57], [490], [467], [900], [1148], [409], [410], [1367], [988], [352], [546], [115], [785], [812], and [362]): - y££ HxL + qHHl ê 2L2 - x2 L v0 yHxL = l yHxL. Now, let us analyze the coefficient c2 in the Taylor expansion of the solution lHaL of eveAlphaZero1. As in part a), the first derivative of the eigenvalue equation with respect to a vanishes identically because of the symmetry of the potential under consideration. In[52]:= D[eve2, α] /. α -> 0 Out[52]= 0
To simplify the following expressions, we make use of the eigenvalue equation derived above. In[53]:= eveRule = {a_ Cos[k l] k^e1_. κ^e2_. ->
-a k^(e1 - 1) κ^(e2 - 1)(κ^2 - k^2) Sin[k l]/2};
So we have the numerator and denominator of the ratio needed for c2 . In[54]:= num1 = ((D[eve3, {α, 2}] /. α -> 0) //. waveVectorRule) // Factor; In[55]:= num2 = num1 /. eveRule // Together // Factor Out[55]= −2 κ2 H−1320 k11 l Cos@k lD + 264 k13 l3 Cos@k lD + 130 k10 Sin@k lD +
1188 k10 l κ Sin@k lD − 300 k12 l3 κ Sin@k lD + 4 k8 κ2 Sin@k lD + 288 k10 l2 κ2 Sin@k lD − 2772 k8 l κ3 Sin@k lD + 660 k10 l3 κ3 Sin@k lD − 367 k6 κ4 Sin@k lD − 936 k8 l2 κ4 Sin@k lD + 2604 k6 l κ5 Sin@k lD − 600 k8 l3 κ5 Sin@k lD + 522 k4 κ6 Sin@k lD + 1224 k6 l2 κ6 Sin@k lD − 2352 k4 l κ7 Sin@k lD + 228 k6 l3 κ7 Sin@k lD − 304 k2 κ8 Sin@k lD − 648 k4 l2 κ8 Sin@k lD + 864 k2 l κ9 Sin@k lD − 48 k4 l3 κ9 Sin@k lD + 60 κ10 Sin@k lD + 72 k2 l2 κ10 Sin@k lD − 180 l κ11 Sin@k lD + 12 k2 l3 κ11 Sin@k lDL In[56]:= denom1 = ((D[eve3, λ] /. α -> 0) //. waveVectorRule) // Factor; In[57]:= denom2 = denom1 /. eveRule // Together // Factor Out[57]= 576 k4 κ2
H22 k11 l Cos@k lD + 352 k10 Sin@k lD − 25 k10 l κ Sin@k lD − 700 k8 κ2 Sin@k lD + 55 k8 l κ3 Sin@k lD + 692 k6 κ4 Sin@k lD − 50 k6 l κ5 Sin@k lD − 322 k4 κ6 Sin@k lD + 19 k4 l κ7 Sin@k lD + 48 k2 κ8 Sin@k lD − 4 k2 l κ9 Sin@k lD + 2 κ10 Sin@k lD + l κ11 Sin@k lDL
Multiplying by -1 ê 2, we finally arrive at the following value for the coefficient c2 . In[58]:= c2 = -1/2 Collect[num2
, {Sin[k l], Cos[k l]}, Simplify]/ Collect[denom2, {Sin[k l], Cos[k l]}, Simplify] Out[58]= −H−528 k11 l H−5 + k2 l2 L κ2 Cos@k lD − 2 κ2 H−300 k12 l3 κ + 60 κ10 H1 − 3 l κL + 4 k2 κ8 H−76 + 216 l κ + 18 l2 κ2 + 3 l3 κ3 L − 6 k4 κ6 H−87 + 392 l κ + 108 l2 κ2 + 8 l3 κ3 L − 4 k8 κ2 H−1 + 693 l κ + 234 l2 κ2 + 150 l3 κ3 L + k6 κ4 H−367 + 2604 l κ + 1224 l2 κ2 + 228 l3 κ3 L + 2 k10 H65 + 594 l κ + 144 l2 κ2 + 330 l3 κ3 LL Sin@k lDL ê H2 H12672 k15 l κ2 Cos@k lD + 576 k4 κ2 H2 k6 κ4 H346 − 25 l κL + k10 H352 − 25 l κL − 4 k2 κ8 H−12 + l κL + κ10 H2 + l κL + 5 k8 κ2 H−140 + 11 l κL + k4 κ6 H−322 + 19 l κLL Sin@k lDLL
In the limit of infinitely large v0 , we are back to part a). This limit can be modeled as the limit k Ø 0 [177]. Making use of this and the corresponding limit of the k, we come back to the result of part a) of this exercise. c2], κ, maxκExp]/ Coefficient[Denominator[c2], κ, maxκExp] /. {k -> i Pi/l} // Simplify] @@ Union[Exponent[#, κ]& /@ {Numerator[c2], Denominator[c2]}] l4 H−15 + i2 π2 L Out[59]= 48 i4 π4 In[59]:= Function[maxκExp, Coefficient[Numerator[
For the perturbation theory of a constant field between two d-potentials, see [32]. For the physical relevance of such calculations, see [1077], [105], [460], [573], [636], [507], [296], [19], [1041], [628], [494], [1106], [1294], [1289], and [906] and the references therein.
Solutions
1279
11. Fermi Integrals, Sum of All Reciprocal 9-Free Numbers, Zagier’s Function a) Here is the implementation fermiIntApprox of the approximation (including the bounds on the variables), along with the exact result fermiIntExact. In[1]:= fermiIntApprox[a_?(((TrueQ[-1 < # < Infinity] && !IntegerQ[#]) ||
Head[a] == Symbol)&), z_?(TrueQ[1 < # < Infinity] || Head[z] == Symbol &), n_Integer?(# >= -1&), k_Integer] := (2Pi/(Sin[Pi a] Gamma[1 + a]) * Sum[((2i + 1)^2 Pi^2 + Log[z]^2)^(a/2) * Cos[a(Pi - ArcTan[(2i + 1)Pi/Log[z]])], {i, 0, n}] + Pi/(Sin[Pi a] Gamma[1 + a]) (Log[z]^2 + (2(n + 1) + 1)^2 Pi^2)^(a/2)* Cos[a(Pi - ArcTan[(2(n + 1) + 1)Pi/Log[z]])] 2/Sin[Pi a] (Log[z]^2 + (2(n + 1) + 1)^2 Pi^2)^((a + 1)/2)* Sum[Zeta[2i]/Gamma[a + 2(1 - i)]* (Log[z]^2 + (2(n + 1) + 1)^2 Pi^2)^-i* Sin[a Pi - (a + 1 - 2i) ArcTan[(2(n + 1) + 1)Pi/Log[z]]], {i, 0, k}]) /; If[NumberQ[a], N[2k - a] > 1, True] In[2]:= fermiIntExact[a_, z_] = z LerchPhi[-z, a + 1, 1];
The most useful case for applications is a = 1 ê 2. (The replacement rule Cos[x_] :> Cos[ExpandAll[x]] serves to simplify terms of the form Cos[(Pi + ∫)/2].) In[3]:= (fermiIntApprox[1/2, z, 5, 5] /.
{Cos[x_] :> Cos[ExpandAll[x]]}) // Short[#, 12]& 3 13 π 17 13 π EE 65 π19ê2 CosA ArcTanA EE j 2 CosA 2 ArcTanA 3ê4 i Log@zD 2 Log@zD j j Out[3]//Short= −2 H169 π + Log@zD2 L + + j è!!!! ! j− 2 + Log@zD2 L5 3 π 768 H169 π k 2
13 13 π 9 13 π 11 π15ê2 CosA ArcTanA EE π11ê2 CosA ArcTanA EE 2 Log@zD 2 Log@zD + + 4 2 2 2 640 H169 π + Log@zD L 144 H169 π + Log@zD2 L3 13 π 13 π π7ê2 CosA 52 ArcTanA EE π3ê2 CosA 12 ArcTanA EE z y è!!!!! Log@zD Log@zD z z z 2 + 2 z+4 π 2 2 6 H169 π + Log@zD2 L 120 H169 π + Log@zD L {
1 π 1 3π 1ê4 SinA ArcTanA EE + H9 π2 + Log@zD2 L SinA ArcTanA EE + 2 Log@zD 2 Log@zD 1 5π 1ê4 H25 π2 + Log@zD2 L SinA ArcTanA EE + 2 Log@zD 1 7π 1ê4 1ê4 H49 π2 + Log@zD2 L SinA ArcTanA EE + H81 π2 + Log@zD2 L 2 Log@zD 1 9π 1 11 π 1ê4 SinA ArcTanA EE + H121 π2 + Log@zD2 L SinA ArcTanA EEN + 2 Log@zD 2 Log@zD 1 13 π è!!!!! 1ê4 2 π H169 π2 + Log@zD2 L SinA ArcTanA EE 2 Log@zD 1ê4
JHπ2 + Log@zD2 L
In[4]:= FreeQ[%, _Zeta | _Gamma, {0, Infinity}] Out[4]= True
All g and Zeta functions have been computed, and now nothing stands in the way of their further use outside of Mathematica. Finally, we examine the quality of the approximation over a wide parameter range. In[5]:= TableForm[Apply[{#1, #3 - #2, (#3 - #2)/#3}&,
Out[5]//TableForm=
Table[{E^z, fermiIntExact[1/2, Exp[z]], fermiIntApprox[1/2, Exp[z], 5, 4]} // N // Chop, {z, 0.1, 5.1, 0.4}], {1}], TableHeadings -> {{}, {"z", "abs. error ", "rel. error "}}] z abs. error rel. error 1.10517 1.24484 × 10−10 1.50423 × 10−10 1.64872 1.33853 × 10−10 1.19797 × 10−10 2.4596 1.42203 × 10−10 9.63981 × 10−11 3.6693 1.49375 × 10−10 7.84605 × 10−11 5.47395 1.55418 × 10−10 6.46637 × 10−11 8.16617 1.60237 × 10−10 5.39114 × 10−11 12.1825 1.63763 × 10−10 4.54018 × 10−11
The Classical Special Functions
1280 1.66066 × 10−10 1.67097 × 10−10 1.66894 × 10−10 1.65342 × 10−10 1.62626 × 10−10 1.58868 × 10−10
18.1741 27.1126 40.4473 60.3403 90.0171 134.29
3.85841 × 10−11 3.30262 × 10−11 2.84324 × 10−11 2.45618 × 10−11 2.12805 × 10−11 1.84768 × 10−11
The approximation is excellent. HalgL
HexpL
b) We start by implementing the two expansions d,o HhL, d,o HhL. In[1]:= AsympAlg[d_, η_, o_] :=
Sum[(2 (1 - 2^(1 - 2k)) η^(1/2(d - 4k)) Zeta[2k])/ Gamma[1 + d/2 - 2k], {k, 0, Floor[d/4]}] Sin[(d Pi)/2]/Pi Sum[(2(1 - 2^(1 - 2k))η^(1/2(d - 4k)) Zeta[2k])/ Gamma[-d/2 + 2k], {k, 1 + Floor[d/4], o}]
AsympExp[d_, η_, o_] := Cos[Pi (d/2 - 1)] Sum[(-1)^(k + 1)/(k^(d/2)) Exp[-k η], {k, o}] Asymp[d_, η_, o_] := AsympAlg[d, η, o] + AsympExp[d, η, o] HalgL
Because for even d the part d,o HhL vanishes, the expansion is most accurate in these cases. In[6]:= (* closed form of the exact result *)
[d_, η_] = 1/Gamma[d/2] Integrate[∂^(d/2 - 1)/(1 + Exp[∂ - η]), {∂, 0, Infinity}, Assumptions -> d > 0] d Out[7]= −PolyLogA , −η E 2 In[8]:= h[d_, η_, o_] := (Asymp[d, η, o] - [d, η])/[d, η] In[9]:= Plot[Log[10, Abs[h[d, 6, 8]]], {d, 0, 10}, PlotRange -> All] -1 -2 -3 -4 -5 -6 -7 2
4
6
8
10
Here are two typical expansions. One is purely algebraic and one is purely exponential in nature. In[10]:= Asymp[1, η, 5] 19ê2
15ê2
11ê2
7ê2
3ê2
146 π 127 π 62 π 7π π + 15ê2 + + + 19ê2 11ê2 7ê2 3ê2 π
2
è!!!!! η π
460550215125 η 638512875 η 893025 η 675 η 3η Out[10]= − + è!!!! !
In[11]:= Asymp[2, η, 5] Out[11]=
−5 η −4 η −3 η −2 η − + − + −η + η 5 4 3 2 HalgL
HexpL
A contour plot of d,o HhL ë d,o HhL over the h,d-plane shows that the “special” points occur for d = 1 + 4 k, k œ . In[12]:= g[{d_, η_}, o_] := AsympExp[d, η, o]/AsympAlg[d, η, o] In[13]:= With[{∂ = 10^-6},
ContourPlot[Evaluate[g[{d, η}, 5]], {η, ∂, 3/2}, {d, ∂, 9}, PlotPoints -> 200, PlotRange -> {-1, 1}, Contours -> 40, ColorFunction -> (Hue[0.8#]&), ContourStyle -> {Thickness[0.002]}]]
Solutions
1281
8 6 4 2 0
0
0.2 0.4 0.6 0.8
1
1.2 1.4
HalgL At the special points d,o HhL vanishes. It is straightforward to calculate high-precision approximations of these points for a given k.
In[14]:= ηSpecial[d_] := FindRoot[Evaluate[AsympAlg[d, η, 2 d + 100] == 0],
{η, 0.9}, WorkingPrecision -> 100] // N[#, 30]&
Here are the h-values for the first few points. In[15]:= Table[{c, ηSpecial[1 + 4c]}, {c, 0, 4}] Out[15]= 880, 8η → 0.869292163309593920883438143793 All, PlotPoints -> 25, AxesLabel -> {"x", "t", "T"}]}]]]
0.4 T0.3 0.2 0.1 0 0
0.2
0.25
0.5 x 0.75
0.1 1
0.15 t
0.05
Not only to linear, but also solutions to many nonlinear partial differential equation can be expressed in Theta functions [408]. For a solution of the initial value problem of the 1D heat equation using Meijer G functions, see [1183]. b) Here is the direct implementation of Green’s function. The four variables x, y, xs, and ys are all real. In[1]:= GreenRectangle[{x_, y_}, {xs_, ys_}, a_, b_] :=
Module[{q = Exp[-Pi b/a], t, = Conjugate, z = x + I y, zs = xs + I ys}, t[arg_] = EllipticTheta[1, arg/(2a) Pi, q]; 1/(2Pi) Re[Log[(t[z + [zs]] t[z - [zs]])/(t[z + zs] t[z - zs])]]] /. Conjugate[z_] :> (z /. i_Complex :> Conjugate[i])
For convenience, we now define the Green’s function for symbolic arguments. In[2]:= gf = GreenRectangle[{x, y}, {xs, ys}, a, b] b π bπ − − π Hx+xs+ y− ysL π Hx−xs+ y+ ysL EllipticThetaA1, , a E EllipticThetaA1, , a E
2a 2a ReALogA bπ b π EE
Out[2]=
− − π Hx−xs+ y− ysL π Hx+xs+ y+ ysL EllipticThetaA1, , a E EllipticThetaA1, , a E
2a 2a 2π
The Green’s function satisfies the Laplace equation. (We do not get the isolated point where the right-hand side does not equal 0 because differentiation is generic. This means single-point singularities are ignored by Mathematica by default.) In[3]:= D[gf, {x, 2}] + D[gf, {y, 2}] // Simplify
The Classical Special Functions
1286 Out[3]= 0
Unfortunately, the asymptotic behavior for x º x£ and y º y£ cannot be computed directly. (Because there is currently no mechanism to tell Series that the variables involved are all real, some problems with differentiating Re are expected.) In[4]:= Off[EllipticThetaPrime::argr];
ser = Series[gf, {x, xs, 1}, {y, ys, 0}] // Short[#, 4]& π Hx+xs+ y− ysL EllipticThetaA1, ,
bπ − a
π H1L E EllipticThetaA1, ,
1 − a
E
2a 2a ReALogA EE bπ 1
Out[5]//Short=
− a − π Hx−xs+ y− ysL π H1L a E EllipticThetaA1, E EllipticThetaA1, 2 a , 2 a ,
2π
In[6]:= Off[EllipticThetaPrime::argr];
Series[gf /. Re[ζ_] :> ζ, {x, xs, 0}, {y, ys, 0}] // TraditionalForm bp y i bp i p xs - ÅÅÅÅ ÅaÅÅÅÅÅÅ zzz jjj  p ys - ÅÅÅÅaÅÅÅÅÅÅÅ yzzz z y jij jij 2  a J1 jjjjj ÅÅÅÅÅÅÅÅ zyz zz J1 jj ÅÅÅÅÅÅÅÅaÅÅÅÅÅÅÅÅÅÅÅ ,‰ zz z aÅÅÅÅÅÅÅ ,‰ jj jj z zz k { k jj logjj- ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅ{ zzzz - logHy - ysL jj jj zz b p b p i y i y p xs  p ys - ÅÅÅÅÅaÅÅÅÅÅ Å zzz £ jjj - ÅÅÅÅÅaÅÅÅÅÅ Å zzz z jj jj p J jjjj ÅÅÅÅÅÅÅÅ z zz z ÅÅÅÅÅÅÅÅÅÅÅ ,‰ zz J1 jj0,‰ zz zz 1 j aÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅa jjj k zz k { k {{ 1 j zz + OHHx - xsL1 L Out[7]//TraditionalForm= jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅ Å ÅÅÅ Å ÅÅ Å + OHHy ysL L jj zz 2 p jj zz jj zz jj zz jj zz jj zz k { In[8]:= Off[EllipticThetaPrime::argr];
Series[gf /. Re[ζ_] :> ζ, {y, ys, 0}, {x, xs, 0}] // TraditionalForm bp y i bp i p xs - ÅÅÅÅ ÅaÅÅÅÅÅ Å zzz jjj  p ys - ÅÅÅÅÅaÅÅÅÅÅ Å yzzz z y jij jij 2 a J1 jjjjj ÅÅÅÅÅÅÅÅ zyz zz J1 jj ÅÅÅÅÅÅÅÅÅÅÅÅ zz z aÅÅÅÅÅÅÅ ,‰ aÅÅÅÅÅÅÅ ,‰ jj jj z zz k { k ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ { z z - logHx - xsL zz ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅ jjj logjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z zz bp y i b ÅpÅÅÅÅyÅÅÅ z ij p xs  p ys - ÅÅÅÅ jj jj z zz jj j p J1 jjjj ÅÅÅÅÅÅÅÅaÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅaÅÅÅÅÅÅÅ ,‰ ÅaÅÅÅÅÅ Å zzzzz J£1 jjjjj0,‰- ÅÅÅÅÅaÅÅÅÅÅ Å zzzzz zz zz jj k k { k {{ 1 z j j Out[9]//TraditionalForm= j ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + OHHx - xsL Lzzzz + OHHy - ysL1 L jj 2p zz jj zz jj zz jj z jjj zzz j z k {
Similarly, the homogeneous Dirichlet conditions on the boundary cannot be verified symbolically. In[10]:= ((GreenRectangle[#, {xs, ys}, a, b] // FullSimplify) === 0)& /@
{{0, y}, {2a, y}, {x, 0}, {x, 2b}} Out[10]= 8False, False, False, False
120, Mesh -> False, PlotRange -> {0, 1/3}, ClipFill -> None], (* overall contour view *) ContourPlot[Evaluate[GreenRectangle[{x, y}, {2, 2}, 4, 3]], {x, 0, 4}, {y, 0, 3}, PlotPoints -> 40, Contours -> 30, ContourShading -> False, AspectRatio -> Automatic], (* zoom-in view *) Plot3D[Evaluate[GreenRectangle[{x, y}, {2, 2}, 4, 3] (-1/(2Pi) Log[Sqrt[(x - 2)^2 + (y - 2)^2]])], {x, 1.99, 2.01}, {y, 1.99, 2.01}, PlotPoints -> 20]}]]];
Solutions
1287
3 2.5 0.3 0.2 0.1 0 0
2 3 2 1
2
1 3
4
0
0.0732 0.073 0.0728 0.0726
1.5 1
1.99 1.995
0.5 0
0
1
2
3
2.005 2 2
1.995 2.005
4
1.99
So all properties of a Green’s function seem to be satisfied. (Because of the zero boundary conditions, GreenRectangle[ j1 , j2 , j£1 , j£2 , p, p] can be nicely visualized on a torus. We leave this to the reader.) We will now use the Green’s function to solve the boundary value problem. We start by calculating the normal derivative of the Green’s function. In[12]:= gf = GreenRectangle[{x, y}, {xs, ys}, a, b];
(gf[{x_, y_}, {xs_, ys_}, a_, b_] = (* do nor differentiate Re *) 1/a Re[D[a gf /. Re[ζ_] :> ζ, xs] // Simplify]) // TraditionalForm Out[13]//TraditionalForm= bp bp bp bp ji p Hx+xs+Â H y-ysLL - ÅÅÅÅÅaÅÅÅÅÅÅ zzyz ji p Hx-xs+Â H y+ysLL - ÅÅÅÅÅaÅÅÅÅÅ Å zzyz ji p Hx+xs+Â Hy+ysLL - ÅÅÅÅÅaÅÅÅÅÅ Å zzyz y ij J£ jjijj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ p Hx-xs+Â Hy-ysLL - ÅÅÅÅÅaÅÅÅÅÅÅ zzyz J£1 jjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J£1 jjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J£1 jjjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz zz zz zz z jj 1 j zz 2ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ 2ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ jj k { k { k { k {z z Rejj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ zz b pÅÅÅyÅÅÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ b pÅÅÅÅyÅ - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ b pÅÅÅÅyÅ z i p Hx+xs+Â H y-ysLL - ÅÅÅÅ i p Hx-xs+Â H y+ysLL - ÅÅÅÅ i p Hx+xs+Â Hy+ysLL - ÅÅÅÅ jj jjij p Hx-xs+Â Hy-ysLL - ÅÅÅÅbÅÅÅÅpÅÅÅ zzyz j Å ÅÅÅ Å Å Å z j Å ÅÅÅ Å Å Å z j Å ÅÅÅ Å Å Å z j z j z j z a zz a zzz a zzz a zzz z j J1 jj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ z J1 jjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J1 jjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ J1 jjj ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ 2 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ 2ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ a ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ,‰ k k { k { k { k {{ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 4a
To minimize the numerical integrations needed, we subtract 1 from the boundary values. This gives two sides of the rectangle with homogeneous boundary conditions where the integral vanishes. We reduce the default values for the precision and accuracy goals of NIntegrate because we are only interested in a visualization here. In[14]:= SetOptions[NIntegrate, PrecisionGoal -> 4,
AccuracyGoal -> 4, MaxRecursion -> 8]; (* integral along the rectangle boundary *) ψ[{x_, y_}, a_, b_] := (* integrand is peaked near ys ≈ y near edges *) NIntegrate[gf[{x, y}, {0, ys}, a, b], {ys, 0, y, b}] + NIntegrate[gf[{x, y}, {a, ys}, a, b], {ys, b, y, 0}] (* no integration needed here *) ψ[{x_, y_}, a_, b_] := 0. /; y == 0 || y == a
We use the symmetry of the problem under consideration to calculate the values of yHx, yL in only one quarter of the rectangle. Now we add the value 1 to the solution to fulfill the original boundary conditions. In[20]:= ψDataQuarter = Flatten[#, 1]& @
With[{a = 2, b = 1, ∂ = 10^-3, app = 50, bpp = 50}, Table[{x, y, ψ[{x, y}, a, b] + 1}, {x, ∂, a/2, (a/2 - ∂)/app}, {y, 0, b/2, b/2/bpp}]];
Mirroring the data on the two symmetry lines of the rectangle yields the list of data ψDataQuarter. In[21]:= ψDataAll = Union @ With[{a = 2, b = 1},
Join[ψDataQuarter, {a - #1, #2, #3}& @@@ ψDataQuarter, {#1, b - #2, #3}& @@@ ψDataQuarter, {a - #1, b - #2, #3}& @@@ ψDataQuarter]];
Now we interpolate the data and calculate the Laplace operator applied to the resulting function. For a numerically reliable differentiation we use a higher interpolation order in Interpolation. In[22]:= ipo = Interpolation[ψDataAll, InterpolationOrder -> 12];
∆[x_, y_] = D[ipo[x, y], x, x] + D[ipo[x, y], y, y];
The following graphics show the function yHx, yL and H∑2 ê ∑ x2 + ∑2 ê ∑ y2 L yHx, yL. In average, the right graphic shows that the residuals are mostly less than 10-5 . Taking into account that we performed the numerical integration to only 4 digits no
The Classical Special Functions
1288
better result was to be expected. Near the boundaries where the integrand becomes sharply peaked and the derivatives become one-sided and near the corners where we have discontinuous boundary conditions, the error of the solution is larger. In[24]:= With[{a = 2, b = 1, ∂ = 10^-3},
Show[GraphicsArray[ Block[{$DisplayFunction = Identity}, {(* 3D plot of the solution of Laplace equation *) Plot3D[ipo[x, y], {x, ∂, a - ∂}, {y, 0, b}, PlotPoints -> 60, Mesh -> False], (* contour plot of the solution of Laplace equation *) ContourPlot[ipo[x, y], {x, ∂, a - ∂}, {y, 0, b}, PlotPoints -> 160, ColorFunction -> (Hue[0.78 #]&), Contours -> Append[Table[c, {c, 1, 2, 1/20}], 1.1097698], PlotRange -> All, AspectRatio -> Automatic], (* error of the solution *) Plot3D[Log[10, Abs[∆[x, y]]], {x, ∂, a - ∂}, {y, 0, b}, PlotPoints -> 60, PlotRange -> All, Mesh -> False]}]]]];
1 0.8
2 1.75 1.5 1.25 1 0.5
1 0.8 0.6 0.4 1
1.5
0.2
5 0 -5 -10 -15
0.6 0.4 0.2 0
0
0.5
1
1.5
2
0
0.5
1 0.8 0.6 0.4 1
1.5
0.2 0
We end by remarking that for constant boundary values on the edges no numerical integration is actually necessary. The integral yHx, yL = - Ÿ ∑ Gab Hx, y, x£ , y£ L ê ∑ x£ µ constant d y£ can be carried out in closed form by partial integration. In[25]:= (gf[{x_, y_}, {xs_, ys_}, a_, b_] = Re[Simplify[
Integrate[D[gf /. Re -> Identity /. (* use symbolic indefinite integration *) EllipticTheta -> ϑ, xs], ys] /. ϑ -> EllipticTheta]]) // TraditionalForm Out[25]//TraditionalForm=
1 p Hx - xs + Â Hy - ysLL - ÅÅÅÅbÅÅÅÅpÅÅ Å p Hx + xs + Â Hy - ysLL - ÅÅÅÅbÅÅÅÅpÅÅ Å - ÅÅÅÅÅÅÅÅÅÅ ImJlogJJ1 J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , ‰ a NN + logJJ1 J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , ‰ a NN + 2p 2a 2a p Hx - xs + Â Hy + ysLL - ÅÅÅÅbÅÅÅÅpÅÅ Å p Hx + xs + Â Hy + ysLL - ÅÅÅÅbÅÅÅÅpÅÅ Å logJJ1 J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , ‰ a NN + logJJ1 J ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , ‰ a NNN 2a 2a In[26]:= Ψ[{x_, y_}, a_, b_] :=
gf[{x, y}, {0, b}, a, b] - gf[{x, y}, {0, 0}, a, b] + 1 - (gf[{x, y}, {a, b}, a, b] - gf[{x, y}, {a, 0}, a, b])
Here is a check for “random” values of x and y showing that ψ[{x, y}, a, b] agrees with Ψ[{x, y}, a, b]. In[27]:= With[{a = 1, b = 2, x = 1/Pi, y = 1/E},
{ψ[{x, y}, a, b], Ψ[{x, y}, a, b] // N}]
Out[27]= 80.655828 + 0. , 0.655828
1) && (Length[Union[Length /@ (#[[2, 2]]& /@ #)]] === 2))&];
Next we remove trivial cases that arise from commutativity. In[17]:= splits2 = DeleteCases[DeleteCases[splits1,
C[_, {a_, {1}, a_}] | C[_, {a_, {1, 0}, a_}] | C[_, {a_, {0, 1}, a_}], {2}], {}]; uniteRules = Join[Function[{m1, m2}, {s___, c:C[_, {a_, m1, b_}], t___, C[_, {b_, m2, a_}], u___} :> {s, c, t, u}] @@@ {{{0}, {0}}, {{1, 0}, {0, 1}}, {{0, 1}, {1, 0}}}, Function[m, {s___, c:C[_, {a_, m, b_}], t___, C[_, {b_, m, a_}], u___} :> {s, c, t, u}] /@ {{0, 0}, {1, 1}}]; In[20]:= splits3 = (#
//. uniteRules)& /@ splits2;
Now we have 288 candidates, each representing one identity. In[21]:= {Length[splits3], Union[Length /@ splits3]} Out[21]= 8288, 82
""])& /@ (writeIdentityInShortForm /@ allIdentities) Out[28]= 8+@1111D+@4444D−82222 D[Cosh[η], η] ηFunc''[η] -> D[Cosh[η], {η, 2}] D[Cosh[η], η]^2
Out[21]=
sFunc[s], sFunc'[s], sFunc'[s] + sFunc''[s]}
sFunc@sD − n2 sFunc@sD − m2 Csch@ηD2 sFunc@sD + 2 Cosh@ηD sFunc @sD + Sinh@ηD2 sFunc @sD 4
We rewrite all terms depending on h as terms in s of this differential equation. In[22]:= ∆9 = ∆8 /. {Cosh[η] -> s, Sinh[η]^2 -> s^2 - 1, Csch[η]^2 -> 1/(s^2 - 1)} Out[22]=
sFunc@sD m2 sFunc@sD − n2 sFunc@sD − + 2 s sFunc @sD + H−1 + s2 L sFunc @sD 4 −1 + s2
The Classical Special Functions
1326 Reordering the terms shows that it is a Legendre differential equation. In[23]:= ∆10 = Collect[-∆9, {sFunc[s], sFunc'[s], sFunc''[s]}]
1 m i j z Out[23]= j− + n2 + 2 y z sFunc@sD − 2 s sFunc @sD + H1 − s2 L sFunc @sD 2
k 4
−1 + s {
The solutions of the last differential equation are Legendre functions of lower index n - 1 ê 2 and upper index †m§. è!!!!!!!!! 15. Riemann–Siegel Formula, Zeros of Hurwitz Zeta Function, Zeta Zeta Function, Harmonic Polylogarithms, 1 ¥ 2 ¥ 3 ¥ ∫ = 2 p a) Mathematica cannot calculate the series expansion of RiemannSiegelZ directly. In[1]:= Series[RiemannSiegelZ[t], {t, Infinity, 3}] Out[1]= RiemannSiegelZ@tD
So we will use the given formulas to calculate the coefficients ck . We will first calculate the series expansion of expHiHlogHt ê H2 pLL - t ê 2 - p ê 8 - JHtLLL and then the series expansion of H⁄¶j=0 A j HyL w j L H⁄¶j=0 yH jL HpL y j ê j!L. Mathematica also cannot calculate the series expansion of RiemannSiegelTheta. In[2]:= Series[RiemannSiegelTheta[t], {t, Infinity, 3}] Out[2]= RiemannSiegelTheta@tD
But Mathematica can compute the series expansion of LogGamma[z] around z = ¶. In[3]:= Series[LogGamma[z], {z, Infinity, 5}] 5
Out[3]=
1 −1 − Log@ 1z D 1 1 1 1 1 1 3 H z L 1 6 + J Log@2 πD + LogA EN + − J N + + OA E 2 2 z 12 z 360 z 1260 z 1z
Using this series, it is straightforward to calculate the series expansion of the Riemann–Siegel Theta function. In[4]:= RiemannSiegelThetaSeries[t_, o_] :=
Module[{aux1, aux2, aux3, aux4}, (* series for LogGamma *) aux1 = Normal[Simplify[PowerExpand[ Series[LogGamma[z], {z, Infinity, o + 4}]]]]; (* change variables *) aux2 = aux1 /. z -> I t/2 + 1/4; (* simplify logarithmic terms *) aux3 = Expand[PowerExpand[Normal[Series[aux2, {t, Infinity, o}]]]] - I t/2 Log[Pi]; (* take imaginary part *) aux4 = (Plus @@ (Cases[aux3, _Complex _]/I)) + O[t]^2]
Here are the first 20 terms of the series expansion. In[5]:= rsts = RiemannSiegelThetaSeries[t, 20] Out[5]=
91546277357 5749691557 118518239 + + + 131491430400 t19 64012419072 t17 8021606400 t15 8191 1414477 511 127 31 + + + + + 2555904 t13 1476034560 t11 1216512 t9 430080 t7 80640 t5 7 1 π 1 Log@2D Log@πD Log@tD + − + J− − − + N t + O@tD2 5760 t3 48 t 8 2 2 2 2
The following table shows the size of the terms for t = 100. In[6]:= Block[{t = N[100, 100],
ser = FoldList[Plus, 0, Drop[Insert[#, Last[#], 2]&[ Reverse[List @@ Normal[rsts]]], -1]]}, ser - RiemannSiegelTheta[t]] // N Out[6]= 8−87.9722, 0.392491, −0.000208335, −1.21532 × 10−9 , −3.84454 × 10−14 , −2.95336 × 10−18 , −4.20149 × 10−22 , −9.58616 × 10−26 , −3.20622 × 10−29 , −1.47839 × 10−32 , −8.98912 × 10−36 , −6.96886 × 10−39 , −6.70928 × 10−42
2Pi/ω^2; Series[Exp[I aux2], {ω, 0, o}]]
Here are the first few terms of this series. In[8]:= RiemannSiegelThetaExpSeries[ω, 8]
ω2
ω4
4027 ω6
16123 ω8
Out[8]= 1 + − − + − − + O@ωD9 96 π 18432 π2 26542080 π3 10192158720 π4
Now, let us deal with the series expansion of the second factor, namely, H⁄¶j=0 A j HyL w j L H⁄¶j=0 yH jL H pL y j ê j!L. We start with the calculation of the A j HyL. We implement the recursion relation and the series expansion independently. Because the yH jL H pL involving series contains only nonnegative powers of y, we need all nonpositive powers of y in the series for the A j HyL. Be aware of the Expand in the definitions of the [j]. Because we differentiate, nested expressions arise, and expanding the results is essential to get expressions of manageable size. In[9]:= [0] = Exp[I 2Pi y^2];
[j_] := [j] = Expand[-1/2 y [j - 1] - 1/32 /Pi^2 D[1/y [j - 1], {y, 2}]]; A[j_] := [j] + O[y]
Taking now enough terms with respect to w in all series expansions, we arrive at the following function RiemannSiegel ExtraTermsList that calculates the coefficients ck . In[12]:= RiemannSiegelExtraTermsList[ω_, n_] :=
Module[{aux1, aux2}, aux1 = RiemannSiegelThetaExpSeries[ω, n + 1]; aux2 = Series[Coefficient[Normal[Sum[A[j] ω^j, {j, 0, 3n + 4}] * Sum[Derivative[k][ψ][p] y^k/k!, {k, 0, 3n + 4}]], y, 0], {ω, 0, n + 1}]; Take[Expand[CoefficientList[aux1 aux2, ω]], n]]
Here is a list of the first ten coefficients. We do not substitute the actual form of yHpL because the high-order derivatives would give quite large results. In[13]:= res = RiemannSiegelExtraTermsList[ω, 10]
ψH3L @pD ψ @pD ψH6L @pD ψ @pD ψH5L @pD ψH9L @pD 96 π 64 π 18432 π 64 π 3840 π 5308416 π ψ@pD 19 ψH4L @pD 11 ψH8L @pD ψH12L @pD + + + , 128 π2 24576 π4 5898240 π6 2038431744 π8 5 ψH3L @pD 901 ψH7L @pD 7 ψH11L @pD ψH15L @pD − − − − , 3072 π4 82575360 π6 849346560 π8 978447237120 π10 5 ψ @pD 367 ψH6L @pD 18889 ψH10L @pD 17 ψH14L @pD ψH18L @pD + + + + , 2048 π4 7864320 π6 237817036800 π8 652298158080 π10 563585608581120 π12 H5L H9L H13L H17L 5 ψ @pD 407 ψ @pD 6649 ψ @pD 2131 ψ @pD ψ @pD − 4 − − − − − 2048 π 2621440 π6 11890851840 π8 5707608883200 π10 15655155793920 π12 H21L H4L H8L ψ @pD 41 ψ@pD 427 ψ @pD 26405 ψ @pD 88651 ψH12L @pD , + + + + 378729528966512640 π14 32768 π4 1048576 π6 8455716864 π8 22830435532800 π10 11153 ψH16L @pD 23 ψH20L @pD ψH24L @pD + + , 8766887244595200 π12 180347394745958400 π14 290864278246281707520 π16 H3L H7L H11L H15L 2603 ψ @pD 3781 ψ @pD 21543701 ψ @pD 66727 ψ @pD − − − − − 3145728 π6 264241152 π8 669692775628800 π10 3652869685248000 π12 H19L H23L 8503 ψ @pD 13 ψ @pD ψH27L @pD − − = 2524863526443417600 π14 60596724634642022400 π16 251306736404787395297280 π18
Out[13]= 9ψ@pD, − 4 , − 2 − 4 − 2 , 2 + 6 ,
Showing all prefactors of the last result in factored form yields a slightly nicer looking result. In[14]:= showIntegersFactored[Rational[p_, q_]] :=
showIntegersFactored[p]/showIntegersFactored[q]; showIntegersFactored[1] = 1; showIntegersFactored[p_PrimeQ] = p;
The Classical Special Functions
1328
showIntegersFactored[i_Integer?Negative] = -showIntegersFactored[-i]; showIntegersFactored[i_Integer?Positive] := HoldForm @@ {Times @@ Apply[HoldForm[Power[##]]&, FactorInteger[i], {1}]} In[21]:= Take[res, 6] /. r_Rational :> showIntegersFactored[r] // TableForm
ψ@pD H3L
ψ @pD − π2 H25 31 L
H6L
ψ @pD ψ @pD + π2 26 π4 H211 32 L
Out[21]//TableForm=
H5L
H9L
1 H4L
1 H8L
ψ @pD ψ @pD ψ @pD − − − π2 26 π4 H28 31 51 L π6 H216 34 L H12L
ψ@pD 19 ψ @pD 11 ψ @pD ψ @pD + + + π2 27 π4 H213 31 L π6 H217 32 51 L π8 H223 35 L 1 H3L
5 ψ @pD − − π4 H210 31 L
I171 531 M ψH7L @pD π6 H218 32 51 71 L
1 H11L
H15L
7 ψ @pD ψ @pD − − π8 H221 34 51 L π10 H228 36 51 L
For a quick numerical check of the derived coefficients ck , we substitute the actual value of yH pL. In[22]:= evalR = res /. ψ -> Function[p, Cos[2Pi(p^2 - p - 1/16)]/Cos[2 Pi p]];
This results in a large expression. In[23]:= ByteCount[evalR] Out[23]= 5113400
We use the package NumericalMath`OptimizeExpression` to shrink the expression to a smaller size. In[24]:= optimize = Experimental`OptimizeExpression[#,
OptimizationLevel -> 1, ExcludedForms -> {}]&; In[25]:= evalRO = optimize[evalR];
The next table shows the size of the various correction terms for t = 106 . In[26]:= Block[{t = N[10^6, 50], ν, p},
ν = Floor[Sqrt[t/(2 Pi)]]; p = Sqrt[t/(2 Pi)] - ν; mainTerm = 2 Sum[Cos[RiemannSiegelTheta[t] - t Log[k]]/Sqrt[k], {k, ν}]; resTerms = (-1)^(ν - 1) (t/(2 Pi))^(-1/4)* MapIndexed[(t/(2Pi))^(-(#2[[1]] - 1)/2) #1&, First[evalRO]]; (* differences of approximate and exact values *) (mainTerm + FoldList[Plus, 0, resTerms]) - RiemannSiegelZ[t]] // N Out[26]= 80.0397462, 1.17633 × 10−6 , 4.58937 × 10−10 , 1.32087 × 10−13 , 5.21417 × 10−17 , 3.69943 × 10−19 , 5.17449 × 10−23 , 3.13999 × 10−25 , 4.43323 × 10−29 , 4.8514 × 10−31 , 5.47272 × 10−35
10^-5, Terms -> 5]; rhs[z_?NumberQ, α_?NumberQ] := (z Zeta[z + 1, α]/ND[Zeta[ζ, α], ζ, z])
As initial conditions for the differential equations, we use the zeros at a = 1. A plot of †zHy + ÅÅÅÅ12 iL§ along the critical line shows many minima—this means potential zeros. In[6]:= pl = Plot[Abs[Zeta[1/2 + I y]], {y, 10., 200},
PlotPoints -> 500, AspectRatio -> 1/5] 6 5 4 3 2 1 50
100
150
200
More than 3000 points were sampled to get this curve. In[7]:= Length[pl[[1, 1, 1, 1]]] Out[7]= 3323
Here is a rough search for the first 50 zeros. In[8]:= pre = Select[Partition[pl[[1, 1, 1, 1]], 3, 1],
(* search for minima *) #[[1, 2]] > #[[2, 2]] && #[[3, 2]] > #[[2, 2]]&]; In[9]:= zeroIntervals = Take[Map[First, Drop[#, {2}]& /@ pre, {2}], 50]; In[10]:= Show[pl, (* zero-intervals *)
Graphics[{Hue[0], PointSize[0.01], Point[{#, 0}]& /@ (Apply[Plus, Map[First, pre, {2}], {1}]/3)}]] 6 5 4 3 2 1 50
100
150
Here is a refinement for their actual values. In[11]:= zeros = FindRoot[Zeta[z, 0] == 0, {z, 1/2 + I #[[1]], 1/2 + I #[[2]]},
AccuracyGoal -> 12, MaxIterations -> 50][[1, 2]]& /@ zeroIntervals Out[11]= 80.5 + 14.1347 , 0.5 + 21.022 , 0.5 + 25.0109 , 0.5 + 30.4249 , 0.5 + 32.9351 , 0.5 + 37.5862 , 0.5 + 40.9187 , 0.5 + 43.3271 , 0.5 + 48.0052 , 0.5 + 49.7738 , 0.5 + 52.9703 , 0.5 + 56.4462 , 0.5 + 59.347 , 0.5 + 60.8318 , 0.5 + 65.1125 , 0.5 + 67.0798 , 0.5 + 69.5464 , 0.5 + 72.0672 , 0.5 + 75.7047 , 0.5 + 77.1448 , 0.5 + 79.3374 , 0.5 + 82.9104 , 0.5 + 84.7355 , 0.5 + 87.4253 , 0.5 + 88.8091 , 0.5 + 92.4919 , 0.5 + 94.6513 , 0.5 + 95.8706 , 0.5 + 98.8312 , 0.5 + 101.318 , 0.5 + 103.726 , 0.5 + 105.447 , 0.5 + 107.169 , 0.5 + 111.03 , 0.5 + 111.875 , 0.5 + 114.32 , 0.5 + 116.227 , 0.5 + 118.791 , 0.5 + 121.37 , 0.5 + 122.947 , 0.5 + 124.257 , 0.5 + 127.517 , 0.5 + 129.579 , 0.5 + 131.088 , 0.5 + 133.498 , 0.5 + 134.757 , 0.5 + 138.116 , 0.5 + 139.736 , 0.5 + 141.124 , 0.5 + 143.112
∂, w'[0] == D[Hypergeometric2F1[a, b, c, z1], t] /. t -> ∂}] //. {rx -> r, ry -> r}, {w}, {t, 0, 6 2Pi}, MaxSteps -> 10000, PrecisionGoal -> 10, AccuracyGoal -> 8], {r, 1/5, 4/5, 3/5/ppr}];
We extract the function values. In[13]:= Table[hyperTab3DE[j] = Table[sol1[r][[1, 1, 2]][N[ϕ]],
{ϕ, j 2Pi + ∂, j 2Pi + 2Pi - ∂, (2Pi - 2∂)/ppϕ}, {r, 1/5, 4/5, 3/5/ppr}], {j, 0, 2}];
Finally, we display the result. In[14]:= (* frequently used options for inner (optsi) and
outer (optso) functions in the following *) optsi = Sequence[Axes -> True, PlotRange -> All, DisplayFunction -> Identity]; optso = Sequence[ViewPoint -> {3, -1, 1.5}, BoxRatios -> {1, 1, 1.8}, AxesLabel -> {"x", "y", None}]; In[17]:= Show[GraphicsArray[
Block[{$DisplayFunction = Identity}, Function[reIm, Show[Table[ListSurfacePlot3D[MapThread[Append[#1, Re[#2]]&, {xyTab3, hyperTab3DE[j]}, 2], optsi], {j, 0, 2}], optso]] /@ {Re, Im}]]]
Solutions
1343
0 0.5 5 x1 1.5 .5 2
4
4
2
2
0
0
-2
-2
-4 0 -1-0.5 y
0.5 1
0 0.5 5 x1 1.5 .5 2
-4 0 -1-0.5 y
0.5 1
The picture is the same as the one above (as expected). For the branch point at infinity, we solve the differential equation along ellipses with center 1 ê 2 + 0 i. In[18]:= mp = 1/2;
Table[sol1[r] = NDSolve[N[{eq1, w[0] == Hypergeometric2F1[a, b, c, z1] /. t -> ∂, w'[0] == D[Hypergeometric2F1[a, b, c, z1], t] /. t -> ∂}] //. {rx -> 1/2 + r, ry -> r}, {w}, {t, 0, 6 2Pi}, MaxSteps -> 10000, PrecisionGoal -> 10, AccuracyGoal -> 8], {r, 1/5, 4/5, 3/5/ppr}];
We extract the function values from the resulting InterpolatingFunction-objects. In[20]:= Table[hyperTab6DE[j] =
Table[sol1[r][[1, 1, 2]][N[ϕ]], {ϕ, j 2Pi + ∂, j 2Pi + 2Pi - ∂, (2Pi - 2∂)/ppϕ}, {r, 1/5, 4/5, 3/5/ppr}], {j, 0, 5}];
Finally, we display the result. In[21]:= Show[GraphicsArray[
Block[{$DisplayFunction = Identity}, Function[reIm, Show[Table[ListSurfacePlot3D[MapThread[Append[#1, Re[#2]]&, {xyTab6, hyperTab6DE[i]}, 2], optsi], {i, 0, 5}], optso]] /@ {Re, Im}]]]
0 x 1
10
10
0
0
-10 0.5 -0.5 0 y
0 x 1
-10 0.5 -0.5 0 y
Again, the picture is the same as the one constructed using the Kummer relations. The so-constructed sheets of the Riemann surface of 2F1 H1 ê 3; 1 ê 2, 1 ê 6; zL also have a branch point at z = 0. By using some more complicated paths for solving the differential equation, we could go on and also make a picture of these sheets. We end here. The reader, if interested in this subject, should be able to carry out these further manipulations. As a third possible way to get the various sheets of the hypergeometric function, we could use the integral representation of the hypergeometric function and deform the integration path in dependence of z appropriately. We do not carry out this approach here; for details, see [687]. For further discussions of the structure of the Riemann surface of the hypergeometric function 2 F1 Ha, b; c; zL, see [137], [735], [556], and [1227]. c) Here are graphics of the real and imaginary parts of KHzL ê KH1 - zL. In[1]:= [z_] = EllipticK[z]/EllipticK[1 - z]; In[2]:= Show[GraphicsArray[
Plot3D[#[[x + I y]], {x, -2, 2}, {y, -2, 2}, DisplayFunction -> Identity, Mesh -> False, PlotPoints -> 120, PlotRange -> All]& /@ {Re, Im}]]
The Classical Special Functions
1344
2 1.5 1 0.5 -2 2
2 1 -1
0 0
1 0.5 0 -0.5 -1 -2 2
-1 1
2
2 1 -1
-2
0 0
-1 1
2 -2
The right branch cut for z > 1 shows the typical shape of a logarithmic branch point. Taking into account the series expansions of KHzL near z = 0 and z = 1, namely KHzL º p ê 2 H1 + z ê 4 + 9 ê 64 z2 + ∫L and KHzL º -1 ê 2 lnH1 - zL + lnH4L zØ0
zØ1
we recognize that the points z = 0 and z = 1 are both logarithmic branch points. The numerator of KHzL ê KH1 - zL gives rise to the branch point at z = 1 and the denominator to the branch point at z = 0. This means the Riemann surface of KHzL ê KH1 - zL has double infinite many sheets. Both functions, KHzL, and KH1 - zL are (linearly independent) solutions of the following hypergeometric differential equation. In[3]:= a = 1/2; b = 1/2; c = 1;
ode = z (1 - z) w''[z] + (c - (a + b + 1)z) w'[z] - a b w[z] w@zD 4
Out[4]= − + H1 − 2 zL w @zD + H1 − zL z w @zD
In[5]:= {ode /. w -> Function[z, EllipticK[z]],
ode /. w -> Function[z, EllipticK[1 - z]]} // Simplify Out[5]= 80, 0
ω1, ω0'' -> ω2, ω0''' -> ω2'}, ω0'[ϕ] == ω1[ϕ], ω1'[ϕ] == ω2[ϕ], Thread[{ω0[ϕ0], ω1[ϕ0], ω2[ϕ0]} == Change["z -> ϕ"][{f0, f1, f2}, ϕ0, {mp, rx, ry}]]}]; NDSolve[eqs, {ω0, ω1, ω2}, {ϕ, -o 2Pi, o 2Pi}, PrecisionGoal -> 12, AccuracyGoal -> 12, MaxSteps -> 10^4]];
Here are the function values and the first two derivatives of the four sheets directly neighboring to the principal sheet. In[16]:= = 1; In[17]:= nsol11 = solveODEAroundBranchPoint[{1, 1/2, 1/2},
{[1/2], '[1/2], ''[1/2]}, Pi, + 1]; In[18]:= tab11 = Change["ϕ -> z"][#, Pi, {1, 1/2, 1/2}]& /@
Table[{ω0[Pi + j 2Pi], ω1[Pi + j 2Pi], ω2[Pi + j 2Pi]} /. nsol11[[1]], {j, -, }] // Chop Out[18]= 881. + 2. , 0.913893, 0.835201 Y1, Y0'' -> Y2, Y0''' -> Y2'}, Y0'[y] == Y1[y], Y1'[y] == Y2[y], Thread[{Y0[y0], Y1[y0], Y2[y0]} == Change["z -> y"][{f0, f1, f2}, y0]]}]; NDSolve[eqs, {Y0, Y1, Y2}, {y, y0, yMax}, PrecisionGoal -> 12, AccuracyGoal -> 12, MaxSteps -> 10^4]];
Now we have all functions to actually solve the Schwarz differential equation on a grid and construct the corresponding sheets of the Riemann surface. In[27]:= ppy = 6; ppϕ = 24; ∂ = 10^-3;
insideIterator = {y, ∂, 1/2 - ∂, (1/2 - 2 ∂)/ppy}; outsideIterator = {y, 1/2 + ∂, 1, (1/2 - ∂)/ppy}; Needs["Graphics`Graphics3D`"] Do[(* solve differential equation along (1/2, 1/2 + I) *) yIFs = YIF[k] = solveODENorthwards[startData[[k]], 0, 1]; (* construct function values and derivative values *) {startDataInside, startDataOutside} = Table[{y, Change["y -> z"][{Y0[y], Y1[y], Y2[y]} /. yIFs[[1]], y]}, #]& /@ {insideIterator, outsideIterator}; (* encircle both branch points *) ((R[#1] = solveODEAroundBranchPoint[{1/2, #1, 1/2 + #1}, #2, Pi/2, 1/2])& @@@ #)& /@ {startDataInside, startDataOutside}; (* points of the sheets *) {pointsInside, pointsOutside} = Table[ = R[y][[1, 1, 2]]; Table[{1/2., 0., 0.} + {y Cos[ϕ], y Sin[ϕ], [ϕ]}, {ϕ, -Pi, Pi, 2Pi/ppϕ}], #]& /@ {insideIterator, outsideIterator}; (* construct polygons *) sheetPoly[k] = Function[reIm, Cases[ ListSurfacePlot3D[Apply[{#1, #2, reIm[#3]}&, #, {-2}], DisplayFunction -> Identity], _Polygon, Infinity]& /@ {pointsInside, pointsOutside}] /@ {Re, Im}, {k, Length[startData]}]
Coloring the sheets differently and cutting the edges of the polygons (to have a better view of the other sheets) yields the following graphic of the sheets that are nearest to the principal sheet of KHzL ê KH1 - zL.
Solutions
1347 In[32]:= Do[sheetColor[k] = SurfaceColor[Hue[Random[]], Hue[Random[]], 2.3],
{k, Length[startData]}] In[33]:= makeDiamondPolygon[Polygon[l_]] :=
Polygon[Plus @@@ Partition[Append[l, First[l]], 2, 1]/2] In[34]:= Show[Graphics3D[
Table[{sheetColor[k], sheetPoly[k][[2]]}, {k, Length[startData]}] /. p_Polygon :> makeDiamondPolygon[p], BoxRatios -> {1, 1, 3/4}, ViewPoint -> {0, -3, 1}, PlotRange -> {-1/2, 1}]]
Now let us construct symbolic expressions for the other sheets. From the integral representation pê2 1ê2 KHzL ã Ÿ0 H1 - z sin2 HJLL dJ, the following jump behavior along the branch cut H1, ¶L of KHzL follows: + ImHKHz ≤ 0 iLL = ≤ KH1 - zL. This formula allows the implementation of the function KKPExtensionStep . KKPExten sionStep[K, z][f] will return a list of the neighboring sheets of f, obtained by continuing the function K. In[35]:= KKPExtensionStep[K_, z_][f_] :=
Module[{c = 1, Kp = DeleteCases[{EllipticK[z], EllipticK[1 - z]}, K][[1]], , k}, (* replace all Ks by extended ones *) = f /. K :> K + I k[c++] Kp; (* reduce fraction *) ExpandNumerator /@ Together[ (* the neighboring sheets *) Table[Evaluate[], Evaluate[Sequence @@ Table[{k[j], -1, 1}, {j, c - 1}]]]]]
Using the abbreviations K = KHzL and K' = KH1 - zL we show KKPExtensionStep at work. In[36]:= abbreviate[expr_] :=
expr /. {EllipticK[z] -> K, EllipticK[1 - z] -> K'} In[37]:= (ext1 = KKPExtensionStep[EllipticK[z], z][[z]]) // abbreviate
K − K
K
K + K
Out[37]= 9 , , = K K K In[38]:= (ext2 = KKPExtensionStep[EllipticK[1 - z], z][[z]]) // abbreviate
K − K + K
K K
K K+K
Out[38]= 9 , , =
The sheets of the lists ext1 and ext2 are solutions of the Schwarz differential equation for KHzL ê KH1 - zL. In[39]:= (odeRatio /.
w -> Function[z, #])& /@ Flatten[{ext1, ext2}] // Simplify
Out[39]= 80, 0, 0, 0, 0, 0
x + I y], {x, -2, 2}, {y, ##}, PlotPoints -> {pp, Round[pp/2]}, DisplayFunction -> Identity]& @@@ {{ -2, -∂}, {∂, 2}})] In[44]:= Show[Graphics3D[makeSheetPolygons[{[z], z}, Im, 30]],
Axes -> True, PlotRange -> All]
1 0.5 0 -0.5 -1 -2 2
2 1 -1
0 0
-1 1
2
-2
The function graphicsPair shows the sheets KKs from two different viewpoints, from the positive and negative x-directions. In[45]:= graphicsPair[{KKs_, z_}, pp_] :=
With[{gr = makeSheetPolygons[{#, z}, Im, 30]& /@ KKs}, Show[GraphicsArray[ Graphics3D[{EdgeForm[Thickness[0.002]], SurfaceColor[Hue[0.12], Hue[0], 2.7], gr}, ViewPoint -> #]& /@ {{+3, -1, 2}, {-3, -1, 2}}] /. p_Polygon :> makeDiamondPolygon[p]]]
The following two pairs of graphics show that the sheets of ext1 join smoothly along the positive x-axis and the sheets of ext2 join smoothly along the negative x-axis. In[46]:= graphicsPair[{ext1, z}, 30]
In[47]:= graphicsPair[{ext2, z}, 30]
Solutions
1349
Carrying out the continuation repeatedly yields more and more sheets. KKPExtensions[3, z] contains 2232 sheets, including the ones that contain the above numerically calculated startData. Here is a quick check of this statement. (The maximal difference of 5 10-11 agrees with the PrecisionGoal option setting used for NDSolve above.) In[48]:= Function[l, Min[Abs[l - #]]& /@ (First /@ startData)][
KKPExtensions[3, z] /. z -> 1/2.] // Max Out[48]= 7.96381 × 10−9
We end with a graphic of the sheets of KKPExtensions[1, z]. In[49]:= graphicsPair[{KKPExtensions[1, z], z}, 20]
d) Starting with the differential equation w££ H zL 2 z w£ HzL equation w££ H zL 2 wH zL w£ HzL2 0 for wHzL erfH-1L HzL. +
-
=
=
0 for wHzL
=
erf HzL, it is straightforward to derive the differential
=
In[1]:= w''[z] - 2 w[z] w'[z]^2 /. w -> InverseErf Out[1]= 0
Now we adapt to a coordinate system that is appropriate for displaying the Riemann surface near z 1. Changing now variables according to z 1 r expHi L and wHzL H L, we obtain the differential equation ££ H L 2 H L £ H L2 i £ H L 0 for H L. In[2]:= z = 1 + r Exp[I ϕ]; {w0 = Φ[ϕ], w1 = D[Φ[ϕ], ϕ] 1/D[z, ϕ], w2 = D[w1, ϕ] 1/D[z, ϕ]}; =
=
F
j
-
F j
Out[4]=
F
j
-
F
j
=
+
j
= F j
F j
-Numerator[Together[w2 - 2 w0 w1^2]] − Φ @ϕD − 2 Φ@ϕD Φ @ϕD2 + Φ @ϕD
Now we solve this differential equation for various values of r over a -range corresponding to multiple surroundings of the point z 1. In[5]:= ∂ = 10^-3; Do[nsol[r] = NDSolve[{Φ''[ϕ] - 2 Φ[ϕ] Φ'[ϕ]^2 - I Φ'[ϕ] == 0, j
=
(* initial conditions on the real axis *) Φ[Pi] == 0, Φ'[Pi] == -I InverseErf'[1 - r]}, Φ, {ϕ, -6Pi, 8Pi}][[1, 1, 2]], {r, ∂, 7/4 - ∂, (7/4 - 2∂)/40}]
In[7]:= data = Table[{1 + r Cos[ϕ], r Sin[ϕ], nsol[r][ϕ]},
{ϕ, -6Pi, 8Pi, 2Pi/30}, {r, ∂, 7/4 - ∂, (7/4 - 2∂)/40}]; The visualization of the so-obtained values of erfH-1L HzL at the sheets next to the principal sheet is straightforward. We display ReHerfH-1L HzLL and ImHerfH-1L HzLL.
The Classical Special Functions
1350 In[8]:= makePolys[data_] :=
Table[Polygon[{data[[i, j]], data[[i, j + 1]], data[[i + 1, j + 1]], data[[i + 1, j]]}], {i, Length[data] - 1}, {j, Length[data[[1]]] - 1}]; In[9]:= With[{λ = Length[data]},
Show[GraphicsArray[ Function[reIm, (* display real and imaginary part *) Graphics3D[{EdgeForm[], (* color according to ϕ *) MapIndexed[{SurfaceColor[Hue[#2[[1]]/λ], Hue[#2[[1]]/λ], 2.4], #1}&, makePolys[Map[MapAt[reIm, #, 3]&, data, {2}]]] // N}, BoxRatios -> {1, 1, 1.75}, ViewPoint -> {-3, 0, 1}]] /@ {Re, Im}]]]
17. Kummer’s 24 Solutions of the Gauss Hypergeometric Differential Equation, Appell Differential Equation a) Before treating the hypergeometric differential equation in detail, let us first perform the change of the independent variable z Ø x in a generic differential equation. Denote the function uHzL expressed as a function of x by UHxL = uHzHxLL. We can then transform derivatives of u with respect to z to derivatives of U with respect to x in the following manner u[z] Ø U[x]. In[1]:= Derivative[1 ][u][z] := 1/z'[x] Derivative[1][U][x];
Derivative[n_][u][z] := Together[1/z'[x] D[Derivative[n - 1][u][z], x]];
So the left-hand side of our second-order differential equations reads as a differential equation in x. In[3]:= u''[z] + g[x] U[x]
z @xD U @xD − U @xD z @xD z @xD
Out[3]= g@xD U@xD + 3
It is slightly rewritten. We write everything above a common denominator and keep only the numerator. In[4]:= Numerator[Together[%]]/z'[x] // Expand
U @xD z @xD z @xD
Out[4]= g@xD U@xD z @xD2 + U @xD −
It now shows the form of the Liouville transformation to apply. In[5]:= U[x_] = Exp[-1/2 Integrate[-z''[x]/z'[x], x]] w[x] Out[5]= w@xD
è!!!!!!!!!!!!!!!! z @xD
After some cosmetic rearrangements, the differential equation for wHxL is given here. In[6]:= Collect[Numerator[Together[%%]]/(4z'[x]^2), {w[x], w''[x]}]
w@xD H4 g@xD z @xD4 − 3 z @xD2 + 2 z @xD zH3L @xDL 4 z @xD
Out[6]= w @xD + 2
For the transformation zHxL = Ha + b xL ê Hg + d xL, the last two difficult-looking terms (also called the Schwarz derivative) fortunately vanish identically. In[7]:= With[{z = (α + β x)/(γ + δ x)},
Together[-3/4 D[z, {x, 2}]^2/D[z, x]^2 + 1/2 D[z, {x, 3}]/D[z, x]]] Out[7]= 0
The above equation thus shows the relation hHxL = z£ HxL2 gHzHxLL.
Solutions
1351 In[8]:= (* do not need any special rule for derivatives of u anymore *)
Derivative[1 ][u][z] =. Derivative[n_][u][z] =.
Now, let us go to the hypergeometric differential equation. The Liouville transformation is now given by the following. In[11]:= Simplify[ExpandAll[Exp[-1/2 Integrate[
(c - (1 + a + b) z)/(z (1 - z)), z]]]] u[z] 1 H−1−a−b+cL
Out[11]= H−1 + zL 2
z−cê2 u@zD
In[12]:= y[z_] = ((1 - z)^((-1 - a - b + c)/2) u[z])/z^(c/2) 1 H−1−a−b+cL
Out[12]= H1 − zL 2
z−cê2 u@zD
So this is the normal form of the hypergeometric differential equation. In[13]:= (z (1 - z) D[y[z], {z, 2}] + (c - (1 + a + b) z) D[y[z], z] -
a b y[z]) // Together 1 4 H−1 + zL
Out[13]= − 1
a
b
c
c
JH1 − zL− 2 − 2 − 2 + 2 z−1− 2 H2 c u@zD − c2 u@zD − 4 a b z u@zD − 2 c z u@zD + 2 a c z u@zD + 2 b c z u@zD + z2 u@zD − a2 z2 u@zD + 2 a b z2 u@zD − b2 z2 u@zD + 4 z2 u @zD − 8 z3 u @zD + 4 z4 u @zDLN
Here is some rewriting done with the last expression to bring it to polynomial form. In[14]:= Cancel[(Factor /@ Numerator[%])/(1 - z)^(c/2)] Out[14]= −2 c u@zD + c2 u@zD + 4 a b z u@zD + 2 c z u@zD − 2 a c z u@zD − 2 b c z u@zD −
z2 u@zD + a2 z2 u@zD − 2 a b z2 u@zD + b2 z2 u@zD − 4 z2 u @zD + 8 z3 u @zD − 4 z4 u @zD
So now it can be cast in the following form. In[15]:= #/(-4 (z - 1)^2 z^2) & /@ (Factor /@ Collect[%, {u[z], u'[z], u''[z]}])
H−2 c + c2 + 4 a b z + 2 c z − 2 a c z − 2 b c z − z2 + a2 z2 − 2 a b z2 + b2 z2 L u@zD 4 H−1 + zL z
Out[15]= − + u @zD 2 2
The function gHzL is then given by the following. In[16]:= g[z_, a_, b_, c_] = Coefficient[%, u[z]]
−2 c + c2 + 4 a b z + 2 c z − 2 a c z − 2 b c z − z2 + a2 z2 − 2 a b z2 + b2 z2 4 H−1 + zL z
Out[16]= − 2 2
We use the explicit form of zHxL. In[17]:= z = (α x + β)/(γ x + δ);
One could think that after making the definitions, the equality gHxL = hHxL can now be easily solved via these definitions with a call to Reduce. In[18]:= g1 = g[x, a, b, c];
h1 = D[z, x]^2 g[z, as, bs, cs]; (* Reduce[# == 0& /@ CoefficientList[ Numerator[Together[g1 - h1]], x], {α, β, γ, δ, as, bs, cs}] *)
Unfortunately, this input never returns. So we must help Mathematica here. We could start with the last equation and see what could happen. In[21]:= CoefficientList[Numerator[Together[g1 - h1]], x][[-1]] // Factor Out[21]= −H−1 + a − bL H1 + a − bL α2 Hα − γL2 γ2
This means a = 0 or g = 0 or … Instead of giving nine equations to Reduce, or analyzing backward starting with the last equation of all possibilities we will go another route and split the equality g1 == h1 in two groups by comparing numerator and denominator independently [605]. Because the numerators and denominators are only determined up to a constant, we multiply with an auxiliary variable auxFac. We look at the numerators and the denominators.
The Classical Special Functions
1352 In[22]:= Together[g1] == Together[h1] Out[22]=
2 c − c2 − 4 a b x − 2 c x + 2 a c x + 2 b c x + x2 − a2 x2 + 2 a b x2 − b2 x2 4 H−1 + xL2 x2 2 2 2 2 2 2 2 2 2 2 2 −HH−β γ + α δL H−x α + as x α − 2 as bs x α + bs x α − 2 x α β + 2 as2 x α β − 4 as bs x α β + 2 bs2 x α β − β2 + as2 β2 − 2 as bs β2 + bs2 β2 + 4 as bs x2 α γ + 2 cs x2 α γ − 2 as cs x2 α γ − 2 bs cs x2 α γ + 4 as bs x β γ + 2 cs x β γ − 2 as cs x β γ − 2 bs cs x β γ − 2 cs x2 γ2 + cs2 x2 γ2 + 4 as bs x α δ + 2 cs x α δ − 2 as cs x α δ − 2 bs cs x α δ + 4 as bs β δ + 2 cs β δ − 2 as cs β δ − 2 bs cs β δ − 4 cs x γ δ + 2 cs2 x γ δ − 2 cs δ2 + cs2 δ2 LL ê H4 Hx α + βL2 Hx α + β − x γ − δL2 Hx γ + δL2 L
These suggest that it would be easiest to begin the computation with the terms that do not have all of the variables, for example, the denominators. In[23]:= h1 = Together[h1];
eqDen1 = Denominator[g1] - auxFac Denominator[h1] Out[24]= 4 H−1 + xL2 x2 − 4 auxFac Hx α + βL2 Hx α + β − x γ − δL2 Hx γ + δL2
Now, we have only seven equations to be solved. In[25]:= (eqDen2 = CoefficientList[eqDen1, x]) // Short[#, 12]& Out[25]//Short= 8−4 auxFac β4 δ2 + 8 auxFac β3 δ3 − 4 auxFac β2 δ4 , −8 auxFac β4 γ δ − 16 auxFac α β3 δ2 +
24 auxFac β3 γ δ2 + 24 auxFac α β2 δ3 − 16 auxFac β2 γ δ3 − 8 auxFac α β δ4 , 4 − 4 auxFac β4 γ2 − 32 auxFac α β3 γ δ + 24 auxFac β3 γ2 δ − 24 auxFac α2 β2 δ2 + 72 auxFac α β2 γ δ2 − 24 auxFac β2 γ2 δ2 + 24 auxFac α2 β δ3 − 32 auxFac α β γ δ3 − 4 auxFac α2 δ4 , −8 − 16 auxFac α β3 γ2 + 8 auxFac β3 γ3 − 48 auxFac α2 β2 γ δ + 72 auxFac α β2 γ2 δ − 16 auxFac β2 γ3 δ − 16 auxFac α3 β δ2 + 72 auxFac α2 β γ δ2 − 48 auxFac α β γ2 δ2 + 8 auxFac α3 δ3 − 16 auxFac α2 γ δ3 , 4 − 24 auxFac α2 β2 γ2 + 24 auxFac α β2 γ3 − 4 auxFac β2 γ4 − 32 auxFac α3 β γ δ + 72 auxFac α2 β γ2 δ − 32 auxFac α β γ3 δ − 4 auxFac α4 δ2 + 24 auxFac α3 γ δ2 − 24 auxFac α2 γ2 δ2 , −16 auxFac α3 β γ2 + 24 auxFac α2 β γ3 − 8 auxFac α β γ4 − 8 auxFac α4 γ δ + 24 auxFac α3 γ2 δ − 16 auxFac α2 γ3 δ, −4 auxFac α4 γ2 + 8 auxFac α3 γ3 − 4 auxFac α2 γ4
as})) | (Sort @ (First[rest] /. {a -> b, b -> a}))], Null, AppendTo[bag, Sort @ First[rest]]]; rest = Rest[rest], {Length[preSol] - 1}]; (* prepare solutions in form of Rules *) Map[Prepend[#, z -> variableTrafos[[i]]]&, {ToRules[Or @@ bag]}], {i, Length[solDen]}], 1]; In[32]:= TableForm[%] 1 z → 1−x
as → 1 − a
bs → 1 + b − c
cs → 1 − a + b
1 z → 1−x
as → a
bs → −b + c
cs → 1 + a − b
1 z → 1−x
as → 1 + a − c
bs → 1 − b
cs → 1 + a − b
z→ z→ z→ z→ z→
1 1−x 1 x 1x 1x 1x
z→x z→x z→x Out[32]//TableForm= z → x z → x −1+x
as → −a + c
bs → b
cs → 1 − a + b
as → 1 − a
bs → −a + c
cs → 1 − a + b
as → a
bs → 1 + a − c
cs → 1 + a − b
as → 1 + b − c
bs → b
cs → 1 − a + b
as → −b + c
bs → 1 − b
cs → 1 + a − b
as → 1 − a as → a as → 1 + a − c as → −a + c as → 1 − a
bs → 1 − b bs → b bs → 1 + b − c bs → −b + c bs → 1 + b − c
cs → 2 − c cs → c cs → 2 − c cs → c cs → 2 − c
z → x −1+x
as → a
bs → −b + c
cs → c
z → x −1+x
as → 1 + a − c
bs → 1 − b
cs → 2 − c
The Classical Special Functions
1354 z → x −1+x
as → −a + c
bs → b
cs → c
z→1−x z→1−x z→1−x z→1−x −1+x z → x
as → 1 − a as → a as → 1 + a − c as → −a + c as → 1 − a
bs → 1 − b bs → b bs → 1 + b − c bs → −b + c bs → −a + c
cs → 1 − a − b + c cs → 1 + a + b − c cs → 1 + a + b − c cs → 1 − a − b + c cs → 1 − a − b + c
−1+x z → x
as → a
bs → 1 + a − c
cs → 1 + a + b − c
z→ z→
−1+x x −1+x x
as → 1 + b − c
bs → b
cs → 1 + a + b − c
as → −b + c
bs → 1 − b
cs → 1 − a − b + c
Now, reversing the transformations of the normal form x to z and constructing the normal form of the original equation in the solutions, we arrive at the following 24 solutions of the hypergeometric differential equation (Kummer’s 24 solutions [605]). In[33]:= ((PowerExpand[Together //@
(* transform back to solution original differential equation for 2F1 *) (Unevaluated[Hypergeometric2F1[as, bs, cs, x]* x^+(cs/2)(1 - x)^-((cs - as - bs - 1)/2)* z^-(c/2)(1 - z)^+((c - a - b - 1)/2)/Sqrt[D[x, z]]] /. #)] /. (* change (z - 1)^exp to the form (1 - z)^exp to be uniform and to have standard form; ignore z-independent phase factor *) {(z - 1)^exp_ -> (1 - z)^exp} /. (* expand exponents to make them collapse down *) {(zz_)^(exp_) :> zz^Expand[exp]}) //. (* get rid of prefactors not containing z *) {numFac_?(FreeQ[#, z]&) zFacs___ hyp_Hypergeometric2F1 -> zFacs hyp})& /@ (allSolutions /. {z -> x, x -> z}) // TableForm[#, TableSpacing -> {3}]& 1 H1 − zL−1−b+c z1−c Hypergeometric2F1@1 − a, 1 + b − c, 1 − a + b, D 1−z 1 H1 − zL−a Hypergeometric2F1@a, −b + c, 1 + a − b, D 1−z 1 H1 − zL−1−a+c z1−c Hypergeometric2F1@1 + a − c, 1 − b, 1 + a − b, D 1−z 1 H1 − zL−b Hypergeometric2F1@−a + c, b, 1 − a + b, D 1−z
H1 − zL−a−b+c za−c Hypergeometric2F1@1 − a, −a + c, 1 − a + b, 1z D 1 z−a Hypergeometric2F1@a, 1 + a − c, 1 + a − b, D z 1 z−b Hypergeometric2F1@1 + b − c, b, 1 − a + b, D z
H1 − zL−a−b+c zb−c Hypergeometric2F1@−b + c, 1 − b, 1 + a − b, 1z D H1 − zL−a−b+c z1−c Hypergeometric2F1@1 − a, 1 − b, 2 − c, zD Hypergeometric2F1@a, b, c, zD z1−c Hypergeometric2F1@1 + a − c, 1 + b − c, 2 − c, zD Out[33]//TableForm=
H1 − zL−a−b+c Hypergeometric2F1@−a + c, −b + c, c, zD z H1 − zL−1−b+c z1−c Hypergeometric2F1@1 − a, 1 + b − c, 2 − c, D 1−z z H1 − zL−a Hypergeometric2F1@a, −b + c, c, D 1−z z H1 − zL−1−a+c z1−c Hypergeometric2F1@1 + a − c, 1 − b, 2 − c, D 1−z z H1 − zL−b Hypergeometric2F1@−a + c, b, c, D 1−z
Solutions
1355 H1 − zL−a−b+c z1−c Hypergeometric2F1@1 − a, 1 − b, 1 − a − b + c, 1 − zD Hypergeometric2F1@a, b, 1 + a + b − c, 1 − zD z1−c Hypergeometric2F1@1 + a − c, 1 + b − c, 1 + a + b − c, 1 − zD H1 − zL−a−b+c Hypergeometric2F1@−a + c, −b + c, 1 − a − b + c, 1 − zD −1+z H1 − zL−a−b+c za−c Hypergeometric2F1@1 − a, −a + c, 1 − a − b + c, D z −1+z z−a Hypergeometric2F1@a, 1 + a − c, 1 + a + b − c, D z −1+z z−b Hypergeometric2F1@1 + b − c, b, 1 + a + b − c, D z −1+z H1 − zL−a−b+c zb−c Hypergeometric2F1@−b + c, 1 − b, 1 − a − b + c, D z
For the “automatic” derivation of more complicated hypergeometric identities based on the differential equation of 2 F1 Ha, b; c; zL, see [720]. For q-analogues of these equations, see [328]. b) These are the two differential equations obeyed by F1 Ha; b1 , b2 ; c; z1 , z2 L. (We use the symbol F1 instead of the built-in symbol AppellF1 to avoid the evaluation of the derivatives.) In[1]:= eqs0 = With[{w = F1[z1, z2]},
{z1 (1 - z1) D[w, z1, z1] + z2 (1 - z1) D[w, z1, z2] + (c - (1 + a + b1) z1) D[w, z1] - b1 z2 D[w, z2] - a b1 w, z2 (1 - z2) D[w, z2, z2] + z1 (1 - z2) D[w, z1, z2] + (c - (1 + a + b2) z2) D[w, z2] - b2 z1 D[w, z1] - a b2 w}] Out[1]= 8−a b1 F1@z1, z2D − b1 z2 F1H0,1L @z1, z2D + Hc − H1 + a + b1L z1L F1H1,0L @z1, z2D + H1 − z1L z2 F1H1,1L @z1, z2D + H1 − z1L z1 F1H2,0L @z1, z2D, −a b2 F1@z1, z2D + Hc − H1 + a + b2L z2L F1H0,1L @z1, z2D + H1 − z2L z2 F1H0,2L @z1, z2D − b2 z1 F1H1,0L @z1, z2D + z1 H1 − z2L F1H1,1L @z1, z2D
1
Applying now eliminate repeatedly and starting with eqs1 yields after six steps the ordinary differential equation we were looking for. (In the first elimination step, two derivatives are eliminated at once.) In[5]:= eqsT = eqs1;
While[(derivativesToEliminate = Union[Cases[eqsT, Derivative[_, _?(# =!= 0&)][F1][_, _], Infinity]]) =!= {}, (* next derivative to eliminate *)
The Classical Special Functions
1356 nextDerivative = derivativesToEliminate[[-1]]; (* new equations *) eqsT = eliminate[eqsT, Union[First /@ Position[eqsT, nextDerivative]][[-1]], nextDerivative]]
Collecting and simplifying terms yields the following linear third order differential equation for F1 Ha; b1 , b2 ; c; z1 , z2 L. In[7]:= (ode = Collect[eqsT, Table[D[w[z1, z2], {z1, k}], {k, 0, 3}],
FullSimplify]) /. {Derivative[d1_, 0][w][z1, z2] :> Derivative[d1][W][z1], w[z1, z2] -> W[z1]} /. (* for a nicer-looking result *) {b1 -> Subscript[b, 1], b2 -> Subscript[b, 2], z1 -> Subscript[z, 1], z2 -> Subscript[z, 2], F1 -> Subscript[F, 1]} // TraditionalForm Out[7]//TraditionalForm= 8a b1 Hb1 + 1L F1 Hz1 , z2 L + Hb1 + 1L H-c + H2 a + b1 + 2L z1 + H-a + b2 - 1L z2 L F1 H1,0L Hz1 , z2 L + HHa + 2 b1 + 4L z21 - Hc + b1 + Ha + b1 - b2 + 3L z2 + 2L z1 + Hc - b2 + 1L z2 L F1 H2,0L Hz1 , z2 L + Hz1 - 1L z1 Hz1 - z2 L F1 H3,0L Hz1 , z2 L
D[AppellF1[a, b1, b2, c, z1, z2], {z1, d1}, {z2, d2}], F1[z1, z2] :> AppellF1[a, b1, b2, c, z1, z2]} /. (* numerical values for parameters *) Rule @@@ Transpose[{{a, b1, b2, c, z1, z2}, Table[Random[Real, {-1/2, 1/2}, 50], {6}]}] Out[9]= 80. × 10−40
All, AspectRatio -> Automatic, Axes -> False, Frame -> True, opts]
Here are two examples with different coefficient ranges. In[3]:= Show[GraphicsArray[GaussLucasTheoremVisualization[12, #,
DisplayFunction -> Identity]& /@ {3, 5 + 5I}]] 1.5 1 1
0.5
0.5
0
0 -0.5
-0.5
-1
-1 -1.5
-1 -0.5
0
0.5
-1.5 -1 -0.5 0 0.5 1
Solutions
1357
Note that polynomials, although in some sense the simplest of all functions, show a rich behavior in many respects. A couple of other, interesting “root-pictures” related to the above images could be produced by using, for instance, a visualization of Sturm’s theorem on the number of real roots of a polynomial in a given interval via [1212]. Make Input
SturmPicture[poly_, var_] := Module[{localPoly, x, degree, polyTab, zerosTab, mi, ma, intervalTab, polyFuncTab, intervalMidPointsTab, negPositionsTab, negRectangles}, (* a local version of the polynomial *) localPoly = Expand[poly //. var -> x]; (* degree of the polynomial *) degree = Exponent[localPoly, x]; (* the derivatives up to degree -1 of the polynomial *) polyTab = Table[D[localPoly, {x, i}], {i, 0, degree - 1}]; (* the zeros of all derivatives *) zerosTab = Union[Cases[NRoots[# == 0, x], _Real, {-1}]]& /@ polyTab; (* x-interval in which all sign changes are happening *) {mi, ma} = {-1, 1} Abs[Subtract @@ #]/8 + #&[{Min[#], Max[#]}&[Flatten[zerosTab]]]; (* intervals in which the polynomials have equal signs *) intervalTab = If[# === {}, {}, Partition[Join[{mi}, #, {ma}], 2, 1]]& /@ zerosTab; (* all polynomials as Functions *) polyFuncTab = Apply[Function[##, Listable]&, {x, #}& /@ polyTab, {1}]; (* the midpoints of all intervals *) intervalMidPointsTab = Apply[Plus[##]/2&, intervalTab, {2}]; (* position of the intervals in which the polynomials are negative *) negPositionsTab = Flatten[Position[#, _?(# < 0&)]]& /@ (#[[1]][#[[2]]]& /@ Transpose[{polyFuncTab, intervalMidPointsTab}]); (* the intervals in which the polynomials are negative *) negIntervalsTab = Apply[Part, Transpose[{intervalTab, negPositionsTab}], {1}]; (* black rectangles in which the polynomials are negative *) negRectangles = MapIndexed[Rectangle[{#[[1]], #2[[1]] - 1}, {#[[2]], #2[[1]]}]&, negIntervalsTab, {2}]; (* show all intervals in which the polynomials are negative *) Graphics[negRectangles, PlotRange -> {{mi, ma}, {0, degree + 1}}, Frame -> True]]; (* an example *) SturmPicture[Product[y - i, {i, -20, 20}], y]
40
80
30
60
20
40
10
20
-20
-10
0
10
20
-4
-2
0
2
4
b) Let us start with the roots of a random polynomial, the roots of the polynomial differentiated, the roots of the polynomial differentiated twice, and so on. In the case of real coefficients, the picture has the obvious mirror symmetry between the lower and the upper half-planes, which is generically lost in the case of complex coefficients. In[1]:= SeedRandom[999];
Show @ GraphicsArray @ (Function[coeffs, Graphics[MapIndexed[{PointSize[#2[[1]]/Length[coeffs] 0.02], #1}&, (* points at the roots *) Map[Point[{Re[#[[1, 2]]], Im[#[[1, 2]]]}]&, (NSolve[# == 0, x]& /@
The Classical Special Functions
1358 (NestList[(* differentiate the polynomials *) N[D[#, x]]&, (* form the polynomials *) coeffs.Array[x^#&, Length[coeffs], 0], Length[coeffs] - 2])), {2}]], PlotRange -> All, AspectRatio -> Automatic, Axes -> False, Frame -> True]] /@ (* two random lists of coefficients *) {Array[Random[Integer, {-8, 8}]&, 25], Array[Random[Complex, {-12 - 12I, 12 + 12I}]&, 25]}) 1
1
0.5
0.5 0
0
-0.5
-0.5
-1 -1
-1
-0.5
0
0.5
1
-1
-0.5
0
0.5
1
1.5
The roots seem to lie on curves. To connect them in the “right” order, we would have to know the expression d a polynomialHxL ê dxa . Taking into account only powers of the independent variable and using linearity, we should look for a continuous form of d axn ê dxa . Looking at integer values of a, one obvious possibility is as follows: d axn ê dxa = n ! ê Hn - aL ! xn-a . (Here Pochhammer functions come into play, which is why this exercise belongs in this chapter.) Interpreting a! not only for integer a (which Mathematica does automatically, because every function (if possible) is defined for arbitrary complex arguments), we have the desired generalization. (Such generalizations of the order of differentiation go back to Liouville; for a detailed discussion, see [1101], [1180], [255], [957], [884], [1061], [641], [404], [643], [891], and [765]; for applications in physics, see [595], [431], [321], [367], [831], [1072], [1169], [1025], [1115], [1108], [697], [1328], [578], [433], [655], [95], [694], [721], [1082], [1085], [175], [883], [594], [976], [55], [1014], [1092], [73], [261], [4], [763], [430], [593], [466], [542], [432], [523], [1040], and [313], for the relation between special functions and fractional differentiation, see [679], [1327], and [1078]. For fractional differences, see [890], [391], [927], [534], [596], and [928]. For the differentiation of discrete functions, see [358].) The following picture shows how this formula interpolates between integer values of a. The black lines represent x3 differentiated and integrated an integral number of times. In[3]:= With[{(* n in x^n *) n = 3}, Show[
(* the x^3 n - times differentiated *) {Plot3D[Re[n!/(n - a)! x^(n - a)], {x, -3, 3}, {a, 7, -2}, PlotPoints -> {60, 55}, ClipFill -> None, MeshStyle -> Thickness[0.002], PlotRange -> {-20, 30}, DisplayFunction -> Identity], Graphics3D[{Thickness[0.01], ParametricPlot3D[ (* the prefactor*x^m from integer times differentiating *) Evaluate[# + {0, 0, 0.3}& /@ {{x, 0, x^3}, {x, 1, 3x^2}, {x, 2, 6x}, {x, 3, 6}, {x, 4, 0}, {x, -1, x^4/4}, {x, -2, x^5/20}, {x, 5, 0}, {x, 6, 0}, {x, 7, 0}}], {x, -3, 3}, DisplayFunction -> Identity][[1]]}]}, DisplayFunction -> $DisplayFunction, AxesLabel -> {"x", "a", None}]]
30 20 10 0 -10 -20
6 4 2 a
-2 x
0
0 2
-2
Solutions
1359
Using the above relation for every term of a polynomial, we can define a polynomial differentiated a noninteger number of times. (Because we are interested only in the zeros of such expressions, we use Cancel[…] to pull out the term y^α, which can never be zero.) In[4]:= DifferentiatedPolynomial[poly_, var_, y_, α_] :=
Cancel[# y^α]& /@ Plus @@ MapIndexed[#1 y^(#2[[1]] - 1 - α) (#2[[1]] - 1)!/(#2[[1]] - 1 - α)!&, CoefficientList[poly, var]]
Here is an example. In[5]:= DifferentiatedPolynomial[a1 x^5 + a2 x^3 - a3 x^2 - a4, x, x, a]
2 a3 x2 H2 − aL !
6 a2 x3 H3 − aL !
120 a1 x5 H5 − aL !
a4 H−aL !
Out[5]= − + + −
This is iterated here. In[6]:= NestList[DifferentiatedPolynomial[#, x, x, a]&,
a1 x^5 + a2 x^3 - a3 x^2 - a4, 4] // TableForm −a4 − a3 x2 + a2 x3 + a1 x5 2
3
5
2 a3 x 6 a2 x 120 a1 x a4 − + + − H2−aL! H3−aL! H5−aL! H−aL! 2
3
5
2
3
4 a3 x 36 a2 x 14400 a1 x a4 + + − Out[6]//TableForm= − HH2−aL!L2 HH3−aL!L2 HH5−aL!L2 HH−aL!L2 5
8 a3 x 216 a2 x 1728000 a1 x a4 − + + − HH2−aL!L3 HH3−aL!L3 HH5−aL!L3 HH−aL!L3 2
3
5
16 a3 x 1296 a2 x 207360000 a1 x a4 − + + − HH2−aL!L4 HH3−aL!L4 HH5−aL!L4 HH−aL!L4
To avoid spurious lines in the picture (without changing the topology of the actual result in the sense of which root of the polynomial pHxL is continuously “connected” with which root of the polynomial p£ HxL), we drop all terms in which a > n + 1, n being a positive integer, by defining a ReducedGeneralizedPolynomial . These terms vanish at negative integer values of n - a, but are not equal to 0 between these values. Omitting these terms simplifies the ongoing numerical tasks. In[7]:= ReducedDifferentiatedPolynomial[poly_, var_, y_, α_, n_] :=
Drop[CoefficientList[#, y], n].Array[y^#&, (* avoid y -> 0 solutions *) Exponent[#, y] + 1 - n, 0]&[ DifferentiatedPolynomial[poly, var, y, α]] In[8]:= Array[ReducedDifferentiatedPolynomial[
a1 x^5 + a2 x^3 - a3 x^2 - a4, x, x, a, #]&, 5, 0] // TableForm 2
3
5
2
4
2 a3 x 6 a2 x 120 a1 x a4 − + + − H2−aL! H3−aL! H5−aL! H−aL! 2 a3 x 6 a2 x 120 a1 x − + + H2−aL! H3−aL! H5−aL! 2 a3 6 a2 x 120 a1 x3 Out[8]//TableForm= − + + H2−aL!
H3−aL! 2
H5−aL!
6 a2 120 a1 x + H3−aL! H5−aL! 120 a1 x H5−aL!
Because these so-calculated expressions are again polynomials in the unknown, we use NSolve for generating a dense set of zeros between integer values of the number of differentiations. (We could, of course, also use a less-dense set and apply Interpolation.) Here, we implement this. (The routine ZerosOfDifferentiatedPolynomialGraphics shows the roots of the polynomial differentiated an integer number of times in big points and the roots of the polynomial differentiated a nonintegral number of times in small points.) In[9]:= ZerosOfDifferentiatedPolynomialGraphics[poly_, var_, steps_] :=
Module[{a}, Show[Graphics[{{PointSize[0.008], Table[Point[{Re[#], Im[#]}]& /@ Cases[ (* integer times differentiated — the bigger dots *) NRoots[D[poly, {var, i}] == 0, var], _?NumberQ, {-1}], {i, 0, Exponent[poly, var] - 1}]}, {PointSize[0.003], Table[Function[polya, Table[Point[{Re[#], Im[#]}]& /@ (* solve the polynomial *) Cases[NRoots[N[polya] == 0, var], _?NumberQ, {-1}], {a, i, i + 1. - 10^-6, (* between two integers *) (1. - 10^-6)/steps}]][
The Classical Special Functions
1360
(* the polynomial between two integer times differentiated *) ReducedDifferentiatedPolynomial[poly, var, var, a, i]], {i, 0, Exponent[poly, var] - 2}]}}], PlotRange -> All, Frame -> True, Axes -> False, AspectRatio -> Automatic]]
Here is an example. In[10]:= ZerosOfDifferentiatedPolynomialGraphics[
8 z^12 - 6 z^11 + z^10 - 4 z^9 - z^8 - 3 z^7 + 8 z^6 + 6 z^5 + 4 z^4 - z^3 + z^2 + 5 z - 7, z, 120] 1 0.5 0 -0.5 -1 -0.5
0
0.5
1
Now, we recognize which roots “belong together”. Another possibility would have been to calculate the paths of the roots via the solution of a nonlinear first-order differential equation. Such an ordinary differential equation could be easily derived from the corresponding polynomial ReducedDifferentiatedPolynomial[ …]. By starting at the known values of the roots of polynomials differentiated an integral number of times, we could solve the differential equations numerically. In this case, care has to be taken when dividing by 0 and singular points of the differential equation. For just seeing which root path belongs to which, the above pointwise approach is appropriate. For a more detailed picture of the paths of the roots, the differential equation approach is more suitable. In addition, the differential equation approach does easily allow for a complex-valued order of differentation. (For the averaging properties of multiple differentiation, see [451].) Note that this picture looks different from what one would get by a linear interpolation (the use of another interpolation does not change the picture dramatically) of the coefficients between polynomialHzL and polynomial£ HzL. In[11]:= Module[{p, po, a},
(* the original polynomial *) p[0] = 8 x^12 - 6 x^11 + x^10 - 4 x^9 - x^8 - 3 x^7 + 8 x^6 + 6 x^5 + 4 x^4 - x^3 + x^2 + 5 x - 7; (* the polynomial p[0] differentiated i times *) Do[p[i] = D[p[0], {x, i}], {i, 12}]; (* linear interpolations between i times and (i + 1)-times differentiated polynomial *) Do[po[i, a_] = ((1 - a) CoefficientList[p[i], x] + a Append[CoefficientList[p[i + 1], x], 0]). Table[x^j, {j, 0, 12 - i}], {i, 0, 11}]; Show[Graphics[(* the roots of an integer times differentiated *) {{PointSize[0.008], Map[Point[{Re[#], Im[#]}]&, Table[Cases[NRoots[p[i] == 0, x], _?NumberQ, {-1}], {i, 0, 11}], {-1}]}, (* the roots of the interpolants *) {PointSize[0.003], Map[Point[{Re[#], Im[#]}]&, Table[Cases[NRoots[po[i, a] == 0, x], _?NumberQ, {-1}], {i, 0, 11}, {a, 0, 1, 1/250}], {-1}]}}], Frame -> True, AspectRatio -> Automatic]]
Solutions
1361 1 0.5 0 -0.5 -1 -1.5
-1
-0.5
0
0.5
1
19. Coinciding Bessel Zeros, p-Formulas a) We search for n, m, x, z by starting from random values until we find such values that the two identities hold. We might get some messages FindMinimum::regex if no minimum can be found within the specified search region. In[1]:= r := Random[Real, {0, 100}]; In[2]:= SeedRandom[1111];
While[Check[(* search for minimum; catch messages *) Not[FindMinimum[Re[(BesselJ[ν, x] - BesselJ[µ, x])^2 + (BesselJ[ν, z] - BesselJ[µ, z])^2], Evaluate[Sequence @@ (pre = {#, r, r, 0, 100}& /@ {ν, µ, x, z})]][[1]] < 10^-10], True], Null]; FindMinimum::regex : Reached the point 8100.398, 68.8359, 83.3, 91.0552< which is outside the region 880., 0., 0., 0. prec + δprec] // SetPrecision[#, prec]&; (* find smallest degree polynomial *) While[polyα = Recognize[α1, o, t]; sel = Select[t /. Union[{ToRules[Roots[polyα == 0, t]]}],
Solutions
1363 Abs[# - α1] == 0.&]; If[sel =!= {}, α2 = sel[[1]]]; (* high-precision check of original equation *) N[R[α2], 2prec] - Sqrt[n] =!= 0., (* increase degree *) o = o + 2]; α2]
Here is again the n = 10 example from above. In[13]:= findSmallAlgebraicInteger[10, 100] // Timing
è!!!!!!!! 223 − 70 10 10 H247 + 14
Out[13]= 90.63 Second, è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!! ! =
54 I54 +
10 L M
Now now continue to construct the terms of the infinite sums. In[14]:= makeπTerm[n_, k_, prec_:150] :=
Module[{α, α1, α2, polyα, 1, 2, poly, a, b, , o}, (* α as an algebraic number *) α2 = Simplify[findSmallAlgebraicInteger[n, prec]]; (* numerical value for a *) 1 = N[[n, α2], prec]; (* a as an algebraic number *) o = 2; While[poly = Recognize[1, o, t]; 2Pre = Select[t /. Union[{ToRules[Roots[poly == 0, t]]}], Abs[# - 1] == 0.&]; If[2Pre === {}, True, 2 = 2Pre[[1]]; (* high-precision check of original equation *) N[[n, α2], 2prec] - 2 =!= 0.], (* increase degree *) o = o + 2]; (* a, b, c as an algebraic numbers *) {a, b, c} = Simplify[#]& /@ {2, [n, α2], [n, α2]}; (* return summand *) (a + b k) Pochhammer[1/2, k] Pochhammer[1/3, k]* Pochhammer[2/3, k]/k!^3 c^k // Simplify]
The calculation of the Ramanujan-type p-formulas can now be done quickly. In[15]:= $MaxExtraPrecision = 1000; Out[16]=
makeπTerm[17, k] 1 Hk !L3 i è!!!!!!!! 1ê3 è!!!!!!!! 2ê3 2ê3 j j + 6661 I9657941 + 2343501 17 M − 21 21ê3 I9657941 + 2343501 17 M M I74172 jJ−II74172 2 k è!!!!!!!! 1ê3 è!!!!!!!! 2ê3 22ê3 − 3165 I9657941 + 2343501 17 M − 21 21ê3 I9657941 + 2343501 17 M − è!!!!!!!! 1ê3 2ê3 , 34 I17 I−74172 2 I9657941 + 2343501 17 M − è!!!!!!!! 2ê3 è!!!!!!!! 1748 I9657941 + 2343501 17 M + 21 21ê3 I9657941 + 2343501 17 MMMMM í J289 I289 I9657941 + 2343501
è!!!!!!!! 1ê3 , è!!!!!!!! 1ê3 17 M + I17 I−74172 22ê3 I9657941 + 2343501 17 M −
1748 I9657941 + 2343501
k 2 è!!!!!!!! 2ê3 è!!!!!!!! 17 M + 21 21ê3 I9657941 + 2343501 17 MMMM NN
i i2 2 j j j j j 51 - j 3 k k
i y 855788 è!!!!!!!! 1ê3 y j z+ j z + I2934393569 + 737141607 17 M z j−1244 − zz z è!!!!!!!!1ê3 H2934393569 + 737141607 17 L k {{ è!!!!!!!! 1ê3 è!!!!!!!! 2ê3 2ê3 1ê3 I2 I−74172 2 − 1748 I9657941 + 2343501 17 M + 21 2 I9657941 + 2343501 17 M + è!!!!!!!! 1ê3 17 , I17 I−74172 22ê3 I9657941 + 2343501 17 M − è!!!!!!!! 2ê3 è!!!!!!!! 1748 I9657941 + 2343501 17 M + 21 21ê3 I9657941 + 2343501 17 MMMM kM ë è!!!!!!!! è!!!!!!!! 1ê3 , è!!!!!!!! 1ê3 2ê3 I 51 I289 I9657941 + 2343501 17 M + I17 I−74172 2 I9657941 + 2343501 17 M −
y è!!!!!!!! 2ê3 è!!!!!!!! z 17 M + 21 21ê3 I9657941 + 2343501 17 MMMMMz z { y 1 1 2 z PochhammerA , kE PochhammerA , kE PochhammerA , kEz z 3 2 3 { 1748 I9657941 + 2343501
The Classical Special Functions
1364 In[17]:= $MaxExtraPrecision = 1000;
Do[πTerm[j] = makeπTerm[j, k], {j, 2, 20}] // Timing Out[18]= 836.86 Second, Null
è!!!!! ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Hk !L3 3 3 Hk !L3
In[21]:= (* largest here calculated j *)
πTerm[20] // FullSimplify // TraditionalForm Out[22]//TraditionalForm=
1 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅ è!!!!! ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ p Hk !L3 GHkL è!!!!! è!!!!! è!!!!!!! k è!!!!! è!!!!! è!!!!!!! -2 k-1 ij 3 k+2 -3 k-1 3 I205692 + 118755 3 + 91988 5 + 53109 15 M I205694 + 118755 3 + 91988 5 + 53109 15 M j2 k è!!!!! è!!!!! è!!!!!!! è!!!!! è!!!!! è!!!!!!! I15 I159327 + 91988 3 + 71253 5 + 41138 15 M k + 4 I36828 + 21263 3 + 16470 5 + 9509 15 MM 1 yy i GH3 kL Gjjk + ÅÅÅÅÅ zzzz 2 {{ k
We end by calculating the average number of digits are gained for each summand. We calculate this number by explicitly summing the first 100 terms and comparing the result with 1 ê p. In[23]:= digitsPerSummand[term_] :=
With[{termN = N[term, 1000], l = 100}, (* logarithm of absolute value of error *) -Log[10, Abs[N[1/Pi - Sum[termN, {k, 0, 100}]]]]/100] In[24]:= ListPlot[Table[{j, digitsPerSummand[πTerm[j]]}, {j, 2, 20}]] 5 4 3 2 1
5
10
15
20
20. Force-Free Magnetic Fields, Bessel Beams, Gauge Transformation a) We load the package Calculus`VectorAnalysis` to carry out the Div and Curl operation easily. In[1]:= Needs["Calculus`VectorAnalysis`"]
SetCoordinates[Cylindrical[r, ϕ, z]]
Out[2]= Cylindrical@r, ϕ, zD
In[3]:= Div[{Br, Bϕ, Bz}, Cylindrical] // FullSimplify Out[3]=
Br r
In[4]:= Curl[{Br, Bϕ, Bz}, Cylindrical] / {Br, Bϕ, Bz} // FullSimplify
Bϕ Bz r
Out[4]= 90, 0, =
÷” Substituting the given expressions, we get the following expressions for the components of B.
Solutions
1365 In[5]:= {Bz, Bϕ, Br} = {x, a, l} Exp[-l z] BesselJ[{0, 1, 1}, x r];
The divergence vanishes identically. In[6]:= Div[{Br, Bϕ, Bz}, Cylindrical] // FullSimplify Out[6]= 0
For the curl we get the following result. In[7]:= Curl[{Br, Bϕ, Bz}, Cylindrical]/{Br, Bϕ, Bz} // FullSimplify
−l2 + x2 a
Out[7]= 9a, , a=
This means the Div-equation is already fulfilled and the Curl-equation gives the following value for x. In[8]:= Solve[%[[2]] == a, x] Out[8]= 99x → −
a2 + l2 a2 + l2 è!!!!! $%%%%%%%%%%%%%%%%%%%%%% è!!!!! a =, 9x → a $%%%%%%%%%%%%%%%%%%%%%% == a a
In[9]:= % /. Power[a_, 1/2] Power[b_, 1/2] :> Power[Expand[a b], 1/2] Out[9]= 99x → −
è!!!!!!!!!!!!!!!!!! ! è!!!!!!!!!!!!!!!!!!! a2 + l2 =, 9x → a2 + l2 ==
b) We start by defining our default coordinate system to be a cylindrical one. In[1]:= Needs["Calculus`VectorAnalysis`"];
SetCoordinates[Cylindrical[r, ϕ, z]];
These are the magnetic field components. In[3]:= Br = 0;
Bϕ = BesselJ[1, k Sin[α] r] Exp[I (k Cos[α] z - ω t)]; Bz = 0;
They fulfill the equation div BHrL = 0. In[6]:= Div[{Br, Bp, Bz}, Cylindrical] // FullSimplify Out[6]= 0
Using the Maxwell equation curl BHr, tL = ∑ EHr, tL ê ∑ t we can determine the electric field components up to an integration constant. In[7]:= Integrate[Curl[{Br, Bϕ, Bz}, Cylindrical], t] ==
{Er[r, ϕ, z, t], Eϕ[r, ϕ, z, t], Ez[r, ϕ, z, t]} // FullSimplify − t ω+ k z Cos@αD k BesselJ@1, k r Sin@αDD Cos@αD ω − t ω+ k z Cos@αD k BesselJ@0, k r Sin@αDD Sin@αD 0, = ω 8Er@r, ϕ, z, tD, Eϕ@r, ϕ, z, tD, Ez@r, ϕ, z, tD
Automatic, PlotRange -> 1.001 {{-1, 1}, {-1, 1}}]; (* direction of the vector potential at (pp + 1)^2 points *) directions = Table[direction[{2. ri/pp, ϕ + If[EvenQ[ri], 0, 2Pi/pp/2]}, 0.08], {ri, 0, pp}, {ϕ, 0, 2Pi, 2Pi/pp}]; (* show both graphics *) Show[GraphicsArray[{ (* directions *) Graphics[{directions, border}, commonOpts], (* the flow lines *) Show[{Table[ ParametricPlot[Evaluate[{x[s], y[s]} /. (* solve differential equations numerically *) NDSolve[Join[odes, {x[0] == x0, y[0] == 0}], {x, y}, {s, -3Pi, 3Pi}]], {s, -3Pi, 3Pi}, DisplayFunction -> Identity, PlotPoints -> 120], {x0, 1/n, 1 - 1/n, 1/n}], Graphics[border]}, commonOpts]}]]]
Solutions
1367
We end with visualizing †AHr, jL§. The graphics show the †AHr, jL§ becomes maximal at the centers of the edges. In[16]:= Show[GraphicsArray[
Block[{a = 2, H = 1, ∂ = 10^-8, absA, $DisplayFunction = Identity}, absA = Sqrt[#.#]&[A[{Sqrt[x^2 + y^2], ArcTan[x, y]}]]; {Plot3D[Evaluate[absA], {x, -1 + ∂, 1 - ∂}, {y, -1 + ∂, 1 - ∂}, PlotPoints -> 60, Mesh -> False], ContourPlot[Evaluate[absA], {x, -1 + ∂, 1 - ∂}, {y, -1 + ∂, 1 - ∂}, PlotPoints -> 60, ColorFunction -> (Hue[0.8 #]&)]}]]] 1 0.5 0.6 0.4 0.2 0
0 0.5 -0.5
0 0
-0.5
-0.5 0.5
-1
-1
-0.5
0
0.5
1
21. Riemann Surface of the Bootstrap Equation Mathematica can solve the implicit equation z = 2 w - expHwL + 1 with respect to w by using the ProductLog function. In[1]:= Solve[z == 2 w - Exp[w] + 1, w]
InverseFunction::ifun : Inverse functions are being used. Values may be lost for multivalued inverses. More… Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. More… 1 1 − 1 + z Out[1]= 99w → J−1 + z − 2 ProductLogA− 2 2 EN== 2 2
Because Solve does not produce all possible solutions for multivalued inverse functions, we only get one sheet in this way. The other sheets are easy to obtain by using the analytic continuation for the ProductLog function. In[2]:= w[k_, z_] =
(z - 1)/2 - ProductLog[k, -Exp[(z - 1)/2]/2];
Here is a quick numerical check that these solutions satisfy the original equation. In[3]:= Table[Chop[z -( 2 w[k, z] - Exp[w[k, z]] + 1) /.
{k -> Random[Integer, {-10, 10}], z -> Random[Complex, {-5 - 5I, 5 + 5I}]}], {100}] // Union Out[3]= 80
Identity]], (* some sheets and some stripes *) {k, -2, 2}, {j, -2, 2}], _Polygon, Infinity]}], BoxRatios -> {1, 1, 0.6}, ViewPoint -> {3, -0.9, 0.7}]
Solutions
1369
The imaginary part gives a good view of the branch points, all of which connect two sheets. In[12]:= (DownValues[In][[$Line - 1]] /.
(* change to imaginary part; change view point *) {Re -> Im, {3, -0.9, 0.7} -> {-3, 1, 0.3}})[[2]]
For a more detailed discussion of the Riemann surface of this function, see [562], [1261], and [825]. 22. Differential Equation of Powers of Airy Functions, Map Airy Distribution, Zeros of Airy Function * a) Motivated by the differential equation for the Airy function itself, we make for the differential equation for the powers of HiL Airy functions an ansatz of the form ⁄n+1 i=0 ci HzL w HzL = 0 and determine the coefficients ci HzL by observing that the functions i £i Ai HzL, Ai HzL are linearly independent [864]. This is implemented in a compact form below. pow is the power, w is the independent, and z is the dependent variable of the resulting differential equation. In[1]:= ODEOfAiryPowers[α_, w_, z_] :=
(* the ansatz *)(Array[D[w[z], {z, #}]&, α + 2, 0].Array[C, α + 2, 0] //. Map[Factor, Function[ansatz, (* set coefficients, and solve for the C[i] *) Flatten[{Solve[# == 0& /@ Apply[Plus, Cases[ansatz, _ #]/#& /@ Array[AiryAi[z]^(α - #) AiryAiPrime[z]^#&, α + 1, 0], {1}], Array[C, α + 2, 0]], {C[pow + 1] -> 1}}]][Expand[(* the ansatz *) Array[C, α + 2, 0].Array[D[AiryAi[z]^α, {z, #}]&, α + 2, 0]]], {2}]) == 0
Here are the differential equations for the first 10 powers of AiHzL. In[2]:= Off[Solve::svars];
Array[ODEOfAiryPowers[#, w, z]&, 10] Out[3]= 8−z C@2D w@zD + C@2D w @zD 0, −2 C@3D w@zD − 4 z C@3D w @zD + C@3D wH3L @zD 0,
9 z2 C@4D w@zD − 10 C@4D w @zD − 10 z C@4D w @zD + C@4D wH4L @zD 0, 64 z C@5D w@zD + 64 z2 C@5D w @zD − 30 C@5D w @zD − 20 z C@5D wH3L @zD + C@5D wH5L @zD 0, −5 H−26 + 45 z3 L C@6D w@zD + 518 z C@6D w @zD + 259 z2 C@6D w @zD − 70 C@6D wH3L @zD − 35 z C@6D wH4L @zD + C@6D wH6L @zD 0, −3456 z2 C@7D w@zD − 4 H−295 + 576 z3 L C@7D w @zD + 2352 z C@7D w @zD + 784 z2 C@7D wH3L @zD − 140 C@7D wH4L @zD − 56 z C@7D wH5L @zD + C@7D wH7L @zD 0, 7 z H−2776 + 1575 z3 L C@8D w@zD − 38748 z2 C@8D w @zD − 4 H−1485 + 3229 z3 L C@8D w @zD + 7896 z C@8D wH3L @zD + 1974 z2 C@8D wH4L @zD − 252 C@8D wH5L @zD − 84 z C@8D wH6L @zD + C@8D wH8L @zD 0, 256 H−155 + 1152 z3 L C@9D w@zD + 256 z H−925 + 576 z3 L C@9D w @zD − 236160 z2 C@9D w @zD − 20 H−1095 + 2624 z3 L C@9D wH3L @zD + 21840 z C@9D wH4L @zD + 4368 z2 C@9D wH5L @zD − 420 C@9D wH6L @zD − 120 z C@9D wH7L @zD + C@9D wH9L @zD 0, −243 z2 H−13084 + 3675 z3 L C@10D w@zD + 44 H−11870 + 96111 z3 L C@10D w @zD + 11 z H−141740 + 96111 z3 L C@10D w @zD − 1036860 z2 C@10D wH3L @zD − 110 H−600 + 1571 z3 L C@10D wH4L @zD + 52668 z C@10D wH5L @zD + 8778 z2 C@10D wH6L @zD −
The Classical Special Functions
1370
660 C@10D wH7L @zD − 165 z C@10D wH8L @zD + C@10D wH10L @zD 0, −1280 z H−12731 + 28800 z3 L C@11D w@zD − 256 z2 H−190111 + 57600 z3 L C@11D w @zD + 264 H−13995 + 122624 z3 L C@11D w @zD + 176 z H−41795 + 30656 z3 L C@11D wH3L @zD − 3669600 z2 C@11D wH4L @zD − 220 H−783 + 2224 z3 L C@11D wH5L @zD + 114576 z C@11D wH6L @zD + 16368 z2 C@11D wH7L @zD − 990 C@11D wH8L @zD − 220 z C@11D wH9L @zD + C@11D wH11L @zD 0
AiryAi[z]^pow[[1]], Derivative[n_][w][z] -> D[AiryAi[z]^pow[[1]], {z, n}]}]], %] Out[4]= 8True, True, True, True, True, True, True, True, True, True
-y}; In[3]:= Shallow[approx, 8]
5 85085 H−Power@2DL9ê2 5391411025 H−Power@2DL15ê2 i j Out[3]//Shallow= j− H−Power@2DL3ê2 − − − 663552 k 48 1267709431363375 H−Power@2DL21ê2 z π 2 y3ê2 y z CosA + E + 84537841287168 4 3 {
6115295232
2562040760785380875 5849680962125 37182145 385 π 2 y3ê2 J1 + − + − N SinA + E 32462531054272512 y12 1761205026816 y9 127401984 y6 4608 y3 4 3
The resulting expression has the form as sinHp ê 4 + 2 ê 3 y3ê2 L - ac cosHp ê 4 + 2 ê 3 y3ê2 L. We extract the coefficients of the two trigonometric functions. In[4]:= {sinCoeff, cosCoeff} = { Coefficient[#, Sin[Pi/4 + 2/3 y^(3/2)]],
-Coefficient[#, Cos[Pi/4 + 2/3 y^(3/2)]]}&[approx] 2562040760785380875 5849680962125 37182145 385 32462531054272512 y 1761205026816 y 127401984 y 4608 y
Out[4]= 91 + 9 + , 12 − 6 − 3 9ê2
15ê2
21ê2
1 5391411025 I− 1y M 1267709431363375 I− 1y M 5 1 3ê2 85085 I− y M J− N + + + = 48 y 663552 6115295232 84537841287168
Solutions
1371
The condition as sinHp ê 4 + 2 ê 3 y3ê2 L -ac cosHp ê 4 + 2 ê 3 y3ê2 L = 0 means tanHp ê 4 + 2 ê 3 y3ê2 L = ac ê as or p ê 4 + 2 ê 3 y3ê2 = arctanHac ê as L + k p, k = -1,-2,-3,… (by taking into account that AiHzL has only zeros for negative real z). The term ac ê as is small for large positive y, and we approximate it by its first series terms. In[5]:= shouldBeZero = Pi/4 + 2/3 y^(3/2) + k Pi -
Normal[Series[ArcTan[Cancel[cosCoeff/sinCoeff]], {y, Infinity, 18}]] 9ê2
Out[5]=
15ê2
21ê2
1 M 82825 I 1y M 1282031525 I 1y M π 5 1 3ê2 1105 I y + k π − J N + − + + 4 48 y 9216 98304 88080384 27ê2
33ê2
1 138827178967109332375 I 1y M 1207576545674309483743375 I M 2 y3ê2 y − + 14023813415445725184 78982117155790324236288 3
Now, we have a relation of the form f Hy, kL = 0, which we would like to solve for y = yHcL. We carry out this inversion by first changing variables from y to x via y = H3 ê 2 xL2ê3 and then inverting the resulting series for dk = -3 Hk p + p ê 4L ê 2 ( = 3 ê 8 p H4 k - 1L, k = 1, 2, …). We suppress the k-dependence of d in the following. In[6]:= shouldBeZero = shouldBeZero //.
{y -> (3/2 x)^(2/3), Pi/4 + k Pi -> -2/3 d} // PowerExpand 2d 1207576545674309483743375 3 6831760306541400667717632 x 138827178967109332375 1282031525 82825 1105 5 + − + − + x 539122498937926189056 x9 1504935936 x7 746496 x5 31104 x3 72 x
Out[6]= − − 11 +
In[7]:= inv = InverseSeries[Series[shouldBeZero + 2/3 d,
{x, Infinity, 6}]] /. {x -> - 2/3 d} 3 5 i i 1 y 1 y 1255 j z 272075 j z j− z j− z 2 d 2 d 7 1 5 k { k { 3 + 3 + OA− 1 Out[7]= − 1 + 72 2 d E 31104 2239488 − H−2 dL 2d 3 3 3
Now, changing back from x to the original variable z, and writing the resulting expression in descending powers of d, we finally have the following result. In[8]:= z = -((Factor[Normal[(3/2 inv)^(2/3)]] // PowerExpand) //. {(-1)^(1/3) -> -1})
77125 − 11520 d2 + 8640 d4 + 82944 d6 82944 d
Out[8]= − 16ê3 In[9]:= (* to avoid reordering of the sum in Plus *)
(HoldForm @@ {Sort[List @@ Expand[-z/d^(2/3)], Exponent[#1, d] > Exponent[#2, d]&]}) /. List[l__] :> -d^(2/3) Plus[l] 5 5 77125 Out[10]= −d2ê3 J1 + 2 − 4 + N 48 d 36 d 82944 d6
Now we can put all of the above steps together to calculate some more terms of the zeros. In[11]:= res =
Module[{z, y, x, ser, approx, sinCoeff, cosCoeff, shouldBeZero, inv, k, ord = 26}, (* the series *) ser = Series[AiryAi[z], {z, -Infinity, ord}]; approx = ((ser // Normal) Sqrt[Pi] (-z)^(1/4)) /. {z -> -y}; (* coefficients of sin and cos *) {sinCoeff, cosCoeff} = { Coefficient[#, Sin[Pi/4 + 2/3 y^(3/2)]], -Coefficient[#, Cos[Pi/4 + 2/3 y^(3/2)]]}&[approx]; (* the expression that has to vanish *) shouldBeZero = Pi/4 + 2/3 y^(3/2) + k Pi Normal[Series[ArcTan[Cancel[cosCoeff/sinCoeff]], {y, Infinity, ord}]]; shouldBeZero = PowerExpand[shouldBeZero //. {y -> (3/2 x)^(2/3), Pi/4 + k Pi -> 2/3 d}]; (* invert series *) inv = InverseSeries[Series[shouldBeZero - 2/3 d, {x, Infinity, ord}]] /. {x -> 2/3 d}; z = Factor[Normal[(3/2 inv)^(2/3)]] // PowerExpand; (* some cosmetic refinements for a better look *) (HoldForm @@ {Sort[ DeleteCases[List @@ Expand[z/d^(2/3)], _ d^(_?(# < -10&))], Exponent[#1, d] > Exponent[#2, d]&]}) /. List[l__] :> -d^(2/3) Plus[l]]
The Classical Special Functions
1372
This result agrees with [3], 10.4.105 and [1023]. Let us have a brief look at the quality of the derived series. Here are the exact zeros of AiHzL, starting at the approximations just calculated. exactZeros = Table[FindRoot[AiryAi[ζ] == 0, Evaluate[{ζ, ReleaseHold[res] /. (* rename k --> i *) {d -> 3Pi/8 (4i - 1)}}], WorkingPrecision -> 30, AccuracyGoal -> 20][[1, 2]], {i, 8}]
We collect in tab the partial sums for the various orders of res. tab = -d^(2/3) Rest[ FoldList[Plus, 0, Table[d^i Coefficient[res[[1, 3]], d, i], {i, 0, -10, -2}]]];
Here are the differences between the approximations and the exact zeros for the first eight zeros. TableForm[N[Table[N[(tab /. {d -> 3Pi/8 (4i - 1)}) exactZeros[[i]], 20], {i, 8}], 1]]
For a derivation of such expansions using the Lagrange–Bürmann theorem, see [445]. For the zeta function of the Airy zeros, see [182]. c) This is the map-Airy distribution. In[1]:= p[x_] := 2 Exp[-2/3 x^3] (x AiryAi[x^2] - AiryAiPrime[x^2])
A direct call to Series does not succeed in giving the asymptotic. In[2]:= Series[p[x], {x, Infinity, 1}] 3 2 x − 3
Out[2]=
2 i 2 yi j 1 2z j j j− 3 j E z j j− 1 + OA zj j x z j k x {k
Ix2 M
3ê2
1 "####### i 2 j z 1 3ê2 y j j z − x! + OA E z + − 3 j z j z j 2 è!!!! x z π k {
Ix2 M
3ê2
"####### i 1 j zy z 1 5ê2 y j z j z z − x! + OA E z j z z j z j 2 è!!!! x zz z π k {{
Substituting the series expansions for the Airy functions gives the expansions 2 è!!!! - ÅÅ4ÅÅÅ x3 pHxL øö ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ x e 3 xض è!!!! p 7 1 pHxL øøö ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ!Å . è!!!! è!!!!!! xØ-¶ 48 p x5 In[3]:= p[x] /. ({AiryAi[x_] -> Normal[Series[AiryAi[ξ], {ξ, Infinity, 1}]],
3 2 x − 3
Out[3]= 2
AiryAiPrime[x_] -> Normal[Series[AiryAiPrime[ξ], {ξ, Infinity, 1}]]} /. ξ -> x) 5ê4 1ê4 7ê4 1 1 1 i − 2 Ix2 M3ê2 j i y i H y z y 3ê2 j 2 7 H L L 5 H L 1 j x2 z x2 x2 z j j z + − 3 Ix2 M j z xz 3 j j j − j j z j z z è!!!!! z è!!!! ! − è!!!!! z 1ê4 è!!!!! j− j− z j z z z 1 96 π 2 π 96 π L k k 2 π H { k { { x2
In[4]:= Simplify[%, x > 0] 4 x3
Out[4]=
3 H1 + 48 x3 L − è!!!!! 24 π x5ê2
In[5]:= p[-x] /. ({AiryAi[x_] -> Normal[Series[AiryAi[ξ], {ξ, Infinity, 2}]],
2 x3
Out[5]= 2 3
AiryAiPrime[x_] -> Normal[Series[AiryAiPrime[ξ], {ξ, Infinity, 2}]]} /. ξ -> x) 5ê4 1ê4 7ê4 1 1 1 i − 2 Ix2 M3ê2 j i y i H y z y 3ê2 j 2 7 H L L 5 H L 1 j x2 z x2 x2 z j j− z − − 3 Ix2 M j z xz j j j − j− 3 j z j z z z è!!!!! z è!!!! ! − è!!!!! z 1ê4 è!!!!! 1 96 π 96 π { { L k k 2 π H { k 2 π x2
In[6]:= Simplify[%, x > 0] Out[6]=
1 è!!!!! 4 π x5ê2
Now, let us calculate the cumulative distribution function. When dealing with complicated expressions in special functions, it is often of advantage to have the argument of the special functions as simple as possible. So we introduce a second distribution HxL = pHxL ê H2 x1ê2 L. (The denominator arises from the change of variables.) In[7]:= [y_] = p[Sqrt[y]]/(2 Sqrt[y]);
Solutions
1373 x
Mathematica can calculate the indefinite integral needed for the cumulative distribution function PHxL = Ÿ-¶ pHxL dx. In[8]:= (int = Integrate[[y], y]) // TraditionalForm 3ê2
5 4 5 7 4 y3ê2 , ÅÅÅÅ ; ÅÅÅÅ , ÅÅÅÅ ; - ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ N y2 2 F2 J ÅÅÅÅ 6 3 3 3 3 3 ! è!!!! 4
4y 2 2 F2 J ÅÅ76ÅÅ , ÅÅ53ÅÅ ; ÅÅÅÅ73 , ÅÅÅÅ83 ; - ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ N y5ê2 3
Out[8]//TraditionalForm= - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + 5
15 32ê3 GI ÅÅÅÅ3 M
6
1 2 1 5 4 y3ê2 , ÅÅÅÅ ; - ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ N y 2 F2 J ÅÅ6ÅÅ , ÅÅ3ÅÅ ; ÅÅÅÅ 3 3 3 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 32ê3 GI ÅÅÅÅ3 M
+
3 GI ÅÅÅÅ M 3
4 y3ê2 è!!!!! 2 2 F2 J- ÅÅ16ÅÅ , ÅÅ13ÅÅ ; - ÅÅÅÅ13 , ÅÅÅÅ43 ; - ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ N y 3 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 3 è!!!!! 1
3 GI ÅÅ3ÅÅ M
In[9]:= cdf[x_] = PowerExpand[int /. y -> x^2];
Here is the proof of the correctness of cdf as the indefinite integral. In[10]:= FullSimplify[D[cdf[x], x] - p[x]] Out[10]= 0
A plot shows that we must fix the integration constant to have a nonzero value. In[11]:= ListPlot[Table[{x, cdf[x]}, {x, -2.8, 2.8, 5.6/30}],
PlotJoined -> True, Frame -> True] 0.6 0.4 0.2 0 -0.2 -2
-1
0
1
2
Using the asymptotics of the hypergeometric functions 2F2 , we find that the integration constant needed is 1 ê 3. In[12]:= cdfAsymp =
cdf[x] /. HypergeometricPFQ[{a1_, a2_}, {b1_, b2_}, z_] -> With[{Γ = Times @@ Gamma[{##}]&}, E^z z^(a1 + a2 - b1 - b2) Γ[b1, b2]/Γ[a1, a2] + (-z)^-a1 Γ[a2 - a1, b1, b2]/Γ[a2, b1 - a1, b2 - a1] + (-z)^-a2 Γ[a1 - a2, b1, b2]/Γ[a1, b1 - a2, b2 - a2]];
In[13]:= FullSimplify[cdfAsymp, x > 0] 4 x3
Out[13]=
3 2 − − è!!!!! 3 2 π x3ê2
So we have for PHxL the following result. 1 2x 1 4 4 x3 y x2 4 x3 y i 1 1 i1 2 1 5 pHxL = ÅÅÅÅÅÅ + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 2 F2 jj- ÅÅÅÅÅ , ÅÅÅÅÅ ; - ÅÅÅÅÅÅ , ÅÅÅÅÅÅ ; - ÅÅÅÅÅÅÅÅÅÅÅÅÅ zz + ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅ2ÅÅÅÅÅÅ 2 F2 jj ÅÅÅÅÅÅ , ÅÅÅÅÅÅ ; ÅÅÅÅÅÅ , ÅÅÅÅÅÅ ; - ÅÅÅÅÅÅÅÅÅÅ ÅÅÅ zz 3 è!!!! 3 3 3 3 { 32ê3 GH ÅÅÅÅ L 3 { k 6 3 k6 3 3 3 3 GH ÅÅ13ÅÅ L 3 x4 4 x3 y 2 x5 4 x3 y i5 4 5 7 i7 5 7 8 ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Å 2 F2 jj ÅÅÅÅÅÅ , ÅÅÅÅÅÅ ; ÅÅÅÅÅÅ , ÅÅÅÅÅÅ ; - ÅÅÅÅÅÅÅÅÅÅ ÅÅÅ zz - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ5ÅÅÅÅÅÅÅ 2 F2 jj ÅÅÅÅÅ , ÅÅÅÅÅ ; ÅÅÅÅÅÅ , ÅÅÅÅÅÅ ; - ÅÅÅÅÅÅÅÅÅÅÅÅÅ zz 3 è!!!! 4 2ê3 6 3 3 3 3 6 3 3 3 3 { k k { 15 3 GH ÅÅÅÅ3 L 6 3 GH ÅÅÅÅ3 L ¶
The first moment Ÿ-¶ x pHxL dx is 0. This follows immediately from the corresponding indefinite integral and the asymptotics of the Airy functions. In[14]:= intM1y = Integrate[[y] Sqrt[y], y] // FullSimplify
The Classical Special Functions
1374
Out[14]=
35ê6 Gamma@ 43 D − 2π 3ê2 2 y 1 1 y3 i y AiryAiPrime@yD − 27 31ê3 Hypergeometric0F1RegularizedA− 3 j − , E + j27 27 3 9 k 7 y3 y 32ê3 y4 Hypergeometric0F1RegularizedA , Ez z 3 9 {
In[15]:= intM1 = PowerExpand[intM1y /. y -> x^2] Out[15]=
35ê6 Gamma@ 43 D − 2π 3 2 x 1 1 x6 i j x2 AiryAiPrime@x2 D − 27 31ê3 Hypergeometric0F1RegularizedA− 3 j27 − , E + 27 3 9 k 7 x6 z y 2ê3 8 3 x Hypergeometric0F1RegularizedA , Ez 3 9 {
In[16]:= D[intM1, x] - x p[x] // FullSimplify
1 27 3 3 2 x i 4 x6 i j2 − 3 j x7 j j−9 Hypergeometric0F1RegularizedA , E + 12 Hypergeometric0F1RegularizedA 3 9 k k 7 x6 10 x6 zy z , E + x6 Hypergeometric0F1RegularizedA , Ey zz 3 9 3 9 {{
Out[16]= − 1ê3
In[17]:= Simplify[intM1 /. ({AiryAi[x_] ->
Out[17]=
Normal[Series[AiryAi[ξ], {ξ, Infinity, 1}]]} /. ξ -> x), x > 0] 35ê6 Gamma@ 43 D − 2π 3 2 x i 1 1 x6 j x2 AiryAiPrime@x2 D − 27 31ê3 Hypergeometric0F1RegularizedA− 3 − , E + j27 27 3 9 k 7 x6 y 2ê3 8 3 x Hypergeometric0F1RegularizedA , Ez z 3 9 {
In[18]:= Simplify[intM1 /. ({AiryAi[x_] ->
Normal[Series[AiryAi[ξ], {ξ, -Infinity, 1}]]} /. ξ -> x), x < 0] 35ê6 Gamma@ 43 D Out[18]= − 2π 3 2 x 1 − 1 x6 i x2 AiryAiPrime@x2 D − 27 31ê3 Hypergeometric0F1RegularizedA− 3 j , E + j27 27 3 9 k 6 7 x y 32ê3 x8 Hypergeometric0F1RegularizedA , Ez z 3 9 { ¶
Because of the asymptotics of pHxL at -¶, the second moment Ÿ-¶ x2 pHxL dx does not exist. In[19]:= intM2 = PowerExpand[(Integrate[[y] y, y] // FullSimplify) /. y -> x^2] Out[19]=
3 31ê6 Gamma@ 53 D + 4π 3 2 x 1 − 2 x6 i x4 AiryAi@x2 D + 27 32ê3 Hypergeometric0F1RegularizedA− 3 j , E − j27 54 3 9 k 6 8 x y 31ê3 x10 Hypergeometric0F1RegularizedA , Ez z 3 9 {
In[20]:= D[intM2, x] - x^2 p[x] // FullSimplify Out[20]= 0 ¶
The integral Ÿ0 x2 pHxL dx evaluates to 1 ê H31ê3 GH1 ê 3LL. In[21]:= (intM2[[2]]) - (intM2 /. x -> 0)
Solutions
1375 32ê3 2 Gamma@− 3 D
3 31ê6 Gamma@ 5 D 4π
3 + Out[21]= − 2 − 3 2 x 1 2 x6 i j 3 − j27 x4 AiryAi@x2 D + 27 32ê3 Hypergeometric0F1RegularizedA− , E − 54 3 9 k 8 x6 z y 1ê3 10 3 x Hypergeometric0F1RegularizedA , Ez 3 9 {
23. Differential Equation for Dedekind h Function, Darboux–Halphen System a) To find the differential equation for hHzL, we will make polynomial ansatz for p in the form pHhHzL, h£ HzL, h≥ HzL, h£££ HzL, h££££HzLL =
4
‚ i0 ,i1 ,i2 ,i3 ,i4 =1
ci0 i1 i2 i3 i4 hHzLi0 h£ HzLi1 h≥ HzLi2 h£££ HzLi3 h££££HzLi4
and then we will substitute the first Fourier series terms of hHzL into this ansatz. As a result, we obtain a linear system for the ci0 i1 i2 i3 i4 that can be solved.
pÂz To avoid unnecessary multiplications, we will consider hHzL as a series in X = expH ÅÅÅÅ ÅÅÅÅÅÅ L and use SeriesData as the data 12 structures to manipulate. The function ηSeries[n] produces a power series of order n in X.
In[1]:= ηSeries[n_] := X Product[1 - X^(24 k), {k, 1, n/24 + 1}] + O[X]^n
The series is a very sparse one. Only 11 terms out of the first 1000 powers possible are nonvanishing. In[2]:= ηSeries[1000] Out[2]= X − X25 − X49 + X121 + X169 − X289 − X361 + X529 + X625 − X841 − X961 + O@XD1000 pÂz To calculate the differentiated functions h£ HzL, h≥ HzL, h£££ HzL, and h££££ HzL, we backsubstitute X ö expH ÅÅÅÅ ÅÅÅÅÅÅ L. 12
In[3]:= expηSeries[n_] := Normal[ηSeries[n]] /. X -> Exp[Pi I z/12];
Here are the first few even terms of the Fourier series of hHzL. In[4]:= expηSeries[500]
πz
25 π z
49 π z
121 π z
169 π z
289 π z
361 π z
12 + 12 − 12 − 12 Out[4]= 12 − 12 − 12 +
The function dηSeries[d][n] implements the d-times differentiated series for hHzL of order n and express all terms through X. In[5]:= dηSeries[d_][n_] := dηSeries[d][n] = (D[expηSeries[n], {z, d}] /.
Exp[exp_] -> X^(12 exp/(I Pi z))) + O[X]^(n - d) In[6]:= dηSeries[2][300]
π2 X 144
625 π2 X25 144
2401 π2 X49 144
14641 π2 X121 144
28561 π2 X169 144
83521 π2 X289 144
Out[6]= − + + − − + + O@XD298
Let us substitute our differentiated expressions into the ansatz for the differential equation. As we will see later, taking the first six nonvanishing terms of the series into account will generate enough terms to solve uniquely for all coefficients ci0 i1 i2 i3 i4 . In[7]:= o
= 300; ansatz = Sum[If[i0 + i1 + i2 + i3 > 4, 0, (* the terms *) c[i0, i1, i2, i3, i4] dηSeries[0][o]^i0 * dηSeries[1][o]^i1 dηSeries[2][o]^i2 * dηSeries[3][o]^i3 dηSeries[4][o]^i4], {i0, 0, 4}, {i1, 0, 4}, {i2, 0, 4}, {i3, 0, 4}, {i4, 0, 4}];
Equating the coefficients of the powers of X to zero gives us 96 nontrivial equations. In[9]:= (eqs1 = DeleteCases[CoefficientList[Normal[ansatz], X], 0, {1}]) // Length Out[9]= 96
On the other hand, we have 350 unknowns ci0 i1 i2 i3 i4 . In[10]:= (vars = Cases[eqs1, _c, Infinity] // Union) // Length
The Classical Special Functions
1376 Out[10]= 350
Because in the process of differentiation p appeared in various powers, the resulting equations eqs1 also contain p in various powers. Here, this is exemplified in the 11th equation. In[11]:= eqs1[[11]]
390625 π8 c@0, 0, 0, 0, 2D 203125 π7 c@0, 0, 0, 1, 1D 15625 π6 c@0, 0, 0, 2, 0D 214990848 17915904 1492992 195625 π6 c@0, 0, 1, 0, 1D 8125 π5 c@0, 0, 1, 1, 0D 625 π4 c@0, 0, 2, 0, 0D − − − 1492992 124416 10368 195325 π5 c@0, 1, 0, 0, 1D 7825 π4 c@0, 1, 0, 1, 0D 325 3 − + π c@0, 1, 1, 0, 0D + 124416 10368 864 25 2 195313 π4 c@1, 0, 0, 0, 1D 7813 π c@0, 2, 0, 0, 0D − + π3 c@1, 0, 0, 1, 0D + 72 10368 864 313 13 π2 c@1, 0, 1, 0, 0D − π c@1, 1, 0, 0, 0D − 2 c@2, 0, 0, 0, 0D 72 6
Out[11]= − + + +
Assuming that the powers of p are linear independent, we equate the coefficients of all powers of p for all equations. This gives us many more nontrivial equations, namely, 1246. In[12]:= (eqs2 = DeleteCases[Flatten[CoefficientList[#, pi]& /@
(eqs1 /. Pi -> pi)], 0]) // Length Out[12]= 1246
Solving these 1246 equations gives the following result (for space reasons, we display only the nonzero solutions). In[13]:= sol = Solve[# == 0& /@ eqs2, vars];
DeleteCases[sol, _c -> 0, {2}] Solve::svars : Equations may not give solutions for all "solve" variables. More… Out[14]= 88c@0, 4, 0, 0, 0D → −18 c@3, 0, 0, 0, 1D, c@0, 4, 0, 0, 1D → −18 c@3, 0, 0, 0, 2D,
c@0, c@1, c@1, c@2, c@2, c@2, c@2,
4, 2, 2, 0, 0, 1, 1,
0, 1, 1, 2, 2, 0, 0,
0, 0, 0, 0, 0, 1, 1,
2D 0D 2D 0D 2D 0D 2D
→ −18 c@3, 0, 0, 0, 3D, c@0, 4, 0, 0, 3D → −18 c@3, 0, 0, 0, 4D, → 12 c@3, 0, 0, 0, 1D, c@1, 2, 1, 0, 1D → 12 c@3, 0, 0, 0, 2D, → 12 c@3, 0, 0, 0, 3D, c@1, 2, 1, 0, 3D → 12 c@3, 0, 0, 0, 4D, → 33 c@3, 0, 0, 0, 1D, c@2, 0, 2, 0, 1D → 33 c@3, 0, 0, 0, 2D, → 33 c@3, 0, 0, 0, 3D, c@2, 0, 2, 0, 3D → 33 c@3, 0, 0, 0, 4D, → −28 c@3, 0, 0, 0, 1D, c@2, 1, 0, 1, 1D → −28 c@3, 0, 0, 0, 2D, → −28 c@3, 0, 0, 0, 3D, c@2, 1, 0, 1, 3D → −28 c@3, 0, 0, 0, 4D
N[ηD[0][z0, ∂0], prec], Derivative[k_][η][z] -> N[ηD[k][z0, ∂0], prec]}] // N[#, 22]& In[22]:= quickCheck[2/3 + 3/4 I, 10^-100, 500] Out[22]= 89.333661071319466658021, 0. × 10−100 + 0. × 10−100 < In[23]:= quickCheck[7/11 + 13/9 I, 10^-100, 500] Out[23]= 80.07422974187168967869175, 0. × 10−101 + 0. × 10−101
dηSeries[0][o], Derivative[k_][η][z] -> dηSeries[k][o]}] Out[24]= O@XD999
Note that introducing a new function uHzL = h£ HzL ê hHzL allows us to reduce the order of the differential equation by one and gives the following nice differential equation uH3L HzL - 24 uHzL u££ HzL + 36 u£ HzL2 = 0. In[25]:= Factor[ode2 //. Derivative[k_][η][z] :> D[u[z] η[z], {z, k - 1}]] Out[25]= η@zD4 H−36 u @zD2 + 24 u@zD u @zD − uH3L @zDL
b) We start by defining the three solutions w1 , w2 , and w3 . In[1]:= λ[τ_] = InverseEllipticNomeQ[Exp[I Pi τ]];
w1[τ_] = 1/2 D[Log[λ'[τ]/λ[τ]], τ]; w2[τ_] = 1/2 D[Log[λ'[τ]/(λ[τ] - 1)], τ]; w3[τ_] = 1/2 D[Log[λ'[τ]/(λ[τ](λ[τ] - 1))], τ];
Although InverseEllipticNomeQ is a complicated modular function, Mathematica can find the derivative of EllipticNomeQ. In[5]:= InverseEllipticNomeQ'[q] Out[5]= H2 EllipticK@InverseEllipticNomeQ@qDD2
H−1 + InverseEllipticNomeQ@qDL InverseEllipticNomeQ@qDL ê Hπ q H−EllipticE@1 − InverseEllipticNomeQ@qDD EllipticK@InverseEllipticNomeQ@qDD + EllipticK@1 − InverseEllipticNomeQ@qDD H−EllipticE@InverseEllipticNomeQ@qDD + EllipticK@InverseEllipticNomeQ@qDDLLL
InverseEllipticNomeQ is the inverse of the function EllipticNomeQ. So to calculate qH-1L £ we use the following identity. In[6]:= InverseFunction[f]' Out[6]=
1 & f @fH−1L @#1DD
The function EllipticNomeQ can be expressed through complete elliptic integrals. In[7]:= eq = EllipticNomeQ[m] // FunctionExpand π EllipticK@1−mD − EllipticK@mD
Out[7]=
The Classical Special Functions
1378
The differentiation of the complete elliptic integrals is straightforward. Replacing expH-p KH1 - mL ê KHmLL by qHmL, substituting qH-1L HqL for m, and using qHqH-1L HzLL = z, we arrive at the following derivative. In[8]:= 1/D[eq, m] /.
Exp[Pi EllipticK[1 - m]/EllipticK[m]] -> 1/EllipticNomeQ[m] /. m -> InverseEllipticNomeQ[q] /. EllipticNomeQ[InverseEllipticNomeQ[q]] -> q // Simplify Out[8]= −H2 EllipticK@InverseEllipticNomeQ@qDD2 H−1 + InverseEllipticNomeQ@qDL InverseEllipticNomeQ@qDL ê Hπ q HEllipticE@InverseEllipticNomeQ@qDD EllipticK@1 − InverseEllipticNomeQ@qDD + HEllipticE@1 − InverseEllipticNomeQ@qDD − EllipticK@1 − InverseEllipticNomeQ@qDDL EllipticK@InverseEllipticNomeQ@qDDLL
This result agrees with the built-in derivative. In[9]:= % - InverseEllipticNomeQ'[q] // Together Out[9]= 0
The actual proof that w1 , w2 , and w3 are solutions is straightforward. We evaluate the derivatives of the wi HtL and writing the result over a common denominator yields the desired 0. In[10]:= {D[w1[τ], τ] - (w1[τ](w2[τ] + w3[τ]) - w2[τ] w3[τ]),
D[w2[τ], τ] - (w2[τ](w1[τ] + w3[τ]) - w1[τ] w3[τ]), D[w2[τ], τ] - (w2[τ](w1[τ] + w3[τ]) - w1[τ] w3[τ])} // Together Out[10]= 80, 0, 0
3000, WorkingPrecision -> 5000]; Abs[s1 - t1] < 10^-2000]
Now, we carry out the actual search for the triples 8 p, q, r z {
b) This is the definition of ln . In[1]:= λ[n_] := (DedekindEta[(1 + I Sqrt[n/3])/2]/
DedekindEta[(1 + I Sqrt[3*n])/2])^6/(3 Sqrt[3])
We will again use the package NumberTheory`Recognize` to calculate an algebraic number of degree d that is near to ln . In[2]:= Needs["NumberTheory`Recognize`"] In[3]:= nearestRoot[λ_, d_] :=
Module[{poly = Recognize[λ, d, C], s}, (* all roots of best polynomial *) s = C /. {ToRules[Roots[poly == 0, C]]}; (* select nearest root *) s[[Position[#, Min[#]]&[Abs[s - λ]][[1, 1]]]]]
By iteratively raising the degree, the function λAlg finds an algebraic number that agrees with ln to at least 5000 digits. In[4]:= λAlg[n_, wp_] :=
Module[{k = 1, λN = Re[N[λ[n], wp]], , δ}, While[(* best possible root *) = nearestRoot[λN, 8 k]; (* high-precision check *) δ = N[ - λ[n], 5000]; δ != 0, (* raise precision *)k++]; ]
Using now sufficient precision for the numericalization of λ[n], the following algebraic values can be calculated in seconds. In[5]:= Off[N::meprec];
λAlg[1, 100] Out[6]= 1 In[7]:= λAlg[2, 100]
Solutions
1381 è!!!!! è!!!!! Out[7]= $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% −264 + 153 3 + "############################################################ 2 I69961 − 40392 3 M# In[8]:= λAlg[3, 100]
è!!!!! Out[8]= "###################################### 3 I−3 + 2 3 M# In[9]:= λAlg[4, 100]
3 2
1 2
è!!!!!
Out[9]= &''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' −18550 + 15147 $%%%%%%%% + 45 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I679753 − 277508 6 M ' In[10]:= λAlg[5, 100] Out[10]=
1 è!!!!! I1 + 5 M 2
In[11]:= λAlg[6, 100]
è!!!!!
è!!!!!
Out[11]= 3 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 J−17918 + 12670 2 + 5 "######################################################################### 3 I8561499 − 6053894 2 M N In[12]:= λAlg[7, 100]
è!!!!! è!!!!! Out[12]= $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% −135 + 52 7 + 6 "############################################ 6 I172 − 65 7 M# In[13]:= λAlg[8, 200] Out[13]=
,
Root@1 + 30248592 #1 − 188475440 #12 + 42675408 #13 − 953184234 #14 + 42675408 #15 − 188475440 #16 + 30248592 #17 + #18 &, 4D
In[14]:= λAlg[9, 200] Out[14]= 3 In[15]:= λAlg[10, 200] Out[15]=
,
Root@1 + 340904160 #1 − 3585031924 #12 − 7530593760 #13 + 22278443046 #14 − 7530593760 #15 − 3585031924 #16 + 340904160 #17 + #18 &, 8D
Now let us look for the values of n, such that ln is an algebraic number of degree four or less. In[16]:= simpleλ[n_, (* maximal degree *) d_, wp_] :=
Module[{λN = Re[N[λ[n], wp]], poly, s, , δ}, poly = Recognize[λN, d, C]; (* small coefficients? *) If[Max[Abs[CoefficientList[poly, C]]] < 10^10, s = C /. {ToRules[Roots[poly == 0, C]]}; = s[[Position[#, Min[#]]&[Abs[s - λN]][[1, 1]]]]; (* high-precision check *) δ = N[ - λ[n], 2000]; If[δ == 0, , {}], {}]] In[17]:= DeleteCases[Table[Subscript[λ, n] ==
simpleλ[n, 4, 100], {n, 100}], _ == {}] // TableForm // TraditionalForm Out[17]//TraditionalForm=
l1 1 è!!!!! l3 "################################### 3 I-3 + 2 3 M# è!!!! ! l5 ÅÅÅÅ12 I1 + 5 M l9 3 è!!!!!!!!!
è!!!!!!!!!
13 23 7 13 % l13 ÅÅ74ÅÅ + ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ + ÅÅ12ÅÅ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ÅÅÅÅ ÅÅÅ + ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ ÅÅÅ 4 2 2
l17 4 +
è!!!!!!! 17 è!!!!!!!!!
è!!!!!!!!!
3 21 171 39 21 % l21 ÅÅ94ÅÅ + ÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅ + ÅÅÅÅ12 $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ÅÅÅÅ ÅÅ ÅÅÅ + ÅÅÅÅÅÅÅÅ ÅÅÅÅ ÅÅÅÅÅÅÅÅ 4 2 2
The Classical Special Functions
1382 è!!!!! 5 è!!!!!!! 3 I6 + 33 M è!!!!!!! 32 + 5 41 è!!!!!!! 55 + 12 21 è!!!!!!! "########################################### è!!!!!!! 45 + 6 57 + 6 I687 + 91 57 M
l25 9 + 4 l33 l41 l49 l57
l65 72 + 9
è!!!!!!! è!!!!!!! 65 + 4 "########################################### 5 I129 + 16 65 M
"######################################### è!!!!!!! è!!!!!!! # 73 + 4 1555 + 182 73 3 ! è!!!! 3 I75 + 52 3 + 36 32ê3 M è!!!!!!! 500 + 53 89 è!!!!!!! è!!!!!!! 364 + 37 97 + 2 "###################################################### 2 I33161 + 3367 97 M#
l73 112 + 13 l81 l89 l97
25. Identities for Gamma Function Values, Identities for Dedekind h Function a) We start by generating all identities for a given denominator n. To generate a closed set of equations, we generate equations also for the divisors of n. We use Γ for the Gamma functions to avoid numerical equality tests (this would slow down all calculations considerably). The cscHp k ê nL can be transformed into algebraic numbers later by using FunctionExpand. In[1]:= allIΓdentities[n_] :=
Module[{t1, t2, divs = Rest[Divisors[n]]}, (* the equations following from the functional identities *) t1 = Table[Γ[k/n] Γ[1 - k/n] - Pi Csc[Pi k/n], {k, 1, n - 1}]; t2 = Flatten[Function[ν, Function[z, Γ[ν z] - ν^(ν z - 1/2) (2Pi)^((1 - ν)/2)* Product[Γ[z + k/ν], {k, 0, ν - 1}]] /@ (1/divs)] /@ divs]; (* evaluate integer and half-integer values and canonicalize arguments *) Flatten[{t1, t2}] /. Γ -> Gamma /. Gamma -> Γ /. cscRule /. gammaRule]
We reduce the number of cosecants and the Gamma functions with arguments greater than 1 with the following two rules. In[2]:= cscRule = Csc[z_] :> Csc[Pi - z] /; z > Pi/2;
gammaRule = Γ[z_?(# > 1&)] :> (z - 1) Γ[z - 1];
For n = 5, we obtain the following set of three equations. In[4]:= Γ5Eqs = allIΓdentities[5]
2 5− 5
1 5
4 5
2 5+ 5
2 5
3 5
Out[4]= 9−2 $%%%%%%%%%%%%%%%%%%%%%%% ! π + ΓA E ΓA E, −2 $%%%%%%%%%%%%%%%%%%%%%% ! % π + ΓA E ΓA E, è!!!! è!!!!
è!!!!! 2 3 4 5 Γ@ 15 D Γ@ D Γ@ D Γ@ D 2 2 3 2 1 4 5 5 5 = −2 $%%%%%%%%%%%%%%%%%%%%%%% ! π + ΓA E ΓA E, −2 $%%%%%%%%%%%%%%%%%%%%%% ! % π + ΓA E ΓA E, 1 − è!!!! è!!!! 2 5 5 5 5 4 π 5+ 5 5− 5
Now, we divide all Gamma values occurring in the identities in two classes: the ones we want to keep and the ones we want to eliminate. Given a set of equations eqs, the function ΓsToEliminate returns a list of the Gamma values to eliminate. In[5]:= ΓsToEliminate[eqs_, ΓsToKeep_] :=
Complement[Union[Cases[eqs, _Γ, Infinity]], ΓsToKeep]
The function step will eliminate one (randomly chosen) Gamma value from eqs. It will try to keep the Gamma values from GsToKeep and return a reduced set of equations. For a fast execution, we deal only with Gamma values that appear linearly in the equations. (For the nonlinear case, we could use the more time-consuming GroebnerBasis command.) In[6]:= step[eqs_, ΓsToKeep_] :=
Module[{remainingGammas, exponents, posis, nextΓ, eqNumber, eqsNew}, remainingGammas = ΓsToEliminate[eqs, ΓsToKeep]; (* look for Gamma values that appear linearly *) exponents = Exponent[eqs, #]& /@ remainingGammas; posis = Position[exponents, 1, {2}]; If[posis =!= {}, (* select a Gamma value to eliminate *) = Random[Integer, {1, Length[posis]}];
Solutions
1383 {nextΓ, eqNumber} = posis[[]]; eqsNew = Union[DeleteCases[Numerator[Together[ eqs /. Solve[eqs[[eqNumber]] == 0, remainingGammas[[nextΓ]]][[1]]]], 0]]; (* remove pure trig identities in csc[…] *) eqsNew = DeleteCases[eqsNew, _?(FreeQ[#, Γ]&)]; eqsNew = Factor[eqsNew]; eqsNew = If[MatchQ[#, _ _Γ], 0, #]& /@ eqsNew; eqsNew = Replace[#, _?NumericQ p_Plus -> p]& /@ eqsNew; eqsNew = Union[DeleteCases[eqsNew, 0]], eqs]]
Keeping Γ[1/5], Γ[4/5] in Γ5Eqs, we obtain the following (trivial) identities. In[7]:= step[Γ5Eqs, {Γ[1/5], Γ[4/5]}]
2 5− 5
1 5
4 5
10 5+ 5
1 5
4 5
Out[7]= 9−2 $%%%%%%%%%%%%%%%%%%%%%%% ! π + ΓA E ΓA E, 2 π − $%%%%%%%%%%%%%%%%%%%%%%% ! ΓA E ΓA E= è!!!! è!!!!
After the repeated application of step, we might be ending up with identities of the form we are looking for. The function makeGammaRatioIdentity determines if this is the case and formats the result nicely. In[8]:= makeGammaRatioIdentity[expr_] :=
Module[{aux1 = Expand[expr], aux2, aux3, aux4, aux5, α, β, A}, If[Head[aux1] === Plus, aux2 = List @@ aux1; aux3 = DeleteCases[Union[#/(# /. _Γ -> 1)& /@ aux2], 1]; If[Length[aux3] === 2 && (* different Gamma values? *) ((Numerator[#] =!= 1 && Denominator[#] =!= 1)&[aux3[[1]]/aux3[[2]]]), {α, β} = aux3; aux4 = aux1 /. {aux3[[1]] -> A}; aux5 = Cancel[Solve[aux4 == 0, A][[1, 1, 2]]/β]; α/β == aux5]]]
To generate identities randomly, we implement a function randomPermutation that mixes the lists of Gamma values, so that we keep a random set of them. In[9]:= randomPermutation[l_List] :=
Module[{lTemp = l, j, λ = Length[l]}, Do[j = Random[Integer, {i, λ}]; {lTemp[[i]], lTemp[[j]]} = {lTemp[[j]], lTemp[[i]]}, {i, λ}]; lTemp]
Now, we have everything together to implement the function randomIdentity that tries to generate a random identity of Gamma functions of the form wanted. In[10]:= randomIdentity[n_] :=
Module[{eqs = allIΓdentities[n], allΓs, Γs}, allΓs = Union[Cases[eqs, _Γ, Infinity]]; (* the Gamma values to keep; make a random choice *) Γs = Γ /@ Take[randomPermutation[allΓs], {Random[Integer, {2, Min[6, Length[allΓs]]}]}]; (* apply step until all unwanted Gamma values are eliminated *) FixedPoint[step[#, Γs]&, eqs, Length[allΓs] + 5]]
For a given seed seed of the random number generator, the function γId will return the identities for Gamma values found. In[11]:= γId[seed_] :=
(SeedRandom[seed]; Union[DeleteCases[makeGammaRatioIdentity /@ randomIdentity[Random[Integer, {5, 48}]], Null], SameTest -> (First[#1] === First[#2]&)])
With a proper seed, we can obtain many identities of the form we were looking for. In[12]:= γId[90938315823026141192] 2
5 Γ@ D
è!!!!! è!!!!! 33ê4 H− 2 + 6 L 4π
12 Out[12]= 9 = 2 2 1 Γ@ D 4
2 Γ@ D 3
The Classical Special Functions
1384 In[13]:= γId[52339558529598473094] 2
π 4π 2π 31ê10 51ê6 Csc@ D Csc@ D Sin@ D
2
2
1 4 Γ@ D Γ@ D
5 15 15 15 15 = Out[13]= 9 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! 2 2 è!!!!! 2 1 Γ@ D Γ@ D 15 3
2
2 H5 +
5L
As remarked above, using FunctionExpand, we can convert the trigonometric expressions in nested radicals. In[14]:= FunctionExpand[%] // FunctionExpand // Simplify 1 4 Γ@ D Γ@ D
è!!!!! 1ê10 1ê6 è!!!!! è!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!! 2 3 5 I 3 + 15 − 10 − 2 5 M
2 Γ@ D 15
2
2
2
5 15 Out[14]= 9 è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! = 2 2 è!!!!!!!! è!!!!! ! è!!!! ! 1 Γ@ D 3
10 + 3
3 H5 +
5L −
15 H5 +
5L
The right-hand side of the following identity autoevaluates to radicals. In[15]:= γId[72121807168444733700]
è!!!!! 3 2 31ê4 H−3 + 3 L π
2
1 Γ@ D
12 Out[15]= 9 è!!!! ! = 2 2 − 1 1 Γ@ D Γ@ D 4 3
Here are some more examples of such identities. In[16]:= γId[8382603719166208017] 4
2
2
2
4
2
2
3 17 7 11 41 15 Γ@ D Γ@ D Γ@ D Γ@ 5 D Γ@ D Γ@ D Γ@ D
16 48 16 8 16 48 16 Out[16]= 9 2 2 23 Γ@ D 48
47 Γ@ D 48
1 3 3ê4 7 π 2 7π 2 3π 4 5π 4 17 π 2 3π 2 7π 2 J N π CscA E CscA E CscA E CscA E CscA E CscA E CscA E = 512 2 16 48 16 16 48 8 16 In[17]:= γId[31354816994988410858] π 11 π 2 25ê6 Sin@ D Sin@ D
2
2 Γ@ D
3 24 Out[17]= 9 24 = 1 2 11 2 23 2 31ê4 π2
Γ@ D Γ@ D Γ@ D 4 24 24
In[18]:= γId[50618374844506072572] 2
Γ@ 1 D
3
è!!!!! 1ê4 è!!!!! 2 3 − 2 2 33ê4 6 H−3 + 3 L π
3 Out[18]= 9 2 = è!!!! ! 2 1 3 Γ@ D Γ@ D 12 4
In[19]:= γId[88395267401272261046] 13 π π 33ê5 55ê6 Csc@ D Sin@ D
2
13 Γ@ D
30 30 30 = Out[19]= 9 è!!!!! 2 2 2 − 1 Γ@ D 6
3 Γ@ D 10
2 H−5 +
29 Γ@ D 30
5 L π2
In[20]:= γId[38487837109080339099] 2
2
Γ@ 2 D Γ@ 8 D
2
è!!!!! è!!!!! 4π 2 2 H−1 + 3 L Sin@ D 3 π
9 9 9 = Out[20]= 9 2 2 2 7ê12 1 Γ@ D 4
4 Γ@ D 9
11 Γ@ D 12
In[21]:= γId[80171190622502344844]
è!!!!!!!!!!!!!!!!!!! è!!!!! ! 9π 7π 5 − 5 Csc@ D Sin@ D
2
1 Γ@ D
5 20 20 = Out[21]= 9 2 1 13 2 4 23ê10 53ê4 π
Γ@ D Γ@ D 20 20
In[22]:= γId[24115537869945002262] 2
2π 7π 17 π 31ê12 Csc@ D Sin@ D Sin@ D
2
2
5 Γ@ 1 D Γ@ D
2
2
4 12 9 36 36 , Out[22]= 9 è!!!!! 2 2 2 4 4 1 Γ@ D 9
5 Γ@ D 36
13 Γ@ D 36
17 Γ@ D 36
2 Γ@ 14 D 1 2 13 2 17 2 29 2 Γ@ D Γ@ D Γ@ D Γ@ D 9 36 36 36
29 Γ@ D 36
4
21ê6
H3 +
3L
π5
5π 2π 2 7π 17 π Csc@ D Csc@ D Sin@ D Sin@ D 36 9 36 36 = 8 22ê3 31ê4 π3
In[23]:= γId[7221486915064620684] 2
4
2
3 19 Γ@ D Γ@ 2 D Γ@ D
16 23ê5 H−3 +
è!!!!! π 9π 2 11 π 2 5 L π Sin@ D2 Sin@ D Sin@ D
10 5 40 40 40 40 = Out[23]= 9 è!!!!! 2 2 2 1 11 31 Γ@ D Γ@ D Γ@ D 40 40 40
−5 +
5
Using the following program, we could now automatically search for Gamma identities.
Solutions
1385
Make Input
Module[{ΓBag, rand, n, res, res1, finalRes}, ΓBag = {}; Do[(* a random seed *) rand = Random[Integer, {1, 10^20}]; SeedRandom[rand]; n = Random[Integer, {5, 48}]; (* do not waste too much time on one example *) res = TimeConstrained[randomIdentity[n], 100]; If[res =!= {} && res =!= $Aborted, res1 = Cases[makeGammaRatioIdentity /@ res, _Equal]; (* print not already encountered identities *) If[res1 =!= {}, finalRes = Select[res1, (FreeQ[ΓBag, #[[1]]] && FreeQ[ΓBag, 1/#[[1]]])&]; If[finalRes =!= {}, ΓBag = Flatten[{ΓBag, First /@ finalRes}]; (* potentially write right-hand sides as algebraic numbers and powers of p: finalRes = Union[TimeConstrained[finalRes // FunctionExpand // RootReduce // ToRadicals, 300]]; *) Print[{rand, n, finalRes}]]]], (* many trials *) {10^5}]]
For similar calculations, see [1271]. b) A quick look at the examples shows two features: a) all polynomials P are homogeneous b) the coefficients ci are the divisors of the largest of the ci . So we will look for identities of the form PHhHc1 tL, …, hHcn tLL = 0 with these three properties. To find such polynomials P we will implement the following strategy: Given a positive integer cmax we form all monomials (so called h-products [522], [159], [413], [521], [984]) hHc1 tLe1 ∫ hHcn tLen with 0 § ek § s , e1 + ∫ + en = s (s being a fixed positive integer) and the ck are divisors of cmax . The fractional part of the Puiseux expansions of the monomials allow to naturally group the list of exponents 8ek q^(c/24) (1 - q^(c k))
ΠToη[expr_] := PowerExpand[expr /. (1 - q^(c_. k)) :> Exp[-c 2 Pi I τ/24] η[c τ] /. q :> Exp[2 Pi I τ]]
Here is an example. In[3]:= ηToΠ[η[3τ]^3 η[5τ]^4] 3
4
Out[3]= q29ê24 H1 − q3 k L H1 − q5 k L In[4]:= ΠToη[%] Out[4]= η@3 τD3 η@5 τD4
The Classical Special Functions
1386
The next step is the generation of all exponent lists 8ek