16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Richard H. Enns<br />

George C. McGuire<br />

<strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong><br />

An Advanced Guide to<br />

Scientific Modeling


Richard H. Enns<br />

Simon Fraser University<br />

Department of Physics<br />

Burnaby, B.C. V5A 1S6<br />

Canada<br />

renns@sfu.ca<br />

Cover design by Mary Burgess.<br />

Library of Congress Control Number: 2006936017<br />

ISBN-10: 0-387-25768-3 e-ISBN-10: 0-387-49333-6<br />

ISBN-13: 978-387-25768-6 e-ISBN-13: 978-0-387-49333-6<br />

Printed on acid-free paper.<br />

George C. McGuire<br />

University College of Fraser Valley<br />

Department of Physics<br />

Abbotsford, BC V2S 7M9<br />

Canada<br />

george.mcguire@ucfv.ca<br />

c○2007 Springer Science+Business Media, LLC<br />

All rights reserved. This work may not be translated or copied in whole or in part without the written<br />

permission of the publisher (Springer Science+Business Media LLC, 233 Spring Street, New York,<br />

NY 10013, USA) and the author, except for brief excerpts in connection with reviews or scholarly<br />

analysis. Use in connection with any form of information storage and retrieval, electronic adaptation,<br />

computer software, or by similar or dissimilar methodology now known or hereafter developed is<br />

forbidden.<br />

The use in this publication of trade names, trademarks, service marks and similar terms, even if they<br />

are not identified as such, is not to be taken as an expression of opinion as to whether or not they are<br />

subject to proprietary rights.<br />

987654321<br />

springer.com (EB)


PREFACE<br />

A computer algebra system (CAS) not only has the number \crunching" and<br />

plotting capability of traditional computing languages such as Fortran and C,<br />

but also allows one to perform the symbolic manipulations and derivations<br />

required in most mathematically based science and engineering courses. To<br />

introduce students in these disciplines to CAS-based mathematical modeling<br />

and computation, the authors have previously developed and classroom tested<br />

the text <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong>: A Gourmet's Guide to the Mathematical<br />

Models of Science [EM01] based on the Maple CAS. Judging by course evaluations<br />

and reader feedback, the response to this book and the computer algebra<br />

approach to modeling has been very favorable. With the release of several new<br />

versions of Maple since this text was published and the authors' accumulation<br />

of many insightful comments and helpful suggestions, a second up-dated edition<br />

seemed expedient. However, incorporating all the changes would make<br />

an already lengthy book even longer. So the topics of the Gourmet's Guide<br />

have been reorganized into two new stand-alone volumes, an already-published<br />

Introductory Guide [EM06] and this Advanced Guide.<br />

In this book, we explore mathematical models involving linear and nonlinear<br />

ordinary and partial di®erential equations (ODEs and PDEs). This volume,<br />

which may be used either as a course text or for self-study, features an eclectic<br />

collection of Maple computer algebra worksheets, or \recipes," that are systematically<br />

organized to illustrate graphical, analytical, and numerical techniques<br />

applied to ODE/PDE-based scienti¯c modeling. No prior knowledge of Maple<br />

is assumed, the early recipes introducing the reader to the basic Maple syntax,<br />

the subsequent recipes introducing further Maple commands and structure on<br />

a need-to-know basis.<br />

The recipes are fully annotated in the text and in most cases presented as<br />

\stories" or in a historical context. Each recipe typically takes the reader from<br />

the analytic formulation of an interesting mathematical model to its analytic<br />

or numerical solution and ¯nally to either a static or animated graphical visualization<br />

of the answer. Every recipe is followed by a set of problems that can<br />

be used to check one's understanding or develop the topic further. For your<br />

convenience, the recipes are included on a CD located in the inside back cover.<br />

v


Contents<br />

PREFACE v<br />

INTRODUCTION 1<br />

A. <strong>Computer</strong> <strong>Algebra</strong> Systems . . . . . . . . . . . . . . . . . . . . . . 1<br />

B. <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong> . . . . . . . . . . . . . . . . . . . . . . . 2<br />

C. Introductory Recipe: Boys Will Be Boys . . . . . . . . . . . . . . . 3<br />

D. Maple Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />

E. How to Use This Text . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

I THE APPETIZERS 11<br />

1 Phase-Plane Portraits 13<br />

1.1 Phase-Plane Portraits . . . . . . . . . . . . . . . . . . . . . . . . 13<br />

1.1.1 Romeo and Juliet . . . . . . . . . . . . . . . . . . . . . . . 18<br />

1.1.2 There's No Damping Vectoria's Romantic Heart . . . . . 23<br />

1.1.3 Van der Pol's Limit Cycle . . . . . . . . . . . . . . . . . . 28<br />

1.2 Three-Dimensional Autonomous Systems . . . . . . . . . . . . . 32<br />

1.2.1 The Period-Doubling Route to Chaos . . . . . . . . . . . 33<br />

1.2.2 The Oregonator . . . . . . . . . . . . . . . . . . . . . . . 40<br />

1.2.3 RÄossler's Strange Attractor . . . . . . . . . . . . . . . . . 44<br />

2 Phase-Plane Analysis 47<br />

2.1 Phase-Plane Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 47<br />

2.1.1 Foxes Munch Rabbits . . . . . . . . . . . . . . . . . . . . 51<br />

2.1.2 The Mona Lisa of Nonlinear Science . . . . . . . . . . . . 58<br />

2.1.3 Mike Creates a Higher-Order Fixed Point . . . . . . . . . 67<br />

2.1.4 The Gnus and Sung of Erehwon . . . . . . . . . . . . . . 73<br />

2.1.5 A Plethora of Points . . . . . . . . . . . . . . . . . . . . . 78<br />

2.2 Three-Dimensional Autonomous Systems . . . . . . . . . . . . . 82<br />

2.2.1 Lorenz's Butter°y . . . . . . . . . . . . . . . . . . . . . . 82<br />

2.3 Numerical Solution of ODEs . . . . . . . . . . . . . . . . . . . . . 88<br />

vii


viii CONTENTS<br />

2.3.1 Finite Di®erence Approximations . . . . . . . . . . . . . . 89<br />

2.3.2 Rabbits and Foxes: The Sequel . . . . . . . . . . . . . . . 91<br />

2.3.3 Glycolytic Oscillator . . . . . . . . . . . . . . . . . . . . . 96<br />

2.3.4 Fox Rabies Epidemic . . . . . . . . . . . . . . . . . . . . . 101<br />

II THE ENTREES 107<br />

3 Linear ODE Models 109<br />

3.1 First-Order Models . . . . . . . . . . . . . . . . . . . . . . . . . . 110<br />

3.1.1 How's Your Blood Pressure? . . . . . . . . . . . . . . . . 110<br />

3.1.2 Greg Arious Nerd's Problem . . . . . . . . . . . . . . . . 115<br />

3.2 Second-Order Models . . . . . . . . . . . . . . . . . . . . . . . . . 118<br />

3.2.1 Daniel Encounters Resistance . . . . . . . . . . . . . . . . 118<br />

3.2.2 Meet Mr. Laplace . . . . . . . . . . . . . . . . . . . . . . 121<br />

3.2.3 Jennifer's Formidable Series . . . . . . . . . . . . . . . . . 126<br />

3.3 Special Function Models . . . . . . . . . . . . . . . . . . . . . . . 130<br />

3.3.1 Jennifer Introduces a Special Family . . . . . . . . . . . . 131<br />

3.3.2 The Vibrating Bungee Cord . . . . . . . . . . . . . . . . . 137<br />

3.3.3 Mathieu's Spring . . . . . . . . . . . . . . . . . . . . . . . 142<br />

3.3.4 Quantum-Mechanical Tunneling . . . . . . . . . . . . . . 144<br />

4 Nonlinear ODE Models 149<br />

4.1 First-Order Models . . . . . . . . . . . . . . . . . . . . . . . . . . 150<br />

4.1.1 An Irreversible Reaction . . . . . . . . . . . . . . . . . . . 150<br />

4.1.2 The Struggle for Existence . . . . . . . . . . . . . . . . . 152<br />

4.1.3 The Bad Bird Equation . . . . . . . . . . . . . . . . . . . 161<br />

4.2 Second-Order Models . . . . . . . . . . . . . . . . . . . . . . . . . 164<br />

4.2.1 Patches Gives Chase . . . . . . . . . . . . . . . . . . . . . 164<br />

4.2.2 Oh What Sounds We Hear! . . . . . . . . . . . . . . . . . 168<br />

4.2.3 Vectoria Feels the Force and Hits the Bottle . . . . . . . . 175<br />

4.2.4 Golf Is Such an \Uplifting" Experience . . . . . . . . . . 179<br />

4.3 Variational Calculus Models . . . . . . . . . . . . . . . . . . . . . 185<br />

4.3.1 Dress Design, the Erehwonese Way . . . . . . . . . . . . . 185<br />

4.3.2 Queen Dido Wasn't a Dodo . . . . . . . . . . . . . . . . . 191<br />

4.3.3 The Human Fly Plans His Escape Route . . . . . . . . . . 195<br />

4.3.4 This Would Be a Great Amusement Park Ride . . . . . . 201<br />

5 Linear PDE Models. Part 1 207<br />

5.1 Checking Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . 207<br />

5.1.1 The Palace of the Governors . . . . . . . . . . . . . . . . 207<br />

5.1.2 Play It, Sam . . . . . . . . . . . . . . . . . . . . . . . . . 211<br />

5.1.3 Three Easy Pieces . . . . . . . . . . . . . . . . . . . . . . 215<br />

5.1.4 Complex, Yet Simple . . . . . . . . . . . . . . . . . . . . . 220<br />

5.2 Di®usion and Laplace's Equation Models . . . . . . . . . . . . . . 223


CONTENTS ix<br />

5.2.1 Freeing Excalibur . . . . . . . . . . . . . . . . . . . . . . . 223<br />

5.2.2 Aussie Barbecue . . . . . . . . . . . . . . . . . . . . . . . 227<br />

5.2.3 Benny's Solution . . . . . . . . . . . . . . . . . . . . . . . 231<br />

5.2.4 Hugo and the Atomic Bomb . . . . . . . . . . . . . . . . . 236<br />

5.2.5 Hugo Prepares for His Job Interview . . . . . . . . . . . . 241<br />

6 Linear PDE Models. Part 2 247<br />

6.1 Wave Equation Models . . . . . . . . . . . . . . . . . . . . . . . . 247<br />

6.1.1 Vectoria Encounters Simon Legree . . . . . . . . . . . . . 247<br />

6.1.2 Homer's Jiggle Test . . . . . . . . . . . . . . . . . . . . . 251<br />

6.1.3 Vectoria's Second Problem . . . . . . . . . . . . . . . . . 254<br />

6.1.4 Sound of Music? . . . . . . . . . . . . . . . . . . . . . . . 257<br />

6.2 Semi-in¯nite and In¯nite Domains . . . . . . . . . . . . . . . . . 261<br />

6.2.1 Vectoria's Fourth Problem . . . . . . . . . . . . . . . . . . 261<br />

6.2.2 Assignment Complete! . . . . . . . . . . . . . . . . . . . . 263<br />

6.2.3 Radioactive Contamination . . . . . . . . . . . . . . . . . 266<br />

6.2.4 \Play It, Sam" Revisited . . . . . . . . . . . . . . . . . . 270<br />

6.3 Numerical Simulation of PDEs . . . . . . . . . . . . . . . . . . . 274<br />

6.3.1 Freeing Excalibur the Numerical Way . . . . . . . . . . . 275<br />

6.3.2 Enjoy the Klein{Gordon Vibes . . . . . . . . . . . . . . . 278<br />

6.3.3 Vectoria's Secret . . . . . . . . . . . . . . . . . . . . . . . 281<br />

III THE DESSERTS 285<br />

7 The Hunt for Solitons 287<br />

7.1 The Graphical Hunt for Solitons . . . . . . . . . . . . . . . . . . 290<br />

7.1.1 Of Kinks and Antikinks . . . . . . . . . . . . . . . . . . . 290<br />

7.1.2 In Search of Bright Solitons . . . . . . . . . . . . . . . . . 293<br />

7.1.3 Can Three Solitons Live Together? . . . . . . . . . . . . . 296<br />

7.2 Analytic Soliton Solutions . . . . . . . . . . . . . . . . . . . . . . 299<br />

7.2.1 Follow That Wave! . . . . . . . . . . . . . . . . . . . . . . 300<br />

7.2.2 Looking for a Kinky Solution . . . . . . . . . . . . . . . . 304<br />

7.2.3 We Have Solitons! . . . . . . . . . . . . . . . . . . . . . . 306<br />

7.3 Simulating Soliton Collisions . . . . . . . . . . . . . . . . . . . . 308<br />

7.3.1 To Be or Not to Be a Soliton . . . . . . . . . . . . . . . . 308<br />

7.3.2 Are Diamonds a Kink's Best Friend? . . . . . . . . . . . . 312<br />

8 Nonlinear Diagnostic Tools 319<br />

8.1 The Poincare Section . . . . . . . . . . . . . . . . . . . . . . . . . 319<br />

8.1.1 A Rattler Signals Chaos . . . . . . . . . . . . . . . . . . . 320<br />

8.1.2 Hamiltonian Chaos . . . . . . . . . . . . . . . . . . . . . . 323<br />

8.2 The Power Spectrum . . . . . . . . . . . . . . . . . . . . . . . . . 329<br />

8.2.1 Frank N. Stein's Heartbeat . . . . . . . . . . . . . . . . . 332<br />

8.2.2 The Rattler Returns . . . . . . . . . . . . . . . . . . . . . 334


x CONTENTS<br />

8.3 The Bifurcation Diagram . . . . . . . . . . . . . . . . . . . . . . 337<br />

8.3.1 Pitchforks and Other Bifurcations . . . . . . . . . . . . . 338<br />

8.4 The Lyapunov Exponent . . . . . . . . . . . . . . . . . . . . . . . 342<br />

8.4.1 Mr. Lyapunov Agrees . . . . . . . . . . . . . . . . . . . . 343<br />

8.5 Reconstructing an Attractor . . . . . . . . . . . . . . . . . . . . . 345<br />

8.5.1 Putting Humpty Dumpty Together Again . . . . . . . . . 346<br />

8.5.2 Random Is Random . . . . . . . . . . . . . . . . . . . . . 349<br />

8.5.3 Butter°y Reconstruction . . . . . . . . . . . . . . . . . . . 351<br />

Epilogue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353<br />

Bibliography 355<br />

Index 361


INTRODUCTION<br />

A. <strong>Computer</strong> <strong>Algebra</strong> Systems<br />

Man is still the most extraordinary computer of all.<br />

John F. Kennedy, former American president. Speech, 21 May 1963.<br />

Unlike traditional programming languages such as Fortran and C, a computer<br />

algebra language such as Maple allows one to compute not only with numbers,<br />

but also with symbols, formulas, equations, and so on. Using a computer<br />

algebra system (CAS), symbolic computation can be done on the computer, replacing<br />

the traditional pen-and-paper approach with the keyboard/mouse and<br />

computer display. By entering short, simple, transparent commands on the<br />

computer keyboard (which will be referred to as the \classic" approach), or by<br />

selecting mathematical symbols from a palette with the mouse, the CAS user<br />

can quickly and accurately generate symbolic input and output on the computer<br />

screen. Mathematical operations such as di®erentiation, integration, and<br />

series expansion of functions can be done analytically on the computer.<br />

Because it also has numerical capability, a CAS allows the student or the<br />

researcher to tackle all aspects of mathematical modeling, from analytic derivation<br />

and manipulation of the model equations to the analytic or numerical<br />

solution of those equations, to the plotting or animation of the results. One of<br />

the most powerful computer algebra systems currently available is Maple 10,<br />

which will be used in this text. Useful reference books to this CAS are the<br />

Maple user manual [Map05] and the introductory and advanced programming<br />

guides [MGH + 05].<br />

In the two volumes of <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong>, we present classic Maple<br />

worksheets, or \recipes," that demonstrate how a CAS can serve as a valuable<br />

adjunct tool in easily deriving, solving, plotting, and exploring interesting,<br />

modern scienti¯c models chosen from a wide variety of disciplines ranging from<br />

the physical and biological sciences to the social sciences and engineering. The<br />

present book is the second volume and concentrates on mathematically more<br />

advanced models involving linear and nonlinear ordinary and partial di®erential<br />

equations (ODEs and PDEs). The classic Maple worksheet interface, which<br />

requires less computer memory than the standard interface, is used to generate<br />

all the mathematical and graphical output shown in this text.<br />

1


2 INTRODUCTION<br />

B. <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong><br />

The mathematics is not there till we put it there.<br />

Sir Arthur Eddington, The Philosophy of Physical Science, 1939<br />

The ODE and PDE recipes in our computer algebra \menu" have been organized<br />

into three sections of increasing mathematical sophistication. The Appetizers<br />

illustrate phase-plane portraits and analysis, the Entrees deal with<br />

linear and nonlinear ODEs and linear PDEs, and the Desserts feature the<br />

hunt for solitons and some nonlinear diagnostic tools. The recipes are intended<br />

to ful¯ll not only a useful and serious pedagogical purpose but also to titillate<br />

and stimulate the reader's intellect and imagination. Associated with each<br />

recipe is an important scienti¯c model or method and usually some historical<br />

background or an interesting story featuring an engineering or science student<br />

who will guide you through the steps of the recipe. These storybook characters<br />

are ¯ctitious composites of some of the more likeable, industrious, and brighter<br />

students that the authors have had the privilege of teaching over the years.<br />

Every topic or story in the text contains the Maple code or recipe to explore<br />

that particular topic. To make life easier for you, all recipes have been placed<br />

on the CD-ROM enclosed within the back cover of this text. The recipes are<br />

ordered according to the chapter, section, and subsection (story) number. For<br />

example, the recipe 01-2-3, entitled RÄossler's Strange Attractor, is associated<br />

with Chapter 1, Section 2, Subsection 3. Although the recipes can be directly<br />

accessed on the CD by clicking on the appropriate worksheet number, it is<br />

recommended that you access them through the menu index ¯le, 00menu.<br />

All recipes may be conveniently accessed from this menu using the hyperlinks.<br />

Complete instructions on how to do this may be found in the menu ¯le.<br />

The computer code on the CD is unannotated, so you will have to read the<br />

text in order to understand what the code is trying to accomplish. The code has<br />

been imported into the text and here is accompanied by detailed explanations<br />

of the underlying modeling concepts and computational methods.<br />

The recommended procedure for using this text is ¯rst to read a given<br />

topic/story for overall comprehension and enjoyment. If you are having any<br />

di±culty in understanding a piece of the text code, then you should execute<br />

the corresponding Maple worksheet and try variations on the code. Keep in<br />

mind that the same objective may often be achieved by a di®erent combination<br />

of Maple commands from those used by the authors. After reading the topic,<br />

you should execute the worksheet (if you have not already done so) to make<br />

sure the code works as expected. At this point feel free to explore the topic.<br />

Try rotating any three-dimensional graphs or running any animations in the<br />

¯le. See what happens when changes in the model or Maple code are made and<br />

then try to interpret any new results. This book is intended to be open-ended<br />

and merely serve as a guide to what is possible in mathematical modeling using<br />

a CAS, the possibilities being limited only by your own background and desires.<br />

Each topic or story is self-contained and generally done completely, from


INTRODUCTORY RECIPE 3<br />

the derivation to the solution to the plot and accompanied by a thorough discussion<br />

of the steps and results. Since arriving at the answer is more important<br />

in our opinion than the method used, one will encounter recipes in which analytic<br />

derivation of the model equations occurs, followed by a numerical solution<br />

because an analytic solution doesn't exist. Although brief introductions, which<br />

generally include some de¯nitions of terminology and short explanations of underlying<br />

concepts, are given for each main topic area, this text is not intended<br />

to teach you everything that you want to know, for example, about methods of<br />

solving ODEs or PDEs. Neither is it intended to teach you about the myriad<br />

subject areas of science or engineering. Instead, it is meant to serve as a guide<br />

to how these topics and areas can be handled using a CAS. However, this book<br />

is not just any ordinary guide. It is a gourmet's guide! It presupposes that the<br />

reader has learned or is about to learn about various scienti¯c models and/or<br />

methods, and we are providing the computer algebra tools to enable you to<br />

solve complex scienti¯c problems more easily, to attain greater understanding,<br />

and to explore the frontiers of science that interest you.<br />

At the end of most recipe subsections, there are related problems where you,<br />

the reader, can check your mastery of the scienti¯c computation and computer<br />

algebra techniques presented in the recipes. The problems also allow you to<br />

explore new frontiers and challenge you to invent and solve \What happens if<br />

:::?" problems. The purpose of this text is not only to teach computer-assisted<br />

computational techniques useful to engineering and science students, but to<br />

whet the student's curiosity and put some fun back into the pursuit of a science<br />

education. For maximum satisfaction and learning, it demands an interactive<br />

approach by the reader. Although the stories were designed to be interesting<br />

or amusing to read, the Maple recipes must be run, the models explored, and<br />

the problems solved. Some things never change in the learning process!<br />

C. Introductory Recipe: Boys Will Be Boys<br />

Giving money and power to government is like giving<br />

whiskey and car keys to teenage boys.<br />

P. J. O'Rourke, American journalist (1947{)<br />

To give you some idea of what a typical computer algebra recipe looks like<br />

and to introduce some basic Maple syntax, consider the problem that follows.<br />

The recipe that solves this problem is not on the CD, so after reading this section<br />

you should open up classic Maple 10 on your computer, type in the recipe,<br />

and execute it.<br />

Richard's grandson Daniel throws a small ball with an initial speed of 15<br />

m/s towards a 3:5-meter-high fence located 20 meters from the ball's initial<br />

position. The ball leaves Daniel's hand at a height of 2 m above the level<br />

ground and just clears the top of the fence. The gravitational acceleration is<br />

g =9:8 m/s 2 . The ball may be regarded as a point particle and air resistance<br />

neglected.


4 INTRODUCTION<br />

(a) At what angle Á with the horizontal is the ball thrown?<br />

(b) How long does it take the ball to reach the fence?<br />

(c) Plot the entire trajectory, then animate the motion of the ball, including<br />

the fence in the animation.<br />

Let's choose the origin to be on the ground below the initial position of the<br />

ball and take the x-coordinate to be horizontal and the y-coordinate vertical.<br />

To begin the recipe, we ¯rst clear Maple's internal memory of any previously<br />

assigned values (other worksheets may be open with numerical values given to<br />

some of the same symbols being used in the present recipe). This is done by<br />

typing in the restart command after the opening prompt ( >) symbol, ending<br />

the command with a colon (:), and pressing Enter (which generates a new<br />

prompt symbol) on the computer keyboard.<br />

> restart:<br />

All Maple command lines must be ended with either a colon, which suppresses<br />

any output, or a semicolon (;), which allows the output to be viewed.<br />

Next, the given parameter values are speci¯ed. For example, the initial<br />

x-coordinate of the ball is entered, the symbolic name xb being placed to the<br />

left of the Maple assignment operator (:=). The numerical value (0) of the<br />

coordinate is placed on the right-hand side of the operator and the output<br />

suppressed here with a command-ending colon. Assigned quantities can be<br />

mathematically manipulated. In a similar manner, the numerical values of the<br />

ball's initial y-coordinate (yb), the horizontal location (xf) of the fence, the<br />

fence's height (yf), the initial speed (V) of the ball, and the magnitude of the<br />

gravitational acceleration (g) are entered. Because the command entries are<br />

short, we have chosen to place them all on the same prompt line, separating<br />

the entries by a space for reading clarity.<br />

> xb:=0: yb:=2: xf:=20: yf:=3.5: V:=15: g:=9.8:<br />

Using the symbol * for multiplication, we express the horizontal (vx) and vertical<br />

(vy) components of the ball's initial velocity in terms of the unknown angle<br />

Á. The Maple input syntax phi is used to generate the Greek letter Á in the<br />

output. Note that the assigned value (15) of V is automatically substituted.<br />

> vx:=V*cos(phi); vy:=V*sin(phi);<br />

vx := 15 cos(Á) vy := 15 sin(Á)<br />

Using the standard kinematic relations [Oha85], we calculate the ball's x and y<br />

coordinates at arbitrary time t. The symbols +, -, /, and^ are used for addition,<br />

subtraction, division, and exponentiation. Note that the decimal coe±cient of<br />

t 2 in the output is given to 10 digits, Maple's usual default accuracy.<br />

> x:=xb+vx*t; y:=yb+vy*t-(1/2)*g*t^2;<br />

x := 15 cos(Á) t y := 2 + 15 sin(Á) t ¡ 4:900000000 t 2<br />

Setting x=xf in the solve command, the time t = tf for the ball to reach the<br />

fence is determined in terms of Á.<br />

> tf:=solve(x=xf,t); #time to reach fence


INTRODUCTORY RECIPE 5<br />

tf := 4 1<br />

3 cos(Á)<br />

A comment, pre¯xed by the pound sign #, has been added to the command<br />

line. Short comments are useful for later reference or for others to read and<br />

understand the purpose of a Maple command. 1<br />

A transcendental equation eq for Á results on evaluating y at t = tf and<br />

equating the result to yf:<br />

> eq:=eval(y,t=tf)=yf;<br />

20 sin(Á) 8:711111111<br />

eq := 2 + ¡<br />

cos(Á) cos(Á) 2 =3:5<br />

The transcendental equation is solved for Á, the result being labeled ©.<br />

> Phi:=solve(eq,phi); #angles in radians<br />

©:=0:9917653601; 0:6538908144; ¡2:149827293; ¡2:487701839<br />

Four angles, expressed in radians, are generated in the above output ©, the<br />

default accuracy being 10 digits. Since the initial angle must be above the horizontal,<br />

only the positive answers are acceptable as solutions for this problem.<br />

Since there are two positive results, this means that Daniel could throw the ball<br />

at two di®erent angles to just clear the fence. To proceed, we shall select one of<br />

the positive answers, say the second one in ©. This is done by entering Phi[2].<br />

You can look at the ¯rst positive angle by changing this entry to Phi[1]. Ifdesired,<br />

the angle Á ¼ 0:65 radians can be converted to degrees using the convert<br />

command with units as the second argument.<br />

> phi:=Phi[2]; theta:=convert(phi,units,radian,degree);<br />

Á := 0:6538908144 μ := 37:46518392<br />

In this case, Daniel throws the ball at an angle μ ¼ 37 1 degrees to the horizontal.<br />

2<br />

It should be mentioned that the convert command is very useful for converting<br />

an expression from one form to another, the form of conversion being dictated<br />

by the choice of second argument. To see the types of conversions possible with<br />

Maple, click on the convert command in the worksheet, then on Help in the<br />

tool bar, and ¯nally on Helponconvert.<br />

Using the °oating-point evaluation command, evalf, we numerically evaluate<br />

the time to reach the fence, which is found to be about 1.68 seconds.<br />

> tf:=evalf(tf); #time to reach fence<br />

tf := 1:679846933<br />

To plot the entire trajectory, the time T for the ball to hit the ground must<br />

be determined. This is accomplished by setting y = 0 and solving for t, which<br />

produces two answers.<br />

> T:=solve(y=0,t);<br />

T := ¡0:1981184874; 2:060197767<br />

1 Longer or more detailed comments may be inserted into a worksheet by clicking on<br />

Insert in the tool bar at the top of the computer screen, then on Execution Group, on<br />

either Before Cursor or After Cursor, onText, and ¯nally typing in the comments.


6 INTRODUCTION<br />

The negative answer is the time at which the ball would have had to been<br />

thrown if it had started from ground level. The second answer is the relevant<br />

one here and is now selected. The ball hits the ground after 2.06 seconds.<br />

> T2:=T[2]; #time to hit ground<br />

T2 := 2:060197767<br />

The entire trajectory of the ball is now plotted using the plot command. The<br />

ball's horizontal and vertical coordinates must be entered as part of a Maple<br />

\list," the list entries being separated by commas and the entire list enclosed<br />

in square brackets. Maple preserves the order of items in a list. In the present<br />

case, the list entries are the x-coordinate, the y-coordinate, and the time range. 2<br />

If no optional arguments are speci¯ed in the plot command, a ¯gure will be<br />

generated in which Maple chooses its own horizontal and vertical scaling. Constrained<br />

scaling can be achieved by including the option scaling=constrained<br />

as an additional argument. 3<br />

On executing the plot command, we generate a computer plot similar to<br />

that reproduced in Figure 1, with y plotted vertically and x horizontally.<br />

> plot([x,y,t=0..T2],scaling=constrained);<br />

6<br />

4<br />

2<br />

0<br />

5 10 15 20 25<br />

Figure 1: Trajectory of the ball.<br />

Note that the horizontal and vertical axes are not labeled in the ¯gure. Axis<br />

labels can be added by including the option labels=["x(in m)","y(in m)"]<br />

in the plot command. Try it and see. 4<br />

If you wish to learn more about the plot command and its optional arguments,<br />

click the left mouse button on the plot command and then on Help<br />

at the top of the computer screen. Clicking on the entry Help on plot opens<br />

up a help page with information about this command structure. The various<br />

2 Thisisaparametric plot, because x and y depend parametrically on the time t.<br />

3 If this optional argument is omitted, constrained scaling can be achieved in another way.<br />

Click your left mouse button on the computer plot. This opens a tool bar at the top of the<br />

computer screen with various options. Clicking on Projection and then on Constrained<br />

produces a plot with constrained scaling.<br />

4 Thedoublequotesinthelabels option indicate a Maple \string," a sequence of characters<br />

that has no value other than itself. A string cannot be assigned to, and will always evaluate to,<br />

itself. Omit the double quotes and note what happens when the plot command is executed.


INTRODUCTORY RECIPE 7<br />

plotting options available can be found by clicking on the underlined hyperlink<br />

plot/details that appears on the help page, and then on plot[options]. Try<br />

including some other options in the plot command. For example, change the<br />

color of the ball's trajectory from the default red to, say, blue.<br />

The ¯nal part of the problem is to animate the trajectory of the ball with<br />

the vertical fence included. The fence is now plotted, but not displayed, being<br />

assigned the name fence. The coordinates of the bottom and the top of the<br />

fence are entered as Maple lists and then formed into another list, i.e., one has<br />

a \list of lists." The fence will be plotted as a vertical (default red) line.<br />

> fence:=plot([[xf,0],[xf,yf]]):<br />

To produce specialized plots, such as an animated one, we must access the plots<br />

library package. This is done by entering the command with(plots). The<br />

preface with always indicates a Maple library package is being \loaded" into<br />

the worksheet. Library packages are extremely important, since they contain<br />

approximately 90% of Maple's mathematical knowledge. Normally, we would<br />

end the command with a colon, but here a semicolon is used to see what plot<br />

commands are contained in the plots library. 5<br />

> with(plots);<br />

Warning, the name changecoords has been redefined<br />

[Interactive; animate; animate3d; animatecurve; arrow; changecoords;:::]<br />

The animate command, appearing in the above list, will be used to animate the<br />

motion of the ball. The syntax is animate(plot command,[plot arguments],<br />

time range,options). Thepointplot command will plot the ball as a point.<br />

The plot arguments symbol=circle and symbolsize=14 instruct Maple to plot<br />

the point as a size-14 circle. 6 Included in the plot arguments list are the ball's<br />

x- andy-coordinates given as a list of lists. The time range is t =0toT2 .In<br />

the options, the number7 of frames is taken to be 200, the frames being equally<br />

spaced in time. The option background=fence causes the fence to appear as<br />

background in each time frame. Finally, the scaling is constrained.<br />

> animate(pointplot,[[[x,y]],symbol=circle,symbolsize=14],<br />

t=0..T2,frames=200,background=fence,scaling=constrained);<br />

When the animate command line is executed on the computer, the initial frame<br />

of the animation will appear on the screen. Clicking on the picture with the left<br />

mouse button places the picture in a viewing box and opens up an animation bar<br />

at the top of the screen. The animation is started by clicking on the arrowhead<br />

( ¤ ) and stopped by clicking on the square ( 2 ).<br />

5 Only a partial list of plot commands is shown here in the text, as indicated by the dots.<br />

Note that a warning message is also produced that informs us that the name changecoords<br />

has been rede¯ned in the current release of Maple. If desired, warnings can be removed by<br />

inserting the command interface(warnlevel=0) prior to loading the library package. From<br />

now on, all such warnings will generally be arti¯cially removed in the text.<br />

6 The default symbol is a diamond and the default size is 10.<br />

7 The default number is 25 frames. 200 frames produces a smoother animation.


8 INTRODUCTION<br />

D. Maple Help<br />

We teachers can only help the work going on,<br />

as servants wait upon a master.<br />

Maria Montessori, Italian educator, The Absorbent Mind, 1949.<br />

We have already seen in the introductory recipe how Maple's Help can be used<br />

to learn more about the Maple commands that appear in the text recipes. If<br />

you wish to ¯nd out what other help is available, click on Help at the top of<br />

the computer screen and then on the entry Using Help. A help page opens<br />

with a number of hyperlinks that you should explore.<br />

Two of the more important hyperlinks are entitled Perform a Topic<br />

Search and Perform a Full Text Search. Here we shall give two simple examples<br />

of using these searches, leaving the full descriptions of the search types<br />

for you to read. It should be noted that neither type of search is case-sensitive.<br />

Our ¯rst example illustrates a topic search, which locates help based on<br />

a keyword that you specify. For example, suppose that you wanted the correct<br />

form of the command for taking a square root. Click on Help, thenon<br />

Topic Search, making sure that the Auto-search box is selected. Depending<br />

on the programming language used, the square root command could be sqr,<br />

sqrt, :::, ::: On typing the ¯rst couple of letters, sq, in the Topic box, Maple<br />

will display all the commands starting with sq. Double click on sqrt or, alternatively,<br />

single click on sqrt and then on OK. A description of the square root<br />

command will appear on the screen. You can then close the Help window and<br />

proceed with programming your recipe.<br />

The second example illustrates a full-text search. Suppose, for example,<br />

that you wish to ¯nd the command for analytically or numerically solving an<br />

ODE. In the Help window, click on Full Text Search. Then type ode in<br />

the Word(s) boxandclickonSearch. Double clicking on dsolve produces<br />

a description of the dsolve command for solving ODEs along with several<br />

examples. If, for example, you want to know how to ¯nd a numerical solution,<br />

click on the hyperlink dsolve,numeric.<br />

The approach employed in the introductory recipe may also be used to ¯nd<br />

information about unfamiliar mathematical functions that appear in the Maple<br />

output. If, for example, the output contained the word \EllipticF," you may<br />

¯nd out what this function is by clicking on the word to highlight it, then on<br />

Help, and ¯nally on Help on EllipticF. You will ¯nd that EllipticF refers to<br />

the incomplete elliptic integral of the ¯rst kind, which is de¯ned in the Help<br />

page. The same Help window may also be opened by typing in a question mark<br />

followed by the word and a semicolon, e.g., ?EllipticF;.<br />

Maple's Help is certainly not perfect, and on occasion you might feel frustrated,<br />

but generally it is helpful and should be consulted whenever you get<br />

stuck with Maple syntax or are seeking just the right command to accomplish<br />

a certain mathematical task.


HOW TO USE THIS TEXT 9<br />

E. How to Use This Text<br />

Begin at the beginning ... and go on till you come to the end.<br />

Lewis Carroll, Alice's Adventures in Wonderland (1865)<br />

The recommended procedure for most readers, particularly for someone who<br />

is new to CASs in general and to Maple in particular, is to follow the advice<br />

given by the king to the white rabbit in Alice's Adventures in Wonderland.<br />

Start with the Appetizers, thengoontotheEntrees, and ¯nish o® with<br />

the Desserts. In the early recipes of the Appetizers you will be introduced<br />

to more of the basic features of the Maple system and see further examples of<br />

Maple's Help. Keep in mind that although we have made every e®ort to keep<br />

this book self-contained, it is impossible for us to teach you everything you<br />

would wish to know about programming with the Maple CAS. After all, that<br />

it is not the primary purpose of this text. Further, the choice of Maple library<br />

packages and associated command structures is to some extent dictated by the<br />

choice of subject matter. Since the topics of <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong> have<br />

now been split between two volumes, you might wish to consult the Introductory<br />

Guide for use of library packages not emphasized in this Advanced Guide. And,<br />

at the risk of sounding immodest, the former volume also contains a wonderful<br />

selection of scienti¯c models.<br />

Of course, if you are already a Maple expert, feel free to pick and choose<br />

those topics and recipes in this volume that interest you or are relevant to your<br />

own scienti¯c tastes or goals.<br />

No matter what approach to using this text is taken, we hope that you<br />

will enjoy the wide range of interdisciplinary topics and stories that we have<br />

presented. Before beginning your intellectual journey through this book, let us<br />

paraphrase a well-known saying from the world of sports with these words of<br />

advice:<br />

You can't learn the great game of scienti¯c modeling<br />

by being a spectator. You must play the game!<br />

We trust that as you sample and explore the various recipes on which our<br />

menu is based, you will enjoy the intellectual \feast" that we have prepared<br />

andpresentedinthisAdvanced Guide to the Mathematical Models of Science.<br />

Bon Appetit!<br />

Richard and George,<br />

Your CAS chefs


Part I<br />

THE APPETIZERS<br />

A man ceases to be a beginner in any given science<br />

and becomes a master in that science when he has<br />

learned that ... he is going to be a beginner all his life.<br />

R. G. Collingwood, British philosopher, The New Leviathan, 1942<br />

In a time of drastic change it is the learners who inherit<br />

the future. The learned usually ¯nd themselves equipped<br />

to live in a world that no longer exists.<br />

Eric Ho®er, American philosopher, Re°ections on the Human Condition, 1973<br />

To know yet to think that one does not know is best;<br />

Not to know yet to think that one knows<br />

will lead to di±culty.<br />

Lao-Tzu, Chinese philosopher, 6th century BC<br />

11


Chapter 1<br />

Phase-Plane Portraits<br />

Every portrait that is painted with feeling<br />

is a portrait of the artist, not of the sitter.<br />

Oscar Wilde, Anglo-Irish playwright, novelist, and poet (1854{1900)<br />

Consider a system of two ¯rst-order coupled ODEs of the general structure<br />

_X ´ dX<br />

= P (X;Y ); _<br />

dY<br />

Y ´ = Q(X;Y ); (1.1)<br />

dt dt<br />

where P and Q are known functions of the dependent variables X and Y ,and<br />

the independent variable has been taken to be the time t. In other model<br />

equations, the independent variable could be a spatial coordinate, e.g., the<br />

Cartesian coordinate x. For compactness, the dot notation of (1.1) will often<br />

be used in our text discussion for time derivatives, one dot denoting d=dt, two<br />

dots standing for d2 =dt2 , and so on. Superscripted primes on the dependent<br />

variable indicate a spatial derivative, e.g., Y 0 ´ dY=dx, Y 00 ´ d2Y=dx2 ,etc.<br />

The 2-dimensional ODE system (1.1) is said to be autonomous, meaningthat<br />

P and Q do not depend explicitly on t. If there is an explicit dependence on the<br />

independent variable, the equations are said to be nonautonomous. Our goal in<br />

the following section is to illustrate a simple graphical procedure for exploring<br />

all possible solutions of equations (1.1) for speci¯c forms of P and Q. In the<br />

second section, we shall show that a 2-dimensional nonautonomous system of<br />

ODEs can be cast into a 3-dimensional autonomous system and present some<br />

interesting examples of the latter.<br />

1.1 Phase-Plane Portraits<br />

Some biological models of competing species are naturally of the standard form<br />

(1.1). For example, a simple ODE model of the temporal evolution of interacting<br />

rabbit and fox populations might be given by the system<br />

_r =2r ¡ 0:04 rf; f _ = ¡f +0:01 rf; (1.2)<br />

where r(t) andf(t) are the numbers of rabbits and foxes per unit area at time<br />

t. If the \interaction" terms involving rf are omitted in (1.2), the remaining<br />

13


14 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

ODEs are linear (¯rst order) in r and f, respectively, and are said to be linear<br />

ODEs. Inclusion of the higher-order interaction terms changes the equations<br />

into nonlinear ODEs. That is to say, P (r; f ) ´ 2 r ¡0:04 rf and Q(r; f) ´¡f +<br />

0:01 rf are nonlinear functions of the dependent variables r and f. Nonlinear<br />

models, such as this one, are usually di±cult or impossible to solve analytically,<br />

so that one must resort to graphical or numerical means to obtain a solution.<br />

Other models, involving second-order ODEs, can often be recast into the<br />

standard form, e.g., models arising from Newton's second law of the structure<br />

Äx = F (x; _x); (1.3)<br />

where x is the displacement and F is the force per unit mass. Setting _x = v,<br />

which is the velocity, (1.3) can be expressed as the coupled ¯rst-order system<br />

_x = v; _v = F (x; v): (1.4)<br />

For example, consider the damped, simple harmonic oscillator (SHO) equation<br />

Äx +2° _x + ! 2 0<br />

x =0; (1.5)<br />

describing the oscillations of a mass m attached to a light spring (spring constant<br />

k) that obeys Hooke's law and experiences a frictional force (damping coe±cient<br />

°) linear in the velocity. The characteristic frequency !0 is equal to p k=m.<br />

On setting _x = v, this second-order linear ODE may be rewritten in standard<br />

form with P (x; v) ´ v and Q(x; v) ´ F (x; v) =¡2 °v¡ ! 2 0 x.<br />

Whether linear or nonlinear, a graphical approach can be used to view all<br />

possible solutions of those ODE systems that can be put into the standard form.<br />

This graphical procedure has proved especially important in the investigation<br />

of nonlinear systems, less so for linear systems, since the latter can usually be<br />

solved analytically. Since equations (1.1) do not depend explicitly on t, the<br />

independent variable may be eliminated by dividing one equation by the other<br />

to form the ratio<br />

dY<br />

dX<br />

Q(X;Y )<br />

= : (1.6)<br />

P (X;Y )<br />

If the Y -versus-X plane is considered, this ratio represents the slope of the<br />

trajectory of the ODE system at the point (X,Y ) in the plane. The X-Y plane<br />

is referred to as the phase plane and the trajectory as a phase-plane trajectory.<br />

For the rabbits{foxes system the phase plane shows the fox number (f) versus<br />

the rabbit number (r), while for the SHO the phase plane is a plot of velocity<br />

(v) against displacement (x).<br />

The time evolution of any possible motion of the ODE system may be pictured<br />

by systematically ¯lling the phase plane with a grid of uniformly spaced<br />

arrows indicating the direction of increasing time and the slope at each grid<br />

point. For a given set of initial conditions, the subsequent temporal evolution<br />

of the system may be traced out by moving from one arrow to the next and<br />

drawing an appropriate line for the trajectory. Pictures created in this manner<br />

are called phase-plane portraits. Since an arrow at any point in the phase plane<br />

is tangent to the trajectory at that point, the grid of arrows is referred to as<br />

the tangent ¯eld.


1.1. PHASE-PLANE PORTRAITS 15<br />

The phase-plane analysis of ODE systems, particularly those that are nonlinear,<br />

can be aided by ¯rst locating the stationary or ¯xed points (X0,Y0) of<br />

the system and then identifying their topological nature, i.e., the characteristic<br />

shape of the trajectories in the vicinity of the ¯xed points. At these points all<br />

the derivatives are zero. Thus, from equation (1.1) they are found by solving<br />

P (X0;Y0) =0; Q(X0;Y0) =0: (1.7)<br />

At a stationary point, it follows from equation (1.6) that the slope of the trajectory<br />

is of the form 0=0 and thus indeterminate. At any other point (referred<br />

to as an ordinary point) of the phase plane, a trajectory has a de¯nite slope.<br />

For linear systems that can be expressed in standard form there will be only<br />

one stationary point. For example, setting P = Q =0fortheSHOyieldsa<br />

stationary point at the origin of the v versus x phase plane.<br />

For nonlinear systems, there can be more than one ¯xed point. As an<br />

example, let's use Maple to determine these points for the rabbits{foxes system.<br />

> restart:<br />

The forms of P and Q for equations (1.2) are entered,<br />

> P:=2*r-0.04*r*f;<br />

> Q:=-f+0.01*r*f;<br />

P := 2 r ¡ 0:04 rf<br />

Q := ¡f +0:01 rf<br />

and the solve command applied to the set of equations 1 P =0,Q =0. A<br />

Maple \set" is enclosed in \curly" (f g) brackets. Unlike a Maple list, the<br />

order of the items is not preserved in a Maple set. The unknowns r and f are<br />

also entered as a set.<br />

> solve(fP=0,Q=0g,fr,fg);<br />

fr =0:; f =0:g; fr =100:; f =50:g<br />

From the output, we see that there are two stationary points, one at the origin<br />

of the f-r phase plane and the other at r =100rabbits,f =50foxes.<br />

Every stationary point has a certain topology in its neighborhood that dictates<br />

the nature of the phase-plane trajectories near that point. Thus, identifying<br />

the nature of each stationary point was an important task historically, since<br />

it allowed investigators in the precomputer era to sketch all the possible phase{<br />

plane trajectories from a knowledge of the location of the stationary points<br />

and their types. In the modern computer era we can let software packages like<br />

Maple do the graphing and analysis for us.<br />

For ODE systems that can be put into standard form, what types of stationary<br />

points are possible? It turns out that there are only four types of so-called<br />

simple 2 stationary points, which are schematically illustrated in Figure 1.1. For<br />

the ¯rst three types (the vortex, focal, and nodal points) we shall<br />

1 Note that it isn't necessary to explicitly set P and Q equal to zero, since Maple will<br />

automatically assume that this is so unless you specify otherwise.<br />

2 The precise de¯nition of the phrase \simple" will be given in Chapter 2.


16 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

V<br />

N<br />

Figure 1.1: Curves near a vortex (V ), focal (F ), nodal (N), saddle (S) point.<br />

use the SHO equation expressed in standard form as an explanatory tool, assuming<br />

that the reader already has some idea of the qualitative nature of the<br />

solutions as the damping coe±cient ° is varied.<br />

For ° = 0, a SHO released from rest outside the origin will oscillate inde¯nitely<br />

about the origin with no change in amplitude. If the velocity is plotted<br />

versus the displacement, the phase-plane trajectories near the origin will qualitatively<br />

look like those shown in the top left of Figure 1.1, the arrows indicating<br />

the direction of increasing time. As the SHO passes through the origin, the velocity<br />

will be a maximum, going to zero as the system reaches its turning points.<br />

For each choice of initial displacement, a di®erent closed loop will be traced out<br />

in the phase plane. In this case, the origin (labeled V )issaidtobeavortex<br />

point or center. Since a continuum of initial conditions is possible, a vortex<br />

point is surrounded by a continuum of closed loops.<br />

For small ° below some critical threshold, the SHO will oscillate about the<br />

origin with an ever-decreasing amplitude, asymptotically approaching the origin<br />

as t !1. The origin is said to be a stable equilibrium point. Two representative<br />

trajectories are shown in the top right of Figure 1.1. As time progresses, each<br />

trajectory approaches the stationary point F at the origin along a (di®erent)<br />

spiral path. The point F is an example of a stable spiral point or focal point.<br />

An unstable focal point would be one for which the trajectory winds o® the<br />

A<br />

1<br />

A<br />

3<br />

F<br />

S<br />

A<br />

4<br />

A<br />

2


1.1. PHASE-PLANE PORTRAITS 17<br />

stationary point as t !1.<br />

As ° is increased, a critical damping is reached, beyond which the behavior<br />

of the SHO system changes. The SHO will no longer oscillate inde¯nitely about<br />

the origin but eventually approach it from a de¯nite direction as t !1.Thisis<br />

schematically illustrated in the bottom left of Figure 1.1 for six di®erent initial<br />

conditions. The origin, labeled N, isinthiscaseanexampleofastablenodal<br />

point. Foranunstablenodalpoint,thetimearrowswouldbereversed.<br />

The fourth type of possible ¯xed point, which will be illustrated in the<br />

following Romeo and Juliet recipe, is called a saddle point.<br />

Figure 1.2: Saddle-point topography.<br />

If you have done any alpine hiking, you might know that a \saddle" is a ridge<br />

between two mountain peaks or summits as illustrated in Figure 1.2, acquiring<br />

its name because the local topography resembles that of a horse saddle. The<br />

saddle point is the low point in the saddle, where in two opposite directions you<br />

would go downhill toward the two valleys and in the two transverse directions<br />

uphill toward the two peaks. If one characterized these four directions by arrows<br />

pointing in the direction of decreasing elevation, the arrows would point away<br />

fromthesaddlepointinthe¯rstcaseandtowarditinthesecond.Ifgivenan<br />

in¯nitesimal nudge, a particle would tend to move away from the saddle point<br />

in the ¯rst case and toward it in the second.<br />

A saddle point (labeled S) in the phase plane is a two-dimensional analogue<br />

of this topology, as schematically indicated in the bottom right of Figure 1.1, the<br />

arrows pointing in the direction of increasing time. The four trajectories labeled<br />

A1S, A2S, A3S, andA4S are examples of so-called separatrixes, dividing the<br />

area about the saddle point into four distinct regions with the trajectories in<br />

each region evolving with time in the directions indicated. A representative<br />

point approaches S along A1S and A2S as t ! +1, while it departs from S<br />

along A3S and A4S at t = ¡1.


18 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

1.1.1 Romeo and Juliet<br />

I am convinced we do not only love ourselves in others<br />

but hate ourselves in others too.<br />

G. C. Lichtenberg, German physicist, philosopher (1742{1799)<br />

The mathematician Steven Strogatz [Str88] [Str94] has suggested a simple dynamic<br />

model to create di®erent scenarios for the love a®air between Romeo and<br />

Juliet. In his model, R(t) andJ(t) represents Romeo's love/hate for Juliet and<br />

Juliet's love/hate for Romeo, respectively, at time t. Positive values of R and<br />

J indicate love, while negative values indicate hate. The love a®air equations<br />

take the form<br />

_R(t) =aR+ bJ; J(t) _ =cR+ dJ;<br />

where a, b, c, anddarereal coe±cients that may have either sign. For the sake<br />

of de¯niteness, let's take a =2,b =1,c = ¡1, and d = ¡2 in the following<br />

problem, leaving other coe±cient values for you to explore.<br />

(a) Is the ODE system linear or nonlinear? Locate the ¯xed point(s).<br />

(b) Create a tangent ¯eld plot and identify the nature of the ¯xed point(s).<br />

(c) Create a phase-plane portrait that contains the four trajectories corresponding<br />

to the following initial conditions: (i) R(0) = ¡0:25, J(0) = 1,<br />

(ii) R(0) = ¡0:27, J(0) = 1, (iii) R(0) = 0:27, J(0) = ¡1, and ¯nally<br />

(iv) R(0) = 0:25, J(0) = ¡1. Consider t =0to4timeunits.<br />

(d) Plot R versus t over the interval t = 0 to 2 for initial condition (i).<br />

(e) Derive analytic solutions for R(t) andJ(t) for initial condition (i).<br />

To plot the tangent ¯eld and create the phase-plane portrait, the dfieldplot<br />

and phaseportrait commands, respectively, will be used. These specialized<br />

di®erential equation plotting tools are contained in the DEtools library package,<br />

which is now loaded. The colon may be replaced with a semicolon to<br />

display the complete list of available commands in this package.<br />

> restart: with(DEtools):<br />

The general love a®air di®erential equations are entered in de1 and de2, each<br />

¯rst-order derivative with respect to t being entered with the diff command.<br />

> de1:=diff(R(t),t)=a*R(t)+b*J(t);<br />

de1 := d<br />

R(t) =a R(t)+b J (t)<br />

dt<br />

> de2:=diff(J(t),t)=c*R(t)+d*J(t);<br />

de2 := d<br />

J (t) =c R(t)+d J (t)<br />

dt<br />

Before proceeding further with solving our problem, a few words should<br />

be said about Maple's derivative command. Using exp, ln, andsin to enter<br />

the exponential, natural logarithm, and sine functions, suppose that Romeo's<br />

love/hate for Juliet depended on time in the following way.


1.1. PHASE-PLANE PORTRAITS 19<br />

> Romeo:=exp(-t)*ln(1+t)*sin(t)/sqrt(1+t^2);<br />

Romeo := e(¡t) ln(1 + t)sin(t)<br />

p 1+t 2<br />

The ¯rst derivative of Romeo with respect to t is now taken, the \inert" form,<br />

Diff, being used on the left-hand side to display the derivative, the \active"<br />

form, diff, employed on the right to explicitly perform the di®erentiation.<br />

> derivative:=Diff(Romeo,t)=diff(Romeo,t);<br />

derivative := d<br />

dt<br />

μ <br />

(¡t) e ln(1 + t)sin(t)<br />

p = ¡<br />

1+t2 e(¡t) ln(1 + t)sin(t)<br />

p<br />

1+t2 + e(¡t) sin(t)<br />

(1 + t) p 1+t2 + e(¡t) ln(1 + t)cos(t)<br />

p ¡<br />

1+t2 e(¡t) ln(1 + t)sin(t) t<br />

(1 + t2 ) (3=2)<br />

The extension of Maple's syntax to higher-order derivatives is straight-forward.<br />

The active form of the second derivative of Romeo is diff(Romeo,t,t) or,<br />

alternatively, diff(Romeo,t$2). Asanexercise,youshouldcalculate,say,the<br />

seventh time derivative of Romeo and see how easy it is to generate the new<br />

answer. A calculation by hand would be very tedious and prone to error.<br />

Returning to our problem, since the right-hand side (rhs) of both de1 and<br />

de2 depend linearly on R and J, the ODEs are linear. By visual inspection,<br />

there is one stationary point at R = J = 0. This is con¯rmed by applying the<br />

solve command to the rhs of the two ODEs.<br />

> statpoint:=solve(frhs(de1),rhs(de2)g,fR(t),J(t)g);<br />

statpoint := fJ (t) =0; R(t) =0g<br />

The given coe±cient values are now speci¯ed,<br />

> a:=2: b:=1: c:=-1: d:=-2:<br />

which are automatically substituted into the two ODEs.<br />

> de1; de2;<br />

d<br />

R(t) =2R(t)+J (t)<br />

dt<br />

d<br />

J (t) =¡R(t) ¡ 2 J (t)<br />

dt<br />

The dfieldplot command is used to plot the tangent ¯eld.<br />

> dfieldplot([de1,de2],[R(t),J(t)],t=0..1,R=-1..1,J=-1..1,<br />

dirgrid=[30,30],arrows=MEDIUM);<br />

The ¯rst and second arguments are Maple lists of the ODEs and dependent<br />

variables. The time range has been taken to be from t =0to1andthe<br />

plotting range for both R and J is from ¡1 to+1. Thedirgrid option speci¯es<br />

the number of horizontal and vertical mesh points (30 £ 30 here) to use for<br />

the tangent arrows. The mimimum is 2 £ 2 and the default is 20 £ 20. The<br />

option arrows=MEDIUM produces \full" arrowheads, the default being \half"<br />

arrowheads. To learn more about dfieldplot, highlight this command with<br />

your mouse, then click on Help, andonHelp on d¯eldplot.


20 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

J<br />

1<br />

0.5<br />

–1 –0.5 0.5 1<br />

R<br />

–0.5<br />

–1<br />

Figure 1.3: Tangent ¯eld for Romeo and Juliet's love a®air.<br />

The tangent ¯eld for Romeo and Juliet's love a®air is shown in Figure 1.3. Inspecting<br />

the graph and comparing with Figure 1.1, it is seen that the stationary<br />

point at the origin is a saddle point. By changing the coe±cient values, the<br />

nature of the stationary point and therefore the nature of the love a®air can be<br />

altered. This is left as a problem at the end of the section for you to explore.<br />

The four initial conditions are now entered,<br />

> ic1:=(R(0)=-0.25,J(0)=1): ic2:=(R(0)=-0.27,J(0)=1):<br />

ic3:=(R(0)=0.27,J(0)=-1): ic4:=(R(0)=0.25,J(0)=-1):<br />

and the phaseportrait command is used to create the phase-plane portrait for<br />

the four initial conditions. These conditions are entered as a list of lists. The<br />

time step size is taken to be 0.05. The default is to divide the time range into 20<br />

equal steps. So the default step size here would be 4=20 = 0:2. Again MEDIUM<br />

arrows are chosen, which are colored red. The trajectories are colored blue using<br />

the linecolor option. A complete list of options may be found under DEplot,<br />

whose Help page may be accessed though the topic search.<br />

> phaseportrait([de1,de2],[R(t),J(t)],t=0..4,[[ic1],[ic2],<br />

[ic3],[ic4]],stepsize=0.05,dirgrid=[30,30],R=-1..1,J=-1..1,<br />

arrows=MEDIUM,color=red,linecolor=blue);<br />

The phase-plane portrait for Romeo and Juliet's love a®air is reproduced in<br />

Figure 1.4. Asymptotically, the trajectories approach the separatrixes of the<br />

saddle point at the origin, the separatrixes dividing the phase plane into four<br />

di®erent \°ow" regions for the tangent arrows. Thus, for example, one can see<br />

that for any initial condition in the lower right region, R will remain positive<br />

and J negative. Romeo's love for Juliet is unrequited!


1.1. PHASE-PLANE PORTRAITS 21<br />

J<br />

1<br />

0.5<br />

–1 –0.5 0 0.5<br />

R<br />

1<br />

–0.5<br />

–1<br />

Figure 1.4: Phase-plane portrait for the love a®air.<br />

By introducing the option scene=[t,R] into phaseportrait, a plot of R<br />

vs. t can be produced. The resulting picture for the ¯rst initial condition is<br />

shown in Figure 1.5, Romeo's initial hate turning to love. Changing R to J in<br />

the scene option will generate J versus t. Try it and see how Juliet responds.<br />

> phaseportrait([de1,de2],[R(t),J(t)],t=0..2,[[ic1]],<br />

stepsize=0.2,scene=[t,R],color=red,linecolor=blue);<br />

R<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

–0.2<br />

0.5 1 1.5 2<br />

t<br />

Figure 1.5: R versus t for the love a®air.


22 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

Now, the ODEs in Strogatz's model are linear with constant coe±cients, so<br />

they can be solved analytically. If proceeding by hand, one can solve de1 for<br />

J(t) and substitute the result into de2 , yielding a second-order ODE in R(t)<br />

alone. Assuming a solution for R(t) oftheforme ®t yields a quadratic equation<br />

in ®, withtworoots®1and ®2. Then R would involve a linear combination<br />

of e ®1 t ®2 t and e , the two arbitrary coe±cients being evaluated with the initial<br />

condition. With R(t) completely determined, J(t) is then easily evaluated.<br />

The Maple di®erential equation solve command, dsolve, hassuchstandard<br />

analytic methods of attack built into its solution algorithm. Applying this<br />

command to the ODE set, subject to the ¯rst initial condition, generates the<br />

following analytic solutions for R(t) andJ(t).<br />

> solution:=dsolve(fde1,de2,ic1g,fR(t),J(t)g);<br />

( Ã<br />

1<br />

solution := R(t) =¡<br />

2 ¡ 7 p !<br />

3 p3<br />

( e<br />

24<br />

p Ã<br />

3 t) 1<br />

+<br />

2 + 7 p !<br />

3 p3<br />

(¡ e<br />

24<br />

p 3 t)<br />

Ã<br />

1<br />

¡ 2<br />

2 ¡ 7 p !<br />

3<br />

e<br />

24<br />

(p Ã<br />

3 t) 1<br />

¡ 2<br />

2 + 7 p !<br />

3<br />

e<br />

24<br />

(¡p3 t) ;<br />

Ã<br />

1<br />

J (t) =<br />

2 ¡ 7 p !<br />

3<br />

e<br />

24<br />

(p Ã<br />

3 t) 1<br />

+<br />

2 + 7 p !<br />

3<br />

e<br />

24<br />

(¡p )<br />

3 t)<br />

In this case, one can see by inspecting the output that ® = § p 3. If the analytic<br />

forms of either R(t) andJ(t) are to be further manipulated, the solution must<br />

be assigned. Otherwise, entering R(t) or J(t) will not produce the analytic<br />

solutions, but just the symbols R(t) andJ(t) in the output.<br />

> assign(solution):<br />

Having assigned the solution, it can now be checked by, for example, subtracting<br />

the right-hand side (rhs) ofde1 from the left-hand side (lhs) ofde1 and<br />

simplifying with the simplify command. The result is 0 as expected.<br />

> check:=simplify(lhs(de1)-rhs(de1));<br />

check := 0<br />

You can check that a zero result occurs if de1 is replaced with de2.<br />

PROBLEMS:<br />

Problem 1-1: Recasting into ¯rst-order ODEs<br />

Recast each of the following second-order ODEs into a ¯rst-order ODE system<br />

and identify P and Q. Which systems are nonlinear? For each autonomous<br />

system, locate all the stationary points. All parameters are real and positive.<br />

(a) Airy equation: y 00 ¡ xy =0;<br />

(b) \soft" spring equation: Äx +(1¡ x2 ) x =0;<br />

(c) Hermite equation: y 00 ¡ xy0 + ny =0;<br />

(d) Rayleigh equation: Äx ¡ ² (1 ¡ _x 2 )_x + x =0;


1.1. PHASE-PLANE PORTRAITS 23<br />

(e) con°uent hypergeometric equation: xy00 +(° ¡ x) y 0 ¡ ®y =0;<br />

(f) plane pendulum equation: Ä μ +sinμ =0.<br />

Problem 1-2: Symbolic di®erentiation<br />

Display and evaluate the following derivatives:<br />

(a) d5<br />

dx 5<br />

³<br />

x6 ln(x)cos(x) e ¡x2´ , (b) d9<br />

dx 9<br />

μ <br />

11<br />

x<br />

p<br />

tanh(2 x)<br />

1+x4 Problem 1-3: Alternative love a®airs<br />

For each of the following possible love a®airs involving Romeo and Juliet:<br />

² produce a tangent ¯eld plot using the dfieldplot command and identify<br />

each stationary point and its stability;<br />

² produce a phase-plane portrait with the speci¯ed initial condition;<br />

² use the phaseportrait command and scene options to plot J(t) andR(t);<br />

² use the dsolve command to derive the analytic solution;<br />

² discuss how the love a®air evolves with time.<br />

(a) _ R = ¡2 R + J, J _ = ¡R ¡ 2 J, R(0) = ¡1, J(0) = 1.<br />

(b) _ R = J, J _ = ¡R, R(0) = 5, J(0) = ¡2.<br />

(c) _ R = J, J _ = ¡R + J, R(0) = 0:1, J(0) = 0.<br />

(d) _ R =2R + J, J _ = R +2J, R(0) = 0:2, J(0) = ¡0:1.<br />

1.1.2 There's No Damping Vectoria's Romantic Heart<br />

Don't waste time trying to break a man's heart; be satis¯ed if you<br />

can just manage to chip it in a brand new place.<br />

Helen Rowland, American journalist, A Guide to Men, \Syncopations," 1922<br />

Vectoria, a physics major at the Metropolis Institute of Technology (MIT),<br />

is working on her computer algebra assignment while waiting for a phone call<br />

from her boyfriend Mike, who is returning from a summer job with an archaeological<br />

dig in a remote area of Asia. In particular, she is asked to use the<br />

DEplot command to illustrate the change in the phase-plane trajectory of the<br />

damped simple harmonic oscillator (SHO) as the damping coe±cient is varied.<br />

Entering DEplot in Maple's Topic Search and clicking OK, Vectoria ¯nds<br />

that the DEplot command is contained in the DEtools library package, which<br />

she now loads.<br />

> restart: with(DEtools):<br />

The SHO equation results on applying Newton's second law of motion to a<br />

unit mass acted on by a Hooke's-law restoring force, Fhooke = ¡! 2 x(t), and<br />

a velocity-dependent Stokes's drag force, Fdrag = ¡¯ (dx=dt). Here x(t) isthe<br />

displacement of the mass from equilibrium, ! is the frequency, and ¯ is the


24 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

damping or drag coe±cient. These two forces are now entered, square brackets<br />

being used for each assigned force to produce the relevant subscript.<br />

> F[hooke]:=-omega^2*x(t); F[drag]:=-beta*diff(x(t),t);<br />

Fhooke := ¡! 2 μ <br />

d<br />

x(t) Fdrag := ¡¯ x (t)<br />

dt<br />

Equating the second time derivative of x(t) to the sum of the forces generates<br />

the SHO equation, de.<br />

> de:=diff(x(t),t,t)=F[hooke]+F[drag];<br />

de := d2<br />

dt2 x(t) =¡!2 μ <br />

d<br />

x(t) ¡ ¯ x (t)<br />

dt<br />

Vectoria now relates the velocity v(t) to the displacement in de2 ,<br />

> de2:=diff(x(t),t)=v(t);<br />

de2 := d<br />

x (t) =v(t)<br />

dt<br />

and substitutes this result into de to create a coupled system (de2 and de3 )of<br />

two ¯rst-order ODEs, linear in x and v.<br />

> de3:=subs(de2,de);<br />

de3 := d<br />

dt v(t) =¡!2 x (t) ¡ ¯ v(t)<br />

To plot the phase-plane trajectory, the parameter values must be speci¯ed.<br />

Vectoria takes ! = 1 and three di®erent ¯ values, namely, b1 =0, b2 =0:2, and<br />

b3 =3.<br />

> omega:=1: b[1]:=0; b[2]:=0.2; b[3]:=3;<br />

b1 := 0 b2 := 0:2 b3 := 3<br />

A \do loop" is used to create a phase-plane portrait using the DEplot command<br />

for each of the three ¯ values.Thegeneralsyntaxforadoloopis<br />

for from by to <br />

while do end do<br />

where the is the main body (the DEplot command here)<br />

of the do loop. In the following do loop, is the index i, the ¯rst <br />

is 1, the second is missing so i automatically increments<br />

by 1, the third is 3, and there is no conditional while <br />

present. The syntax for the DEplot command is the same as for the<br />

phaseportrait command used in the Romeo and Juliet recipe, the time<br />

rangeherebeingfromt =0to50.<br />

> for i from 1 to 3 do<br />

> DEplot([de2,subs(beta=b[i],de3)],[x(t),v(t)],t=0..50,<br />

[[x(0)=1,v(0)=0]],stepsize=0.05,x=-1.1..1.1,v=-1.1..1.1,<br />

dirgrid=[30,30],arrows=MEDIUM,color=red,linecolor=blue):<br />

> end do;


1.1. PHASE-PLANE PORTRAITS 25<br />

On execution of the do loop, the phase-plane portraits shown in Figures 1.6 to<br />

1.8, are produced. For zero damping (¯ =b1 =0), the phase-plane trajectory<br />

v<br />

1<br />

0.5<br />

–1 –0.5 0 0.5 1<br />

x<br />

–0.5<br />

–1<br />

Figure 1.6: Phase-plane portrait for ¯ =0.<br />

displayed in Figure 1.6 is a closed loop circling a vortex ¯xed point at the<br />

origin. The tangent ¯eld is also shown, the arrows pointing in the direction of<br />

increasing time.<br />

For ¯ =0:2, the phase-plane trajectory shown in Figure 1.7 is a spiral that<br />

v<br />

1<br />

0.5<br />

–1 –0.5 0.5 1<br />

x<br />

–0.5<br />

–1<br />

Figure 1.7: Phase-plane portrait for ¯ =0:2.


26 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

asymptotically approaches a stable focal point at the origin. This behavior is<br />

characteristic of underdamping.<br />

v<br />

1<br />

0.5<br />

–1 –0.5 0 0.5 x 1<br />

–0.5<br />

–1<br />

Figure 1.8: Phase-plane portrait for ¯ =3.<br />

Finally, for ¯ = 3, the phase-plane trajectory shown in Figure 1.8 approaches a<br />

stable nodal point at the origin, a behavior characteristic of overdamping. Itis<br />

left as an exercise for you to determine the critical damping threshold between<br />

under- and overdamping.<br />

Unlike the phaseportrait command, DEplot mayalsobeusedtoproduce<br />

solution curves, but not tangent ¯elds, for single higher-order ODEs.<br />

Taking, say, ¯ = b2 =0:2, Vectoria now uses DEplot to generate the x(t)<br />

solution curve shown in Figure 1.9 for the second-order ODE de, giventhe<br />

initial condition 3 x(0) = 1, _x(0)=0. Thetimerangeisfromt =0to50,and<br />

the time step size in the underlying numerical scheme is taken to be 0:05.<br />

> beta:=b[2]:<br />

> DEplot(de,x(t),t=0..50,[[x(0)=1,D(x)(0)=0]],stepsize=0.05);<br />

The numerically derived solution curve in Figure 1.9 decreases in amplitude in<br />

an oscillatory manner, again characteristic of the underdamped SHO.<br />

Finally, since the SHO equation de is linear with constant coe±cients, an<br />

analytic solution can be easily obtained for x(t) usingthedsolve command.<br />

> dsolve(fde,x(0)=1,D(x)(0)=0g,x(t));<br />

x (t) = 1 p<br />

11 e<br />

(¡<br />

33<br />

t<br />

10 ) sin<br />

Ã<br />

3 p 11 t<br />

10<br />

!<br />

t<br />

+ e<br />

(¡ 10 ) cos<br />

Ã<br />

3 p !<br />

11 t<br />

10<br />

3 Note that the derivative condition _x(0) = 0 is entered as D(x)(0)=0, where D is the<br />

di®erential operator. The di®erential operator D is more general than diff. It can represent<br />

derivatives evaluated at a point and can di®erentiate procedures.


1.1. PHASE-PLANE PORTRAITS 27<br />

x(t)<br />

1<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

–0.2<br />

–0.4<br />

–0.6<br />

–0.8<br />

10 20 30 40 50<br />

t<br />

Figure 1.9: x versus t for ¯ =0:2.<br />

Vectoria leaves it as a problem for you to obtain the analytic solution for<br />

the critically damped case.<br />

Unfortunately, Vectoria must leave us for now, since her cell phone has just<br />

rung. Mike's plane has just landed and she's o® to the Metropolis International<br />

Airport to pick him up after he clears immigration and customs.<br />

PROBLEMS:<br />

Problem 1-4: Critical damping<br />

Given ! =1,what¯value corresponds to critical damping of the SHO? Make<br />

a phase-plane portrait for this case using the DEplot command and the initial<br />

condition x(0) = 1, _x(0) = 0. Use this command to plot x(t). Then obtain the<br />

analytic solution.<br />

Problem 1-5: Competition for the same food supply<br />

Two biological species competing for the same food supply are described by the<br />

following nonlinear population number equations:<br />

_<br />

N1 =(4¡ 0:0002 N1 ¡ 0:0004 N2) N1;<br />

_<br />

N2 =(2¡ 0:00015 N1 ¡ 0:00005 N2) N2:<br />

(a) Locate all the stationary points.<br />

(b) Create a tangent ¯eld plot that includes all the stationary points. Identify<br />

thenatureofthesepoints.<br />

(c) Create a phase-plane portrait that includes several representative trajectories<br />

that support your identi¯cation of the stationary points.<br />

(d) Use the scene option to plot N1(t) andN2(t).<br />

(e) Attempt to obtain an analytic solution of the ODE system.


28 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

1.1.3 Van der Pol's Limit Cycle<br />

In order to be able to set a limit to thought, we should have to ¯nd<br />

both sides of the limit thinkable (i.e., we should have to be able to<br />

think what cannot be thought).<br />

Ludwig Wittgenstein, Austrian philosopher (1889{1951)<br />

In the ¯rst two recipes, the ODEs were linear and, because they had constant<br />

coe±cients, were easily solved analytically. In this recipe, we look at the historically<br />

important nonlinear Van der Pol ODE, for which no analytic solution<br />

exists. Balthasar Van der Pol was a Dutch electrical engineer who pioneered<br />

the development of experimental nonlinear dynamics in the 1920s and 1930s<br />

using electrical circuits and discovered several important nonlinear phenomena.<br />

For example, he found that certain nonlinear circuits containing vacuum<br />

tubes could begin to spontaneously oscillate even though the energy source<br />

was constant, the oscillations evolving into a stable cycle, now called a limit<br />

cycle. When these circuits were driven with a signal whose frequency was near<br />

that of the limit cycle, the resulting periodic response shifted its frequency to<br />

that of the driving signal. The circuit became entrained to the driving signal.<br />

Entrainment is the basis of the modern pacemaker, which is used to stabilize<br />

irregular heart beats, or arrhythmias.<br />

In the September 1927 issue of the journal Nature, Van der Pol and van der<br />

Mark reported that an \irregular noise" was heard at certain driving frequencies,<br />

probably one of the ¯rst experimental reports of deterministic chaos. 4<br />

Here, we shall look at a modern electrical circuit [Cho64] that is governed by<br />

the Van der Pol equation and can produce his limit cycle. The circuit, involving<br />

a battery (voltage VB), inductor L, resistorR, capacitor C, and a tunnel diode<br />

D, is shown on the left of Figure 1.10. The tunnel diode has a nonlinear current<br />

(iD)-voltage (VD) curve similar to that shown on the right.<br />

L<br />

V R C D<br />

B<br />

i D<br />

i<br />

i<br />

S<br />

point of<br />

inflection<br />

Figure 1.10: Left: tunnel diode circuit. Right: Current-voltage curve for diode.<br />

4 This historical information is taken from the IEEE History Center (www.ieee.org).<br />

D<br />

V S<br />

V<br />

D


1.1. PHASE-PLANE PORTRAITS 29<br />

The battery voltage VB is adjusted to coincide with the in°ection point VS of<br />

the iD vs. VD curve, i.e., VB = VS. Near this operating point, one may write<br />

i = ¡av+ bv3 ,wherei = iD ¡ iS and v = VD ¡ VS, andaand b are positive.<br />

The governing Van der Pol (VdP) ODE, which will presently be derived, is<br />

Äx ¡ ² (1 ¡ x 2 )_x + x =0; ² > 0; (1.8)<br />

with x proportional to v. Equation (1.8) is just the simple harmonic oscillator<br />

equation for unit frequency and mass with an amplitude-dependent damping<br />

term. For x1 the damping is positive, tending to reduce the<br />

oscillations. The negative damping is responsible for the growth of any small<br />

spontaneous circuit \noise" into stable oscillations, i.e., into a stable limit cycle.<br />

Let's now derive the VdP equation and demonstrate the growth of a small<br />

input signal into a limit cycle for a typical tunnel diode, 1N3719, for which<br />

a =0:05 and b =1:0 in SI units.<br />

The DEtools and PDEtools packages are loaded. The former contains the<br />

DEplot3d command, which is a three-dimensional generalization of the DEplot<br />

command. The PDEtools package contains the dchange command, which will<br />

allow us to easily make a somewhat complicated variable transformation.<br />

> restart: with(DEtools): with(PDEtools):<br />

The time-dependent tunnel diode current and voltage expressions are entered.<br />

> i[D]:=i[S]-a*v(t)+b*v(t)^3; V[D]:=V[S]+v(t);<br />

iD := iS ¡ a v(t)+b v(t) 3 VD := VS + v(t)<br />

The voltage drop across both the resistor R and the capacitor C is the same as<br />

across the diode D, i.e., VR = VD and VC = VD. The voltage drop across the<br />

inductor L is VL = VB ¡ VD = VS ¡ VD, the latter form being entered.<br />

> V[R]:=V[D]: V[C]:=V[D]: V[L]:=V[S]-V[D];<br />

VL := ¡v(t)<br />

By Ohm's law, the current through the resistor is iR = VR=R. The current<br />

through the capacitor is iC = C (dVC=dt).<br />

> i[R]:=V[R]/R; i[C]:=C*diff(V[C],t);<br />

iR := VS<br />

μ<br />

+ v(t)<br />

d<br />

iC := C<br />

R<br />

dt v(t)<br />

<br />

Using Kirchho®'s current rule, eq1 states that the current leaving L must be<br />

equal to the sum of the currents entering R, C, andD.<br />

> eq1:=-i[L](t)+i[R]+i[C]+i[D]=0; #Kirchhoff's current rule<br />

eq1 := ¡iL(t)+ VS<br />

μ<br />

+ v(t) d<br />

+ C<br />

R dt v(t)<br />

<br />

+ iS ¡ a v(t)+b v(t) 3 =0<br />

Di®erentiating eq1 with respect to t eliminates the in°ection point current iS.<br />

> eq2:=expand(diff(eq1,t)/C);<br />

d<br />

eq2 := dt v(t)<br />

CR ¡<br />

d<br />

dt iL(t)<br />

μ<br />

d<br />

μ 2 a<br />

d dt<br />

+ v(t) ¡<br />

C dt2 v(t)<br />

<br />

3 b v(t)<br />

+<br />

C<br />

2<br />

μ<br />

d<br />

dt v(t)<br />

<br />

=0<br />

C


30 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

From the de¯nition of inductance, one has diL=dt = VL=L, which is substituted<br />

into eq2 . This yields a second-order ODE entirely in terms of the potential v(t).<br />

> de:=subs(diff(i[L](t),t)=V[L]/L,eq2);<br />

de := v(t)<br />

CL +<br />

d<br />

dt v(t)<br />

CR +<br />

μ<br />

d<br />

μ 2 a<br />

d dt<br />

v(t) ¡<br />

dt2 v(t)<br />

<br />

3 b v(t)<br />

+<br />

C<br />

2<br />

μ<br />

d<br />

dt v(t)<br />

<br />

=0<br />

C<br />

Then de is put into more compact form by collecting the ¯rst derivatives. The<br />

resulting ODE is the unnormalized form of the VdP equation.<br />

> de1:=collect(de,diff(v(t),t)); #unnormalized VdP equation<br />

μ μ<br />

1 a 3 b v(t)2 d<br />

de1 := ¡ +<br />

CR C C dt v(t)<br />

<br />

+ v(t)<br />

CL +<br />

μ 2 d<br />

v(t) =0<br />

dt2 To obtain the normalized (dimensionless) VdP equation, a transformation will<br />

be made to new variables. First a characteristic frequency ! = 1= p LC is<br />

introduced by making the following substitution into de1 .<br />

> de2:=subs(v(t)/(C*L)=omega^2*v(t),de1);<br />

μ μ<br />

1 a 3 b v(t)2 d<br />

de2 := ¡ +<br />

CR C C dt v(t)<br />

<br />

+ ! 2 μ 2 d<br />

v(t)+ v(t) =0<br />

dt2 Inspecting the structure of de2 , we are led to introduce a dimensionless time<br />

¿ = !t,andvoltagex(¿) = p (3 b) v(t)= p (a ¡ 1=R). The transformation from<br />

the \old" (t; v(t)) to the \new" (¿; x(¿)) variables is entered.<br />

> tr:=ft=tau/omega,v(t)=x(tau)*sqrt(a-1/R)/sqrt(3*b)g:<br />

The dchange command allows us to apply the transformation to de2. The<br />

result is then multiplied by the factor p (3 b)=(! 2 p (a ¡ 1=R).<br />

> sqrt(3*b)*dchange(tr,de2,[x(tau),tau])/(omega^2*sqrt(a-1/R)):<br />

Using the ditto operator, %, to refer 5 to the last computed result, we collect<br />

dx(¿)=d¿ terms and factor the result.<br />

> de3:=collect(%,diff(x(tau),tau),factor);<br />

μ <br />

d<br />

(x (¿) ¡ 1) (x (¿)+1)(aR¡ 1) x (¿)<br />

μ <br />

2<br />

d¿ d<br />

de3 :<br />

+ x (¿)+ x(¿) =0<br />

!CR<br />

d¿ 2<br />

Introducing the dimensionless parameter ² =(aR¡ 1)=(!CR), the normalized<br />

Van der Pol equation results.<br />

> vdp:=subs((a*R-1)=epsilon*(omega*C*R),de3); #VdP equation<br />

μ<br />

d<br />

vdp := (x (¿) ¡ 1) (x (¿)+1)²<br />

d¿ x(¿)<br />

μ <br />

2 d<br />

+ x (¿)+ x (¿) =0<br />

d¿ 2<br />

To make a phase-plane picture, the second-order VdP equation is now rewritten<br />

as two ¯rst-order ODEs in de4 and de5 ,bysettingy(¿) ´ dx(¿)=d¿.<br />

> de4:=diff(x(tau),tau)=y(tau); de5:=subs(de4,vdp);<br />

5 To refer to the second-to-last expression, use %%, and so on.


1.1. PHASE-PLANE PORTRAITS 31<br />

de4 := d<br />

x(¿) =y(¿)<br />

d¿<br />

μ<br />

d<br />

de5 := (x (¿) ¡ 1) (x (¿)+1)² y(¿)+x (¿)+<br />

d¿ y(¿)<br />

<br />

=0<br />

With a =0:05 entered for the tunnel diode 1N3719, a necessary condition for<br />

a limit cycle to occur is that ²>0orR>1=a =1=0:05 = 20 ohms. We take<br />

R =55ohms,L =25:0 £ 10 ¡3 henries, and C =10 ¡6 farads, and calculate !<br />

and ².<br />

> a:=0.05: R:=55: L:=25.0*10^(-3): C:=10^(-6):<br />

> omega:=1/sqrt(L*C); epsilon:=(a*R-1)/(omega*C*R);<br />

! := 6324:555320 ² := 5:030896278<br />

The VdP equation has a ¯xed point at the origin of the y vs. x phase plane.<br />

Let's choose an initial condition close to this point, viz., x(0) = 0:1, y(0) = 0.<br />

> ic:=x(0)=0.1,y(0)=0:<br />

Instead of plotting the trajectory in two dimensions using either the DEplot<br />

or phaseportrait commands, the solution curve corresponding to the initial<br />

condition can be drawn in the three-dimensional ¿ vs. x vs. y space using<br />

DEplot3d with the option scene=[tau,x,y]. The line color of the trajectory<br />

is allowed to vary with ¿. The resulting trajectory appears in a 3-dimensional<br />

viewing box similar to that shown in Figure 1.11. The viewing box can be<br />

rotatedonthecomputerscreen,byclickingontheboxanddraggingwiththe<br />

> DEplot3d([de4,de5],[x(tau),y(tau)],tau=0..60,<br />

scene=[tau,x,y],[[ic]],stepsize=0.01,linecolor=tau);<br />

y<br />

4<br />

0<br />

–4<br />

–2<br />

–1<br />

x<br />

0<br />

1<br />

2<br />

0<br />

10<br />

20<br />

30<br />

40 t<br />

50<br />

60<br />

Figure 1.11: Evolution of the VdP trajectory onto a limit cycle.


32 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

mouse. The angular coordinates, μ and Á, of the viewing box appear in a<br />

small window near the top left of the computer screen, the default angles being<br />

45 ± ,45 ± . The option orientation=[angle,angle], with the values of the two<br />

angles speci¯ed, can be inserted into DEplot3d if some other default orientation<br />

is desired. For example, choose the angles to be μ =0,Á =90toseethephase<br />

plane.<br />

The trajectory evolves away from the vicinity of the origin onto a closed<br />

loop, the limit cycle. You can check that the limit cycle will be obtained no<br />

matter what the choice of initial condition. 6 Can you identify the stationary<br />

point at the origin?<br />

The nonlinear Van der Pol equation does not have an analytic solution.<br />

Applying the dsolve command to the ODE system, de4 and de5 , subject to<br />

the initial condition,<br />

> dsolve(fde4,de5,icg,fx(tau),y(tau)g);<br />

produces no output for x(t) andy(t). Only a few nonlinear ODEs of physical<br />

interest have analytic solutions. We shall see a few examples in Chapter 4.<br />

PROBLEMS:<br />

Problem 1-6: Di®erent initial conditions<br />

With all other parameters as in the text recipe, show for a number of di®erent<br />

initial conditions that all trajectories wind onto the limit cycle. Take the<br />

orientation that shows the y versus x phase plane.<br />

Problem 1-7: Varying the resistance<br />

With all other parameters as in the text recipe, investigate the behavior of the<br />

VanderPolequationastheresistanceRis varied. Choose an orientation that<br />

shows x versus ¿. Discuss the results.<br />

Problem 1-8: Tangent ¯eld<br />

In the text recipe, use the phaseportrait command instead of DEplot3d to<br />

make a phase-plane portrait with the tangent ¯eld included.<br />

1.2 Three-Dimensional Autonomous Systems<br />

Although a three-dimensional plot was produced in the last example, we were<br />

still dealing with a two-dimensional autonomous system. Let's now consider a<br />

general three-dimensional autonomous ODE system of the structure<br />

_X = P (X;Y; Z); Y _ = Q(X;Y; Z); Z _ = R(X;Y; Z); (1.9)<br />

with P , Q, andRknown functions of the three dependent variables X, Y ,and<br />

Z. Some systems of physical interest are naturally of this structure, while the<br />

two-dimensional nonautonomous ODE system<br />

_X = P (X;Y; t); Y _ = Q(X;Y; t); (1.10)<br />

can be recast into the form (1.9) by setting R = 1 and imposing Z(0) = 0.<br />

6 Ifyoustarttoofaro®thelimitcycle,thetimerangemayhavetobeincreased.


1.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 33<br />

1.2.1 The Period-Doubling Route to Chaos<br />

Chaos often breeds life, when order breeds habit.<br />

Henry Adams, American historian (1838{1918)<br />

Nonautonomous nonlinear ODEs, such as Du±ng's equation,<br />

Äx +2° _x + ®x+ ¯x 3 = F cos(!t); (1.11)<br />

have played a very important role in the development of nonlinear dynamics.<br />

Du±ng's equation is a model for the motion of a viscously damped (damping<br />

coe±cient °) spring that is subject to a nonlinear restoring force f = ¡®x¡<br />

¯x3 and is being driven by a periodic force of amplitude F and frequency !.<br />

Depending on the signs and magnitudes of ® and ¯, various descriptive names<br />

are usually applied to Du±ng's equation:<br />

² hard-spring Du±ng equation: ®>0, ¯>0;<br />

² soft-spring Du±ng equation: ®>0, ¯0.<br />

Setting _x = y, Du±ng's equation can be written in the 2-dimensional nonautonomous<br />

form (1.10) with P ´ y and Q ´¡2 °y¡ ®x¡ ¯x3 + F cos(!t).<br />

It can be made autonomous by introducing a third dependent variable, z, and<br />

expressing Du±ng's equation as the three-dimensional system<br />

_x = y; _y = ¡2 °y¡ ®x¡ ¯x 3 + F cos(z); _z = !; with z(0) = 0: (1.12)<br />

After a transient time interval, the Du±ng system can, not unexpectedly,<br />

display a periodic oscillation in response to the periodic driving term. A more<br />

surprising result is that it can exhibit highly irregular, or chaotic, oscillatory<br />

motion that is essentially unpredictable, even though the Du±ng equation is<br />

deterministic. In contrast to the periodic regime, there is an extreme sensitivity<br />

to initial conditions in the chaotic domain.<br />

The Du±ng ODE is not the only dynamical system to exhibit chaotic behavior.<br />

In general, for chaos to occur in a dynamical system, two ingredients are<br />

necessary, namely that some nonlinearity be present and that the system have at<br />

least three dynamical dependent variables (i.e., be at least three-dimensional).<br />

The study of chaotic behavior is a nonlinearly growing ¯eld, and it is not our<br />

intention to explore it in any depth in this text, although some useful diagnostic<br />

tools are brie°y presented in the Desserts.<br />

In the following recipe, Jennifer, a mathematician at MIT, will illustrate<br />

the so-called period-doubling route to chaos for the Du±ng system. This refers<br />

to a sequence of period doublings (halving of the frequency response) that are<br />

observed when a \control" parameter is increased, ultimately ending in a chaotic<br />

regime. This period-doubling scenario is not the only route to chaos, but it is a<br />

very common one in the study of driven nonlinear ODE systems as well as other<br />

nonlinear systems that are naturally three- (or more) dimensional in nature.


34 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

For a given Du±ng spring system with speci¯ed initial conditions, there are<br />

two control parameters that could be varied in the driving force, namely the<br />

frequency ! and the amplitude F . Jennifer decides to hold ! ¯xed, and study<br />

how the Du±ng system responds as F is increased.<br />

After loading the plots and DEtools packages, Jennifer unprotects °,<br />

> restart: with(plots): with(DEtools): unprotect(gamma):<br />

which she would like to use for the damping coe±cient. Otherwise, Maple<br />

treats the entry of gamma as a request for Euler's constant. Ifthisconstant<br />

is unfamiliar to you, consult Maple's Help.<br />

For the sake of de¯niteness, Jennifer considers the inverted spring system<br />

with the parameter values ® = ¡1, ¯ =1,° =0:25, and ! =1,<br />

> alpha:=-1: beta:=1: gamma:=0.25: omega:=1:<br />

and the four force amplitudes F1 =0:325, F2 =0:35, F3 =0:356, and F4 =0:42.<br />

> F[1]:=0.325: F[2]:=0.35: F[3]:=0.356: F[4]:=0.42:<br />

The F values were selected to illustrate distinctly di®erent responses of the<br />

spring system to the driving force. To gain a preliminary understanding of<br />

what motions are possible, Jennifer decides to derive the potential energy function<br />

V (x) and plot it. This may be accomplished by entering the anharmonic<br />

(nonlinear) restoring force f = ¡®x¡ ¯x3 ,<br />

> f:=-alpha*x-beta*x^3; #anharmonic restoring force<br />

f := x ¡ x3 and performing the inde¯nite integral V = ¡ R fdxusing the int command.<br />

> V:=-int(f,x);<br />

V := ¡ 1<br />

2 x2 + 1<br />

4 x4<br />

The potential energy V is plotted over the range x = ¡1:5 to1:5,<br />

> plot(V,x=-1.5..1.5,tickmarks=[3,2],labels=["x","V"]);<br />

–1<br />

x<br />

1<br />

V<br />

–0.2<br />

Figure 1.12: Double-well potential for an inverted-spring Du±ng equation.


1.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 35<br />

the resulting picture being shown in Figure 1.12. The potential is commonly<br />

referred to as the double-well potential. There are two minima, at x = ¡1 and<br />

x = +1, at which points V = ¡ 1<br />

4 , separated by a maximum at x =0,where<br />

V = 0. In the absence of any driving force (set F =0)ordamping(° =0),the<br />

two minima correspond to vortex points, and the maximum is a saddle point.<br />

In this case, the spring system will oscillate in one of the two potential wells<br />

provided that the total energy is less than zero. For a total energy greater than<br />

zero, the oscillations will be back and forth between the two potential wells.<br />

These possible motions can be con¯rmed by making a phase-plane portrait for<br />

° =0andF = 0 in the Du±ng equation.<br />

To make this portrait, Jennifer inserts the time-dependence of the displacement<br />

by changing the variable x to x(t) in the restoring force,<br />

> f:=subs(x=x(t),f):<br />

and introduces the velocity dx=dt = y(t) ineq0 .<br />

> eq0:=diff(x(t),t)=y(t):<br />

The following three initial conditions are considered.<br />

> ic1:=x(0)=0.09,y(0)=0: ic2:=x(0)=-0.09,y(0)=0:<br />

ic3:=x(0)=-1.5,y(0)=0:<br />

These conditions should produce undamped oscillatory motion in the right,<br />

left, and both potential wells, respectively. To con¯rm this, Jennifer applies<br />

the phaseportrait command to the coupled system eq0 and dy=dt = f.<br />

> phaseportrait([eq0,diff(y(t),t)=f],[x(t),y(t)],t=0..100,<br />

[[ic1],[ic2],[ic3]],stepsize=0.1,,x=-1.5..1.5,color=red,<br />

linecolor=blue,arrows=MEDIUM):<br />

1<br />

y<br />

–1 x 1<br />

–1<br />

Figure 1.13: Phase portrait for inverted Du±ng equation for ° =0andF =0.


36 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

The resulting Figure 1.13 exhibits closed-loop trajectories in the phase plane<br />

characteristic of the predicted possible oscillatory motions.<br />

The inclusion of damping and a nonzero force amplitude, on the other hand,<br />

will make the physical behavior much harder to predict. For (° 6= 0), the<br />

two vortices will change to stable focal or nodal points, and in the absence<br />

ofanyenergysource(F = 0) the spring system would asymptotically (t !1)<br />

approach one of the two minima. With the inclusion of the driving term (F 6=0),<br />

which periodically pumps energy into the nonlinear system, periodic solutions<br />

are again possible but their nature much more di±cult to forecast, since the<br />

periodicity of the response depends on the amplitude F chosen (for ¯xed !)<br />

and the initial conditions.<br />

To determine what happens, Jennifer now uses a do loop to construct a<br />

phase-plane graph for each of the four di®erent F values.<br />

> for i from 1 to 4 do<br />

Du±ng's equation is entered for the ith force value, the result being labeled as<br />

the ith equation.<br />

> eq[i]:=diff(y(t),t)+2*gamma*y(t)-f=F[i]*cos(omega*t);<br />

In the phaseportrait command, Jennifer starts the time range at t =100<br />

to eliminate any transient response of the system. The ¯rst initial condition is<br />

chosen, which corresponds to starting the system from rest in the right potential<br />

well of Figure 1.12, slightly displaced to the right of the central peak that<br />

separates the two wells. To create a phase-plane portrait for the nonautonomous<br />

case, the scene=[x,y] option is selected.<br />

> gr[i]:=phaseportrait([eq0,eq[i]],[x(t),y(t)],t=100..250,<br />

[[ic1]],scene=[x,y],stepsize=0.1,color=red,linecolor=blue);<br />

> end do:<br />

The four graphs produced by this do loop are grouped together in a 2 £ 2array<br />

> Graphs:=array(1..2,1..2,[[gr[1],gr[2]],[gr[3],gr[4]]]):<br />

and then displayed, the resulting picture being shown in Figure 1.14.<br />

> display(Graphs,tickmarks=[2,2]):<br />

For the ¯rst three phase-plane portraits, corresponding to F1 = 0:325,<br />

F2 =0:35, and F3 =0:356, the Du±ng system executes qualitatively di®erent<br />

periodic motions in the right potential well of Figure 1.12. Because of the<br />

mathematical uniqueness of the solutions for given initial conditions, \true"<br />

phase-plane trajectories do not cross at ordinary points of the phase plane. But<br />

here there are apparent \crossings" of the trajectories, the number increasing<br />

with increasing F . The crossings are an artifact of using a phase plane to<br />

represent the motion of the driven system. In fact, as mentioned earlier, the<br />

inverted spring system is actually a three-dimensional autonomous system. The<br />

trajectories do not cross when plotted in the three-dimensional x-y-z space.<br />

For F4 =0:42, the driving-force amplitude is su±ciently large that the system<br />

clearly oscillates between both of the potential wells, its motion in the phase<br />

plane appearing to be quite chaotic.


1.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 37<br />

y y<br />

0 x 1<br />

0 x 1<br />

y<br />

0 x 1<br />

Figure 1.14: Phase-plane portraits for F1 =0:325 (top left), F2 =0:35 (top<br />

right), F3 =0:356 (bottom left), and F4 =0:42 (bottom right).<br />

To produce a deeper understanding, Jennifer reruns the ¯le with the scene<br />

option in the ith graph, gr[i], replaced with scene=[t,x] and the time range<br />

shortened to t = 100 to 160. The four displacement (x(t)) curves in Figure 1.15<br />

result, each corresponding to the matching phase-plane portrait in Figure 1.14.<br />

For F1 =0:325, the inverted spring responds periodically at exactly the<br />

driving frequency, the period being T =2¼=! =6:28. If the period is written<br />

as T = n (2 ¼=!), then n = 1 for this case, and the motion is referred to as a<br />

period-one response.<br />

For F2 =0:35, the spring has a repeat period that is twice that of the driving<br />

term, i.e., one has n =2andthereforeaperiod-two response. Notice that now<br />

the system alternates each half-cycle between di®erent maximum values of the<br />

displacement.<br />

For F3 =0:356, the repeat period is four times as large, corresponding to<br />

period four. AsF was increased, the period doubled from period one to period<br />

twotoperiodfour. AsF is further increased, this period doubling will continue<br />

–1<br />

y<br />

x<br />

1


38 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

until the repeat period is so large that the motion appears to be chaotic. This<br />

is what has happened for F4 =0:42.<br />

1<br />

x x<br />

100<br />

1<br />

x<br />

100<br />

t 150 100 t<br />

t<br />

150<br />

x<br />

1<br />

1<br />

–1<br />

100<br />

t<br />

150<br />

150<br />

Figure 1.15: Displacement x versus time t for F1 =0:325 (top left), F2 =0:35<br />

(top right), F3 =0:356 (bottom left), and F4 =0:42 (bottom right).<br />

The scenario that Jennifer has outlined for the inverted Du±ng equation is<br />

a commonly observed phenomenon for forced oscillator systems and is referred<br />

to in the literature as the period-doubling route to chaos.<br />

PROBLEMS:<br />

Problem 1-9: Unforced damped motion<br />

In the text example, keep all equation coe±cients the same (leaving ° =0:25)<br />

but take the forcing amplitude F to be zero.<br />

(a) If the inverted spring system is initially at rest in the right potential well<br />

with total energy E =+ 1<br />

4 , to what stationary point does it asymptotically<br />

evolve? Make a phase-plane portrait and a plot of x versus t.<br />

(b) Identify the stationary point.


1.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 39<br />

(c) How long does it take for the system to be within 1% of this point?<br />

(d) If the spring system is initially at rest in the right potential well, what is<br />

the minimum value that the total energy must have so that it asymptotically<br />

approaches the stationary point in the left potential well?<br />

Problem 1-10: Period 8<br />

In the text example, determine an approximate F for which period 8 occurs.<br />

Problem 1-11: A di®erent response<br />

In the text example, what e®ect does changing the driving frequency to ! =2<br />

haveonthefourgraphs?IdentifytheperiodresponseforeachFvalue. Problem 1-12: Varying frequency<br />

With all other parameters the same as in the text, but with F =0:42, study the<br />

response of the inverted Du±ng system as ! is varied over the range between<br />

zero and one. Interpret the results in each case.<br />

Problem 1-13: Varying the damping coe±cient<br />

With all other parameters the same as in the text, investigate the e®ect on the<br />

four graphs when the damping coe±cient is reduced to ° =0:125. Identify the<br />

period response for each F value. Repeat with ° =0:0625.<br />

Problem 1-14: Varying the force law<br />

Execute the text recipe with the x3 term in the force law replaced with x5 and<br />

discuss how this change a®ects the results. Then try some larger F values (all<br />

other parameters remaining the same) and determine the period response of<br />

each solution.<br />

Problem 1-15: Nonharmonic Du±ng oscillator<br />

For the nonharmonic Du±ng oscillator with ® =0,¯ =1,° =0:04, ! =1,<br />

F =0:2, x(0) = 0:25, and y(0) ´ _x(0) = 0, determine the period response<br />

of the solution. Use both scene=[x,y] and scene=[t,x] before making your<br />

conclusion. What is the period response if x(0) = 0:2, all other parameter<br />

values remaining the same?<br />

Problem 1-16: Another forced oscillator<br />

Determine the period response of the forced-oscillator equation<br />

Äx +0:7 _x + x 3 =0:75 cos t;<br />

subject to the initial condition x(0) = _x(0) = 0. Explore the change in period<br />

response of the solution as the force amplitude is varied. What type of Du±ng<br />

equation is the above equation?<br />

Problem 1-17: Three-dimensional plots<br />

Instead of the planar plots presented in the text recipe, make use of the DEplot3d<br />

command to make three-dimensional plots in the t versus x versus y space. Plot<br />

the trajectory for each F value separately, choosing an orientation in each case<br />

that gives the best view.


40 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

1.2.2 The Oregonator<br />

Everybody's youth is a dream, a form of chemical madness.<br />

F. Scott Fitzgerald, American writer (1896{1940)<br />

The Belousov{Zhabotinski (BZ) chemical reaction is now probably one of the<br />

best known of the chemical oscillators. However, because it was contrary to<br />

the then current belief that all solutions of reacting chemicals must go monotonically<br />

to equilibrium, Belousov could not initially get his chemical oscillator<br />

discovery published in any Soviet journal. Only years later, when his results<br />

were con¯rmed by Zhabotinski, was he given due recognition for his discovery.<br />

For his pioneering research work he was awarded, along with Zhabotinski, the<br />

Soviet Union's highest medal, but unfortunately for him, he had passed away<br />

10 years earlier.<br />

The BZ reaction may be achieved [Tys76] by dissolving 4.292 g of 0.28 M<br />

malonic acid 7 and 0.175 g of 0.002 M cerium ammonium nitrate in 150 ml of 1<br />

M sulfuric acid and stirring well. The solution will initially be yellow, then turn<br />

clear after a few minutes. Then, on adding 1.415 g of 0.063 M sodium bromate,<br />

the solution will oscillate between yellow and clear with a period of about one<br />

minute. A more dramatic color change between red and blue can be achieved<br />

by adding a few ml of 0.025 M ferroin.<br />

Field, K}orÄos, and Noyes [FKN72][FN74] were able to measure the periodic<br />

oscillations in the Br ¡ concentration and the Ce 4+ /Ce 3+ ratio in the BZ reaction.<br />

They then isolated the ¯ve most important reactions in the complicated<br />

chemistry that was taking place and created a kinetic model called the Oregonator,<br />

the name re°ecting the location of where the research was carried out.<br />

Labeling the concentration of BrO ¡<br />

3 as A, thatofHBrO2 as X, thatofBr ¡<br />

as Y ,thatofCe 4+ as Z, and all other less-important chemical species as ¤, the<br />

relevant chemical reactions in the Oregonator model are as follows:<br />

A + Y + ¤<br />

X + Y + ¤<br />

A + X + ¤<br />

k1<br />

! X + ¤<br />

k2<br />

! ¤<br />

k3<br />

! 2 X +2Z + ¤ (1.13)<br />

2 X k4<br />

! A + ¤<br />

Z + ¤<br />

k5<br />

! hY + ¤<br />

Here the ki denote the rates of reaction and h is a numerical \fudge factor"<br />

introduced because of the severe truncation of the full set of equations describing<br />

the complicated chemistry. How sensitive the results are to the value chosen<br />

for h will be left as a problem.<br />

Ignoring the less-important chemical species and noting that the depletion<br />

of A can be neglected, i.e., A is constant, the rate equations for the production<br />

7 Belousov [Bel58] used citric acid, but malonic acid is now commonly substituted.


1.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 41<br />

of X, Y , Z are<br />

_X = k1 AY ¡ k2 XY + k3 AX ¡ k4 X 2 ;<br />

_Y = ¡k1 AY ¡ k2 XY + hk5 Z;<br />

_Z =2k3 AX ¡ k5 Z:<br />

(1.14)<br />

In writing down equations (1.14), use has been made of the following empirical<br />

rule: When two substances react to produce a third, the reaction rate is proportional<br />

to the product of the concentrations of the two substances. Thus, for<br />

example, the structure of the _ X equation can be easily understood. In the ¯rst<br />

chemical reaction, the rate of producing X is +k1 AY. In the second reaction,<br />

there is a decrease in X, the rate contribution being ¡k2 XY. The third reaction<br />

provides a positive contribution +k3 AX. Finally, noting that 2 X in the<br />

fourth reaction is treated as X + X, this reaction provides a rate decrease given<br />

by ¡k4 X 2 . The other rate equations may be similarly understood. The factor<br />

of 2 in the _ Z equation appears because in the third reaction, two of Z appear<br />

for each net (2 X ¡ X) oneofX.<br />

The nonlinear rate equations (1.14) can be converted into a normalized<br />

form that reduces the number of parameters. Introducing a normalized time<br />

¿ =(k1A) t and concentrations<br />

x =(k2X)=(k1 A); y =(k2Y )=(k3 A); z =(k2k5 Z)=(2 k1 k3 A 2 );<br />

and positive parameters,<br />

² = k1=k3; p =(k1A)=k5; q =(k1k4)=(k2 k3);<br />

the Oregonator equations reduce to<br />

² _x(¿) =x + y ¡ qx 2 ¡ xy; _y(¿) =¡y +2hz¡ xy; p _z(¿) =x ¡ z:<br />

As an illustrative example, we will look at the onset of oscillations in the<br />

Oregonator model for ² =0:03, p =2,q =0:006, h =0:75 and initial (normalized)<br />

concentrations x(0) = 1, y(0) = 1, and z(0) = 20.<br />

After loading the plots package,<br />

> restart: with(plots):<br />

the three governing di®erential equations are entered,<br />

> de1:=epsilon*diff(x(t),t)=x(t)+y(t)-q*x(t)^2-x(t)*y(t);<br />

μ <br />

d<br />

de1 := ² x (t) = x(t)+y(t) ¡ q x (t)<br />

dt 2 ¡ x(t) y(t)<br />

> de2:=diff(y(t),t)=-y(t)+2*h*z(t)-x(t)*y(t);<br />

de2 := d<br />

y(t) =¡y(t)+2h z(t) ¡ x (t) y(t)<br />

dt<br />

> de3:=p*diff(z(t),t)=x(t)-z(t);<br />

μ<br />

d<br />

de3 := p<br />

dt z(t)<br />

<br />

= x(t) ¡ z(t)


42 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

along with the parameter values<br />

> epsilon:=0.03: p:=2: q:=0.006: h:=0.75:<br />

and the initial condition.<br />

> ic:=x(0)=1,y(0)=1,z(0)=20:<br />

The set of nonlinear ODEs cannot be solved analytically, so we seek a numerical<br />

solution for the set of three unknowns using the dsolve command with the<br />

numeric option. Unless otherwise speci¯ed, the default numerical scheme is the<br />

Runge{Kutta{Fehlberg 45 (rkf45) algorithm. See Burden and Faires. [BF89]<br />

> sol:=dsolve(fde1,de2,de3,icg,fx(t),y(t),z(t)g,numeric):<br />

The 3-dimensional text plot command is used to place the blue-colored word<br />

\start" near the starting point of the trajectory. The three numbers in the list<br />

are the x-, y-, and z-coordinates where the word is to be placed.<br />

> tp:=textplot3d([1,1,21,"start"],color=blue):<br />

The odeplot command enables us to plot the numerical solution over the time<br />

interval0to20timeunits. Theminimumnumberofplottingpointsistaken<br />

to be 3000 in order to obtain a smooth curve. The default number is 50.<br />

> gr:=odeplot(sol,[x(t),y(t),z(t)],0..20,numpoints=3000,<br />

thickness=2,axes=frame,labels=["x","y","z"],<br />

tickmarks=[3,3,3]):<br />

The above two plots are then displayed together, producing Figure 1.16.<br />

> display(ftp,grg);<br />

30<br />

z<br />

20<br />

10<br />

0<br />

5<br />

y<br />

10<br />

15<br />

Figure 1.16: Evolution of Oregonator system onto limit cycle in phase space.<br />

The trajectory in the 3-dimensional phase space evolvesontoaclosedloop,<br />

characteristic of an oscillatory solution. No matter what the starting point<br />

start<br />

100<br />

50<br />

x<br />

0


1.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 43<br />

(initial condition), the trajectory will wind onto the same loop, indicating that<br />

the loop is a stable 3-dimensional limit cycle.<br />

The odeplot command is used to plot the concentrations x(t), y(t), and z(t)<br />

as red, blue, and green curves respectively, with a title indicating this included.<br />

> odeplot(sol,[[t,x(t),color=red],[t,y(t),color=blue],<br />

[t,z(t),color=green]],0..20,numpoints=3000,tickmarks=[3,3],<br />

thickness=2,title="red=x, blue=y, green=z");<br />

x, y, z<br />

100<br />

50<br />

0<br />

red=x, blue=y, green=z<br />

10 20<br />

t<br />

Figure 1.17: Oscillatory behavior of HBrO2 (x), Br ¡ (y), and Ce 4+ (z).<br />

The black-and-white version is shown in Figure 1.17, the tallest curve being x(t),<br />

the intermediate curve z(t), and the shortest curve y(t). Each curve reaches its<br />

maximum amplitude at a di®erent time.<br />

PROBLEMS: Problem 1-18: Oregonator limit cycle<br />

Con¯rm that a limit cycle results in the Oregonator model, regardless of the<br />

initial (nonzero) concentrations.<br />

Problem 1-19: Another chemical oscillator<br />

The rate equations for a certain chemical oscillator are<br />

A k1<br />

! X<br />

B + X k2<br />

! Y + ¤<br />

2 X + Y<br />

k3<br />

! 3 X<br />

X k4<br />

! ¤<br />

where the concentrations A and B of species A and B are held constant.<br />

(a) Using the empirical rule for chemical reactions, write down the rate equations<br />

for X and Y .


44 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

(b) Convert the rate equations into a normalized form by setting ¿ = k4 t,<br />

x= p (k3=k4) X, y = p (k3=k4) Y , a= p (k3=k4)(k1=k4) A, b=(k2=k4) B.<br />

(c) Taking a =1,b =2:5, x(0) = y(0) = 0:1, produce a 3-dimensional plot<br />

showing x(t) vs.y(t) vs.t. Choose an orientation that clearly shows a<br />

periodic orbit.<br />

(d) Con¯rm the limit-cycle nature by trying a few di®erent initial normalized<br />

concentrations.<br />

Problem 1-20: Oregonator fudge factor<br />

In the text recipe for the Oregonator model, the fudge factor was taken to be<br />

h =0:75. Exploring the range h =0:1 toh = 1, with all other conditions the<br />

same, determine whether a limit cycle occurs. Comment on the sensitivity of<br />

the model on h.<br />

1.2.3 RÄossler's Strange Attractor<br />

Strange as it may seem, no amount of learning can cure stupidity,<br />

and formal education positively forti¯es it.<br />

Stephen Vizinczey, Hungarian novelist (1933{)<br />

The following 3-dimensional nonlinear ODE system, due to RÄossler [RÄ76],<br />

_x = ¡(y + z); _y = x + ay; _z = b + z (x ¡ c); (1.15)<br />

can display a variety of di®erent trajectories in the x-y-z phase space, depending<br />

on the values assigned to the parameters a, b, andcand the initial condition.<br />

The following recipe produces one of the more interesting trajectories.<br />

After loading the DEtools library package,<br />

> restart: with(DEtools):<br />

the right-hand sides of the _x, _y, and_zequations are entered and assigned the<br />

names P , Q, andR, respectively.<br />

> P:=-(y+z); Q:=x+a*y; R:=b+z*(x-c);<br />

P := ¡y ¡ z Q := x + ay R:= b + z (x ¡ c)<br />

We take the parameter values to be a =0:2, b =0:2, and c =5:7.<br />

> a:=0.2: b:=0.2: c:=5.7:<br />

The number and locations of the ¯xed points are determined by solving the<br />

three equations P =0,Q =0,andR =0forx, y, andz. Listsareusedsothat<br />

the order x; y; z of the ¯xed-point coordinates is maintained in the output.<br />

> points:=solve([P=0,Q=0,R=0],[x,y,z]);<br />

points := [ [x =0:007026204834; y= ¡0:03513102417; z=0:03513102417];<br />

[x =5:692973795; y= ¡28:46486898; z=28:46486898] ]<br />

There are two ¯xed points, one of which is near the origin. We take our initial<br />

condition to be x(0) = 0:1, y(0) = 0:1, z =0:1, i.e., near this ¯xed point. The


1.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 45<br />

trajectory that results if the initial condition is near the other ¯xed point is left<br />

as a problem.<br />

> ic:=[x(0)=0.1,y(0)=0.1,z(0)=0.1]:<br />

To enter the relevant ODEs, the dependent variables x, y, andz must be made<br />

time-dependent. This is done in the following command line.<br />

> vars:=fx=x(t),y=y(t),z=z(t)g:<br />

Substituting the variables into P , Q, andR, and equating to dx=dt, dy=dt, and<br />

dz=dt, yields the RÄossler system of ODEs.<br />

> sys:=diff(x(t),t)=subs(vars,P),diff(y(t),t)=subs(vars,Q),<br />

diff(z(t),t)=subs(vars,R);<br />

sys := d<br />

d<br />

x (t) =¡y(t) ¡ z(t); y(t) =x(t)+0:2y(t); dt dt<br />

d<br />

z (t) =0:2+z (t)(x (t) ¡ 5:7)<br />

dt<br />

Choosing the option scene=[x,y,z] in the DEplot3d command, we plot the<br />

trajectory in x-y-z space over the time interval t = 0 to 150, subject to the<br />

given initial condition. The step size is taken to be 0.01 in order to obtain a<br />

smooth curve. The trajectory is colored with the zhue shading option, and a<br />

particular orientation of the viewing box is chosen.<br />

> DEplot3d([sys],[x(t),y(t),z(t)],t=0..150,[ic],scene=[x,y,z],<br />

stepsize=0.01,shading=zhue,orientation=[-120,60],<br />

tickmarks=[3,3,3],thickness=1);<br />

20<br />

z<br />

10<br />

5<br />

y<br />

0<br />

–5<br />

–10<br />

Figure 1.18: RÄossler's strange attractor.<br />

0<br />

x<br />

10


46 CHAPTER 1. PHASE-PLANE PORTRAITS<br />

The resulting picture is shown in Figure 1.18. The trajectory unwinds in a<br />

spiral fashion from its starting point near the origin, indicating that the ¯xed<br />

point at the origin is an unstable focal point. As time progresses, the trajectory<br />

is attracted to a localized region of the phase space where it traces out a<br />

never-repeating (chaotic) path. This is an example of a strange attractor, the<br />

word strange being introduced historically because it was not like a \normal"<br />

attractor (e.g., a focal point). Strange attractors also have the property that<br />

they have noninteger, or fractal, dimensions. If you wish to learn more about<br />

strange attractors and fractal patterns, this topic is discussed at length in the<br />

Introductory Guide.<br />

PROBLEMS: Problem 1-21: Second ¯xed point<br />

Run the text recipe with an initial condition near the second ¯xed point. What<br />

is the probable nature of this ¯xed point? What is the nature of the resulting<br />

trajectory as time progresses?<br />

Problem 1-22: Varying c<br />

Holding all other parameters as in the text recipe, explore the behavior of the<br />

RÄossler system as the coe±cient c is varied. Interpret the results.


Chapter 2<br />

Phase-Plane Analysis<br />

The more important the subject and the closer it cuts to the bone of<br />

our hopes and needs, the more we are likely to err in establishing a<br />

framework for analysis.<br />

Stephen Jay Gould, American paleontologist and science historian (1941{2002)<br />

In the ¯rst chapter, the reader has seen examples of phase-plane portraits for<br />

two-dimensional autonomous ODE systems of the structure<br />

_x = P (x; y); _y = Q(x; y); (2.1)<br />

where P and Q were speci¯ed real functions. Given the mathematical forms<br />

of P and Q, the number and locations of the ¯xed points is easily established,<br />

either analytically or numerically. Quite generally, the topological nature of a<br />

¯xed point can then be determined by examining the °ow of tangent arrows in<br />

its vicinity and/or the temporal evolution of a nearby trajectory. For nonlinear<br />

systems, this was done with numerically based graphing commands. In this<br />

chapter, we will complement this approach by introducing phase-plane analysis,<br />

which involves analytically examining the nature of the trajectories at ordinary<br />

points lying near each ¯xed point. The method can be generalized [Hay64] to<br />

three-dimensional systems, but becomes considerably more complicated.<br />

2.1 Phase-Plane Analysis<br />

Consider an ordinary point (x; y) lying near a ¯xed point (x0;y0). From equation<br />

(2.1), the general expression for the slope of a trajectory at (x; y) is<br />

dy=dx = Q(x; y)=P(x; y): (2.2)<br />

At a stationary point, Q(x0;y0) =P (x0;y0) = 0, while at ordinary points,<br />

although either Q or P may be zero (corresponding to zero slope or in¯nite<br />

slope), they are not zero simultaneously. For ordinary points close to a given<br />

¯xed point, we can write x = x0 + u, y = y0 + v, whereuand v are small, so<br />

that equation (2.2) becomes<br />

dy<br />

dx = Q(x0 + u; y0 + v)<br />

: (2.3)<br />

P (x0 + u; y0 + v)<br />

47


48 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

Taylor expanding the right-hand side of (2.3) in powers of u and v yields<br />

dy dv<br />

=<br />

dx du = cu+ dv+ c 0 u2 + d 0 v2 + f 0 uv+ ¢¢¢<br />

au+ bv+ a 0 u2 + b 0 v2 + e 0 ; (2.4)<br />

uv+ ¢¢¢<br />

where the coe±cients<br />

μ μ μ <br />

μ <br />

@P<br />

@P<br />

@Q<br />

@Q<br />

a ´<br />

; b ´<br />

; c ´<br />

; d ´<br />

;<br />

@x<br />

@y<br />

@x<br />

@y<br />

x0;y0<br />

x0;y0<br />

x0;y0<br />

x0;y0<br />

etc., are real since Q, P were assumed to be real.<br />

For a linear model, only linear terms in u and v will be present in equation<br />

(2.4), the coe±cients a 0 ´ (@2P=@x2 )x0;y0, b 0 ´ (@2P=@y2 )x0;y0, etc., being<br />

identically zero. On the other hand, for a nonlinear model, higher-order terms<br />

corresponding to some of these coe±cients being nonzero must be present.<br />

A simple stationary point for a nonlinear model is one in the neighborhood<br />

of which the qualitative behavior of the trajectories is correctly described by<br />

retaining only the linear terms in u and v in equation (2.4), so that<br />

dv cu+ dv<br />

= : (2.5)<br />

du au+ bv<br />

Clearly, if a, b, c, anddarenonzero and u and v are su±ciently small, then<br />

equation (2.5) should be a good approximation to equation (2.4), the higherorder<br />

terms in u and v making only small corrections that, except for the<br />

vortex, 1 do not qualitatively change the nature of the trajectories.<br />

If, on the other hand, c and d (or a and b) both vanish, then higher-order<br />

terms should be kept in the numerator (or denominator). Even for a, b, c, and<br />

d all nonzero, one can have au + bv =0andcu+ dv =0foruand v 6= 0<br />

(u, v = 0 corresponds to the ¯xed point (x0;y0) of interest), in which case<br />

higher-order terms should be kept in both the numerator and denominator. A<br />

nontrivial solution of cu+ dv =0,au+ bv = 0, can occur only if the system<br />

has zero determinant:<br />

¯ ¯<br />

¯ c d ¯<br />

¯ a b ¯ = bc¡ ad=0: (2.6)<br />

If this occurs, the stationary point is no longer simple (i.e., it is not determined<br />

by linear terms in u and v alone). Since setting either c and d or a and b equal<br />

to zero also makes bc¡ ad vanish, it follows that a simple ¯xed point can occur<br />

if bc¡ ad 6= 0. In the neighborhood of such a stationary point, the trajectories<br />

are described by equation (2.5), so their nature is completely determined by<br />

the four coe±cients a, b, c, andd.<br />

Next we shall establish that there are only four types of simple ¯xed points<br />

for the two-dimensional phase plane, namely the vortex, focal, nodal, and saddle<br />

points introduced in Chapter 1. The expression (2.5) for dv=du can be thought<br />

of as resulting from a pair of coupled ¯rst-order linear ODEs, viz.,<br />

_u = au+ bv; _v = cu+ dv: (2.7)<br />

1 Even the smallest corrections can change a vortex into a focal point.


2.1. PHASE-PLANE ANALYSIS 49<br />

Solving for v in the ¯rst equation and substituting into the second yields the<br />

second-order linear ODE<br />

Äu + p _u + qu=0; with p ´¡(a + d); q ´ ad¡ bc: (2.8)<br />

Since this ODE has constant coe±cients, a solution of the form u = e¸t is<br />

sought. Substituting u into (2.8) yields the quadratic auxiliary equation<br />

¸ 2 + p¸+ q =0; with two roots; ¸1;2 = ¡ p 1 p<br />

§ p2 ¡ 4 q: (2.9)<br />

2 2<br />

These roots may be either real or complex. Since the general solution u is a<br />

linear combination of e ¸1 t and e ¸2 t ,itisclearthatu ! 0ast !1if the<br />

real parts of both ¸1 and ¸2 arenegativeandu !1if either one (or both) of<br />

the roots has a positive real part. For the former, the stationary point will be<br />

stable, while for the latter it will be unstable.<br />

For simple ¯xed points, ad¡ bc ´ q 6= 0, so a zero ¸ root is not possible.<br />

The case q = 0 corresponds to a higher-order stationary point, which will be<br />

illustrated later. The possible roots ¸1, ¸2, which dictate the topological nature<br />

of the ¯xed point, depend on the relative size and signs of p and q. First, let's<br />

consider q>0andp 6= 0. Three cases have to be examined:<br />

² For p 2 > 4q, both the roots ¸1 and ¸2 arerealandofthesamesign,<br />

negative for p>0andpositiveforp0, the general solution<br />

for u is of the structure u = Ae ¡j¸1j t + Be ¡j¸2j t (A, B are arbitrary<br />

constants), while for p0<br />

and unstable nodal points for p0isthe<br />

critically damped SHO.<br />

² For p2 ¡ 4 q0, and unstable focal points for p


50 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

For q>0, now consider the case p =0. Thetworoots,¸1 and ¸2, arenow<br />

purely imaginary, viz., ¸1;2 = § iq, and the general solution is of the undamped<br />

oscillatory form u = A cos(qt)+B sin(qt). The solution is characteristic of<br />

trajectories in the vicinity of a vortex point.<br />

Finally, we examine the situation in which q0 has been labeled as<br />

vortices and focal points, rather than vortices alone. This is because the analysis<br />

for the vortices is not de¯nitive for nonlinear models, 2 sincewehavekept<br />

only ¯rst-order terms in u and v in the Taylor expansion (2.4). Higher-order<br />

terms in the expansion may turn vortices into focal points. With the Taylor expansion<br />

option available in Maple, we could, of course, keep higher-order terms<br />

in an attempt to distinguish between the two types of ¯xed points. This can be<br />

done for individual cases, but it is di±cult to make \global" statements that<br />

2 For linear ODE models, recall that higher-order terms are not present and one can have<br />

vortices only for p =0andq>0.<br />

q


2.1. PHASE-PLANE ANALYSIS 51<br />

apply to all nonlinear systems. A simple global theorem, which is left for the<br />

reader to prove, is due to Poincare:<br />

Suppose that for the system of equations _x = P (x; y), _y = Q(x; y), thefunctions<br />

P (x; y), Q(x; y) satisfy, in the neighborhood of the stationary point O, the<br />

conditions for O to be a vortex or a focus. If P (x; y) and Q(x; y) satisfy the<br />

conditions P (x; ¡y) =¡P (x; y), Q(x; ¡y) =Q(x; y), thenO is a vortex.<br />

In some situations, P and Q may not satisfy the above conditions, yet O is a<br />

vortex. Poincare's theorem represents a su±cient condition for the existence of<br />

a vortex, but is not a necessary condition.<br />

2.1.1 Foxes Munch Rabbits<br />

As for life, it is a battle ...<br />

Marcus Aurelius Antonius, Roman emperor and philosopher (AD 121{180)<br />

In mathematical biology there has been a great deal of interest in predator{prey<br />

systems in which certain animal species (the predator) survive by munching or<br />

crunching on one or more others (the prey). As a simple example, suppose that<br />

a species of fox survives by eating jackrabbits in the rolling hills of Rainbow<br />

County. The rabbits in turn subsist on the available vegetation, of which we<br />

shall assume there is an adequate supply. A model of this predator{prey interaction<br />

can be built up phenomenologically. Let's call f(t) andr(t) the fox and<br />

jackrabbit numbers per unit area (acre, hectare, or whatever) at time t.<br />

If no foxes were present, the rabbit population would increase, the rate<br />

of increase assumed to be proportional to the number of rabbits present, i.e.,<br />

_r(t) = A1 r(t), with the rate constant A1 positive. On the other hand, if<br />

no rabbits were present, the foxes would starve to death and their numbers<br />

decrease, the rate equation being _ f(t) =¡A2 f(t), with A2 > 0.<br />

With both species present, the probability of an interaction will be proportional<br />

to the product r(t) f(t) of the population numbers. For the foxes the<br />

interaction will be positive in nature, but negative for the rabbits. Thus, the<br />

simple phenomenological model takes the following form:<br />

_r = A1 r ¡ B1 rf; f _ = ¡A2 f + B2 rf; (2.10)<br />

with the interaction coe±cients B1 and B2 positive. In practice, mathematical<br />

biologists create more realistic models with other factors taken into consideration<br />

and the coe±cient values determined from observational data. Despite its<br />

simple appearance, this set of nonlinear ODEs cannot be solved analytically.<br />

To begin the recipe, the DEtools library package is loaded because a phaseplane<br />

portrait will be constructed.<br />

> restart: with(DEtools):<br />

We enter the following numerical values: A1 =2, A2 =1, B1 =3=100, and<br />

B2 =1=100, for the coe±cients. The coe±cient numbers are strictly arti¯cial,


52 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

and you should feel free to experiment with di®erent positive values.<br />

> A[1]:=2: A[2]:=1: B[1]:=3/100: B[2]:=1/100:<br />

The nonlinear functions P =A1 r ¡ B1 rf and Q=¡A2 f + B2 rf, corresponding<br />

to the right-hand sides of the ODEs in (2.10), are entered as \functional<br />

operators" using the \arrow notation."<br />

> P:=(r,f)-> A[1]*r-B[1]*r*f;<br />

P := (r; f ) ! A1 r ¡ B1 rf<br />

> Q:=(r,f)-> -A[2]*f+B[2]*r*f;<br />

Q := (r; f) !¡A2f + B2 rf<br />

The \arrow" (->) in the above inputs is formed on the keyboard by entering a<br />

\hyphen" followed by a \greater than" sign. The operation or \procedure" on<br />

the right-hand side of each arrow will be applied when the two3 variables r and<br />

f on the left-hand side are supplied as arguments to P and Q. For example,<br />

let's take r =100andf =10andcalculateP (100; 10).<br />

> P(100,10); #example<br />

170<br />

The procedure on the rhs of P has been applied with the coe±cient values<br />

automatically substituted, namely, 2 £ 100 ¡ (3=100) £ 100 £ 10 = 170.<br />

To classify the stationary points, we need to evaluate a, b, c, andd, which<br />

respectively involve the partial derivatives @P=@r, @P=@f, @Q=@r, and@Q=@f<br />

evaluated at the stationary points. A functional operator F is introduced to<br />

di®erentiate an arbitrary quantity X(r; f ) with respect to a variable v.<br />

> F:=(X,v)->diff(X(r,f),v):<br />

Then F is used to calculate the four relevant partial derivatives of P and Q.<br />

> a:=F(P,r): b:=F(P,f): c:=F(Q,r): d:=F(Q,f):<br />

The results have been labeled a, b, c, andd, but remember that the derivatives<br />

must still be evaluated at each stationary point. So let's locate the stationary<br />

points by solving P (r; f) =0andQ(r; f)=0forr and f.<br />

> sol:=solve(fP(r,f)=0,Q(r,f)=0g,fr,fg);<br />

½<br />

sol := fr =0;f=0g; f = 200<br />

3 ;r=100<br />

¾<br />

There are two ¯xed points, one at the origin (r =0, f = 0) and the second at<br />

r =100, f =200=3=662. By choosing one of the ¯xed points and assigning the<br />

3<br />

solution, the coordinates will automatically be substituted into the expressions<br />

that follow. Let's select the nonzero ¯xed point, which is the second solution<br />

here. As a check, the coordinates r0 and f0 of the ¯xed point are displayed.<br />

> assign(sol[2]); r0:=r; f0:=f;<br />

r0 := 100 f0 := 200<br />

3<br />

Then the values of a, b, c, anddare determined for the assigned ¯xed point.<br />

3 Any (¯nite) number of variables may be used.


2.1. PHASE-PLANE ANALYSIS 53<br />

> a:=a; b:=b; c:=c; d:=d;<br />

a := 0 b := ¡3 c := 2<br />

d := 0<br />

3<br />

The quantities p = ¡(a + d) andq = ad¡ bc are calculated.<br />

> p:=-(a+d); q:=a*d-b*c;<br />

p := 0 q := 2<br />

Referring to Figure 2.1, these values of p and q indicate that the stationary<br />

point must be either a vortex or a focal point. Instead of always referring<br />

back to the p-q picture in the text when tackling other examples, it is more<br />

convenient to create the picture directly in the code and place the (q, p) point<br />

on it. The range of q and p in the ¯gure will be set to be from R = ¡3 to<br />

+3. For other stationary-point problems, this range may have to be adjusted.<br />

Further, the display command will be used to superimpose a number of graphs<br />

in the same ¯gure. This command is found in the plots library package, which<br />

is now loaded.<br />

> R:=3: with(plots):<br />

The ¯rst graph, assigned the name gr1, usesthepointplot command to plot<br />

the point (q, p) (entered as a list) as a size-20 blue box. The default size is 10.<br />

> gr1:=pointplot([q,p],symbol=box,symbolsize=20,color=blue):<br />

The second graph, gr2, plotsthetwobranchesp = § p 4 q of the parabola that<br />

divides the focal point and nodal point regions in the p-q diagram. Note that<br />

q is entered as qq (which ranges from ¡R to R), because q has already been<br />

assigned a speci¯c value. The resulting parabola is represented by a thick (the<br />

default thickness is 0) red curve on the computer screen. The minimum number<br />

of plotting points is taken to be 250, the default being 50.<br />

> gr2:=plot([sqrt(4*qq),-sqrt(4*qq)],qq=-R..R,<br />

numpoints=250,thickness=2,color=red):<br />

The third graph, gr3, generates a thick green line along the p=0 axis between<br />

q =0 andq =R and along the q =0 axis between p=¡R and p=+R.<br />

> gr3:=plot([[[0,0],[R,0]],[[0,-R],[0,R]]],style=line,<br />

color=green,thickness=3):<br />

Using the textplot command, the fourth graph labels the various regions of<br />

the p-q diagram. Here sFP stands for stable Focal Point, uFP for unstable Focal<br />

Point, sNP for stable Nodal Point, uNP for unstable Nodal Point, SP for Saddle<br />

Point, and V and FP for Vortices and Focal Points. The two numbers in each<br />

list are determined by trial and error and indicate the horizontal and vertical<br />

locations of each string of letters.<br />

> gr4:=textplot([[1,0.9,"sFP"],[1,-0.9,"uFP"],<br />

[0.7,2.5,"sNP"],[0.7,-2.5,"uNP"],[-1,0.8,"SP"],<br />

[-1,-0.8,"SP"],[1,0.2,"V and FP "]]):<br />

All four graphs are superimposed with the display command, the axes being<br />

labeled, and the minimum number of tickmarks along each axis speci¯ed.<br />

> display(fgr1,gr2,gr3,gr4g,labels=["q","p"],tickmarks=[3,3]);


54 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

SP<br />

SP<br />

p<br />

2<br />

–2<br />

sNP<br />

sFP<br />

V and FP<br />

–2 2 q<br />

uFP<br />

uNP<br />

Figure 2.2: p-q diagram for the second ¯xed point.<br />

The resulting p-q diagram is shown in Figure 2.2, the location of the box at<br />

p =0,q = 2 indicating that the second stationary point is either a vortex or a<br />

focal point. As you may verify, assigning the ¯rst ¯xed point would move the<br />

box to the saddle-point region of the p-q diagram.<br />

So, is the second ¯xed point a vortex or a focal point? Let's apply Poincare's<br />

theorem. Forming P (r0 + u; f0 ¡ v)+P (r0 + u; f0 + v) andQ(r0 + u; f0 ¡ v) ¡<br />

Q(r0 + u; f0 + v) and expanding,<br />

> expand(P(r0+u,f0-v)+P(r0+u,f0+v));<br />

0<br />

> expand(Q(r0+u,f0-v)-Q(r0+u,f0+v));<br />

¡ uv<br />

50<br />

we see that the ¯rst relation yields zero, but the second doesn't. So Poincare's<br />

theorem is inconclusive here. A phase-plane portrait that includes the two ¯xed<br />

points should settle this issue.<br />

To proceed, the quantities r and f are unassigned from their previous values,<br />

> unassign('r','f'):<br />

and the rabbits{foxes equations generated using the operators P and Q.<br />

> req:=diff(r(t),t)=P(r(t),f(t));<br />

req := d<br />

3<br />

r(t) =2r(t) ¡ r(t) f (t)<br />

dt 100


2.1. PHASE-PLANE ANALYSIS 55<br />

> feq:=diff(f(t),t)=Q(r(t),f(t));<br />

feq := d<br />

1<br />

f (t) =¡f (t)+ r(t) f (t)<br />

dt 100<br />

A phase-plane portrait operator PP is formed to generate a phase-plane portrait<br />

for the rabbits{foxes equations over the time interval t = 0 to 10 time units,<br />

given an initial population of 100 rabbits and 5 foxes (per unit area). The scene<br />

variables x and y and the linecolor c must be speci¯ed. Instead of the default<br />

color red, the tangent ¯eld arrows are colored blue.<br />

> PP:=(x,y,c)->phaseportrait([req,feq],[r(t),f(t)],<br />

t=0..10,[[r(0)=100,f(0)=5]],stepsize=0.01,scene=[x,y],<br />

color=blue,linecolor=c,arrows=MEDIUM,dirgrid=[25,25]):<br />

The operator PP is used to plot a red-colored phase-plane trajectory in the f<br />

versus r plane, the resulting picture being shown in Figure 2.3.<br />

> PP(r,f,red);<br />

250<br />

200<br />

f<br />

100<br />

50<br />

0<br />

100 200 r 400 500 600<br />

Figure 2.3: The phase-plane portrait of the rabbits{foxes interaction.<br />

The phase-plane trajectory is a closed loop around the stationary point at<br />

r0 =100,f0 =66 2<br />

3 , indicating that this stationary point is probably4 avortex,<br />

not a focal, point. The behavior of the trajectory and the appearance of the<br />

tangent ¯eld near the origin is consistent with the origin being a saddle point.<br />

The temporal evolution of the rabbit and fox population numbers can be<br />

observed by entering PP(t,r,blue) and PP(t,f,red) and superimposing the<br />

blue and red curves using the display command. This produces Figure 2.4,<br />

the taller curve in this black-and-white rendition being for the rabbits.<br />

4 One can feel more con¯dent about this conclusion by considering other initial conditions<br />

and taking longer time intervals.


56 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

> display([PP(t,r,blue),PP(t,f,red)],labels=["t","r,f"]);<br />

600<br />

500<br />

400<br />

r,f<br />

200<br />

100<br />

0<br />

2 4 6 8 10<br />

t<br />

Figure 2.4: Periodic variation in the rabbits{foxes population numbers.<br />

The periodic variation in population numbers is clearly seen, the two curves<br />

being slightly out of phase with each other as one would intuitively expect.<br />

You might argue that this cyclic result depends on the particular values chosen<br />

for the coe±cients in the model. As you may con¯rm, choosing other positive<br />

values shifts the vortex-point location but doesn't destroy the periodicity.<br />

quantity<br />

160<br />

120<br />

80<br />

40<br />

snowshoe hare<br />

lynx<br />

1845 1855 1865 1875 1885 1895 1905 1915 1925 1935<br />

year<br />

Figure 2.5: Trading records of fur catches for the Hudson's Bay Company.<br />

Although the above predator{prey model is a phenomenological and oversimpli¯ed<br />

model of reality, the cyclic variations in population numbers that it<br />

predicts is a feature that has been observed in nature for di®erent predator{<br />

prey interactions. For example, this can be seen in Figure 2.5, which shows the<br />

trading records for the period 1845 to 1935 of fur catches by trappers working in<br />

the Canadian north for the Hudson's Bay Company. In this case the lynx were<br />

the predators and the snowshoe hares the prey. Of course, the periodic vari-


2.1. PHASE-PLANE ANALYSIS 57<br />

ations observed in the lynx and snowshoe hare data curves are not as smooth<br />

and regular as in our idealized mathematical model.<br />

PROBLEMS:<br />

Problem 2-1: Iron core inductor<br />

Consider the simple circuit shown in Figure 2.6, consisting of a charged capacitor<br />

C connected to a coil of N turns wrapped around an iron core. The current i<br />

C<br />

i<br />

iron core<br />

inductor<br />

Figure 2.6: Iron core inductor circuit.<br />

versus °ux © relation for the iron core inductor has the form i = N ©=L0+A © 3 ,<br />

where L0 is the self-inductance of the coil, © is the °ux threading through one<br />

turn of the coil, and A>0.<br />

(a) Using Kirchho®'s voltage rule, show that the governing ODE is given by<br />

Ä©+® ©+¯ © 3 =0;<br />

where ® and ¯ are left for you to identify.<br />

(b) Reexpress the ODE in a dimensionless form with ® and ¯ scaled out.<br />

(c) Analytically show that the origin of the phase plane is a vortex. Con¯rm<br />

with a phase-plane ( _ © versus ©) portrait containing a representative orbit.<br />

(d) Usethesceneoptiontoplot©(t).<br />

Problem 2-2: Competing armies<br />

The armies of two warring countries are modeled by the following equations:<br />

_<br />

C1 = ®C1 ¡ ¯C1 C2;<br />

_<br />

C2 =(® +1)C2 ¡ °¯C1 C2;<br />

with ® and ¯ both positive and °>1. Here C1 and C2 are the numbers of<br />

individuals in the armies of countries 1 and 2.<br />

(a) Discuss the model equations and how the model could be improved.<br />

(b) Analytically locate and identify all the stationary points.<br />

(c) Taking ® = 5, ° = 1:15, and ¯ = 1=2500, make a tangent ¯eld plot<br />

that includes all stationary points and some representative trajectories.<br />

Discuss possible outcomes on the basis of this plot.<br />

(d) Using appropriate scene options, create plots of C1(t) andC2(t).


58 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

Problem 2-3: Vortex or focal point?<br />

You are told that the following system has either a vortex or a focal point at<br />

the origin. Analytically determine which it is and support your conclusion by<br />

creating a suitable phase-plane portrait.<br />

_x = y + x (x 2 + y 2 ); _y = ¡x + y (x 2 + y 2 )<br />

2.1.2 The Mona Lisa of Nonlinear Science<br />

Opinion is like a pendulum .... If it goes past the center of gravity on<br />

one side, it must go a like distance on the other.<br />

Arthur Schopenhauer, German philosopher (1788{1860)<br />

In the world of art, one of the most famous portraits ever painted is that of<br />

a woman with an enigmatic smile, referred to as the Mona Lisa. The artist<br />

was the Italian Leonardo da Vinci (1452{1519), who was not only a painter,<br />

but also a sculptor, architect, musician, and scientist. If Leonardo were alive<br />

today, he would probably appreciate on esthetic, as well as scienti¯c, grounds<br />

one of the most important phase-plane portraits of nonlinear science, that of<br />

the simple plane pendulum. If we may make a puny pun, the plane pendulum<br />

is not so plain as its name implies.<br />

θ<br />

L<br />

mgsinθ<br />

m<br />

θ<br />

mg<br />

Figure 2.7: A simple plane pendulum.<br />

What is a simple plane pendulum? It can be modeled as a small mass m<br />

attached to the end of a very light rigid rod of length L that is allowed to<br />

swing freely in a circular arc in the vertical plane as shown in Figure 2.7. Our


2.1. PHASE-PLANE ANALYSIS 59<br />

goal is to derive the equation of motion, locate and classify all of the possible<br />

stationary points, and determine all possible solutions of the simple pendulum.<br />

The necessary packages to carry out this program are now loaded.<br />

> restart: with(plots): with(DEtools): with(PDEtools):<br />

The plots library package contains the display command for superimposing<br />

plots and the textplot command for placing text on a ¯gure. The DEtools<br />

package is needed in order to use the DEplot command to produce a phaseplane<br />

portrait. Finally, the PDEtools package contains the dchange command,<br />

which will enable us to make variable changes in the equation of motion.<br />

Since the coe±cient ° will be introduced as a normalized damping coe±cient,<br />

it must be unprotected from its Maple assignment as Euler's constant.<br />

> unprotect(gamma);<br />

If μ(t) is the angle in radians that the pendulum rod makes with the vertical<br />

at time t, g is the acceleration due to gravity, and the air resistance is assumed<br />

to be proportional to the angular velocity dμ=dt with damping coe±cient ¡,<br />

Newton's second law, applied in the direction tangent to the circular arc, yields<br />

> eq1:=m*L*diff(theta(t),t,t)=-m*g*sin(theta(t))<br />

-Gamma*diff(theta(t),t);<br />

μ <br />

μ 2 d d<br />

eq1 := mL μ(t) = ¡mgsin(μ(t)) ¡ ¡<br />

dt2 dt μ(t)<br />

<br />

On dividing eq1 by mg and expanding, eq2 results.<br />

> eq2:=expand(eq1/(m*g));<br />

μ <br />

μ 2 d d<br />

L μ(t)<br />

¡<br />

dt2 dt<br />

eq2 :=<br />

= ¡sin(μ(t)) ¡<br />

g<br />

μ(t)<br />

<br />

mg<br />

Noting that the radian is actually a dimensionless unit, it is clear from the ¯rst<br />

term in eq2 that p L=g has the units of time. The reciprocal of this quantity<br />

is the characteristic frequency ! of the plane pendulum, which is entered.<br />

> omega:=sqrt(g/L);<br />

r<br />

g<br />

! :=<br />

L<br />

A new dimensionless time variable ¿ = !tis introduced in the following transformation<br />

tr. Since the angle μ is already dimensionless, the transformation<br />

of eq2 into a completely dimensionless form is quite trivial. If Maple is used,<br />

however, the dependent variable μ(t) must be replaced by a new symbol, say,<br />

£(¿), in the variable transformation. The \old" variables are placed on the left<br />

of the transformation set, the \new" variables on the right.<br />

> tr:=ft=tau/omega,theta(t)=Theta(tau)g;<br />

8<br />

><<br />

tr := μ(t) =£(¿); t=<br />

>:<br />

¿<br />

9<br />

>=<br />

r<br />

g >;<br />

L


60 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

Thevariabletransformationofeq2 is implemented in eq3 with the dchange<br />

command. The ¯rst argument is the variable transformation tr, the second<br />

argument the equation to be transformed, the third argument the new variables,<br />

and the last optional argument is to simplify the result.<br />

> eq3:=dchange(tr,eq2,[Theta(tau),tau],simplify);<br />

eq3 := d2<br />

μ<br />

d<br />

sin(£(¿)) mg+¡<br />

d¿<br />

£(¿) =¡<br />

d¿ 2 £(¿)<br />

r<br />

g<br />

L<br />

mg<br />

The equation is further simpli¯ed by de¯ning a dimensionless damping coef-<br />

¯cient ° through the relation ¡ = 2 °mg=!. Inclusion of the factor 2 is a<br />

matter of taste, a choice often made for damped harmonic oscillator systems.<br />

Substituting this expression for ¡ into eq3 and expanding,<br />

> eq4:=expand(subs(Gamma=2*gamma*m*g/omega,eq3));<br />

eq4 := d2<br />

μ<br />

d<br />

£(¿) =¡sin(£(¿)) ¡ 2 °<br />

d¿ 2 d¿ £(¿)<br />

<br />

yields eq4 , the dimensionless equation of motion for the plane pendulum.<br />

To make a phase-plane portrait, this second-order nonlinear ODE is reexpressed<br />

as two coupled ¯rst-order equations by setting the angular velocity<br />

d£=d¿ = V (¿) ineq5 , and substituting eq5 into eq4 .<br />

> eq5:=diff(Theta(tau),tau)=V(tau);<br />

> eq6:=subs(eq5,eq4);<br />

eq5 := d<br />

£(¿) =V (¿)<br />

d¿<br />

eq6 := d<br />

V (¿) =¡sin(£(¿)) ¡ 2 °V (¿)<br />

d¿<br />

From the right-hand sides of eq5 and eq6 ,theformsofPand Q needed to<br />

analyze the possible stationary points are easily identi¯ed and now entered.<br />

> P:=V; Q:=-sin(Theta)-2*gamma*V;<br />

P := V Q := ¡sin(£) ¡ 2 °V<br />

The derivatives @P=@£, @P=@V , @Q=@£, @Q=@V are calculated in a, b, c, d.<br />

> a:=diff(P,Theta): b:=diff(P,V): c:=diff(Q,Theta): d:=diff(Q,V):<br />

The quantities a, b, c, andd still have to be evaluated at the stationary points,<br />

which are found by solving P =0,Q = 0 for the unknowns £ and V .<br />

> sol:=solve(fP,Qg,fTheta,Vg);<br />

sol := f£ =0;V =0g<br />

There is a ¯xed point at the origin of the phase plane, corresponding to the<br />

pendulum at rest with the supporting rod oriented vertically downward (μ =0<br />

in Figure 2.7). This is obvious on physical grounds, since the ¯xed point arises<br />

because there is a zero net force on the mass m in this position. The downward<br />

pull of gravity on m is balanced by the upward tension in the supporting rod.


2.1. PHASE-PLANE ANALYSIS 61<br />

But the net force on m would also be zero if the pendulum were oriented<br />

vertically upward (μ = ¼). If the mass also has zero initial angular velocity, it<br />

will remain at rest, so the point (μ = ¼, V =0)mustbeanotherstationary<br />

point in the phase plane. Clearly, this second ¯xed point is one of unstable<br />

equilibrium, since the slightest nudge would cause the pendulum to move away<br />

from μ = ¼. So, why didn't the solve command produce a second solution<br />

to the equations P = 0, Q = 0? The reason is that the sine function is<br />

a transcendental function, so that in order to obtain the stationary points,<br />

one must solve an inverse transcendental function. To return the entire set of<br />

stationary points, we must make use of the following command line.<br />

> _EnvAllSolutions:=true:<br />

On applying the solve command a second time to the equations P =0,Q =0,<br />

> Sol:=solve(fP,Qg,fTheta,Vg); assign(Sol);<br />

Sol := f£ =¼ Z1 ;V =0g<br />

and noting that the symbol Z1 in the output stands for integer value, the<br />

complete family of stationary points is obtained for the simple pendulum. This<br />

new solution, Sol, is assigned.<br />

For Z1 =0 and Z1 = 1, the ¯xed points (μ =0,V =0) and (μ = ¼, V =0)<br />

result. The other stationary points corresponding to Z1 =2; 3; 4; ::: and<br />

Z1 =¡1; ¡2; ¡3; ::: re°ect the mathematical periodicity of the sine function,<br />

which has a period 2 ¼. Physically, for example, the angular position μ =2¼ is<br />

the same as μ = 0. In our analysis of the types of stationary points, we shall<br />

therefore concentrate on the points (μ =0,V =0) and (μ =¼, V =0).<br />

Continuing, the quantities p = ¡(a + d) andq = ad¡ bc are evaluated,<br />

> p:=-(a+d); q:=a*d-b*c;<br />

p := 2 ° q := (¡1) Z1<br />

and found to be p =2°, while q =+1forZ1 = 0 (or any even integer) and<br />

q = ¡1 forZ1 = 1 (or any odd integer). Let's label the former q value as q1<br />

and the latter as q2 .<br />

> q1:=1: q2:=-1:<br />

Three di®erent ° values, °1 =0,°2 =0:1, and °3 =1:25, are entered, the<br />

numbers selected to reveal di®erent physical behaviors of the pendulum.<br />

> gamma[1]:=0: gamma[2]:=0.1: gamma[3]:=1.25:<br />

In the following do loop,<br />

> for i from 1 to 3 do<br />

two plotting points, corresponding to the stationary points at (μ =0,V =0) and<br />

at (μ =¼, V =0), are calculated for each ° value,<br />

> pt1:=[q1,subs(gamma=gamma[i],p)];<br />

> pt2:=[q2,subs(gamma=gamma[i],p)];<br />

and three plots formed, the ¯xed points represented by size-20 blue circles.<br />

> pl[i]:=plot(fpt1,pt2g,style=point,symbol=circle,<br />

symbolsize=20,color=blue):


62 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

> end do:<br />

Now the rest of the p-q diagram is created. The parabola p 2 =4q is plotted as<br />

a thick red line over the range q = ¡2 to+2. Notethatthe\dummyvariable"<br />

r is used below instead of q as the latter has already been assigned.<br />

> pl[4]:=plot([sqrt(4*r),-sqrt(4*r)],r=-2..2,<br />

numpoints=250,thickness=2,color=red):<br />

The segments q =0 to +2 along the q-axis, and p = ¡3 to+3alongthep-axis,<br />

are plotted as thick green lines.<br />

> pl[5]:=plot([[[0,0],[2,0]],[[0,-3],[0,3]]],style=line,<br />

color=green,thickness=3):<br />

The various regions of the p-q plane are labeled in the same manner as the<br />

previous recipe.<br />

> pl[6]:=textplot([[1,0.8,"sFP"],[1,-0.8,"uFP"],<br />

[0.7,2.5,"sNP"],[0.7,-2.5,"uNP"],[-1,0.8,"SP"],<br />

[-1,-0.8,"SP"],[1.7,0.2,"V/FP"]]):<br />

The six plots are superimposed to produce the entire p-q diagram in Figure 2.8.<br />

> display(fseq(pl[i],i=1..6g,labels=["q","p"],tickmarks=[2,3]);<br />

SP<br />

–2<br />

q<br />

V/FP<br />

2<br />

SP<br />

2<br />

p<br />

–2<br />

sNP<br />

uNP<br />

sFP<br />

uFP<br />

Figure 2.8: p-q diagram for a simple pendulum.<br />

From bottom to top, the pairs of points in Figure 2.8 correspond to ° =0,<br />

° = 0:1, and ° = 1:25. In all three cases, the point on the left, which is<br />

associated with the ¯xed point (μ = ¼, V = 0), is an unstable saddle point.<br />

Because of the mathematical periodicity of the sine function, saddle points


2.1. PHASE-PLANE ANALYSIS 63<br />

will also occur at (μ = ¡¼; §3 ¼; :::, V =0). The¯xedpointsontheright<br />

correspond to (μ =0,V =0)aswellas(μ = §2 ¼; :::, V =0). For° =0,<br />

the ¯xed point is a vortex or a focal point. Applying Poincare's theorem, the<br />

reader will be able to con¯rm that it is a vortex. For ° =0:1, the damping<br />

coe±cient is su±ciently small that (μ =0,V = 0) is a stable focal point, while<br />

for ° =1:25 the damping is su±ciently large that a stable nodal point results.<br />

With the stationary point analysis completed, a phase-plane portrait is now<br />

constructed for each of the ° values. First, the values of £ and V are unassigned.<br />

> unassign('Theta','V'):<br />

Two initial conditions are chosen, both corresponding to pulling the pendulum<br />

to the left of the vertical so that the initial angle is ¡2 radians (about ¡115 ± ).<br />

For ic1 the pendulum is given an initial angular velocity of 2:75 radians per<br />

second, while for ic2 it is released from rest.<br />

> ic1:=Theta(0)=-2,V(0)=2.75;<br />

ic1 := £(0) = ¡2; V (0) = 2:75<br />

> ic2:=Theta(0)=-2,V(0)=0;<br />

ic2 := £(0) = ¡2; V (0) = 0<br />

A functional operator de is formed to evaluate the di®erential equation eq6 for<br />

the ith ° value.<br />

> de:=i->eval(eq6,gamma=gamma[i]):<br />

Another arrow operator, G, is introduced which uses the DEplot command<br />

to produce a phase-plane portrait for the two initial conditions. Using the<br />

linecolor option, the trajectories are colored red. A tangent ¯eld of fullheaded<br />

blue-colored arrows is also included. The argument i =1,2,or3must<br />

be provided for the operator G.<br />

> G:=i->DEplot([eq5,de(i)],[Theta(tau),V(tau)],tau=0..25,<br />

[[ic1],[ic2]],Theta=-2..8.5,V=-2..3.5,stepsize=0.05,<br />

color=blue,linecolor=red,arrows=MEDIUM,<br />

dirgrid=[30,30]):<br />

Entering G(1) and G(2),<br />

> G(1); G(2);<br />

produces Figures 2.9 and 2.10, corresponding to ° =0and° =0:1, respectively.<br />

In Figure 2.9, the vortex ¯xed points at V =0and£=0and2¼can be<br />

clearly seen, as well as the saddle point at V =0,£=¼.<br />

The closed curve encircling the vortex point at the origin is for the second<br />

initial condition (zero initial velocity). In this case, the mass has insu±cient<br />

initial energy to swing over the top, i.e., past the saddle point. The direction<br />

of increasing time is indicated by the tangent-¯eld arrows.<br />

For the ¯rst initial condition (nonzero initial velocity), on the other hand,<br />

the initial energy is su±ciently large that the pendulum can swing over the top.<br />

Since no damping is present, the pendulum continues to move in the positive<br />

μ-direction, alternately speeding up and slowing down, but never approaching<br />

a stationary point.


64 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

V<br />

3<br />

–2 8<br />

Theta<br />

–2<br />

Figure 2.9: Phase-plane diagram for ° =0.<br />

V<br />

3<br />

–2 8<br />

Theta<br />

–2<br />

Figure 2.10: Phase-plane diagram for ° =0:1.<br />

Figure 2.10, corresponding to ° =0:1, displays a completely di®erent behavior.<br />

Due to the presence of small damping, the vortices have turned into stable<br />

focal points. For ic2 , the pendulum initially overshoots μ = 0 but eventually<br />

winds onto the origin. For ic1 , the pendulum makes it over the top once, before<br />

winding onto the stationary point (μ =2¼, V = 0). Physically, of course, this


2.1. PHASE-PLANE ANALYSIS 65<br />

point corresponds to the vertically downward position of the pendulum rod.<br />

The third graph, for ° =1:25, is shown in Figure 2.11. Because the trajectories<br />

turn out to be con¯ned to a limited region of the phase plane, we use the<br />

display command to better control the viewing range of G(3) and e®ectively<br />

magnify the region of interest. Care must be taken in doing this, since the<br />

number of tangent-¯eld arrows is correspondingly reduced and their directions<br />

may not accurately re°ect the directions of the trajectories.<br />

> display(G(3),view=[-2..1,-0.5..3],tickmarks=[3,3]);<br />

–2 –1 1<br />

Theta<br />

Figure 2.11: Phase-plane diagram for ° =1:25.<br />

The damping is now su±ciently large that both trajectories approach the stable<br />

nodal point at the origin. One would have to increase the initial angular velocity<br />

to see any over-the-top behavior before things settle down to a stable nodal<br />

point. Here, the two trajectories merge along a common path for large times.<br />

From an artistic, as well as a scienti¯c, viewpoint Leonardo da Vinci would<br />

undoubtedly have appreciated the many di®erent faces revealed by the, perhaps<br />

not so plain, plane pendulum.<br />

PROBLEMS:<br />

Preamble: For each of the nonlinear ODE systems in the following set of<br />

problems, carry out the following steps:<br />

(1) Use the p-q diagram approach to locate and identify the stationary points<br />

of the system, using Poincare's theorem where necessary.<br />

3<br />

V<br />

2<br />

1


66 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

(2) In each case make a phase-plane portrait with all the ¯xed points included<br />

as well as the tangent ¯eld and some representative trajectories.<br />

(3) Plot the temporal evolution of the dependent variable(s) for the above<br />

trajectories, using the appropriate scene option.<br />

(4) Answer any additional questions posed for the system.<br />

Problem 2-4: Hard and soft springs<br />

For a hard (soft) spring, the displacement x from equilibrium is described by<br />

Äx + ! 2 (1 § ® 2 x 2 ) x =0; with !>0; ®>0:<br />

The plus sign is for the hard spring, the minus sign for the soft spring. Carry<br />

out the steps listed in the preamble for each spring type. Discuss the origin and<br />

nature of the restoring force leading to each equation.<br />

Problem 2-5: Eardrum equation<br />

The displacement x of an eardrum is described by the model equation<br />

Äx + x ¡ x 2 =2=0:<br />

Carry out the steps listed in the preamble.<br />

Problem 2-6: Some nonlinear systems<br />

Carry out the steps listed in the preamble for each of the following systems:<br />

(a) _x = x2 ¡ y3 , _y =2x (x2 ¡ y2 );<br />

(b) _x = ¡x, _y =1¡ x2 ¡ y2 ;<br />

(c) _x = x (1 ¡ x2 ¡ 6 y2 ), _y = y (1 ¡ 3 x2 ¡ 3 y2 ).<br />

Problem 2-7: SIR model of infectious diseases<br />

The study of disease occurrence is called epidemiology. There are basically three<br />

types of deterministic models for infectious diseases that are spread by direct<br />

person-to-person contact. One of these models is referred to as the SIR model,<br />

the name being an acronym for the three population categories in the model.<br />

The S refers to the number of susceptibles who have not yet caught the disease,<br />

the I to the number of infectibles who have become infected with the disease,<br />

and R to the number of removables who have had the disease and are immune<br />

to catching that disease again. The disease being considered is such that very<br />

few people die from it. The SIR model equations are given by<br />

_S = b ¡ aIS; I _ = aIS¡ cI; R _ = cI;<br />

where b = 1 is the constant birth rate, a =0:001 is the interaction coe±cient<br />

between susceptibles and infectibles, and c = 0:1is the rate of increase of<br />

the removables. More generally, the model will have natural deaths in each<br />

category. The initial conditions are S(0) = 100, I(0) = 1, and R(0) = 0.<br />

Carry out the steps listed in the preamble. Note: To use the symbol I, ¯rst<br />

enter the command interface(imaginaryunit=j), which assigns j to stand<br />

for p ¡1, rather than I. Discuss problems with the SIR model.


2.1. PHASE-PLANE ANALYSIS 67<br />

2.1.3 Mike Creates a Higher-Order Fixed Point<br />

I never learn anything talking.<br />

I only learn things when I ask questions.<br />

Lou Holtz, American football coach<br />

Echoing Lou Holtz, Vectoria asks her mathematician boyfriend Mike, \Can<br />

you give me a simple physical example of a higher-order stationary point?"<br />

\Sure," Mike replies, \I can build up a phenomenological force law model<br />

for a nonlinear spring system that will display a higher-order ¯xed point. To<br />

do this, let's consider a light (weightless) spring suspended from one end with<br />

a unit mass attached to the other. Since you are into using computer algebra,<br />

I will do so as well. Let me load the following Maple library packages, that I<br />

am sure we will need, onto your computer.<br />

> restart: with(DEtools): with(plots):<br />

If the spring is stretched by only a small amount x from the equilibrium position,<br />

the force F required to de°ect the unit mass is given by Hooke's law F = kx<br />

with the spring constant k being positive. The restoring force is, of course, of<br />

the opposite sign. As you already know, the equation of motion is then just the<br />

SHO equation, which has periodic solutions. There is only a single stationary<br />

point, namely a vortex, located at the origin of the velocity{displacement phase<br />

plane. Physically, the stationary point corresponds to the situation that both<br />

the velocity and the force F (and therefore the acceleration) are equal to zero.<br />

By integrating F with respect to x, the potential energy V is given by the<br />

parabolic curve V = 1<br />

2 kx2 . The stationary point is at x =0,thebottomof<br />

the potential well.<br />

If we stretch the spring even more, the displacement can be su±ciently large<br />

that higher-order terms in a Taylor expansion of F (x) should be included, thus<br />

leading to a nonlinear equation of motion. If x is not too large, we need keep<br />

terms only up to third order in the Taylor expansion of F (x). I will write the<br />

polynomial force law in the form F = kx¡ gx 2 + hx 3 with k, g, andh all<br />

positive.<br />

> F:=k*x-g*x^2+h*x^3; #deflecting force<br />

F := kx¡ gx 2 + hx 3<br />

The associated potential energy V is again easily obtained by integrating F ."<br />

> V:=int(F,x);<br />

V := 1<br />

2 kx2 ¡ 1<br />

3 gx3 + 1<br />

4 hx4<br />

\Holdonamoment,Mike. Idon'tseewhyyouwenttothirdorderinx in<br />

the force law and why you took the quadratic term to be negative?"<br />

\Let me answer your last question ¯rst. If all three terms in F were positive,<br />

then F (x) would have only one real root at x = 0, which clearly still corresponds<br />

to a vortex. A higher-order stationary point is not possible in this case, no<br />

matter what the size of the coe±cients. Now let's make the quadratic term


68 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

negative. If the coe±cient g is su±ciently large, then as x is increased from<br />

zero, F will grow linearly at small x due to the kxterm, then begin to decrease<br />

at intermediate x due to the ¡gx 2 term, and again increase at larger x due<br />

to the hx 3 term. Since F is a cubic polynomial, there exists the possibility of<br />

F = 0 having three real x roots and therefore three stationary values. Since<br />

we can still look at very small vibrations around the origin where the Hooke's<br />

law contribution predominates, there will still be a vortex at the origin of the<br />

phase plane. So this still leaves two other possible nonzero stationary points<br />

corresponding to the nonzero x roots of F = 0. If you substitute numbers and<br />

play around with the cubic polynomial, the other two stationary points will be<br />

simple stationary points unless the coe±cients are such that the two nonzero<br />

roots coalesce into a single degenerate root. When coalescence takes place, the<br />

F curve will just be tangent to the x-axis at the location of the degenerate root.<br />

So we must impose the condition that dF(x0)=dx =0,aswellasF (x0) =0,in<br />

order to adjust the coe±cients to give a degenerate root x0. It is this degenerate<br />

situation that gives rise to a higher-order ¯xed point, as I will now show you.<br />

We would not have obtained a degenerate root and therefore a higher-order<br />

stationary point if I had not kept the cubic term in F .<br />

Let's calculate the derivative of the force F with respect to x,<br />

> derF:=diff(F,x);<br />

derF := k ¡ 2 gx+3hx 2<br />

and substitute x = x0 into both F =0andderF =0.<br />

> eq1:=subs(x=x[0],fF=0,derF=0g);<br />

eq1 := fk ¡ 2 gx0 +3hx 2 0 =0;kx0 ¡ gx 2 0 + hx3 0 =0g<br />

Solving the set of equations contained in eq1 for the coe±cients g and h,<br />

> sol:=solve(eq1,fg,hg);<br />

sol :=<br />

yields g =2k=x0 and h = k=x 2 0<br />

½<br />

g =2 k<br />

x0<br />

;h= k<br />

¾<br />

. Assigning the solution and collecting the<br />

coe±cients of k in F yields the force law necessary for coalescence of the nonzero<br />

roots to occur.<br />

> assign(sol): F:=collect(F,k);<br />

μ<br />

2 x2<br />

F := x ¡ +<br />

x0<br />

x3<br />

x2 <br />

k<br />

0<br />

In order to plot both the force and potential energy curves as a function of x,<br />

I will choose some speci¯c values for x0 and k. What do you suggest?"<br />

\Oh, I think that we will get a good idea of the physical behavior if we take<br />

x0 =1andk =1."<br />

\OK," Mike replies, \I will evaluate F and V with your suggested numbers,<br />

> F:=eval(F,fx[0]=1,k=1g);<br />

F := x ¡ 2 x 2 + x 3<br />

x 2 0


2.1. PHASE-PLANE ANALYSIS 69<br />

> V:=eval(V,fx[0]=1,k=1g);<br />

V := 1<br />

2 x2 ¡ 2<br />

3 x3 + 1<br />

4 x4<br />

and now plot the force and potential energy in the same ¯gure. To distinguish<br />

the two curves on the computer screen and in a black-and-white text rendition,<br />

I will use di®erent colors and line styles for the two curves. Using a list format<br />

to preserve order, the following plot command will generate a dashed red curve<br />

for F and a solid blue curve for V ."<br />

> plot([F,V],x=-0.25..1.5,color=[red,blue],<br />

linestyle=[DASH,SOLID],labels=["x","F,V"]);<br />

For the reader's bene¯t, the resulting picture observed by Mike and Vectoria<br />

on executing the plot command is reproduced in Figure 2.12.<br />

F,V<br />

0.2<br />

–0.2<br />

–0.4<br />

Figure 2.12: De°ecting force F , dashed line; potential energy V , solid line.<br />

Mike continues, \At the degenerate root location, x0 = 1, the (solid) potential<br />

energy curve is horizontal, corresponding to the (dashed) force curve<br />

touching zero. The equation of motion takes the form<br />

Äx = ¡F = ¡x +2x 2 ¡ x 3 ; (2.11)<br />

so that on setting the velocity _x equal to y, wecanidentifythefunctionsPand Q needed for stationary point analysis.<br />

> P:=-F; Q:=y;<br />

P := ¡x +2x2 ¡ x3 Q := y<br />

To evaluate a, b, c, andd, the following partial derivatives are calculated.<br />

> a:=diff(P,x): b:=diff(P,y): c:=diff(Q,x): d:=diff(Q,y):<br />

Solving the simultaneous equations P =0,Q =0,<br />

x<br />

1


70 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

> sol:=solve(fP,Qg,fx,yg);<br />

sol := fx =0;y=0g; fy =0;x=1g; fy =0;x=1g<br />

yields the expected root at the origin and the twofold degenerate root (x =1,<br />

y = 0). Since we already know that the former is a vortex, let's select the<br />

second (or third) solution and assign it for later use.<br />

> assign(sol[2]);<br />

Then, calculating p and q using the standard formulas,<br />

> p:=-(a+d); q:=a*d-b*c;<br />

p := ¡1 q := 0<br />

we obtain p = ¡1 andq =0. Sinceqis zero, the degenerate root is a higherorder<br />

stationary point as I predicted."<br />

\OK, I understand your construction of a higher-order ¯xed point. But what<br />

do the trajectories look like in the phase plane, and how does the displacement<br />

x(t) behave in this case?"<br />

\To answer your questions, I ¯rst have to unassign x and y from their<br />

stationary-point values,<br />

> unassign('x','y');<br />

and then enter the associated ¯rst-order ODEs.<br />

> ODEs:=fdiff(x(t),t)=y(t),diff(y(t),t)=-x(t)+2*x(t)^2-x(t)^3g;<br />

ODEs :=<br />

½<br />

d<br />

d<br />

x(t) =y(t);<br />

dt dt y(t) =¡x(t)+2x(t)2 ¡ x (t) 3<br />

¾<br />

In order to put the stationary points in the phase-plane diagram, let's create a<br />

plot for the two points, using size-20 red circles to represent their locations.<br />

> gr1:=plot([[0,0],[1,0]],style=point,symbol=circle,<br />

symbolsize=20,color=red):<br />

Employing the DEplot command, we can produce a phase-plane portrait for<br />

di®erent initial conditions."<br />

After some experimentation, Mike comes up with four di®erent initial conditions,<br />

which are included in the following DEplot command line. He chooses<br />

blue arrows with two barbs on the head (using arrows=MEDIUM) for the tangent<br />

¯eld and colors the trajectories red with the linecolor option. The time range<br />

is taken from t = 0 to 20 and the time step size equal to 0:05.<br />

> gr2:=DEplot(ODEs,[x(t),y(t)],t=0..20,x(t)=-1..2.5,<br />

y(t)=-1.5..1.5,[[x(0)=-0.4,y(0)=1],[x(0)=-0.35,y(0)=0],<br />

[x(0)=-0.3,y(0)=0],[x(0)=-0.2,y(0)=0]],stepsize=0.05,<br />

color=blue,linecolor=red,arrows=MEDIUM,dirgrid=[20,20]):<br />

Putting the two graphs gr1 and gr2 together with the display command<br />

> display(fgr1,gr2g,tickmarks=[2,3]);<br />

and controlling the tick marks on the coordinate axes results in the phase portrait<br />

shown in Figure 2.13. The four trajectories, corresponding to the four<br />

initial conditions, are clearly seen.


2.1. PHASE-PLANE ANALYSIS 71<br />

1<br />

–1<br />

Figure 2.13: Phase-plane diagram for the nonlinear spring system.<br />

\That's a nice plot, Mike. I can see the two stationary points and the<br />

change in shape of the trajectories from the inner one to the outer one. Close<br />

to the origin, the tangent ¯eld is characteristic of a vortex. The inner closed<br />

trajectory for the initial condition x(0) = ¡0:2 andy = 0 is a distorted circle<br />

cycling around this vortex point. As the loops grow larger, corresponding to<br />

the other initial conditions, the higher-order terms in the polynomial force law<br />

become more important and there is even more distortion of the closed loops.<br />

For x(0) = ¡0:35 and y(0) = 0, the third-largest loop encloses both stationary<br />

points. For the degenerate stationary point at x =1,y = 0, the tangent<br />

¯eld to the left of the point looks like that for a saddle point, while on the right<br />

it looks like that for a vortex. Does this type of higher-order ¯xed point have<br />

aname?"<br />

\This hybrid stationary point is, not surprisingly, referred to as a saddlevortex<br />

¯xed point. For other examples involving higher-order stationary points,<br />

di®erent hybrid combinations are possible, and are best studied on a case-bycase<br />

basis.<br />

As the trajectory moves further away from both stationary points, as in<br />

the case of the outer loop in Figure 2.13, generated by the initial condition<br />

x(0) = ¡0:4 andy(0) = 1, the positive cubic term in the force law predominates<br />

and periodic motion about both stationary points still occurs.<br />

You also asked about what x(t) lookslike. Thex(0) = ¡0:35, y = 0<br />

trajectory looks as if it could be interesting. To see x(t), we can use the DEplot<br />

2


72 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

command again, but this time with the scene=[t,x] option."<br />

> DEplot(ODEs,[x(t),y(t)],t=0..50,[[x(0)=-0.35,y(0)=0]],scene<br />

=[t,x],stepsize=.05,color=blue,linecolor=red,axes=normal);<br />

1.2<br />

1<br />

0.8<br />

x<br />

0.6<br />

0.4<br />

0.2<br />

–0.2<br />

–0.4<br />

10 20 30 40 50<br />

t<br />

Figure 2.14: Displacement of the nonlinear spring as a function of time.<br />

Again, we have reproduced what Mike and Vectoria see on the computer screen<br />

in Figure 2.14.<br />

Mike continues, \Two features displayed by the x(t) curveleapoutatme,<br />

Vectoria. The shape is not sinusoidal and it is highly asymmetric about the<br />

origin. The deviation away from sinusoidal behavior is a signal that nonlinear<br />

terms are present in the force law. The asymmetry arises speci¯cally from the<br />

quadratic term, which doesn't reverse sign as the spring system passes through<br />

the origin."<br />

\That was great, Mike. I have learned a lot from this example. It's Friday<br />

and I feel like wrapping the week up by going to that little Greek restaurant on<br />

West 4th for supper. How about you?"<br />

\With a glass or two of Tsantali to drink, that sounds good. Save the ¯le,<br />

shut down your computer, and let's be o®."<br />

PROBLEMS:<br />

Problem 2-8: Verhulst predator{prey equations<br />

The population densities of prey (variable x) and predators (variable y) are<br />

governed by the following nonlinear ODEs:<br />

_x = x ¡ Ax 2 ¡ Bxy; _y = y ¡ Cy 2 + Dxy;<br />

with the coe±cients A, B, C, andDall positive.


2.1. PHASE-PLANE ANALYSIS 73<br />

(a) What do the terms involving A and C represent physically?<br />

(b) Show that the nature of the stationary points depends on whether C>B,<br />

C = B, orCBand C


74 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

g(0) = 0:5 ands(0) = 1? Can the gnus and sung get along su±ciently well that<br />

both groups will survive, or is the interaction such that only one will survive?<br />

Although this competition problem is similar to that for the rabbits and<br />

foxes, it is complicated by the appearance of higher-order polynomial and transcendental<br />

terms on the right-hand sides of the evolution equations. This makes<br />

locating the stationary points more of a challenge than in the earlier examples.<br />

To answer the question, the society has called on the services of the preeminent<br />

scientist and conservationist Dr. Eiram Eiruc. Dr. Eiruc begins her<br />

computer analysis by loading the plots and DEtools packages,<br />

> restart: with(plots): with(DEtools):<br />

as well as the given coe±cient values.<br />

> a[g]:=2: a[s]:=1: b[g]:=0.03: b[s]:=0.01: c[g]:=0.1: c[s]:=0.1:<br />

From equations (2.12), the functions P and Q are identi¯ed and entered.<br />

> P:=a[g]*g-b[g]*g*s-c[g]*g^6*s^7;<br />

P := 2 g ¡ 0:03 gs¡ 0:1 g 6 s 7<br />

> Q:=-a[s]*s+b[s]*g*s+c[s]*g^5*exp(-s);<br />

Q := ¡s +0:01 gs+0:1 g 5 e (¡s)<br />

The stationary points can be obtained by setting P = Q =0. However,the<br />

simultaneous solution of these equations is nontrivial because of their complexity.<br />

Before carrying out a numerical search for the roots, Eiram uses the<br />

implicitplot command with boxed axes to graph the functions P =0,Q =0.<br />

The intersection points will then correspond to the stationary points. The<br />

ranges of g and s are determined by trial and error.<br />

> implicitplot(fQ=0,P=0g,g=-6..6,s=-10..10,grid=[60,60],<br />

numpoints=5000,tickmarks=[4,2],axes=box);<br />

s<br />

0<br />

–10<br />

–6 –4 –2 0 g 2 4 6<br />

Figure 2.15: Graphically solving P =0,Q = 0 to locate stationary points.


2.1. PHASE-PLANE ANALYSIS 75<br />

The result is shown in Figure 2.15. Since the population densities cannot be<br />

negative, the only stationary points of interest to Eiram are the one that appears<br />

to be at the origin and the one in the g>0, s>0quadrant. Eiram<br />

could, of course, obtain approximate values by clicking the mouse arrow on the<br />

intersection points in the computer screen plot. More accurate numbers are<br />

found by using the °oating point solve command. However, since the equations<br />

P =0andQ = 0 are quite nonlinear, the fsolve command will yield only one<br />

real root if no range is speci¯ed for the variables. When more than one root is<br />

present, a range must be given that includes the root of interest.<br />

For example, by taking g = ¡1 to1inthefsolve command,<br />

> sol[1]:=fsolve(fP,Qg,fg,sg,g=-1..1);<br />

sol 1 := fg =0:; s =0:g<br />

Eiram con¯rms that there is indeed a stationary point at the origin. Referring<br />

to Figure 2.15, she then chooses the range g =1to3,<br />

> sol[2]:=fsolve(fP,Qg,fg,sg,g=1..3);<br />

sol 2 := fg =1:902803669; s=0:9669140476g<br />

and ¯nds that the second stationary point is at g ¼ 1:90 gnus and s ¼ 0:97<br />

sung (per unit area).<br />

The relevant partial derivatives of P and Q for identifying the stationary<br />

points are calculated.<br />

> a:=diff(P,g): b:=diff(P,s): c:=diff(Q,g): d:=diff(Q,s):<br />

A do loop is formed that will enable Eiram to carry out the identi¯cation process<br />

for each of the two relevant stationary points.<br />

> for i from 1 to 2 do<br />

The \coordinates" of the ith stationary point are assigned.<br />

> assign(sol[i]):<br />

The quantities p = ¡(a + d), q = ad¡ bc,andr = p 2 ¡ 4 q are calculated for<br />

the ith stationary point.<br />

> p[i]:=-(a+d); q[i]:=a*d-b*c; r[i]:=p[i]^2-4*q[i];<br />

Then g and s are unassigned,<br />

> unassign('g','s');<br />

and the do loop ended,<br />

> end do;<br />

yielding the following results:<br />

p1 := ¡1: q1 := ¡2: r1 := 9:<br />

p2 := 11:78445045 q2 := 87:09248243 r2 := ¡209:4966573<br />

Having the Springer Intergalactic edition of this text, Eiram refers to the p-q<br />

diagram given in Figure 2.1. Noting that q1 < 0, she concludes that the stationary<br />

point at the origin is a saddle point. For the second nonzero stationary<br />

point, p2 > 0andq2 > 0, so this ¯xed point is either a stable focal point or a<br />

stable nodal point. But r2 < 0, so it is actually a stable focal point.


76 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

Eiram will con¯rm this analysis by making a phase-plane portrait. She forms<br />

the gnus and sung ODEs by inserting the g and s time-dependence in the P , Q<br />

functions and entering dg(t)=dt = P (g(t);s(t)) and ds(t)=dt = Q(g(t);s(t)).<br />

> gnus:=diff(g(t),t)=subs(fg=g(t),s=s(t)g,P);<br />

gnus := d<br />

dt g(t) =2g(t) ¡ 0:03 g(t) s(t) ¡ 0:1 g(t)6 s(t) 7<br />

> sung:=diff(s(t),t)=subs(fg=g(t),s=s(t)g,Q);<br />

sung := d<br />

dt s(t) =¡s(t)+0:01 g(t) s(t)+0:1g(t)5 e (¡s(t))<br />

A functional operator F is formed to produce a phase-plane portrait for the<br />

gnus and sung, given that initially there were 0:5 gnus and 1 sung (per unit<br />

area), and looking at a time span of 10 years. The scene variables x and y, and<br />

the line color c, must be supplied as arguments.<br />

> F:=(x,y,c)->phaseportrait([gnus,sung],[g(t),s(t)],t=0..10,<br />

[[g(0)=0.5,s(0)=1]],scene=[x,y],g=0..3,s=0..2,stepsize<br />

=0.01,color=blue,linecolor=c,arrows=MEDIUM,<br />

dirgrid=[20,20]):<br />

Then, entering F(g,s,red) produces the phase-plane portrait shown in Figure<br />

2.16, the tangent arrows being colored blue and the trajectory red on the<br />

computer screen.<br />

> F(g,s,red);<br />

2<br />

s<br />

1 2 3<br />

g<br />

Figure 2.16: Phase-plane portrait for the gnus{sung interaction.<br />

As expected, the trajectory winds onto the stable focal point. The tangent<br />

arrows near the origin are indicative of a saddle point.


2.1. PHASE-PLANE ANALYSIS 77<br />

Next, Eiram will show the time evolution of the two animal populations.<br />

First she uses the textplot commandtocreatenamelabelstobeaddedtothe<br />

¯nal ¯gure.<br />

> tp:=textplot([[1.2,1.1,"sung"],[1.2,2,"gnus"]]):<br />

She then uses the display command and the functional operator F to produce<br />

Figure 2.17, showing the temporal evolution of the gnus and sung populations<br />

for a period of two years. On the computer screen the gnus' population density<br />

is colored red, the sung's population density blue.<br />

> display(fF(t,g,red),F(t,s,blue),tpg,labels=["t",""],<br />

tickmarks=[3,3],view=[0..2,0..3]);<br />

3<br />

2<br />

1<br />

0<br />

gnus<br />

sung<br />

1 t 2<br />

Figure 2.17: Temporal evolution of gnus and sung.<br />

So Eiram concludes that if all conditions remain the same, then the two groups<br />

will ultimately live in relative harmony with each other, since both gnus and<br />

sung survive. However, she notes that the gnus will gain the upper hand in<br />

terms of population density over their more backward relatives, even though<br />

initially the density of sung was twice that of the gnus.<br />

PROBLEMS:<br />

Problem 2-10: Create your own model<br />

Create your own complicated model of the gnus{sung interaction by modifying<br />

the last term in each of the equations. Follow the procedure in the text recipe<br />

and determine the fate of the two populations in your model. Feel free to<br />

experiment with parameter values and initial conditions.


78 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

2.1.5 A Plethora of Points<br />

The sure conviction that we could if we wanted to<br />

is the reason so many good minds are idle.<br />

G. C. Lichtenberg, German physicist, philosopher (1742{1799)<br />

We have asked Jennifer, the MIT mathematician, to provide us with a recipe<br />

that locates and identi¯es all the ¯xed points of the nonlinear ODE system<br />

_x = x (1 ¡ x 2 ¡ 6 y 2 ); _y = y (1 ¡ 3 x 2 ¡ 3 y 2 );<br />

making use of conditional logic statements, and to support the identi¯cation<br />

with a tangent-¯eld plot containing all the stationary points. Here is her recipe.<br />

After loading the required library packages,<br />

> restart: with(plots): with(DEtools):<br />

Jennifer identi¯es the rhs of the _x and _y equations as the functions P and Q<br />

needed for the ¯xed-point analysis. She then enters P and Q.<br />

> P:=x*(1-x^2-6*y^2); Q:=y*(1-3*x^2-3*y^2);<br />

P := x (1 ¡ x2 ¡ 6 y2 ) Q := y (1 ¡ 3 x2 ¡ 3 y2 )<br />

Jennifer introduces a functional operator f for di®erentiating a given function<br />

X with respect to an arbitrary variable v.<br />

> f:=(X,v)->diff(X,v):<br />

Making use of the functional operator f, the partial derivatives a = @P=@x,<br />

b = @P=@y, c = @Q=@x, andd = @Q=@y are calculated.<br />

> a:=f(P,x): b:=f(P,y): c:=f(Q,x): d:=f(Q,y):<br />

The partial derivatives must be evaluated at each ¯xed point. To locate these<br />

points, the equations P =0andQ = 0 are solved for x and y. Lists are used<br />

here, because the order of x and y in sol must be preserved for later use.<br />

> sol:=solve([P=0,Q=0],[x,y]);<br />

sol := [ [x =0;y=0]; [x =0;y=RootOf(¡1+3 Z 2 ; label = L1 )];<br />

[x =1;y=0]; [x = ¡1; y=0];<br />

[x =RootOf(5Z 2 ¡ 1); y=RootOf(¡2+15 Z 2 )] ]<br />

In the solution, RootOf( ) is a placeholder for the roots of the polynomial<br />

functiongivenineachincludedargument. Jenniferwantstoextractallthe<br />

roots explicitly. To this end, she ¯rst determines the number of operands (here<br />

the number of lists) in sol using the nops command.<br />

> N:=nops(sol);<br />

N := 5<br />

The number of operands is 5, which is easily con¯rmed by visual inspection of<br />

sol. The roots can be explicitly obtained by applying the allvalues command<br />

to the ith entry in sol, and using the seq command (running from i =1toN)<br />

to generate the sequence of roots. The results are again put into a list, so the<br />

number of operands in the new list of lists can be extracted.


2.1. PHASE-PLANE ANALYSIS 79<br />

> sol2:=[seq(allvalues(sol[i]),i=1..N)];<br />

"<br />

"<br />

p # "<br />

p #<br />

3<br />

3<br />

sol2 := [x =0;y=0]; x =0;y= ; x =0;y= ¡ ;<br />

3<br />

3<br />

" p<br />

5<br />

[x =1;y=0]; [x = ¡1; y=0]; x =<br />

5 ;y=<br />

p #<br />

30<br />

;<br />

15<br />

" p p # " p<br />

5 30<br />

5<br />

x = ;y= ¡ ; x = ¡<br />

5 15<br />

5 ;y=<br />

p # " p p ##<br />

30<br />

5 30<br />

; x = ¡ ;y= ¡<br />

15<br />

5 15<br />

In the sol2 list of lists, there are clearly nine lists of x and y values, corresponding<br />

to the coordinates of nine stationary points. There is indeed a plethora<br />

of ¯xed points in this example. The number of operands (lists here) will be<br />

needed, so this number is extracted with the nops command.<br />

> N2:=nops(sol2);<br />

N2 := 9<br />

Functional operators are formed to numerically evaluate p = ¡(a + d) and<br />

q = ad¡ bc for the ith entry in sol2 .<br />

> p:=i->evalf(eval(-(a+d),sol2[i])):<br />

> q:=i->evalf(eval(a*d-b*c,sol2[i])):<br />

Next, Jennifer creates a do loop, running from i =1toN2 = 9, to identify the<br />

nature of each ¯xed point and to plot each point.<br />

> for i from 1 to N2 do<br />

The ith entry (list of x and y coordinates) of sol2 is entered, and then the x and<br />

y coordinates are extracted separately. For example, taking i =1,sol2[1,1]<br />

extracts the ¯rst entry (x = 0) in the ¯rst list of sol2 , while sol2[1,2] produces<br />

the second entry (y = 0). The right-hand sides are extracted to give the x and<br />

y coordinates of the ¯xed point for plotting purposes.<br />

> sol2[i]; X[i]:=rhs(sol2[i,1]); Y[i]:=rhs(sol2[i,2]);<br />

The values of p, q, andr = p2 ¡ 4 q are determined for the ith ¯xed point. Jennifer<br />

uses the concatenation operator || to attach numbers to these quantities.<br />

For example, the outputs of p||1, p||2, etc., would be of the form p1 , p2 ,etc.<br />

Concatenation is a useful alternative way of numbering quantities.<br />

> p||i:=p(i); q||i:=q(i); r||i:=simplify(p||i^2-4*q||i);<br />

A conditional statement is now entered that will classify the ith ¯xed point<br />

according to the region of the p-q diagram in which it is located. The general<br />

syntax for a conditional statement is<br />

if then <br />

elif then <br />

else <br />

end if<br />

where the elif (else if) and else phrases are optional.


80 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

> if q||i0 and p||i>0 and r||i0 and p||i>0 and r||i>=0 then s||i:=stablenodal;<br />

elif q||i>0 and p||i0 and p||i=0 then s||i:=vortexorfocal;<br />

else s||i:=higherorder;<br />

end if:<br />

The ith stationary point is plotted as a size-20 blue circle,<br />

> gr[i]:=pointplot([[X[i],Y[i]]],symbol=circle,<br />

symbolsize=20,color=blue);<br />

and the conditional statement ended, a colon being used to suppress the output.<br />

> end do:<br />

Using the sequence command, the x and y ¯xed-point coordinates and ¯xedpoint<br />

type are now displayed for all nine ¯xed points. For example, the ¯xed<br />

point at x =0,y = 0, is an unstable nodal point.<br />

> seq([X[i],Y[i],s||i],i=1..N2);<br />

" p # " p #<br />

3<br />

3<br />

[0; 0; unstablenodal]; 0; ; stablenodal ; 0; ¡ ; stablenodal ;<br />

3 3<br />

" p<br />

5<br />

[1; 0; stablenodal] ; [¡1; 0; stablenodal];<br />

5 ;<br />

p #<br />

30<br />

; saddle ;<br />

15<br />

" p p # " p<br />

5 30<br />

5<br />

; ¡ ; saddle ; ¡<br />

5 15 5 ;<br />

p # " p p #<br />

30<br />

5 30<br />

; saddle ; ¡ ; ¡ ; saddle<br />

15 5 15<br />

The two relevant ODEs are entered, with the time dependence of x and y being<br />

substituted into P and Q.<br />

> xeq:=diff(x(t),t)=subs(fx=x(t),y=y(t)g,P);<br />

xeq := d<br />

dt x (t) =x(t)(1¡ x (t)2 ¡ 6 y(t) 2 )<br />

> yeq:=diff(y(t),t)=subs(fx=x(t),y=y(t)g,Q);<br />

yeq := d<br />

dt y(t) =y(t)(1¡ 3 x(t)2 ¡ 3 y(t) 2 )<br />

The dfieldplot command is used to plot the tangent ¯eld for this ODE system,<br />

the resulting graph being assigned the name gr[N2+1].<br />

> gr[N2+1]:=dfieldplot([xeq,yeq],[x(t),y(t)],t=0..10,<br />

x=-1.2..1.2,y=-1.2..1.2,dirgrid=[26,26],arrows=MEDIUM):<br />

The above graph assignment allows Jennifer to use the sequence command to<br />

plot all the stationary points and the tangent ¯eld in the same ¯gure.<br />

> display(fseq(gr[i],i=1..N2+1)g,tickmarks=[3,3]);


2.1. PHASE-PLANE ANALYSIS 81<br />

The resulting picture is shown in Figure 2.18. The plot con¯rms the identi¯cation<br />

of the ¯xed points, e.g., the unstable nodal point at the origin.<br />

1<br />

–1 1<br />

–1<br />

Figure 2.18: A plethora of ¯xed points.<br />

PROBLEMS:<br />

Problem 2-11: Lots of ¯xed points<br />

Consider the coupled ODE system<br />

_x = y (1 + x ¡ y 2 ); _y = x (1 + y ¡ x 2 ):<br />

Using conditional logic statements, locate and identify all the ¯xed points. Make<br />

a tangent-¯eld plot containing all these stationary points.<br />

Problem 2-12: Not so many ¯xed points<br />

Locate and identify all the ¯xed points of the ODE system<br />

_x =16x 2 +9y 2 ¡ 25; _y =16x 2 ¡ 16 y 2 ;<br />

making use of conditional logic statements. Support the identi¯cation with a<br />

tangent-¯eld plot containing all the stationary points.<br />

Problem 2-13: Squid and herring<br />

The major food source for squid is herring. If S and H are the numbers of<br />

squid and herring, respectively, per acre of seabed, the interaction between the<br />

two species can be modeled [Sco87] by the system (with time in years)<br />

_H = k1 H ¡ k2 H 2 ¡ k3 HS; S _ = ¡k4 S ¡ k5 S 2 + bk3 HS;<br />

with k1 =1:1, k2 =10 ¡5 , k3 =10 ¡3 , k4 =0:9, k5 =10 ¡4 ,andb =0:02.<br />

(a) Using conditional logic statements, locate and identify all the stationary<br />

points of the squid{herring system.


82 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

(b) Make a phase-plane portrait that shows all the stationary points and<br />

includes some representative trajectories. Discuss possible outcomes for<br />

di®erent ranges of initial populations.<br />

(c) Suppose that every last squid were removed from the area occupied by<br />

the herring and from all surrounding areas. Would the herring population<br />

increase inde¯nitely without bound or would there be an upper limit on<br />

the number of herring per unit area? If you believe the latter would occur,<br />

what is that number?<br />

(d) If the squid-free situation just described had persisted for many years,<br />

how many squid would there be two years later if a pair of fertile squid<br />

were introduced into the area?<br />

2.2 Three-Dimensional Autonomous Systems<br />

The analysis of the general autonomous 3-dimensionsal system,<br />

_X = P (X;Y; Z); Y _ = Q(X;Y; Z); Z _ = R(X;Y; Z); (2.13)<br />

where P , Q, andRmay be nonlinear functions of the dependent variables X, Y ,<br />

and Z, can be tackled in a manner similar to the 2-dimensional case. However,<br />

the analytic identi¯cation of the ¯xed points is nontrivial, and we refer the<br />

interested reader to the texts by Jackson [Jac90] and Hayashi [Hay64].<br />

We shall be content to look at one speci¯c example, locating the ¯xed points,<br />

establishing their stability, and using a graphical approach to identify their<br />

nature. What better example is there than Lorenz's famous chaotic \butter°y"?<br />

2.2.1 Lorenz's Butter°y<br />

The butter°y's attractiveness derives not only from colors<br />

and symmetry: deeper motives contribute to it.<br />

Primo Levi, Italian chemist, author, Other Peoples Trades,\Butter°ies," 1985<br />

In a famous paper, Edward Lorenz [Lor63] discussed the possibility of very-longrange<br />

weather forecasting. Starting with the nonlinear Navier{Stokes PDEs of<br />

°uid mechanics, Lorenz attempted to model thermally driven convection in the<br />

earth's atmosphere. The atmosphere was treated as a °at °uid layer that is<br />

heated from below by the surface of the earth and cooled from above by heat<br />

radiation into outer space. Lorenz managed to reduce the original set of PDEs<br />

to the following set of three nonlinear ODEs:<br />

_x = ¾ (y ¡ x); _y = rx¡ y ¡ xz; _z = xy¡ bz; (2.14)<br />

where x is proportional to the convective velocity, y to the temperature di®erence<br />

between ascending and descending °ows, and z to the mean convective heat


2.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 83<br />

°ow. The positive coe±cients ¾ and r are the Prandtl and reduced Rayleigh<br />

numbers, respectively, and b>0 is related to the wave number.<br />

The Lorenz equations (2.14) must be solved numerically. On doing so,<br />

Lorenz discovered that a very small change in the initial condition could lead<br />

to dramatically di®erent long-term behavior of the numerical solutions. This<br />

could have implications for very-long-range weather forecasting, because present<br />

conditions are never known exactly due to the inevitable inaccuracy and incompleteness<br />

of weather observations. One might argue that this conclusion was<br />

model dependent, particularly because the original PDEs were so severely simpli¯ed,<br />

but in fact Lorenz found that this sensitivity to initial conditions was a<br />

general feature of nonlinear systems.<br />

In addition to the sensitivity feature, Lorenz's ODE system is well known<br />

because its trajectory in x-y-z phase space is attracted to a localized region<br />

where it traces out a never-repeating (chaotic) path whose shape somewhat<br />

resembles the two wings of a butter°y. This is another example of a strange<br />

attractor, the attractor di®ering in appearance from the RÄossler strange attractor<br />

seen in Chapter 1. Lorenz's butter°y attractor is illustrated in the following<br />

recipe, along with a stability analysis of the ¯xed points.<br />

The DEtools and Linear<strong>Algebra</strong> packages are loaded. The former is needed<br />

because we shall be using the DEplot and DEplot3d commands to plot x(t)<br />

and the butter°y attractor, respectively. The Linear<strong>Algebra</strong> package contains<br />

commands to construct and manipulate matrices and vectors and solve linear algebra<br />

problems. Various commands (e.g., GenerateMatrix and Eigenvalues)<br />

in this package will be used for the stability analysis.<br />

> restart: with(DEtools): with(Linear<strong>Algebra</strong>):<br />

The right-hand sides of the three Lorenz equations are entered and assigned the<br />

names P , Q, andR, to be consistent with equations (2.13).<br />

> P:=sigma*(y-x); Q:=r*x-y-x*z; R:=x*y-b*z;<br />

P := ¾ (y ¡ x) Q := rx¡ y ¡ xz R:= xy¡ bz<br />

To produce Lorenz's butter°y, we take ¾ =10,b =8=3, and r =28.<br />

> sigma:=10: b:=8/3: r:=28:<br />

To locate the ¯xed points, the equations P =0,Q =0,andR =0aresolved<br />

for x, y, andz.<br />

> sol:=solve([P,Q,R],[x,y,z]);<br />

sol := [ [x =0;y=0;z=0]; [ x =6RootOf(¡2+ Z 2 ; label = L3 );<br />

y =6RootOf(¡2+ Z 2 ; label = L3 );z =27]]<br />

The number N of operands in sol is determined.<br />

> N:=nops(sol);<br />

N := 2<br />

The allvalues command is used to remove the RootOf that appeared in sol.<br />

> sol2:=[seq(allvalues(sol[i]),i=1..N)];


84 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

sol2 := [ [x =0;y=0;z=0]; [ x =6 p 2;y=6 p 2;z =27];<br />

[ x = ¡6 p 2;y= ¡6 p 2;z =27]]<br />

Thenumberof¯xedpointsisequaltothenumberN2 of operands in sol2 .<br />

> N2:=nops(sol2);<br />

N2 := 3<br />

So the Lorenz system has three ¯xed points. The stability of these ¯xed points<br />

will now be determined by extending the procedure used in the phase-plane<br />

analysis. A functional operator f is introduced to substitute the coordinates<br />

x + u, y + v, z + w of an ordinary point, near a ¯xed point (x; y; z), into a<br />

dependent variable V ,whereV will be taken to be P , Q, andR.<br />

> f:=V->simplify(subs(fx=x+u,y=y+v,z=z+wg,V)):<br />

Assuming that u, v, andw are su±ciently small, only linear terms in these<br />

variables will be retained in P , Q, andR. Since P is already linear, entering<br />

f(P) produces the linear algebraic form shown in eq1 . However, on entering<br />

f(Q) the nonlinear term uw will be present. This term can be removed with<br />

the remove command, which is done in eq2 . Similarly, the nonlinear term uv<br />

is removed from f(R) in eq3 .<br />

> eq1:=f(P); eq2:=remove(has,f(Q),u*w);<br />

eq3:=remove(has,f(R),u*v):<br />

eq1 := 10 y +10v ¡ 10 x ¡ 10 u<br />

eq2 := 28 x +28u ¡ y ¡ v ¡ xz¡ xw¡ uz<br />

8 z 8 w<br />

eq3 := xy+ xv+ uy¡ ¡<br />

3 3<br />

Let's take i = 1, so that assigning the ith operand in sol2 corresponds to taking<br />

the ¯xed point coordinates to be x =0,y =0,z = 0. The stability of the other<br />

two ¯xed points may be examined by choosing i =2ori =3.<br />

> i:=1: assign(sol2[i]): #choose i<br />

For i =1,eq1 , eq2 ,andeq3 reduce to the following linear forms:<br />

> eq1:=eq1; eq2:=eq2; eq3:=eq3;<br />

8 w<br />

eq1 := 10 v ¡ 10 u eq2 := 28 u ¡ v eq3 := ¡<br />

3<br />

So, the linearized ODEs at an ordinary point near the ¯xed point at the origin<br />

are<br />

du<br />

dv<br />

dw 8 w<br />

=10v ¡ 10 u; =28u ¡ v; = ¡<br />

dt dt dt 3 :<br />

The stability is determined by assuming that u; v; w ' e¸t . For the ODEs<br />

to have a nontrivial solution, a determinantal equation must be satis¯ed that<br />

when expanded produces a cubic equation in ¸ with three roots. To have a<br />

stable ¯xed point, the real part of ¸ must be negative for all three roots. If any<br />

root has a real part that is positive, the solution will grow with time, leading<br />

to an unstable situation.


2.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 85<br />

Let's now carry out this analysis using a matrix approach. Equating eq1 to<br />

¸u, eq2 to ¸v,andeq3 to ¸w,theGenerateMatrix command<br />

> (A,B):=GenerateMatrix([eq1=lambda*u,eq2=lambda*v,<br />

eq3=lambda*w],[u,v,w]);<br />

2<br />

3<br />

¡10 ¡ ¸ 10 0 2 3<br />

0<br />

6<br />

A; B :=<br />

28 ¡1 ¡ ¸ 0 7<br />

4<br />

¡8<br />

5 ; 4 0 5<br />

0 0 ¡ ¸ 0<br />

3<br />

yields the relevant 3 £ 3matrixAandzero column vector B such that<br />

2<br />

u<br />

3 2<br />

0<br />

3<br />

A 4 v 5 = B ´ 4 0 5 :<br />

w<br />

0<br />

The determinant of A is computed, yielding a cubic polynomial in ¸.<br />

> det:=Determinant(A);<br />

det := 720 + 722 41<br />

¸ ¡<br />

3 3 ¸2 ¡ ¸3 The determinant is set equal to zero, solved for ¸, and the answer put in °oatingpoint<br />

form.<br />

> lambdas:=evalf(solve(det=0,lambda));<br />

lambdas := ¡2:666666667; 11:82772345; ¡22:82772345<br />

Three real roots are obtained, with two of them being negative, but the third<br />

one positive. Thus, the ¯xed point at the origin is unstable. It should be noted<br />

that the same result can be obtained by setting ¸ =0inA and obtaining the<br />

eigenvalues by using the Eigenvalues command. In this case, the ¸ values are<br />

expressed as a column matrix or vector.<br />

> eiv:=evalf(Eigenvalues(eval(A,lambda=0)));<br />

2<br />

¡2:666666667<br />

3<br />

eiv := 4 11:82772345<br />

¡22:82772345<br />

5<br />

To see how the trajectory evolves from the vicinity of the ¯xed point, the<br />

variables x, y, z are unassigned from their previous values,<br />

> unassign('x','y','z'):<br />

and an initial condition near the ¯xed point (the origin for i = 1) chosen.<br />

> ic:=[x(0)=rhs(sol2[i,1])+0.1,y(0)=rhs(sol2[i,2])+0.1,<br />

z(0)=rhs(sol2[i,3])+0.1]:<br />

ic := [x(0) = 0:1;y(0) = 0:1;z(0) = 0:1]<br />

The system of Lorenz ODEs is entered by introducing time dependence into<br />

the x, y, z variables,<br />

> var:=(x=x(t),y=y(t),z=z(t)):


86 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

and substituting these variables into P , Q, andR, whichareequatedtodx=dt,<br />

dy=dt, anddz=dt, respectively.<br />

> sys:=diff(x(t),t)=subs(var,P),diff(y(t),t)=subs(var,Q),<br />

diff(z(t),t)=subs(var,R);<br />

sys := d<br />

d<br />

x (t) =10y(t) ¡ 10 x(t); y(t) =28x (t) ¡ y(t) ¡ x (t) z (t);<br />

dt dt<br />

d<br />

8<br />

z(t) =x (t) y(t) ¡<br />

dt 3 z(t)<br />

The DEplot command is used with the scene option scene=[t,x] to plot x<br />

versus t for the system of ODEs (subject to the initial condition), the line color<br />

being allowed to change with time as the time increases.<br />

> DEplot([sys],[x(t),y(t),z(t)],t=0..60,[ic],scene=[t,x],<br />

stepsize=0.01,linecolor=t,thickness=1);<br />

The black-and-white version of the plot is shown in Figure 2.19.<br />

20<br />

x<br />

10<br />

0<br />

–10<br />

10 20 30 40 50 60<br />

t<br />

Figure 2.19: x versus t for an initial condition near the origin.<br />

There is no apparent repeat pattern as x increases with t, themotionbeing<br />

chaotic. Longer times can be taken to con¯rm this. Sensitivity to the initial<br />

condition can be checked by changing the initial condition slightly and observing<br />

that the x versus t curve changes dramatically. Although the ODEs are<br />

deterministic, one's intuition is inadequate to predict what the value of x will<br />

be at large times if the initial condition is changed slightly. This is in contrast<br />

to a linear ODE system, where a slight change in initial condition will produce<br />

only a small change in the solution.<br />

The DEplot3d command is now used to plot the trajectory in the x-y-z<br />

space, the line color again being allowed to change with t.


2.2. THREE-DIMENSIONAL AUTONOMOUS SYSTEMS 87<br />

> DEplot3d([sys],[x(t),y(t),z(t)],t=0..50,[ic],scene=[x,y,z],<br />

stepsize=0.01,linecolor=t,orientation=[-23,68]):<br />

40<br />

30<br />

z<br />

20<br />

10<br />

–10<br />

x<br />

0 10<br />

–20 –10 0 10 20<br />

y<br />

Figure 2.20: Lorenz's butter°y.<br />

Qualitatively, the trajectory leaves the origin in a ¯xed direction, implying that<br />

the ¯xed point is an unstable nodal point. The trajectory then evolves into a<br />

localized region of phase space, producing a nonrepeating path that ¯lls in the<br />

region so that the pattern resembles (to an active imagination, especially when<br />

seen in color on the computer screen) the wings of a butter°y.<br />

By choosing i = 2 and 3, you can use the recipe to determine the nature of<br />

the other two ¯xed points and observe the strange attractor that results.<br />

PROBLEMS:<br />

Problem 2-14: Other ¯xed points<br />

Use the text recipe to investigate the other two ¯xed points for the Lorenz<br />

system. Identify their probable nature and generate x versus t as well as the<br />

phase-space trajectory for an initial condition near each ¯xed point.<br />

Problem 2-15: Sensitivity<br />

Use the text recipe to explore the sensitivity to initial conditions for the Lorenz<br />

system.<br />

Problem 2-16: The Oregonator<br />

Consider the Oregonator system<br />

² _x = x + y ¡ qx 2 ¡ xy; _y = ¡y +2hz¡ xy; p _z = x ¡ z;<br />

with ² =0:03, p =2,q =0:006, h =0:75. Show analytically that the origin is<br />

an unstable ¯xed point.


88 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

Problem 2-17: The RÄossler system<br />

Consider the RÄossler system<br />

_x = ¡(y + z); _y = x + ay; _z = b + z (x ¡ c);<br />

with a, b, c>0. Analytically show that there are no stationary points for<br />

c< p 4 ab and two ¯xed points for c> p 4 ab. Find analytic expressions for<br />

the latter points. Linearizing the system in the vicinity of these ¯xed points,<br />

¯nd the cubic equation for the roots ¸. Taking a = b =0:2 and allowing c to<br />

take on the values c =2:4, 3:5, 4:0, 5:0, 8:0, solve the cubic equation for the<br />

roots and determine the stability in each case.<br />

Taking x(0) = 0:1, y(0) = 0:1, z(0) = 0, show by plotting the trajectories in<br />

phase space that each c value leads to a qualitatively di®erent behavior of the<br />

solution. Identify the behavior by plotting y(t).<br />

Problem 2-18: Multiple stationary points<br />

For the following 3-dimensional system,<br />

_x =(1¡ z)[(4¡ z 2 )(x 2 + y 2 ¡ 2 x + y)+4(2x ¡ y) ¡ 4];<br />

_y =(1¡ z)[(4¡ z 2 )(xy¡ x ¡ zy)+4(x + zy) ¡ 2 z ];<br />

_z = z 2 (4 ¡ z 2 )(x 2 + y 2 );<br />

locate all of the stationary points and determine the stability of each point.<br />

Explore the nature of the ¯xed points and the behavior of this system by making<br />

suitable 3-dimensional x-y-z plots.<br />

2.3 Numerical Solution of ODEs<br />

In the opening chapter as well as this one, we have encountered nonlinear ODE<br />

models for which analytic solutions simply do not exist, in which case use must<br />

be made of Maple command structures that solve the given ODE(s) numerically.<br />

In this section, we would like to discuss brie°y the basis for the Runge{Kutta{<br />

Fehlberg 45 (RKF45) method that Maple employs as its default scheme in the<br />

dsolve(ODE,numeric) command for numerically solving ODEs.<br />

All such numerical schemes make use of the idea of replacing the ODE with<br />

a di®erence equation in which each derivative is replaced with a ¯nite di®erence<br />

approximation involving a ¯nite step size. The step size may either be ¯xed or,<br />

as in the RKF45 method, variable, taking bigger steps in °atter regions and<br />

smaller steps in steeper regions. The di®erence equation can be iterated using<br />

adoloopprocedure.<br />

The common ¯nite di®erence approximations for ¯rst and second derivatives<br />

are introduced in the ¯rst recipe. Our intention in this and subsequent recipes<br />

is only to give you the \°avor" of the subject of numerical analysis, referring<br />

you to texts such as Burden and Faires [BF89] or Numerical <strong>Recipes</strong> [PFTV89]<br />

for more complete treatments.


2.3. NUMERICAL SOLUTION OF ODES 89<br />

2.3.1 Finite Di®erence Approximations<br />

A tool knows exactly how it is meant to be handled, while the user of<br />

the tool can only have an approximate idea.<br />

Milan Kundera, Czech author, critic (1929{)<br />

Consider a general function y(x) as schematically depicted by the solid curved<br />

line in Figure 2.21. The independent variable has been taken to be x, butit<br />

could just as well be the time t. It is desired to ¯nd, say, the ¯rst and second<br />

Q<br />

x–h<br />

h<br />

y(x–h)<br />

P<br />

y(x)<br />

h<br />

R<br />

y(x+h)<br />

x x+h<br />

Figure 2.21: Obtaining ¯nite di®erence approximations to derivatives.<br />

derivatives of y at an arbitrary point P on the curve located at the horizontal<br />

position x. Assuming that h is small, two neighboring points R and Q located<br />

at x + h and x ¡ h, respectively, are considered. At point R, the vertical height<br />

is y(x + h) andatQ it is y(x ¡ h).<br />

Since h is assumed to be small, y(x + h) can be Taylor expanded in powers<br />

of h about h = 0, neglecting terms of, say, order h 4 (i.e., O(h 4 )) and higher.<br />

> restart:<br />

> eq1:=y(x+h)=taylor(y(x+h),h=0,4);<br />

eq1 := y(x + h) =<br />

y(x)+D(y)(x) h + 1<br />

2 (D(2) )(y)(x) h2 + 1<br />

6 (D(3) )(y)(x) h3 +O(h4 )<br />

The O(h4 )termineq1 can be removed with the convert(polynom) command.<br />

> eq1b:=convert(eq1,polynom);<br />

eq1b := y(x + h) =y(x)+D(y)(x) h + 1<br />

2 (D(2) )(y)(x) h2 + 1<br />

6 (D(3) )(y)(x) h3 Similarly y(x ¡ h) is Taylor expanded and the fourth-order term removed.


90 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

> eq2:=y(x-h)=convert(taylor(y(x-h),h=0,4),polynom);<br />

eq2 := y(x ¡ h) =y(x) ¡ D(y)(x) h + 1<br />

2 (D(2) )(y)(x) h2 ¡ 1<br />

6 (D(3) )(y)(x) h3 On subtracting the second expansion, eq2 , from the ¯rst, eq1b,<br />

> eq3:=eq1b-eq2;<br />

eq3 := y(x + h) ¡ y(x ¡ h) =2D(y)(x) h + 1<br />

3 (D(3) )(y)(x) h 3<br />

the h 2 terms cancel, leaving terms involving h and h 3 on the right-hand side of<br />

eq3 . If the latter term is now dropped by substituting h 3 =0intoeq3 ,<br />

> eq3b:=subs(h^3=0,eq3);<br />

eq3b := y(x + h) ¡ y(x ¡ h) =2D(y)(x) h<br />

the relative error in eq3b will be O(h3 )=O(h) =O(h2 ). Solving eq3b for D(y)(x)<br />

yields the central di®erence approximation (CDA) y 0 CDA to the ¯rst derivative.<br />

To use the symbol y 0 in the assignment, y 0 must be enclosed in left quotes.<br />

> `y 0 `[CDA]:=solve(eq3b,D(y)(x));<br />

y 0 1 y(x + h) ¡ y(x ¡ h)<br />

CDA :=<br />

2 h<br />

The quantity y 0 CDA is just the slope of the chord QR that approaches the slope<br />

of the tangent to the y(x) curveatPas h ! 0. The reader will recognize<br />

this limiting result as the usual de¯nition for the ¯rst derivative. The ¯nite<br />

di®erence approximation consists in taking h to be small, but ¯nite.<br />

Now, the above CDA is not the only way of representing y 0 .Theforward-<br />

to the ¯rst derivative results on dropping the<br />

di®erence approximation y 0 FDA<br />

h2 and h3 terms in eq1b and solving for D(y)(x).<br />

> eq4:=subs(fh^2=0,h^3=0g,eq1b);<br />

eq4 := y(x + h) =y(x)+D(y)(x) h<br />

> `y 0 `[FDA]:=solve(eq4,D(y)(x));<br />

y 0 FDA<br />

The backward-di®erence approximation y 0 BDA<br />

> eq5:=subs(fh^2=0,h^3=0g,eq2);<br />

y(x + h) ¡ y(x)<br />

:=<br />

h<br />

is similarly obtained from eq2 .<br />

eq5 := y(x ¡ h) =y(x) ¡ D(y)(x) h<br />

> `y 0 `[BDA]:=solve(eq5,D(y)(x));<br />

y 0 y(x ¡ h) ¡ y(x)<br />

BDA := ¡<br />

h<br />

The forward- and backward-di®erence approximations, both of which have errors<br />

of O(h), correspond to approximating y 0 at P by the slopes of the chords<br />

PRand QP, respectively. For a given (small) value of h, the FDA and BDA are<br />

not as accurate as the CDA. Despite this, the FDA is more commonly used to<br />

represent ¯rst time derivatives in solving initial value problems than the CDA,<br />

because, as will be seen, it allows one to explicitly advance forward in time from<br />

t = 0. Numerical ODE-solving procedures based on the FDA are called explicit


2.3. NUMERICAL SOLUTION OF ODES 91<br />

schemes. If the step size is too large, explicit ¯xed-step numerical schemes tend<br />

to become numerically unstable, so variable-step schemes or implicit schemes<br />

are also commonly used. Implicit schemes are based on the BDA.<br />

How does one represent the second derivative? As with the ¯rst derivative<br />

thereismorethanonewaytorepresenty 00 by a ¯nite di®erence approximation.<br />

However, the most commonly used form is obtained by adding eq1b and eq2<br />

and solving for the second derivative.<br />

> `y 00 `:=solve(eq1b+eq2,(D@D)(y)(x));<br />

y 00 :=<br />

y(x + h)+y(x ¡ h) ¡ 2 y(x)<br />

h 2<br />

This central di®erence approximation, which has an error O(h 2 ), is often used in<br />

numerically solving di®usion and wave equation models, as shall be illustrated<br />

in Chapter 6. A more accurate approximation to y 00 is left as a problem.<br />

PROBLEMS:<br />

Problem 2-19: Alternative second-derivative approximation<br />

By also Taylor expanding y(x +2h) andy(x ¡ 2 h) show that<br />

y 00 [¡y(x+2h)+16y(x+h) ¡ 30 y(x)+16y(x ¡ h) ¡ y(x ¡ 2 h)]<br />

(x)=<br />

(12 h2 +O(h<br />

)<br />

4 )<br />

is an alternative ¯nite di®erence approximation to the second derivative.<br />

Problem 2-20: Fourth-derivative approximation<br />

Show that<br />

y 0000 [y(x +2h) ¡ 4 y(x + h)+6y(x) ¡ 4 y(x ¡ h)+y(x ¡ 2 h)]<br />

(x) =<br />

h4 +O(h 2 )<br />

is a ¯nite di®erence approximation to the fourth derivative.<br />

2.3.2 Rabbits and Foxes: The Sequel<br />

A journey of a thousand miles must begin with a single step.<br />

Lao-tzu, Chinese philosopher (sixth century BC)<br />

Now that we have some idea of how to approximate ¯rst and second derivatives<br />

by ¯nite di®erences, numerical ODE-solving algorithms can be created of<br />

varying accuracy and CPU (central processing unit) time. The ultimate goal,<br />

of course, is to produce a highly accurate numerical scheme for a given ODE<br />

that takes as little CPU time as possible. Generally, more accurate schemes<br />

allow larger step sizes to be used but involve more function evaluations on each<br />

step. Larger step sizes reduce the CPU time, while more function evaluations<br />

increase the time. Unfortunately, the step size can be increased only so far before<br />

the solution becomes quite inaccurate or even displays wild oscillations, an<br />

indication of numerical instability. How the best compromise between accuracy<br />

and time may be reached is the subject matter of numerical analysis courses


92 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

and beyond the scope of this text. Here, we shall be content to present a few<br />

examples that illustrate some of the more important ideas.<br />

The ¯rst recipe involves revisiting those natural foes, the sly foxes and pesky<br />

jackrabbits of Rainbow County. In this sequel, we will not employ the phaseplane<br />

portrait approach but instead replace each time derivative with a forwarddi®erence<br />

approximation and convert the ODEs to ¯nite di®erence equations.<br />

Recall that the predator{prey equations were of the general structure<br />

_r = ar¡ brf ´ R(r; f ); f _ = ¡cf + drf ´ F (r; f); (2.15)<br />

where r(t) andf(t) aretherabbitandfoxnumbers(perunitarea)attimet.<br />

For the coe±cient values we shall take a =2,b =0:01, c =1,andd =0:01,<br />

and r(0) = 300 rabbits and f(0) = 150 foxes as initial conditions.<br />

To solve this set of ¯rst-order nonlinear ODEs, we can proceed as follows.<br />

If h is the time step size, then the time on step (n + 1) is related to the time<br />

on step n by tn+1 = tn + h. Introducing the notation rn ´ r(tn), fn ´ f(tn),<br />

rn+1 ´ r(tn+1), and fn+1 ´ f(tn+1), the FDA to the two time derivatives is<br />

_r = (rn+1 ¡ rn)<br />

and<br />

h<br />

_ f = (fn+1 ¡ fn)<br />

:<br />

h<br />

The overall accuracy of the numerical scheme then depends on how R(r; f )and<br />

F (r; f ) are approximated. Historically, the oldest and simplest approximation<br />

is to evaluate these functions on the nth time step, reducing the ODEs to<br />

rn+1 = rn + hR(rn;fn); fn+1 = fn + hF(rn;fn): (2.16)<br />

This ¯nite di®erence approximation, which allows one to advance forward a<br />

single step at a time, is referred to as the forward Euler algorithm.<br />

The step size h must be taken to be small to obtain an accurate approximation<br />

to the solution of the original ODEs. How small? A common approach<br />

to answering this question is to cut the step size in two and see what e®ect it<br />

has on the answer. This procedure can be repeated until a su±ciently accurate<br />

answer for your purposes has been attained. Some words of caution should be<br />

o®ered, however. One cannot keep cutting the step size in two inde¯nitely for<br />

a ¯xed number of digits or one will encounter round-o® error, theanswerin<br />

fact becoming less accurate. Further, to execute the worksheet out to the same<br />

total time will take more and more CPU time as the step size is decreased.<br />

Let's now solve equations (2.16), ¯rst loading the plots package and entering<br />

the coe±cient values.<br />

> restart: with(plots):<br />

> a:=2: b:=0.01: c:=1: d:=0.01:<br />

The initial time, initial rabbit number, and initial fox number are speci¯ed and<br />

thetimestepsizetakentobeh =0:02. We take N = 1000 steps, so the total<br />

elapsed time for the numerical run will be 0:02 £ 1000 = 20 time units.<br />

> t[0]:=0: r[0]:=300: f[0]:=150: h:=0.02: N:=1000:<br />

Although the Maple system normally uses 10 digits as its default, the number of<br />

digits is speci¯ed in case it is desired to increase this number, e.g., to lessen the


2.3. NUMERICAL SOLUTION OF ODES 93<br />

round-o® error mentioned earlier. To compare the speed of di®erent numerical<br />

schemes or algorithms, the computer CPU time at which the execution of the<br />

algorithm begins is recorded using the time command. The CPU time at which<br />

the execution is ¯nished will also be recorded, the CPU time for the algorithm<br />

then being the di®erence. The CPU time will depend on the computer being<br />

used, the times quoted here being for a 3-GHz PC.<br />

> Digits:=10: begin:=time():<br />

Functional operators are formed to calculate R and F for speci¯ed x and y.<br />

> R:=(x,y)->a*x-b*x*y: F:=(x,y)->-c*y+d*x*y:<br />

A do loop is used to iterate the di®erence equations (2.16) and the time.<br />

> for n from 0 to N do<br />

> r[n+1]:=r[n]+h*R(r[n],f[n]);<br />

> f[n+1]:=f[n]+h*F(r[n],f[n]);<br />

> t[n+1]:=t[n]+h;<br />

A 3-dimensional plotting point is formed for the nth time step.<br />

> pnt[n]:=[t[n],r[n],f[n]];<br />

> end do:<br />

On ending the loop, the temporal evolution of the solution will be observed by<br />

creating a three-dimensional plot using a sequence of the plotting points from<br />

n =0ton = N and the pointplot3d command.<br />

> pointplot3d([seq(pnt[n],n=0..N)],symbol=cross,color=red,<br />

axes=normal,labels=["t","r","f"],tickmarks=[2,3,3]);<br />

20<br />

t<br />

600<br />

f<br />

400<br />

200<br />

0 0<br />

200<br />

r<br />

400<br />

Figure 2.22: Forward Euler solution of the rabbits{foxes equations.


94 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

The resulting spiral trajectory, corresponding to a cyclic variation in population<br />

numbers, is shown in Figure 2.22. The elapsed CPU time for the run,<br />

> CPUtime:=(time()-begin)*seconds;<br />

CPUtime := 0:130 seconds<br />

was only a fraction of a second.<br />

Instead of this \¯rst principles approach" to numerically solving the rabbits{<br />

foxes equations, one can alternatively \dial up" the forward Euler approximation<br />

as follows. The dependent variables r and f are unassigned,<br />

> unassign('r','f'): begin2:=time():<br />

and the ODE system is entered.<br />

> sys:=diff(r(t),t)=R(r(t),f(t)),diff(f(t),t)=F(r(t),f(t)):<br />

The initial population numbers are entered as the initial condition.<br />

> ic:=r(0)=300,f(0)=150:<br />

The numerical ODE solve command is used with the \classical" forward Euler<br />

method included as an option. The step size is 0:02, the same as before.<br />

> sol:=dsolve(fsys,icg,fr(t),f(t)g,type=numeric,<br />

method=classical[foreuler],stepsize=0.02):<br />

By using the odeplot command and specifying that 1000 time steps are to be<br />

taken, exactly the same plot (not displayed here) as in Figure 2.22 is produced.<br />

> odeplot(sol,[t,r(t),f(t)],0..20,numpoints=1000,style=point,<br />

symbol=cross,axes=normal,labels=["t","r","f"],<br />

tickmarks=[2,3,3]);<br />

If the three-dimensional picture produced by either code is rotated to show the<br />

r{f plane, the phase-plane trajectory is as shown in Figure 2.23.<br />

600<br />

400<br />

f<br />

200<br />

0 200 400<br />

r<br />

Figure 2.23: Phase-plane trajectory for the rabbits{foxes system.<br />

Although it appears that the trajectory is an outward-growing spiral, this conclusion<br />

would not be correct. The trajectory really should be a vortex, i.e., a


2.3. NUMERICAL SOLUTION OF ODES 95<br />

closed loop. The incorrect behavior is due to cumulative error arising from use<br />

of the Euler approximation (which has low accuracy) and the ¯nite step size.<br />

Keeping in mind the danger of round-o® error for a ¯xed number of digits, the<br />

growth of the spiral can in principle be reduced by reducing h. But in practice,<br />

the CPU time goes up so rapidly that the Euler method is not used for serious<br />

numerical calculations. In the next recipe, the classical fourth-order Runge{<br />

Kutta method is introduced, a much more accurate numerical scheme than the<br />

Euler method for a given step size.<br />

Finally, the CPU time for the forward Euler dial-up method is determined,<br />

> CPUtime2:=(time()-begin2)*seconds;<br />

CPUtime2 := 0:330 seconds<br />

and is actually slightly longer than for the ¯rst-principles calculation.<br />

PROBLEMS:<br />

Problem 2-21: Van der Pol equation<br />

By setting _x = y, the second-order Van der Pol (VdP) equation<br />

Äx ¡ ² (1 ¡ x 2 )_x + x =0<br />

may be written as a coupled system of two ¯rst-order ODEs. Choosing ² =5<br />

and x(0) = _x(0) = 0:1, solve the VdP system for h =0:01 and t =0to15using<br />

the ¯rst principles Euler method. Rotate your plot to produce a phase-plane<br />

portrait solution and compare the result with what would be obtained using<br />

the dial-up Euler option of the dsolve command.<br />

Problem 2-22: White dwarf equation<br />

In his theory of white dwarf stars, Chandrasekhar [Cha39] introduced the nonlinear<br />

equation<br />

x (d 2 y=dx 2 )+2(dy=dx)+x (y 2 ¡ C) 3=2 =0;<br />

with the boundary conditions y(0) = 1 and y 0 (0) = 0. Write the second-order<br />

equation as two ¯rst-order equations and solve the system using the ¯rst principle's<br />

Euler method. Take h =0:01 and 10-digit accuracy, and numerically<br />

compute y(x) over the range 0 · x · 4withC =0:1 and plot the result. (Hint:<br />

Start at x =0:01 to avoid any problem at the origin.)<br />

Problem 2-23: Baleen whales<br />

May [May80] has discussed the solution of the following normalized equation<br />

describing the population of sexually mature adult baleen whales:<br />

_x(t) =¡ax(t)+bx(t ¡ T )(1 ¡ (x(t ¡ T )) N ):<br />

Here x(t) is the normalized population number at time t, a and b are the<br />

mortality and reproduction coe±cients, T is the time lag necessary to achieve<br />

sexual maturity, and N is a positive parameter. If the term 1 ¡ (x(t ¡ T )) N is<br />

negative, then this term is to be set equal to zero. Taking a =1,b =2,T =2,<br />

step size h =0:01, and 4000 time steps, use the ¯rst principles Euler method to<br />

solve numerically for x(t ¡ T )versusx(t) andforx(t) for(a)N =3:0, and (b)<br />

N =3:5. Plot your results. For (a) you should observe a period-one solution,


96 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

and for (b) a period-two solution. Discuss how this interpretation can be made<br />

from your plots.<br />

Problem 2-24: Arti¯cial example<br />

Consider the nonlinear equation<br />

dy=dx = xy(y ¡ 2);<br />

with y(0) = 1. Taking h =0:02 and 10-digit accuracy, solve for y(x) outto<br />

x = 3 using the dial-up Euler's method and plot the result.<br />

Problem 2-25: Modi¯ed Euler algorithm<br />

If the rabbits{foxes system is written for brevity as _r = R(r; f )and_ f = F (r; f ),<br />

the modi¯ed Euler algorithm for solving the equations is<br />

rn+1 = rn + h<br />

2 (R1[n]+R2[n]); fn+1 = fn + h<br />

2 (F1[n]+F2[n]);<br />

where<br />

tn+1 = tn + h; R1[n] ´ R(rn;fn); F1[n] ´ F (rn;fn);<br />

R2[n] ´ R(rn + hR1[n];fn + hF1[n]); F2[n] ´ F (rn + hR1[n];fn + hF1[n]):<br />

Taking the same parameter values as in the text recipe, but N twice as large,<br />

solve the rabbits{foxes equations using the modi¯ed Euler algorithm given<br />

above. Rotate your plot to show the r{f phase plane and compare the result<br />

with that for the Euler method.<br />

Problem 2-26: Onset of numerical instability<br />

Investigate the onset of numerical instability as h is increased in the modi¯ed<br />

Euler algorithm of the previous problem.<br />

2.3.3 Glycolytic Oscillator<br />

Give me another horse!<br />

William Shakespeare, King Richard III (1564{1616)<br />

The Euler algorithm, which is the simplest example of an explicit ¯xed-step<br />

method, is not a very accurate numerical procedure, being of order h accuracy<br />

(error O(h2 )). A systematic approach to developing more accurate explicit numerical<br />

schemes are the ¯xed-step Runge{Kutta (RK) methods [BF89], which<br />

still use the FDA approximation for the ¯rst derivatives but create better approximations<br />

to the functions on the right-hand side of the ODEs.<br />

Consider an ODE system of the general form<br />

_x = X(t; x; y); _y = Y (t; x; y); (2.17)<br />

where X and Y are known functions of the arguments. Note that any secondorder<br />

ODE of the general structure Äx = Y (t; x; _x) can be put into this standard<br />

form by setting _x = y ´ X.<br />

In the Euler method, the functions X and Y are evaluated only once on<br />

each step. The general RK approach is to increase the accuracy by using more


2.3. NUMERICAL SOLUTION OF ODES 97<br />

evaluations of the functions X and Y , the extra evaluations being carried out at<br />

intermediate points between tn and tn + h in such a way that an nth-order RK<br />

scheme is equivalent to a Taylor series expansion of the functions truncated at<br />

terms of order n. The interested reader is referred to numerical analysis texts<br />

such as Burden and Faires [BF89] for the details.<br />

Here it will su±ce to illustrate the application of the fourth-order Runge{<br />

Kutta (RK4) method, which has been the historical \workhorse" of ¯xed-step<br />

methods. This method, which involves four function evaluations of X and Y on<br />

each step, is of order h 4 in accuracy (error O(h 5 )). Explictly, the RK4 method<br />

applied to equation (2.17) takes the following form:<br />

xn+1 = xn + 1<br />

6 (K1 +2K2 +2K3 + K4); yn+1 = yn + 1<br />

6 (L1 +2L2 +2L3 + L4);<br />

with K1 = hX(tn; xn; yn);<br />

K2 = hX(tn + h=2; xn + K1=2; yn + L1=2) ;<br />

K3 = hX(tn + h=2; xn + K2=2; yn + L2=2) ;<br />

K4 = hX(tn + h; xn + K3; yn + L3);<br />

and L1 to L4 obtained by replacing X with Y in K1 to K4.<br />

Since this RK4 scheme is O(h4 ) accurate, one can either use the same step<br />

size as in the Euler method, producing an answer of greater accuracy, or, alternatively,<br />

use a larger step size to speed up the calculation. However, h can be<br />

increased only so much before the Taylor expansion on which the RK4 method<br />

is based begins to break down and wild numerical oscillations in the output<br />

occur. All explicit schemes are prone to this numerical instability if the step<br />

size is made too large.<br />

Runge{Kutta methods of even greater accuracy than RK4 can be generated,<br />

but these involve even more evaluations of X and Y , which increases the CPU<br />

time. The RK4 method is usually deemed to be the optimum ¯xed-step explicit<br />

method that best combines good accuracy with reasonable CPU time.<br />

As an illustration of the RK4 method, let's consider solving the nonlinear<br />

ODEs describing the glycolytic oscillator. Living cells obtain energy by breaking<br />

down sugar, a process known as glycolysis. In yeast cells, this process proceeds<br />

in an oscillatory way with a period of a few minutes. A simple system of model<br />

equations proposed by Sel'kov [Sel68] to describe the oscillations is as follows:<br />

_x = ¡x + ay+ x 2 y;<br />

_y = b ¡ ay¡ x 2 (2.18)<br />

y:<br />

Here x and y refer to the concentrations of adenosine diphosphate (ADP) and<br />

fructose-6-phosphate (F6P), respectively, and a and b are positive constants.<br />

We shall use the nominal values a=0:05 and b= 0:5, and take x0 =3, y0 =3.


98 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

After loading the plots package, specifying the number of digits, and recording<br />

the beginning time,<br />

> restart: with(plots): Digits:=10: begin:=time():<br />

the parameter values are entered and N = 1000 steps of size h =0:05 are<br />

considered.<br />

> t[0]:=0: x[0]:=3: y[0]:=3: a:=0.05: b:=0.5: N:=1000: h:=0.05:<br />

The functional, or arrow, operator is used to produce the right-hand side of<br />

each ODE. Whatever forms are inserted for x and y in the entries X(x,y) and<br />

Y(x,y) will be operated on as indicated on the right-hand side of the arrow.<br />

> X:=(x,y)-> -x+a*y+x^2*y;<br />

X := (x; y) !¡x + ay+ x2 y<br />

> Y:=(x,y)->b-a*y-x^2*y;<br />

Y := (x; y) ! b ¡ ay¡ x2 y<br />

Similarly, operators are introduced to perform the four function evaluations,<br />

where f will be taken to be X and Y . Note that X and Y do not depend<br />

explicitly on time here.<br />

> k1:=f->h*f(x[n],y[n]):<br />

> k2:=f->h*f(x[n]+K1[n]/2,y[n]+L1[n]/2):<br />

> k3:=f->h*f(x[n]+K2[n]/2,y[n]+L2[n]/2):<br />

> k4:=f->h*f(x[n]+K3[n],y[n]+L3[n]):<br />

Using the above operators, the fourth-order Runge{Kutta algorithm is iterated<br />

from n =0toN = 1000 and a plotting point produced at each step.<br />

> for n from 0 to N do<br />

> K1[n]:=k1(X); L1[n]:=k1(Y);<br />

> K2[n]:=k2(X); L2[n]:=k2(Y);<br />

> K3[n]:=k3(X); L3[n]:=k3(Y);<br />

> K4[n]:=k4(X); L4[n]:=k4(Y);<br />

> x[n+1]:=x[n]+(K1[n]+2*K2[n]+2*K3[n]+K4[n])/6;<br />

> y[n+1]:=y[n]+(L1[n]+2*L2[n]+2*L3[n]+L4[n])/6;<br />

> t[n+1]:=t[n]+h;<br />

> pnt[n]:=[t[n],x[n],y[n]];<br />

> end do:<br />

Using the spacecurve command, the sequence of points is plotted as a solid<br />

blue line with normal axes. The tickmarks are controlled, axis labels added,<br />

and a particular orientation of the 3-dimensional viewing box chosen.<br />

> spacecurve([seq(pnt[n],n=0..N)],color=blue,axes=normal,<br />

tickmarks=[2,2,2],labels=["t","x","y"],<br />

orientation=[23,71]);<br />

The resulting picture is shown in Figure 2.24. It may be rotated on the computer<br />

screen by dragging with the mouse.


2.3. NUMERICAL SOLUTION OF ODES 99<br />

50<br />

t<br />

2<br />

y<br />

0<br />

Figure 2.24: Temporal evolution of a glycolytic oscillator.<br />

The spiral behavior characteristic of temporal oscillations is clearly seen. If<br />

the three-dimensional ¯gure is rotated on the computer screen to show the x-y<br />

phase plane, a closed loop will be observed. One can also view x versus t and<br />

y versus t. The CPU time for the ¯rst-principles RK4 calculation is<br />

> CPUtime:=(time()-begin)*seconds;<br />

CPUtime := 0:500 seconds<br />

about one-half a second.<br />

After unassigning the variables x and y,<br />

> unassign('x','y'): begin2:=time():<br />

exactly the same 3-dimensional plot is produced (not displayed here) by using<br />

the dsolve command with the option method=classical[rk4].<br />

> sys:=diff(x(t),t)=X(x(t),y(t)),diff(y(t),t)=Y(x(t),y(t)):<br />

> sol:=dsolve(fsys,x(0)=3,y(0)=3g,fx(t),y(t)g,type=numeric,<br />

method=classical[rk4],stepsize=0.05):<br />

> odeplot(sol,[t,x(t),y(t)],0..50,axes=normal,numpoints=1000,<br />

color=blue,style=line,tickmarks=[2,2,2],<br />

labels=["t","x","y"],orientation=[23,71]);<br />

> CPUtime2:=(time()-begin2)*seconds;<br />

CPUtime2 := 0:300 seconds<br />

The CPU time for the dial-up routine is slightly shorter than the ¯rst-principles<br />

calculation here.<br />

x<br />

5


100 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

PROBLEMS:<br />

Problem 2-27: Harvesting of ¯sh<br />

In suitably normalized units, the e®ect of ¯shing on the normalized population<br />

number x of a single species of ¯sh with a limited food supply can be described<br />

by the following nonlinear ODE,<br />

_x = x (1 ¡ x) ¡ Hx=(a + x);<br />

where H is the harvesting coe±cient and a is a parameter. For H =0,the<br />

remaining ODE is known as the logistic equation. Show that this equation has<br />

an analytic solution and plot the result for a =0:2 andx(0) = 0:1. Discuss the<br />

behavior of the solution.<br />

Then, using the ¯rst-principles RK4 method with step size h =0:1, numerically<br />

investigate this equation as the harvesting coe±cient H is increased from<br />

zero. Plot your results and discuss the change in behavior as H increases.<br />

Problem 2-28: Bucky the beaver<br />

Bucky the beaver attempts to swim across a river by steadily aiming at a target<br />

point directly across the river. The river is 1 km wide and has a speed of 1<br />

km/hr, while Bucky's speed is 2 km/hr. In Cartesian coordinates, Bucky is<br />

initially at (x =1;y = 0), while the target point is at (0; 0). Bucky is initially<br />

swept an in¯nitesimal distance downstream but recovers almost instantly to<br />

continue his swimming motion. His equations of motion are<br />

2 x<br />

2 y<br />

_x = ¡ p ; _y =1¡ p<br />

x2 + y2 x2 + y2 :<br />

(a) Justify the structure of the equations.<br />

(b) Using the ¯rst-principles RK4 method with h =0:01, determine how long<br />

it takes Bucky to reach the target point.<br />

(c) Determine the analytic solution y(x) for Bucky's path across the river.<br />

(d) Plot the analytic and numerical solutions together for Bucky's path.<br />

Problem 2-29: Chemical reaction<br />

Consider the irreversible chemical reaction<br />

2K2Cr2O7 +2H2O+3S! 4KOH + 2Cr2O3 +3SO2, with initially N1 = 2000 molecules of potassium dichromate (K 2Cr 2O 7), N2 =<br />

2000 molecules of water (H 2O), and N3 = 3000 atoms of sulphur (S). The<br />

number X of potassium hydroxide (KOH) molecules at time t sisgivenbythe<br />

rate equation<br />

_X = k (2 N1 ¡ X) 2 (2 N2 ¡ X) 2 (4 N3=3 ¡ X) 3 ;<br />

with k =1:64 £ 10 ¡20 s ¡1 and X(0) = 0. Determine X(t) byusingthe¯rstprinciples<br />

RK4 method with h =0:001. How many KOH molecules are present<br />

at t =0:1 s?att =0:2 s?


2.3. NUMERICAL SOLUTION OF ODES 101<br />

2.3.4 Fox Rabies Epidemic<br />

Thought is an infection. In the case of certain thoughts, it becomes<br />

an epidemic.<br />

Wallace Stevens, American poet (1879{1955)<br />

As already mentioned, if the step size h is made too large, ¯xed-step explicit<br />

methods not only become increasingly inaccurate, but will become numerically<br />

unstable with the solution eventually \blowing up." One approach to avoiding<br />

this instability is to make use of the backward-di®erence approximation to the<br />

derivative and create an implicit or semi-implicit numerical scheme.<br />

In this example, we will illustrate this approach by solving the nonlinear<br />

ODEs for the fox rabies epidemic 7 model of Anderson and coworkers [AJMS81]<br />

using the backward Euler algorithm. The ideas presented here can be extended<br />

to higher-order RK methods.<br />

The rabies epidemic model was applied to the fox population in central Europe,<br />

the epidemic believed to have originated in Poland in 1939. In this model,<br />

the fox population is divided into three categories: susceptibles (population<br />

density x foxes/km 2 ) are foxes that are currently healthy but are susceptible<br />

to catching the virus; infected (density y) arefoxesthathavecaughtthevirus<br />

but are not yet capable of passing on the virus; infectious (density z) arefoxes<br />

that are capable of infecting the susceptibles. The model has no category of<br />

recovered immune foxes because very few, if any, survive after acquiring the<br />

rabies virus. For other diseases with a lower mortality rate, one would add a<br />

recovered category and therefore an additional modeling equation. The relevant<br />

equations for the fox rabies epidemic are<br />

_x = ax¡ (b + gN) x ¡ ¯xz´ X;<br />

_y = ¯xz¡ (¾ + b + gN) y ´ Y;<br />

_z = ¾y¡ (® + b + gN) z ´ Z;<br />

(2.19)<br />

with N = x + y + z being the total fox density. The meaning of the various<br />

coe±cients in (2.19) and their estimated values is as follows:<br />

Symbol Meaning Value<br />

a average per capita birth rate 1/year<br />

b average per capita intrinsic death rate 0:5/year<br />

¯ rabies transmission coe±cient 79:67 km 2 /year<br />

¾ 1=¾ = average latent period (¼ 28 to 30 days) 13/year<br />

® death rate of rabid foxes 73/year<br />

g gN represents increased death rate at large 0.1-5 km 2 /year<br />

N due to depletion of food supply<br />

7 Modeling the spread of diseases is extensively discussed in Murray [Mur89].


102 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

Using the BDA for the time derivative to connect time step n to the previous<br />

step n ¡ 1 and approximating the rhs with its value at step n, thebackward<br />

Euler approximation to equations (2.19) is<br />

xn ¡ xn¡1<br />

h<br />

= Xn; yn ¡ yn¡1<br />

h<br />

= Yn;<br />

zn ¡ zn¡1<br />

h<br />

= Zn;<br />

or letting n ! n + 1 and substituting the forms of X, Y ,andZ,<br />

xn+1 = xn + h (a ¡ b) xn+1 ¡ hgNn+1 xn+1 ¡ h¯xn+1 zn+1<br />

yn+1 = yn + h¯xn+1 zn+1 ¡ h (¾ + b) yn+1 ¡ hgNn+1 yn+1<br />

zn+1 = zn + h¾yn+1 ¡ h (® + b) zn+1 ¡ hgNn+1 zn+1<br />

(2.20)<br />

with Nn+1 = xn+1 + yn+1 + zn+1.<br />

This algorithm is nonlinear in the unknowns xn+1, yn+1, andzn+1, andis<br />

an example of an implicit algorithm because one cannot explicitly express the<br />

unknowns in terms of the known values xn, yn, andzn. The standard approach<br />

is to make the scheme semi-implicit by linearizing it as follows. For a nonlinear<br />

function f(xn+1; zn+1), we Taylor expand thus:<br />

μ <br />

μ <br />

@f<br />

@f<br />

f(xn+1;zn+1) =f(xn;zn)+(xn+1¡xn)<br />

+(zn+1¡zn)<br />

+¢¢¢<br />

@x<br />

@z<br />

xn;zn<br />

xn;zn<br />

For our fox-rabies example, this gives us, for example,<br />

f ´ (xz) n+1 = xn zn + zn(xn+1 ¡ xn)+xn(zn+1 ¡ zn): (2.21)<br />

Applying this procedure to all of the quadratic terms on the rhs of (2.20) and<br />

gathering all the \new" values xn+1, etc.,onthelhs,weobtain<br />

with<br />

A1n xn+1 + B1n yn+1 + C1n zn+1 = xn + D1n;<br />

A2n xn+1 + B2n yn+1 + C2n zn+1 = yn + D2n;<br />

A3n xn+1 + B3n yn+1 + C3n zn+1 = zn + D3n;<br />

(2.22)<br />

A1n =1+h (b ¡ a)+hg(Nn + xn)+h¯zn; B1n =hgxn; C1n =h (¯ + g) xn;<br />

A2n =hgyn ¡ h¯zn; B2n =1+h (¾ + b)+hg(Nn + yn); C2n =hgyn ¡ h¯xn;<br />

A3n =hgzn; B3n =hgzn ¡ h¾; C3n =1+h (® + b)+hg(Nn + zn);<br />

D1n =hgNn xn + h¯xn zn; D2n =hgNn yn ¡ h¯xn zn; D3n =hgNn zn:<br />

We now have three linear equations (2.22), with known numerical coe±cients<br />

determined from the previous step, for the three unknowns xn+1, yn+1, zn+1.


2.3. NUMERICAL SOLUTION OF ODES 103<br />

The semi-implicit algorithm is now implemented in the following recipe,<br />

taking a total of 5000 time steps of size h =0:004.<br />

> restart: Digits:=10: total:=5000: h:=0.004:<br />

The parameter values are entered, with g at the lower end of its range.<br />

> a:=1: b:=0.5: beta:=79.67: g:=0.1: alpha:=73: sigma:=13:<br />

Initially, we take x0 =4,y0 =0:4, and z0 =0:1.<br />

> t[0]:=0: x[0]:=4: y[0]:=0.4: z[0]:=0.1:<br />

The initial plotting point is formed, and the starting time of the do loop that<br />

iterates the algorithm is recorded.<br />

> pnt[0]:=[t[0],x[0],y[0]]: begin:=time():<br />

> for n from 0 to total do<br />

The various coe±cients are evaluated on the nth step.<br />

> N[n]:=x[n]+y[n]+z[n];<br />

> A1[n]:=1+h*(b-a)+h*g*(N[n]+x[n])+h*beta*z[n];<br />

> B1[n]:=h*g*x[n];<br />

> C1[n]:=h*(beta+g)*x[n];<br />

> D1[n]:=h*g*N[n]*x[n]+h*beta*x[n]*z[n];<br />

> A2[n]:=h*g*y[n]-h*beta*z[n];<br />

> B2[n]:=1+h*(sigma+b)+h*g*(N[n]+y[n]);<br />

> C2[n]:=h*g*y[n]-h*beta*x[n];<br />

> D2[n]:=h*g*N[n]*y[n]-h*beta*x[n]*z[n];<br />

> A3[n]:=h*g*z[n];<br />

> B3[n]:=h*g*z[n]-h*sigma;<br />

> C3[n]:=1+h*(alpha+b)+h*g*(N[n]+z[n]);<br />

> D3[n]:=h*g*N[n]*z[n];<br />

The linear equations for xn+1, yn+1, zn+1 are entered,<br />

> E1:=A1[n]*x[n+1]+B1[n]*y[n+1]+C1[n]*z[n+1]=x[n]+D1[n];<br />

> E2:=A2[n]*x[n+1]+B2[n]*y[n+1]+C2[n]*z[n+1]=y[n]+D2[n];<br />

> E3:=A3[n]*x[n+1]+B3[n]*y[n+1]+C3[n]*z[n+1]=z[n]+D3[n];<br />

and numerically solved.<br />

> sol[n+1]:=(fsolve(fE1,E2,E3g,fx[n+1],y[n+1],z[n+1]g));<br />

The solution is assigned and the values of xn+1, yn+1, andzn+1 are recorded<br />

at time tn+1 = tn + h.<br />

> assign(sol[n+1]);<br />

> x[n+1],y[n+1],z[n+1];<br />

> t[n+1]:=t[n]+h;<br />

Finally, a plotting point is formed and the loop ended.<br />

> pnt[n+1]:=[t[n+1],x[n+1],y[n+1]];<br />

> end do:


104 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

Ona3-GHzPC,theCPUtimetoexecutetheloop<br />

> cpu:=time()-begin;<br />

cpu := 10:565<br />

is about 11 seconds.<br />

The points are now plotted, the resulting curve being shown in Figure 2.25.<br />

The three-dimensional curve may be rotated on the computer screen by dragging<br />

the viewing box with the mouse. What does the model calculation predict?<br />

> plots[spacecurve]([seq(pnt[n],n=0..total)],color=black,<br />

axes=normal,tickmarks=[3,2,3],labels=["t","x","y"]);<br />

20<br />

t<br />

10<br />

1.5<br />

1<br />

0.5<br />

Figure 2.25: Semi-implicit solution of fox rabies epidemic model.<br />

You can con¯rm that the algorithm remains stable for much larger h, but<br />

becomes increasingly inaccurate. In general, semi-implicit schemes are not guaranteed<br />

to be stable, but usually are. However, such schemes are costly in terms<br />

of computing time if high accuracy is required. For systems of nonlinear ODEs,<br />

this is usually the case, so variable- or adaptive-step explicit schemes are preferred<br />

by researchers. Such schemes adjust the step size so that larger steps are<br />

used when the \terrain" is °atter and smaller steps when it becomes steeper.<br />

Maple's default ODE algorithm is based on the Runge{Kutta{Fehlberg 45<br />

(RKF45) scheme, one of the most widely used adaptive step methods. Without<br />

getting into the details, which can be found in standard numerical analysis<br />

texts [BF89], the code uses both the fourth-order and ¯fth-order Runge{Kutta<br />

schemes and compares the results of both algorithms on each step, using the<br />

di®erence in answers as a measure of the error. The step size is then adjusted<br />

to maintain some maximum tolerance on the error.<br />

0<br />

y<br />

2<br />

x<br />

4


2.3. NUMERICAL SOLUTION OF ODES 105<br />

PROBLEMS:<br />

Problem 2-30: The arms race<br />

Rapoport [Rap60] has proposed the following system of model equations to<br />

describe the arms race between two nations (or two groups of nations),<br />

_x = ¡m1 x + a1 y + b1 y 2 ;<br />

_y = ¡m2 y + a2 x + b2 x 2 ;<br />

where x and y are the defense budgets (in suitable units of currency) of the two<br />

nations and all constants are positive. Explain the terms in the model.<br />

Apply the semi-implicit backward Euler method to Rapoport's model, taking<br />

the nominal values m1 =0:5, a1 =1,b1 =0:02, m2 =0:4, a2 =0:1,<br />

b2 =0:05, x(0) = y(0) = 0:5. Try di®erent step sizes and plot the results in t<br />

vs. x vs. y space. Discuss the results.<br />

Problem 2-31: Van der Pol oscillator<br />

The Van der Pol equation,<br />

Äx ¡ ² (1 ¡ _x 2 )+x =0;<br />

with ² =5:03, x(0) = 0:1, and _x(0) = 0 was the subject of recipe 01-1-3.<br />

Choosing a suitable step size, numerically solve this ODE using the semi-implicit<br />

backward Euler method and compare with the results obtained in 01-1-3.<br />

Problem 2-32: Second-order-accurate scheme<br />

Given a system of ¯rst-order nonlinear ODEs with a representative equation<br />

of the structure _x = X(x; : : :), one can create a second-order-accurate semiimplicit<br />

numerical scheme by using the backward-di®erence approximation for<br />

the derivative and replacing the Euler approximation Xn on the rhs with the<br />

average (Xn + Xn+1)=2.<br />

Derive a second-order-accurate semi-implicit algorithm for the RÄossler system<br />

of Section 1.2.3. Taking a = b =0:2, c =5:0, x(0) = 4:0, y(0) = z(0) = 0,<br />

and h =0:05, determine the behavior of the system up to t = 100 and plot the<br />

trajectory in x-y-z space. How do your results compare with those obtained<br />

with recipe 01-2-3 for the same parameter values?<br />

Problem 2-33: Sti® ODE system<br />

A sti® ODE system is one for which there are two or more very di®erent time or<br />

spatial scales of the independent variable. Numerical instability can occur for<br />

sti® systems solved with ¯xed-step explicit schemes unless the step size is taken<br />

to be shorter than (about) the shortest time scale for the system. Consider the<br />

following set of coupled linear ODEs,<br />

_x =998x +1998y; _y = ¡999 x ¡ 1999 y;<br />

subject to the initial conditions x(0) = 1 and y(0) = 0.<br />

(a) Analytically solve the system for x(t) andy(t).<br />

(b) Determine the two characteristic times in the solutions and con¯rm that<br />

they are very di®erent from each other.


106 CHAPTER 2. PHASE-PLANE ANALYSIS<br />

(c) Using the dial-up RK4 algorithm, con¯rm the statement on numerical<br />

instability and the characteristic time scales.<br />

(d) Using the backward-di®erence approximation for the time derivatives and<br />

the Euler approximation on the right-hand side, show that the numerical<br />

instability can be \cured." Choose a step size such that when plotted<br />

using a point style, the numerical points lie on the analytic curves for<br />

x(t) andy(t).<br />

Problem 2-34: Forced sti® system<br />

Repeat the steps of the previous problem for the forced system<br />

_x =9x +24y +5cost ¡ 1<br />

1<br />

sin t; _y = ¡24 x ¡ 51 y ¡ 9cost + sin t;<br />

3 3<br />

subject to the initial conditions x(0) = 4=3 andy(0) = 2=3.


Part II<br />

THE ENTREES<br />

That is the essence of science:<br />

ask an impertinent question,<br />

and you are on the way to a pertinent answer.<br />

Jacob Bronowski, British scientist, author, The Ascent of Man, 1973<br />

The whole of science is nothing more<br />

than a re¯nement of everyday thinking.<br />

Albert Einstein, physics Nobel laureate, Out of My Later Years, 1950<br />

The e®ort to understand the universe is one<br />

of the very few things that lifts human life a little<br />

above the level of farce, and gives it<br />

some of the grace of tragedy.<br />

Steven Weinberg, American physicist, The First Three Minutes, 1977<br />

107


Chapter 3<br />

Linear ODE Models<br />

Among all the mathematical disciplines the theory of di®erential<br />

equations is the most important. It furnishes the explanation of all<br />

those elementary manifestations of nature which involve time.<br />

Sophus Lie, Norwegian mathematician (1842{1899)<br />

In the two chapters of the Appetizers, we presented only a few examples of<br />

linear ODEs, because the graphical and numerical techniques were more suitable<br />

for nonlinear systems where generally exact analytic solutions simply do<br />

not exist. Also, modern research often involves nonlinear ODE (and PDE)<br />

systems, a subject that is almost completely neglected in undergraduate mathematics<br />

training. So, one of the goals of this text is to partially ¯ll in this<br />

\hole," showing how a computer algebra system may be used to explore nonlinear<br />

models without getting \buried" in messy and complicated mathematical<br />

details. However, we would be remiss if we did not provide some coverage of<br />

linear di®erential equation systems, both ordinary and partial. The former are<br />

covered in this chapter, while linear PDEs are dealt with in Chapters 5 and 6.<br />

In between, we shall explore nonlinear ODEs further in Chapter 4.<br />

For linear ODE systems with constant coe±cients, it is always possible to<br />

¯nd exact analytic solutions in terms of \elementary" mathematical functions<br />

such as sines and cosines, logs, and exponentials. Analytic solutions are also<br />

possible for linear ODEs with variable coe±cients that are of the so-called<br />

Sturm{Liouville [MW71] type. Included in this classi¯cation are such \famous"<br />

ODEs as Bessel's equation and the Legendre and Hermite equations, to mention<br />

just a few. The solutions are expressed in terms of \special" functions, de¯ned<br />

in terms of either in¯nite series or ¯nite polynomials.<br />

In this chapter, the emphasis will be on illustrating how the dsolve command<br />

can be used to easily generate analytic solutions for some physically<br />

interesting linear ODE systems, with both constant and variable coe±cients.<br />

We will not go into mathematical methods here, leaving this to your mathematics<br />

education. However, if you would like to see computer algebra recipes that<br />

apply mathematical methods to solving ODEs, you are referred to <strong>Computer</strong><br />

<strong>Algebra</strong> <strong>Recipes</strong> for Mathematical Physics [Enn05].<br />

109


110 CHAPTER 3. LINEAR ODE MODELS<br />

3.1 First-Order Models<br />

The most general nth-order linear ODE can be written in the form<br />

a0(t) dn x(t)<br />

dt n<br />

+ a1(t) dn¡1 x(t)<br />

dt n¡1<br />

dx(t)<br />

+ ¢¢¢+ an¡1(t)<br />

dt + an(t) x(t) =h(t); (3.1)<br />

the equation being labeled as linear because each term on the left-hand side is<br />

linear, or of ¯rst order, in the dependent variable x. For the sake of de¯niteness,<br />

the independent variable has been taken to be the time t here, but could be a<br />

spatial variable. If h(t) = 0, the di®erential equation is said to be homogeneous,<br />

otherwise it is inhomogeneous.<br />

In the following two recipes, we look at two examples of inhomogeneous<br />

¯rst-order ODEs, the ¯rst involving constant coe±cients, the second containing<br />

variable coe±cients.<br />

3.1.1 How's Your Blood Pressure?<br />

Amid the pressure of great events, a general principle gives no help.<br />

Georg Hegel, German philosopher (1770{1831)<br />

On measuring your blood pressure, your doctor will give you two numbers.<br />

A normal blood pressure for humans is 120/80, the ¯rst number specifying<br />

the maximum (systolic) pressure (in units of mm of Hg) on the arterial walls,<br />

the second number the minimum (diastolic) pressure. The blood pressure is<br />

generated by the beating of the heart, its variation controlled by the aorta.<br />

The aorta is the large blood vessel into which the arterial blood °ows on<br />

leaving the heart. During the systolic phase of the heartbeat cycle, blood is<br />

pumped under pressure from the heart into one end of the aorta, whose walls<br />

then stretch in order to accommodate the blood. The diastolic phase then<br />

follows during which there is no °ow of blood into the aorta, its walls elastically<br />

contracting. The blood is then squeezed out of the aorta and around the body's<br />

circulatory system. The following recipe presents a simple model of the variation<br />

of blood pressure due to the beating heart and the aorta.<br />

The entry infolevel[dsolve] will provide some information about the<br />

dsolve command, the amount of information generally increasing as the integer<br />

(which can vary from 1 to 5) speci¯ed on the right of the colon is increased.<br />

> restart: infolevel[dsolve]:=2:<br />

Let V (t) be the volume of the aorta and p(t) the pressure within it at time t.<br />

Assuming that the aorta expands linearly with increasing p, thenV = V0 + Cp,<br />

where V0 and C are constants. The parameter C, called the compliance, isa<br />

measure of the stretchability of the aorta. Mentally di®erentiating this relation<br />

produces ode1 .<br />

> ode1:=diff(V(t),t)=C*diff(p(t),t);<br />

ode1 := d<br />

V (t) =C<br />

dt<br />

μ d<br />

dt p(t)


3.1. FIRST-ORDER MODELS 111<br />

Therateofchangeofvolume(dV=dt) of the aorta is equal to the di®erence<br />

between the rate f(t) at which blood is pumped into the aorta by the heart and<br />

the rate p(t)=R at which blood is pumped out of the aorta into the circulatory<br />

system. The constant R is referred to as the systemic resistance. Thus, the<br />

second ODE is is now given by ode2 .<br />

> ode2:=diff(V(t),t)=f(t)-p(t)/R;<br />

ode2 := d<br />

p(t)<br />

V (t) =f (t) ¡<br />

dt R<br />

An ODE (ode3 ) for pressure alone results on substituting ode1 into ode2 .<br />

> ode3:=subs(ode1,ode2);<br />

μ<br />

d<br />

ode3 := C<br />

dt p(t)<br />

<br />

= f (t) ¡ p(t)<br />

R<br />

As a simple model of the forcing function f(t), let's assume that during the<br />

systolic (pumping) phase f(t) =A sin(¼t=¿), with A the amplitude and ¿ the<br />

duration of this phase, and f(t) = 0 during the diastolic (nonpumping) phase.<br />

So f(t) is a piecewise forcing function. If T is the time for one complete cycle<br />

(time between heart beats), the piecewise function for two heartbeats can be<br />

entered using the following piecewise command.<br />

> f(t):=piecewise(t0, R>0, A>0, and P>0.<br />

> sol:=dsolve(fode3,p(0)=Pg,p(t))<br />

assuming (tau>0,T>tau,C>0,R>0,A>0,P>0) ;<br />

The assuming command applies the assumption only to the command line in<br />

which it appears. If you wish to apply assumptions to the entire work sheet,<br />

you can use the assume command at the beginning of the work sheet. In either


112 CHAPTER 3. LINEAR ODE MODELS<br />

case, the assumptions are determined by trial and error, i.e., looking at the<br />

form of the answer, which is now given.<br />

Methods for ¯rst order ODEs:<br />

| Trying classi¯cation methods |<br />

trying a quadrature<br />

trying 1st order linear<br />

< ¡t<br />

e<br />

( RC<br />

>:<br />

)μ<br />

P + AC¼¿R2<br />

¿ 2 + ¼ 2 R 2 C 2<br />

AC¼¿R<br />

¡<br />

2 μ <br />

¼t<br />

cos<br />

¿<br />

¿ 2 + ¼2R2C 2 +<br />

AR¿ 2 μ <br />

¼t<br />

sin<br />

¿<br />

¿ 2 + ¼2R2 ; t · ¿<br />

C2 8<br />

<<br />

AC¼¿R<br />

:<br />

2 ¿¡t<br />

e<br />

( RC )<br />

¿ 2 + ¼2R2 ¡t<br />

+ e( RC<br />

C2 )μ<br />

P + AC¼¿R2<br />

¿ 2 + ¼2R2C 2<br />

<br />

; t · T<br />

¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢<br />

Intheabovesolution,wehaveshownonlytheanalyticform(thusthedots)<br />

for the ¯rst cycle to save on text space. You can observe the complete solution<br />

by executing the recipe on your computer. Because of the inclusion of the<br />

infolevel[dsolve] command, we are told in the output that Maple recognizes<br />

ode3 as a ¯rst-order linear ODE and presumably uses a standard method for<br />

solving such an ODE. You may object to this \black box" nature of the dsolve<br />

command, but obtaining the answer easily in our opinion is more important<br />

than the mechanical details leading up to it. However, if the methodology is<br />

important to you, we shall mimic a hand calculation in the next recipe.<br />

To make a plot, we shall take the parameter values1 to be T = 1 second (60<br />

heartbeats per minute), ¿ =0:15 s, C =0:002 liters/mm Hg, P =80mmHg,<br />

and R = 1056 mm Hg/liter/second.<br />

> tau:=0.15: T:=1: C:=0.002: P:=80: R:=1056:<br />

The amplitude parameter A must be such that the right-hand side (rhs) of the<br />

solution must be the same at t = T as at t = 0, i.e., the heartbeat is periodic.<br />

> eq:=eval(rhs(sol),t=0)=eval(rhs(sol),t=T);<br />

432:0593387 A¼<br />

eq := 80: =<br />

+49:82624166<br />

0:0225 + 4:46054400 ¼2 The above equation is numerically solved for A.<br />

> A:=fsolve(eq,A);<br />

A := 0:9791418590<br />

The pressure is then given by the rhs of sol, the °oating-point evaluation commandbeingusedtoexpresstheanswertofourdigits.<br />

> Pressure:=evalf(rhs(sol),4);<br />

1These approximate values are taken from the Internet.


3.1. FIRST-ORDER MODELS 113<br />

Pressure:= © 103:4 e (¡0:4735 t) ¡ 23:36 cos(20:95 t)+0:5280 sin(20:95 t); t· 0:15<br />

f 103:4 e (¡0:4735 t) +23:36 e (0:07102¡0:4735 t) ;t· 1:<br />

f 103:4 e (¡0:4735 t) +23:36 e (0:07102¡0:4735 t) (0:4735¡0:4735 t)<br />

+23:36 e<br />

¡ 23:36 cos(¡20:95 + 20:95 t)+0:5280 sin(¡20:95 + 20:95 t); t· 1:15<br />

f 103:4 e (¡0:4735 t) +23:36 e (0:07102¡0:4735 t) (0:4735¡0:4735 t)<br />

+23:36 e<br />

+23:36 e (0:5445¡0:4735 t) ; 1:15 plot(f(t),t=0..2*T,labels=["t","f(t)"],tickmarks=[3,4]);<br />

0.8<br />

0.6<br />

f(t)<br />

0.4<br />

0.2<br />

0<br />

1 t 2<br />

Figure 3.1: Piecewise forcing function f(t).<br />

The blood pressure variation is plotted over the same interval.<br />

> plot(Pressure,t=0..2*T,labels=["t","Pressure"]);<br />

120<br />

110<br />

Pressure<br />

100<br />

90<br />

80<br />

0 0.2 0.4 0.6 0.8 1 t 1.4 1.6 1.8 2<br />

Figure 3.2: Time variation of the blood pressure.


114 CHAPTER 3. LINEAR ODE MODELS<br />

The resulting picture is shown in Figure 3.2, the plot capturing the gross behavior<br />

of the variation in blood pressure with time. More detailed behavior can<br />

be obtained by using more sophisticated models. You might try an Internet<br />

search to learn more about these models.<br />

PROBLEMS:<br />

Problem 3-1: More heartbeats<br />

Modify the forcing function in the text recipe to include four heartbeats. Do an<br />

Internet search on blood pressure and discuss how the model could be improved.<br />

Problem 3-2: An RL circuit<br />

A simple electrical circuit consists of a resistor of R ohms (−) in series with an<br />

inductor of L henries (H) and a battery providing a constant voltage v (in volts<br />

(V)). If i(t) is the current in the circuit at time t, the voltage drop across the<br />

resistor is Ri (Ohm's law) and across the inductor is L (di=dt).<br />

(a) Making use of Kirchho®'s voltage rule, which states that the sum of the<br />

voltage drops is equal to the supplied voltage, derive the ¯rst-order ODE<br />

for i(t) and solve it, given that the initial current is zero.<br />

(b) Taking L =4H,R =12−,andv = 60 V, plot the solution over a time<br />

interval that brings the current to within 1% of its asymptotic value.<br />

(c) The battery is replaced with a generator that produces a variable voltage<br />

of v(t) = 60 sin(30 t) volts, the resistor and inductor retaining the same<br />

values as in part (b). If the initial current is zero, determine the current<br />

i(t) fort¸0. Plot the current over a time interval that brings the current<br />

to within 1% of steady state.<br />

Problem 3-3: Learning curves for widget production<br />

Learning curves are used by scientists interested in learning theory. A learning<br />

curve is a plot of the performance P (t) of someone learning a skill as a function<br />

of the training time t. A simple model of learning curve is to assume that the<br />

rate dP=dt at which performance improves is proportional to M ¡ P (t), where<br />

M is the maximum level of performance. Determine the analytic form of P (t)<br />

and discuss what this model implies.<br />

Two new workers (Jimbo and Jumbo) are hired for an assembly line producing<br />

widgets. Jimbo (Jumbo) produces 25 (35) widgets during the ¯rst hour and<br />

45 (50) widgets the second hour. Estimate the maximum number of widgets<br />

per hour that each is capable of producing and plot their learning curves.<br />

Problem 3-4: Population growth<br />

A deer population initially numbers 1000 and has a growth rate of 0.5 when t<br />

is measured in months. The population is \harvested" throughout the year at<br />

therateofh (2 + cos(¼t=6)) per month, where h is a constant. Determine the<br />

deer population number as a function of t. What value of h would lead to a<br />

zero population growth over the 12-month period from t =0tot =12? Plot<br />

the deer-population curve for this 12-month period.


3.1. FIRST-ORDER MODELS 115<br />

3.1.2 Greg Arious Nerd's Problem<br />

It will be found, in fact, that the ingenious are always fanciful,<br />

and the truly imaginative never otherwise than analytic.<br />

Edgar Allan Poe, American writer, TheMurdersintheRueMorgue,1841<br />

Greg Arious Nerd, an eminent mathematician at the Erehwon Institute of Technology<br />

(EIT), has assigned the following problem for his undergraduate class to<br />

solve using computer algebra. They are not to use dsolve to analytically solve<br />

the relevant ODE, but instead use command structures found in the DEtools<br />

library package that mimic the steps in a hand calculation.<br />

Starting from rest, Evil Knievel weevil experiences a time-dependent drive<br />

force Fdrive = t2 e ¡t andadragforceFdrag = ¡(t2 =(1 + t)) v(t), per unit mass.<br />

Mimicking a hand calculation, determine Evil's velocity v(t) attimetand plot<br />

it over the interval t = 0 to 10 Erehwonian time units. What distance does Evil<br />

travel in this interval?<br />

Here is Professor Nerd's answer key. Loading the DEtools package,<br />

> restart: with(DEtools):<br />

the drag and drive forces are entered.<br />

> F[drag]:=-(t^2/(1+t))*v(t); F[drive]:=t^2*exp(-t);<br />

Fdrag := ¡ t2 v(t)<br />

Fdrive := t<br />

1+t<br />

2 e (¡t)<br />

Applying Newton's second law, the ODE governing Evil Knievel's velocity is<br />

> ode:=diff(v(t),t)=F[drag]+F[drive];<br />

ode := d<br />

dt v(t) =¡t2 v(t)<br />

1+t + t2 e (¡t)<br />

Although not requested, Nerd applies the odeadvisor command to ode. This<br />

command will classify the ODE and inclusion of the help option causes a relevant<br />

Help page with useful hyperlinks to be opened. The Help page should be<br />

closed when one is ¯nished reading it.<br />

> odeadvisor(ode,help); #close Help page<br />

[ linear]<br />

In this case, ode is classi¯ed as linear, which is obvious by inspection.<br />

Proceeding by hand, one would look for the integrating factor2 of the ¯rstorder<br />

inhomogeneous ODE. With Maple, the integrating factor IF for ode is<br />

obtained by entering intfactor(ode), which is then simpli¯ed.<br />

> IF:=intfactor(ode);<br />

t2<br />

IF := e<br />

( 2 ¡ t +ln(1+t))<br />

> IF:=simplify(IF);<br />

R<br />

2 f(t) dt.<br />

For a general linear ¯rst-order ODE, _x + f(t) x = g(t), the integrating factor is e


116 CHAPTER 3. LINEAR ODE MODELS<br />

( t (t¡2)<br />

IF := (1 + t) e 2 )<br />

With the integrating factor known, the standard mathematical procedure is to<br />

multiply ode by IF and integrate. This is easily accomplished with the ¯rst<br />

integral (firint) command.<br />

> sol1:=firint(ode*IF);<br />

μ<br />

<br />

t (t¡2) t (t¡2)<br />

sol1 := e<br />

( ) 2 + e<br />

( ) 2 t v(t) ¡ 3 te (1=2 t2 ¡ 2 t) ¡ 4 e (1=2 t2 ¡ 2 t)<br />

+ 5<br />

2 I p ¼e (¡2) p μ<br />

1<br />

2erf<br />

2 I p 2 t ¡ p <br />

2 I ¡ t2 e (1=2 t2 ¡ 2 t) + C1 =0<br />

In the solution output, I stands for p ¡1, erf for the error function, 3 and C1<br />

is the integration constant to be determined. Then, sol1 is solved for v(t), the<br />

result (assigned the name V ) not being shown here in the text.<br />

> V:=solve(sol1,v(t));<br />

Evil Knievel's initial velocity is zero. So the constant C1 is determined by<br />

evaluating the velocity V at t = 0, equating the result to 0, and solving for<br />

C1 . The constant will be automatically substituted into V .<br />

> _C1:=solve(eval(V,t=0)=0,_C1);<br />

C1 := 4 + 5<br />

2 I p ¼e (¡2) p 2erf( p 2 I)<br />

On simplifying V , Evil Knievel's velocity is now determined at arbitrary time<br />

t ¸ 0. This is a nontrivial result to derive by hand.<br />

> Vel:=simplify(V);<br />

Vel := 1<br />

μ<br />

6 te<br />

2<br />

+2t 2 e<br />

t (t¡4)<br />

( 2<br />

t (t¡4)<br />

( 2<br />

) +8e (<br />

t (t¡4)<br />

2 ) p (¡2) ¡ 5 I ¼e p μ<br />

1<br />

2erf<br />

) p<br />

¡ 8 ¡ 5 I ¼e (¡2) p 2erf( p <br />

2 I) e<br />

2 I p 2 t ¡ p <br />

2 I<br />

t (t¡2)<br />

(¡ 2<br />

) ± (1 + t)<br />

Now, since the original ODE was completely real, the velocity must also be<br />

completely real. It can be converted to a real form using the Re (real part of)<br />

command, assuming that t>0. The new function er¯ is the imaginary error<br />

function, 4 which is a real function here.<br />

> Vel:=Re(Vel) assuming t>0;<br />

Vel := 1<br />

Ã<br />

6 te<br />

2<br />

+2t 2 e<br />

t (t¡4)<br />

( 2<br />

t (t¡4)<br />

( 2<br />

R<br />

3 2 u<br />

De¯ned as erf(u) = p¼<br />

) +8e (<br />

t (t¡4)<br />

2 ) p (¡2) +5 ¼e p à p<br />

2 t<br />

2er¯<br />

) p (¡2) ¡ 8+5 ¼e p 2er¯( p <br />

2) e<br />

0 e¡t2<br />

dt:<br />

4 De¯ned as er¯(u) =¡I erf(Iu)= 2<br />

p¼<br />

R u<br />

0 et2<br />

dt.<br />

t (t¡2)<br />

(¡ 2<br />

2 ¡ p 2<br />

!<br />

) ± (1 + t)


3.1. FIRST-ORDER MODELS 117<br />

Evil Knievel's velocity is plotted over the time interval t = 0 to 10 time units,<br />

labels being added to the graph.<br />

> plot(Vel,t=0..10,labels=["t","Vel"],tickmarks=[3,3]);<br />

0.3<br />

Vel<br />

0.2<br />

0.1<br />

0<br />

2 4 6 8 10<br />

t<br />

Figure 3.3: Evil Knievel's velocity pro¯le.<br />

The resulting picture is shown in Figure 3.3, the velocity curve increasing from<br />

zero to a maximum and then decreasing to zero again as t !1.<br />

The distance traveled in the time interval t = 0 to 10 is equal to the area<br />

under the velocity curve between these limits, this area obtained by performing<br />

the integration R 10<br />

Vel dt. However, if the integer 10 is used, the integral will<br />

0<br />

not be evaluated. A °oating-point answer could be obtained by apply the evalf<br />

command. An alternative way used here in Professor Nerd's answer key is to<br />

enter the upper limit as 10.0, which forces a °oating-point evaluation of the<br />

integral. It does not imply any increase in accuracy.<br />

> distance:=int(Vel,t=0..10.0); #note floating point number<br />

distance := 0:9943356328<br />

So, Evil Knievel travels just under 1 Erehwonian spatial unit in the time interval.<br />

PROBLEMS:<br />

Problem 3-5: Direct solution<br />

Solve Professor Nerd's problem directly with the dsolve command and check<br />

that the answer is identical to that derived in the text recipe.<br />

Problem 3-6: Di®erent drive force<br />

The drive force in the text recipe is replaced with Fdrive =sin(t) t2 e ¡t . Determine<br />

the velocity as a function of time and plot the result over the interval<br />

t = 0 to 10. What is Evil Knievel's maximum velocity and at what time does<br />

this occur? What is his maximum displacement from the origin in this interval<br />

and at what time does this occur?


118 CHAPTER 3. LINEAR ODE MODELS<br />

3.2 Second-Order Models<br />

3.2.1 Daniel Encounters Resistance<br />

Belief like any other moving body follows the path of least resistance.<br />

Samuel Butler, English writer (1835{1902)<br />

In the introductory recipe, recall that Richard's grandson Daniel threw a small<br />

ball with an initial speed of 15 m/s toward a 3:5-meter-high fence located 20<br />

meters from the ball's initial position. The ball left his hand at a height of 2<br />

m above the level ground and just cleared the top of the fence. The gravitational<br />

acceleration has the value g =9:8 m/s2 . The ball was regarded as a point<br />

particle and air resistance was neglected.<br />

In the recipe, we determined the angle with the horizontal that the ball was<br />

thrown, the time for the ball to reach the fence, and animated the motion of<br />

the ball with the fence included.<br />

In the following recipe, we shall make the above model calculation more<br />

realistic by including the e®ect of air resistance on the ball. Provided that the<br />

ball is smooth and its velocity ~v is not too high, the air resistance is governed by<br />

Stokes's resistance law, the drag force taking the form ~ Fdrag = ¡mk~v, where<br />

m is the mass of the ball and the drag coe±cient k is positive.<br />

As previously, the origin is chosen to be on the ground below the initial<br />

position of the ball and the x-coordinate is taken to be horizontal and the<br />

y-coordinate vertical. The plots package, needed for the animation, is loaded.<br />

> restart: with(plots):<br />

With air resistance included, Newton's second law of motion yields the following<br />

ODE in the x direction.<br />

> xeq:=diff(x(t),t,t)=-k*diff(x(t),t);<br />

xeq := d2<br />

μ <br />

d<br />

x (t) =¡k x (t)<br />

dt2 dt<br />

Although xeq is a second-order ODE, it clearly can be reduced to a ¯rst-order<br />

ODE by integrating both sides once, and then solved by the same \hand"<br />

procedure used in the last recipe. However, it's quicker to solve for x(t) using<br />

the dsolve command, subject to the initial condition x(0) = xb and _x(0) =<br />

V cos(Á). Here xb is the initial x-coordinate of the ball, V the initial speed,<br />

and Á the initial angle of the velocity with the horizontal. For the time being,<br />

everything is kept symbolic, the parameter values being substituted later. After<br />

applying the dsolve command, we take the rhs of the resulting answer, yielding<br />

the x-coordinate of the ball at time t ¸ 0.<br />

> x:=rhs(dsolve(fxeq,x(0)=xb,D(x)(0)=V*cos(phi)g,x(t)));<br />

xb k + V cos(Á)<br />

x := ¡<br />

k<br />

V cos(Á) e(¡kt)<br />

k<br />

Taking xf to be the x-coordinate of the fence, we ¯nd the time tf for the ball<br />

to reach the fence by equating x to xf and solving for t.


3.2. SECOND-ORDER MODELS 119<br />

> tf:=solve(x=xf,t);<br />

μ <br />

xb k + V cos(Á) ¡ xf k<br />

ln<br />

V cos(Á)<br />

tf := ¡<br />

k<br />

In the y direction, the gravitational force on the ball must be included as well<br />

as air resistance. Newton's second law yields the ODE given in yeq.<br />

> yeq:=diff(y(t),t,t)=-k*diff(y(t),t)-g;<br />

yeq := d2<br />

μ<br />

d<br />

y(t) =¡k<br />

dt2 dt y(t)<br />

<br />

¡ g<br />

Solving yeq with the dsolve command, subject to the initial condition y(0) =<br />

yb, _y(0) = V sin(Á), where yb is the ball's initial y-coordinate, and taking the<br />

rhs, yields y.<br />

> y:=rhs(dsolve(fyeq,y(0)=yb,D(y)(0)=V*sin(phi)g,y(t)));<br />

y := ¡ e(¡kt) (V sin(Á) k + g)<br />

¡ gt<br />

k 2<br />

k + yb k2 + V sin(Á) k + g<br />

k2 Evaluating y at t=tf , and equating to the fence height yf , yields the following<br />

formidable looking transcendental equation eq for the unknown angle Á.<br />

> eq:=eval(y,t=tf)=yf;<br />

(xb k + V cos(Á) ¡ xf k)(V sin(Á) k + g)<br />

eq := ¡<br />

k2 V cos(Á)<br />

μ <br />

xb k + V cos(Á) ¡ xf k<br />

g ln<br />

V cos(Á)<br />

+<br />

+ yb k2 + V sin(Á) k + g<br />

k 2<br />

k 2<br />

= yf<br />

To solve the transcendental equation for Á, thegivenvaluesxb =0m,yb =2m,<br />

xf =20m,yf =3:5m, V =15m/s,andg =9:8m/s 2 , are entered. The drag<br />

coe±cient is taken to be k =0:01 s ¡1 .<br />

> xb:=0: yb:=2: xf:=20: yf:=3.5: V:=15: g:=9.8: k:=0.01:<br />

The transcendental equation must be solved numerically. This is done in the<br />

following two command lines, two di®erent search ranges (in radians) being<br />

speci¯ed for Á to determine the two possible angles, ©1 and ©2, atwhichthe<br />

ball can be thrown to just clear the fence. Making use of the ditto operator, we<br />

convert the ¯rst angle to degrees.<br />

> Phi[1]:=fsolve(eq,phi,0..0.8); evalf(convert(%,degrees));<br />

©1 := 0:6696475750 38:36797980 degrees<br />

> Phi[2]:=fsolve(eq,phi,0.8..Pi/2);<br />

©2 := 0:9693759172<br />

Without air resistance, it was previously found that the smaller of the two<br />

possible angles was 37.47 degrees, about 1 degree less than the value found<br />

above. It is left as an exercise for you to compare the values for the upper<br />

angle, with and without air resistance.<br />

To animate the ball, the ¯rst angle ©1 will be selected.


120 CHAPTER 3. LINEAR ODE MODELS<br />

> phi:=Phi[1]: #select angle<br />

In this case, the time tf to reach the fence is calculated<br />

> tf:=evalf(tf);<br />

tf := 1:715218642<br />

to be about 1.72 s, slightly more than the 1.68 s without air resistance.<br />

Setting y = 0, we determine the time T for the ball to hit the ground,<br />

> T:=solve(y=0,t);<br />

T := 2:090175405; ¡0:1946627301<br />

the positive angle (¯rst solution here) being selected.<br />

> T2:=T[1]; #choose positive time<br />

T2 := 2:090175405<br />

The ball hits the ground after 2.09 seconds, compared to 2.06 seconds without<br />

air resistance.<br />

The fence is plotted as a quite thick (default color red) line.<br />

> fence:=plot([[xf,0],[xf,yf]],style=line,thickness=3):<br />

Using exactly the same syntax as in the introductory recipe, the motion of the<br />

ball is animated with the fence as background.<br />

> animate(pointplot,[[[x,y]],symbol=circle,symbolsize=14],<br />

t=0..T2,frames=200,background=fence,scaling=constrained);<br />

To see this animation, execute the recipe on your computer, click on the opening<br />

frame,andthenonthestartarrowintheMapletoolbar.<br />

PROBLEMS:<br />

Problem 3-7: Maximum drag coe±cient<br />

With all other parameters the same as in the text recipe, what is the maximum<br />

value of the drag coe±cient k such that the ball just clears the fence? What<br />

are the two corresponding initial angles?<br />

Problem 3-8: How high?<br />

If the drag coe±cient k is equal to 0:1s ¡1 , how high can the fence be for the<br />

ball to just clear it, all other parameters the same as in the text recipe? What<br />

are the two initial angles in this case?<br />

Problem 3-9: A falling raindrop<br />

For a sphere of diameter d meters moving in air, the approximate value of the<br />

constant k in Stokes's linear resistance law, ~ Fdrag = ¡k~v newtons, is given by<br />

k =1:55 £ 10 ¡4 d. For a small spherical raindrop (density ½ =103kg/m3 ,<br />

d =10 ¡4 m) falling from rest, determine the distance through which it falls in<br />

t seconds and its velocity then. Plot the distance and velocity separately over<br />

atimeintervalt = 0 to the time at which the velocity reaches 99 percent of its<br />

terminal (asymptotic) value.


3.2. SECOND-ORDER MODELS 121<br />

3.2.2 Meet Mr. Laplace<br />

The weight of evidence for an extraordinary claim must be<br />

proportioned to its strangeness (known as the principle of Laplace).<br />

Pierre-Simon Laplace, French mathematician (1749{1827)<br />

Pierre-Simon Laplace was one of the most in°uential scientists in history. Indeed,<br />

he has been referred to as the Newton of France. Not only did he make<br />

outstanding contributions to astronomy, for example, mathematically investigating<br />

the stability of the solar system, he developed probability theory as a<br />

coherent body of knowledge from a set of miscellaneous problems, and played a<br />

leading role in forming the modern discipline of mathematical physics. One of<br />

his most important contributions to the latter is the Laplace transform, which<br />

canbeusedtosolvelinearODEs.<br />

The Laplace transform of a function f(t) isde¯nedas<br />

L(f(t)) ´ F (s) =<br />

Z 1<br />

0<br />

f(t)e ¡st dt:<br />

By integrating by parts and assuming that e ¡stf(t) ! 0ast !1,itiseasy<br />

to show that<br />

³ ´<br />

³ ´<br />

L f(t) _ = sF(s) ¡ f(0) and L Äf(t) = s 2 F (s) ¡ sf(0) ¡ _ f(0):<br />

The Laplace transform method of solving a linear ODE (system) with constant<br />

coe±cients is to Laplace transform the ODE, solve the resulting algebraic<br />

equation for F (s), and then perform the inverse Laplace transform to obtain<br />

the solution f(t). In the era before computer algebra existed, tables of Laplace<br />

transforms and their inverses were almost as common as integral tables, and<br />

one of their main uses was in solving linear ODEs. With the Maple computer<br />

algebra system, these tables are obsolete, since Maple has an integral transform<br />

library package that includes the Laplace transform and its inverse.<br />

The use of this package is now demonstrated in the ¯rst of the two recipes<br />

that follow. It is desired to solve the following forced oscillator ODE for x(t):<br />

Äx +4_x +13x =sin(t); with x(0) = 1 and _x(0) = ¡5:<br />

Entering the integral transform package and using a semicolon to display<br />

its contents, we see that it contains the Laplace transform (laplace) command<br />

and its inverse (invlaplace).<br />

> restart: with(inttrans);<br />

[addtable; fourier; fouriercos; fouriersin; hankel; hilbert; invfourier;<br />

invhilbert; invlaplace; invmellin; laplace; mellin; savetable]<br />

The forced oscillator ode is entered,<br />

> ode:=diff(x(t),t,t)+4*diff(x(t),t)+13*x(t)=sin(t);<br />

μ μ <br />

2 d d<br />

ode := x (t) +4 x (t) +13x(t) =sin(t)<br />

dt2 dt


122 CHAPTER 3. LINEAR ODE MODELS<br />

along with the initial conditions.<br />

> x(0):=1: D(x)(0):=-5:<br />

The alias commandisusedtoreplacelaplace(x(t); t; s), which would otherwise<br />

appear in the output, with the symbol F .ThatistosayFwill be the Laplace<br />

transform of x(t), the transformed independent variable being s.<br />

> alias(F=laplace(x(t),t,s)):<br />

The Laplace transform of ode is performed,<br />

> eq:=laplace(ode,t,s);<br />

eq := s 2 F +1¡ s +4sF +13F = 1<br />

s 2 +1<br />

and the algebraic equation eq solved for F .<br />

> F:=solve(eq,F);<br />

F :=<br />

s (¡s + s 2 +1)<br />

s 4 +14s 2 +4s 3 +4s +13<br />

The inverse Laplace transform of F is calculated, yielding the analytic solution<br />

(labeled X) of the forced oscillator ODE.<br />

> X:=invlaplace(F,s,t);<br />

X := ¡ 1 3 1<br />

cos(t)+ sin(t)+ (123 cos(3 t) ¡ 121 sin(3 t)) e(¡2 t)<br />

40 40 120<br />

The steps carried out above mimic a hand calculation. An easier way to derive<br />

exactly the same form of x(t) istousethedsolve commandwiththeLaplace<br />

transform option, i.e., include method=laplace.<br />

> dsolve(fode,x(0)=1,D(x)(0)=-5g,x(t),method=laplace);<br />

x (t) =¡ 1 3 1<br />

cos(t)+ sin(t)+ (123 cos(3 t) ¡ 121 sin(3 t)) e(¡2 t)<br />

40 40 120<br />

The implementation of the Laplace transform method with Maple can be extended<br />

to systems of linear ODEs, as is demonstrated in the following problem,<br />

a problem that is quite challenging to do by hand.<br />

Masses m1 and m2, with equilibrium positions at x=2 andx=5, arefreeto move horizontally on a smooth surface (the x-axis). The mass m1 is connected<br />

to a ¯xed wall on its left by a linear spring (spring constant k) andonitsright<br />

to m2 with an identical spring. A driving force F =f sin(!t)actstotheright<br />

on m2. A °uid resistance is present, given by Stokes's drag law, Fdrag =¡av.<br />

(a) Derive the governing ODEs for the displacements x1(t) andx2(t) ofm1<br />

and m2 from equilibrium. Taking m1 =2, m2 =1, k =1, a =1, ! =2,<br />

f =2, x1(0)=1, x2(0)=0, _x1(0)=0, and _x2(0) =0, solve the ODEs using<br />

the Laplace transform option in the dsolve command.<br />

(b) Extract the steady-state and transient parts of x1 and x2 separately and<br />

plot them. Discuss the results.<br />

(c) Animate the motion of m1 and m2 about their equilibrium positions over<br />

a time interval for which the transients become small.


3.2. SECOND-ORDER MODELS 123<br />

Loading the plots package, we use the alias command. Entering x1, x2, m1,<br />

m2 will produce the subscripted quantities x1, x2, m1, andm2in the output.<br />

> restart: with(plots):<br />

> alias(x[1]=x1,x[2]=x2,m[1]=m1,m[2]=m2):<br />

When m2 is displaced from equilibrium by amount x2 at time t in, say, the<br />

positive x-direction, it exerts a force on m1 through the connecting spring. If<br />

m1 is displaced from equilibrium by amount x1(t), the force exerted on m1 by<br />

m2 is k (x2(t) ¡ x1(t)). The spring connected to the wall will exert a force<br />

¡kx1(t) in the opposite direction. Including damping, Newton's second law<br />

yields the ODE ode1 governing the displacement x1(t) ofm1.<br />

> ode1:=m1*diff(x1(t),t,t)<br />

=k*(x2(t)-x1(t))-k*x1(t)-a*diff(x1(t),t);<br />

μ <br />

μ 2 d d<br />

ode1 := m1 x1(t) = k (x2(t) ¡ x1(t)) ¡ k x1(t) ¡ a<br />

dt2 dt x1(t)<br />

<br />

The mass m1 will exert an equal and opposite force on m2 through the connecting<br />

spring, i.e., ¡k (x2(t) ¡ x1(t)). Including the damping and driving forces,<br />

the displacement x2(t) ofm2 is given by the ODE ode2 .<br />

> ode2:=m2*diff(x2(t),t,t)<br />

=-k*(x2(t)-x1(t))-a*diff(x2(t),t)+f*sin(omega*t);<br />

μ <br />

μ 2 d d<br />

ode2 := m2 x2(t) = ¡k (x2(t) ¡ x1(t)) ¡ a<br />

dt2 dt x2(t)<br />

<br />

+ f sin(!t)<br />

One has a system of two coupled, linear, second-order, inhomogeneous ODEs.<br />

To solve them, let's ¯rst enter the given parameter values,<br />

> m1:=2: m2:=1: k:=1: a:=1: omega:=2: f:=2:<br />

and the initial conditions.<br />

> ic:=x1(0)=1,x2(0)=0,D(x1)(0)=0,D(x2)(0)=0:<br />

The set of ODEs is analytically solved for x1(t) andx2(t), subject to the initial<br />

conditions, using the dsolve command with the Laplace transform option.<br />

The same answer could be obtained by mimicking the hand calculation in the<br />

previous example. This is left as a problem.<br />

> sol:=dsolve(fode1,ode2,icg,fx1(t),x2(t)g,method=laplace);<br />

sol := fx1(t) = 36<br />

26<br />

cos(2 t)+ sin(2 t)<br />

493 493<br />

¡ 1 X<br />

( (56380 + 339955 ® + 193087 ®<br />

194242<br />

®=%1<br />

2 + 188250 ® 3 ) e ( ®t) )g;<br />

fx2(t) =¡ 164 228<br />

cos(2 t) ¡ sin(2 t)<br />

493 493<br />

¡ 1 X<br />

( (107923 + 533529 ® + 249954 ®<br />

194242<br />

®=%1<br />

2 + 293736 ® 3 ) e ( ®t) )g<br />

%1 := RootOf(2 Z 4 +3 Z 3 +5 Z 2 +3 Z +1)


124 CHAPTER 3. LINEAR ODE MODELS<br />

The sine and cosine terms in the solution survive as t ! 1 and represent<br />

the steady-state parts, while the exponential terms decay to zero and thus<br />

correspond to the transient parts of the solution. The summation is over the four<br />

roots of the quartic polynomial given in the subexpression %1. To manipulate<br />

the solution further, it is now assigned.<br />

> assign(sol):<br />

Using the remove command, the exponential terms are removed from x1(t) and<br />

x2(t) to yield the steady-state parts, x1ss and x2ss, separately.<br />

> x1ss:=remove(has,x1(t),exp); x2ss:=remove(has,x2(t),exp);<br />

x1ss := 36<br />

26<br />

228<br />

cos(2 t)+ sin(2 t) x2ss := ¡164 cos(2 t) ¡ sin(2 t)<br />

493 493 493 493<br />

The select command is used to extract the exponential terms from x1(t) and<br />

x2(t), thus producing the transient parts separately.<br />

> x1tr:=select(has,x1(t),exp): x2tr:=select(has,x2(t),exp):<br />

Because the roots of a quartic polynomial must be found, the numerical °oatingpoint<br />

evaluation command is applied to each of the transient parts. The complex<br />

evaluation command is then used to simplify the outputs, which are given<br />

by x1tr and x2tr.<br />

> x1tr:=evalc(evalf(x1tr)); x2tr:=evalc(evalf(x2tr));<br />

x1tr := 0:5591296681 e (¡0:3923340189 t) cos(0:3903466128 t)<br />

+0:9914981558 e (¡0:3923340189 t) sin(0:3903466128 t)<br />

+0:3678480196 e (¡0:3576659811 t) cos(1:226572647 t)<br />

¡ 0:1154210539 e (¡0:3576659811 t) sin(1:226572647 t)<br />

x2tr := 0:6802842310 e (¡0:3923340189 t) cos(0:3903466128 t)<br />

+1:721342502 e (¡0:3923340189 t) sin(0:3903466128 t)<br />

¡ 0:3476270302 e (¡0:3576659811 t) cos(1:226572647 t)<br />

+0:3225193055 e (¡0:3576659811 t) sin(1:226572647 t)<br />

You might have thought our earlier identi¯cation of the exponential terms as<br />

the transient contribution a bit premature, but now one can clearly see that<br />

they decay to zero as t goes to in¯nity.<br />

The steady-state and transient contributions are now plotted separately.<br />

Lists are used here so that the steady-state and transient parts of x1(t) are<br />

colored red on the computer screen, while the corresponding parts for x2(t) are<br />

colored blue.<br />

> plot([x1ss,x2ss],t=0..20,color=[red,blue],tickmarks=[3,4]);<br />

> plot([x1tr,x2tr],t=0..20,color=[red,blue],tickmarks=[3,4]);<br />

The black-and-white versions of the two pictures are shown in Figure 3.4, the<br />

steady-state contributions on the left, the transient contributions on the right.


3.2. SECOND-ORDER MODELS 125<br />

0.4<br />

0.2<br />

0<br />

–0.2<br />

–0.4<br />

10 t 20<br />

1<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

10 t 20<br />

Figure 3.4: Steady-state (left) and transient (right) contributions.<br />

In the steady-state picture, the shorter of the two oscillatory curves corresponds<br />

to x1(t), the taller one to x2(t). The motion of mass m1 is approximately 180<br />

degrees out of phase with m2. The period of oscillation of both masses is<br />

identical with that of the driving force.<br />

In the transient picture, the curve that rises above 1 is x2(t). Both curves<br />

decay to essentially zero in less than 20 time units.<br />

To animate the solution, the complete (steady-state plus transient) timedependent<br />

displacements are added to the given equilibrium coordinates.<br />

> X1:=2+x1ss+x1tr: X2:=5+x2ss+x2tr:<br />

The motion of the two masses is now animated, each mass being represented<br />

by a size-10 (default color red) circle. To produce motion along the horizontal<br />

axis, the horizontal coordinate of each mass is entered in a list with the vertical<br />

coordinate set equal to zero. The time range is such that the transient parts<br />

vanish, revealing the steady-state motion. You can take a larger time interval<br />

if you desire. To obtain a smooth animation, 200 frames are used.<br />

> animate(f[X1,0],[X2,0]g,t=0..20,frames=200,style=point,<br />

symbol=circle,symbolsize=20,tickmarks=[3,2]);<br />

Execute the command on your computer to see the animated motion.<br />

PROBLEMS:<br />

Problem 3-10: Hand calculation<br />

Making use of the integral transform package, mimic a hand calculation to<br />

derive the solution for the second example.<br />

Problem 3-11: Transform package approach<br />

Use the integral transform package and the Laplace transform method to solve<br />

the following ODEs. Con¯rm the solutions using the method= laplace option<br />

in the dsolve command. Plot each solution over a suitable time range that<br />

includes the steady-state regime. Extract the transient part of the solution and


126 CHAPTER 3. LINEAR ODE MODELS<br />

estimate the time interval over which it lasts.<br />

(a) _y +5y =cos(t)+e ¡t ; y(0) = 1;<br />

(b) Äy ¡ 5_y +6y =0; y(0) = 2; _y(0) = 5;<br />

(c) 9Äy +6_y + y =5; y(0) = 6; _y(0) = 1;<br />

(d) 5Äy +2_y + y =sin 2 (t); y(0) = ¡3; _y(0) = 1;<br />

(e) _x = ¡4 x + y +3; _y = ¡4 x ¡ 4 y +5; x(0) = 1; y(0) = ¡1;<br />

(f) Äy +_y =2cos4 (t) e ¡t ; y(0) = 0; _y(0) = ¡2;<br />

(g) Äy +2_y = t cos(t) e ¡t + t2 cos(2 t) e ¡2 t ; y(0) = 0; _y(0) = 0.<br />

3.2.3 Jennifer's Formidable Series<br />

Isn't life a series of images that change as they repeat themselves?<br />

Andy Warhol, American pop artist (1928{1987)<br />

Jennifer is currently teaching a course on ordinary di®erential equations at<br />

MIT. As part of an assignment, she has assigned the following problem to be<br />

done with the Maple computer algebra system.<br />

Consider the following second-order linear ODE with variable coe±cients,<br />

2 xy 00 (x)+(1¡ 2 x) y 0 (x) ¡ x 2 y(x) =0; y(0) = 1;y 0 (0) = 0:<br />

(a) Show that Maple is unable to produce a closed-form analytic solution.<br />

(b) Derive a procedure for numerically determining y(x) andy0 (x) atanarbitrary<br />

x value. Evaluate y and y 0 at X =4.<br />

(c) Derive a series solution for y(x), keeping su±cient terms to achieve 1%<br />

agreement with the numerical answer at X.<br />

(d) Plot the series derived in part (c) and the numerical solution together in<br />

thesame¯gureovertherangex =0toX.<br />

Vectoria, who is in Jennifer's class, has submitted the following recipe to solve<br />

the problem. In order to have the ODE appear on the computer screen in the<br />

prime notation used in the problem wording, she loads the PDEtools package,<br />

which contains the declare command for achieving this notation.<br />

> restart: with(plots): with(PDEtools):<br />

As indicated by the output, the following declare command will cause y(x) to<br />

be displayed as y and introduce primes for the derivatives with respect to x.<br />

> declare(y(x),prime=x):<br />

y(x) will now be displayed as y<br />

derivatives with respect to xoffunctionsofonevariable<br />

will now be displayed with 0


3.2. SECOND-ORDER MODELS 127<br />

On entering the given di®erential equation, Vectoria observes that the output<br />

in de is expressed in terms of the prime notation.<br />

> de:=2*x*diff(y(x),x,x)+(1-2*x)*diff(y(x),x)-x^2*y(x)=0;<br />

de := 2 x y 00 +(1¡ 2 x) y 0 ¡ x2 y =0<br />

The initial condition is speci¯ed, as well as the value of X and a parameter d<br />

that will control the spacing of the numerical points in the graph.<br />

> ic:=y(0)=1,D(y)(0)=0: X:=4: d:=8:<br />

Using dsolve, an attempt is made to analytically solve de for y(x).<br />

> dsolve(fde,icg,y(x)); #no analytic solution<br />

No output is generated, Maple being unable to provide an analytic answer. Although<br />

she has now omitted it, Vectoria had included infolevel[dsolve]:=5;<br />

prior to the dsolve command. On doing so she was able to view a very lengthy<br />

list of unsuccessful ODE solving methods tried by Maple. If you wish to see<br />

these attempts, include the above infolevel command.<br />

To generate a procedure for numerically evaluating y and y 0 at arbitrary x,<br />

Vectoria includes the numeric option in dsolve and requests that the output<br />

be given as a \list procedure."<br />

> numsol:=dsolve(fde,icg,y(x),numeric,output=listprocedure);<br />

numsol := [x =(proc(x) ::: end proc); y=(proc(x) ::: end proc);<br />

y 0 =(proc(x) ::: end proc)]<br />

Evaluating y(x) withthenumsol procedure will generate a numerical answer<br />

for y at x when the value of x is supplied as the argument of Ynum de¯ned<br />

below. Then, entering Ynum(X) gives the numerical value of y at X (4, here),<br />

the answer being given to 18 digits, more than the \normal" 10-digit accuracy.<br />

> Ynum:=eval(y(x),numsol): Ynum(X);<br />

41:1065491999371986<br />

Thus, y ¼ 41 at x = X = 4. A similar command structure is used to numerically<br />

evaluate the derivative of y, yielding y 0 ¼ 76 at X.<br />

> Ynumder:=eval(diff(y(x),x),numsol): Ynumder(X);<br />

75:6306643796735756<br />

Vectoria will use a do loop to systematically calculate series solutions of de as<br />

a function of the order n, terms of order xn and larger being neglected. The<br />

do loop will include a conditional statement that will terminate the loop when<br />

the absolute percentage di®erence j100 (ynum(X)¡yseries(X))=ynum(X)j drops<br />

below one percent. As a \seed number" to implement the conditional statement,<br />

she calculates the absolute percentage di®erence between the starting value of<br />

y(0) = 1 and the numerical value of y at x = X =4.<br />

> percent[0]:=abs(evalf(100*(Ynum(X)-1)/Ynum(X))); #seed<br />

percent 0 := 97:56729762<br />

The do loop runs from 1 to 50, the number 50 being chosen to be large enough<br />

to achieve a percentage error below one percent. The loop will calculate the


128 CHAPTER 3. LINEAR ODE MODELS<br />

series solution to order n as long as the percentage error in the previous order<br />

is above 1 percent.<br />

> for n from 1 to 50 while percent[n-1]>1 do<br />

The order of the series is taken to be n. The error in the series is of order x n ,<br />

terms of this order and larger being neglected. If the order is not speci¯ed, the<br />

default order is 6.<br />

> Order:=n:<br />

The di®erential equation is solved for y(x), subject to the initial condition,<br />

with the series option included. The dsolve command uses several methods<br />

when trying to ¯nd a series solution to an ODE or ODE system. When initial<br />

conditions are given, such as in this problem, the series is calculated at the<br />

given point. Otherwise, the series is calculated at the origin. The ¯rst method<br />

used is a Newton iteration, the second involves a direct substitution to generate<br />

a system of equations which must be solved, while the third is the method of<br />

Frobenius discussed in standard ODE texts. Useful references may be found by<br />

entering the topic dsolve,series in Maple's Topic Search.<br />

> sol[n]:=dsolve(fde,icg,y(x),'series');<br />

To remove the \order of" term that appears in the output of the last command<br />

line, the convert( ,polynom) command is applied to the right-hand side of the<br />

nth order solution. The largest term in the series for Yn is x n¡1 .<br />

> Y[n]:=convert(rhs(sol[n]),polynom);<br />

The absolute percentage error at x = X is calculated for each order,<br />

> percent[n]:=abs(evalf(100*(Ynum(X)-eval(Y[n],x=X))/Ynum(X)));<br />

and the do loop ended with a colon to suppress the lengthy output.<br />

> end do:<br />

The loop stops at N = n ¡ 1, in this case order 17, for which the percentage<br />

error (to 3 digits) is 0.696 percent. As you can check by either replacing the<br />

colonwithasemicoloninthedolooportakingN = n¡ 2, the percentage error<br />

in order 16 is 1.31 percent. Order 17 is the ¯rst order for which the percentage<br />

error drops below one percent. The corresponding polynomial representation<br />

of the solution is given by Y17.<br />

> N:=n-1; evalf(percent[N],3)*percent; Y[N]:=Y[N];<br />

N := 17 0:696 percent<br />

Y17 := 1 + 1<br />

15 x3 + 1<br />

70 x4 + 4<br />

1575 x5 + 29<br />

20790 x6 + 43<br />

126126 x7 61<br />

+<br />

1001000 x8<br />

16013<br />

+<br />

1033782750 x9 498307<br />

+<br />

152770117500 x10 7710323<br />

+<br />

14115958857000 x11<br />

2117887<br />

+<br />

21250934424720 x12 96270661<br />

+<br />

5534097506437500 x13 121568353967<br />

+<br />

46021554863534250000 x14<br />

1141494706493<br />

+<br />

2859910909376771250000 x15 2799853112879<br />

+<br />

47283860368362618000000 x16


3.2. SECOND-ORDER MODELS 129<br />

Using the sequence command, we graph the numerical solution from x =0 to<br />

X in steps of size 1=d. Each numerical point is plotted as a size-16 blue circle.<br />

> gr1:=plot([seq([i/d,Ynum(i/d)],i=0..d*X)],style=point,<br />

symbol=circle,symbolsize=16,color=blue):<br />

The series solution is plotted as a solid thick curve over the same range of x,<br />

> gr2:=plot(Y[N],x=0..X,thickness=2):<br />

and the two graphs superimposed to produce Figure 3.5.<br />

> display(fgr1,gr2g,labels=["x","y"]);<br />

40<br />

30<br />

y<br />

20<br />

10<br />

0 1 2 x 3 4<br />

Figure 3.5: Comparison of numerical (circles) and series (curve) solutions.<br />

Of course, because of the imposition of the conditional statement, the ¯t of the<br />

series solution to the numerical points is very good.<br />

Vectoria hopes that Jennifer will like her solution to this problem. By<br />

modifying Vectoria's recipe, you should be able to solve the following problems,<br />

which also appeared on Jennifer's assignment.<br />

PROBLEMS:<br />

Problem 3-12: What's special about this ODE?<br />

Consider the following linear second-order ODE:<br />

xy 00 (x)+y 0 (x)+xy(x) =0; y(0) = 1;y 0 (0) = 0:<br />

(a) Show that Maple is able to produce a closed-form analytic solution. Identify<br />

the ODE and the \special" function that appears in the solution.<br />

(b) Derive a series solution for y(x), keeping su±cient terms to achieve 1%<br />

agreement with the analytic answer at x = X =10.<br />

(c) Plot the series derived in part (b) and the analytic solution together in the<br />

same ¯gure over the range x =0toX, representing the analytic answer<br />

by appropriately sized and spaced circles.


130 CHAPTER 3. LINEAR ODE MODELS<br />

Problem 3-13: Another ODE<br />

Consider the following linear second-order ODE:<br />

xy 00 (x)+2y 0 (x)+xy(x) =0; y(0) = 1;y 0 (0) = 0:<br />

(a) Show that Maple is able to produce a closed-form analytic solution.<br />

(b) Derive a series solution for y(x), keeping su±cient terms to achieve 1%<br />

agreement with the analytic answer at x = X =20.<br />

(c) Plot the series derived in part (b) and the analytic solution together in the<br />

same ¯gure over the range x =0toX, representing the analytic answer<br />

by appropriately sized and spaced circles.<br />

Problem3-14: Variationonthetextproblem<br />

Carry out the same steps as in Jennifer's text problem for the ODE<br />

y 00 (x) ¡ xy 0 (x) ¡ 1=0; y(0) = 1;y 0 (0) = 0:<br />

3.3 Special Function Models<br />

Many boundary-value problems of mathematical physics lead to variable-coe±cient<br />

ODEs of the Sturm{Liouville (S{L) form,<br />

·<br />

d<br />

p(x)<br />

dx<br />

dy(x)<br />

¸<br />

¡ q(x) y(x) =¡¸w(x) y(x); (3.2)<br />

dx<br />

where p(x), q(x), and w(x) are real functions of the spatial variable x, ¸ is a<br />

real constant, and certain conditions on y and its ¯rst derivative are speci¯ed<br />

at the boundaries. Often the only solution to such a problem is the trivial<br />

solution y(x) = 0, but for special values (called the eigenvalues) ¸1, ¸2, ::: of<br />

¸, nontrivial solutions (called the eigenfunctions) y1, y2, ::: can occur.<br />

For certain choices of the functions p(x), q(x), w(x), and ¸, the well-known<br />

Bessel, Legendre, Hermite, Chebyshev, Mathieu, etc., ODEs result. The solutions<br />

of these ODEs, which take the form of in¯nite series or ¯nite polynomials<br />

in x, have been historically labeled as special functions, to distinguish them<br />

from such ordinary functions as the sine, cosine, log, and exponential functions.<br />

Special-function solutions can also occur for initial-value problems with x<br />

replaced with the time t. The systematic study of the S{L ODE and special<br />

functions and their properties is beyond the scope of this text. The interested<br />

reader is referred to standard mathematical texts (e.g., [MW71], [Boa83]) for<br />

the theoretical aspects and to [Enn05] for recipes on applications. Here, we shall<br />

be content to introduce two of the more famous members of the S{L family and<br />

then look at two special-function models.


3.3. SPECIAL FUNCTION MODELS 131<br />

3.3.1 Jennifer Introduces a Special Family<br />

\That's a great deal to make one word mean," Alice said in a<br />

thoughtful tone. \When I make a word do a lot of work like that,"<br />

said Humpty Dumpty, \I always pay it extra."<br />

Lewis Carroll, Through the Looking Glass, 1872<br />

Although we shall not emulate Humpty Dumpty and pay the word \special"<br />

extra for making it work so hard in this section, we would tell Alice, if she were<br />

here, that the phrase \special" function does encompass a great many functions<br />

with their associated mathematical properties. The Handbook of Mathematical<br />

Functions by Abramowitz and Stegun [AS72], for example, contains over<br />

1000 pages dealing with the properties of special functions. This handbook,<br />

produced by the U.S. National Bureau of Standards, is one of the standard<br />

reference books for these functions and has been reprinted many times since it<br />

was ¯rst issued.<br />

We have asked our MIT mathematician friend Jennifer to introduce two of<br />

the more prominent members of this special family of functions.<br />

Letting the letter L stand for ¸, Jennifer forms a functional operator SL for<br />

generating speci¯c cases of the Sturm{Liouville ODE when the forms of p, q,<br />

w, andLare supplied as arguments.<br />

> restart: with(plots):<br />

> SL:=(p,q,w,L)->diff(p*diff(y(x),x),x)-q*y(x)=-L*w*y(x);<br />

μ μ μ<br />

d d<br />

SL := (p; q; w; L) ! p<br />

dx dx y(x)<br />

<br />

¡ q y(x) =¡Lwy(x)<br />

A second functional operator sol is introduced to provide the general analytic<br />

solution y(x) of a speci¯ed ODE.<br />

> sol:=ode->dsolve(ode,y(x)):<br />

Now Jennifer will make two choices for p, q, w, andLthat lead to probably<br />

the best-known two members of the family of special functions. Taking p = x,<br />

q = ¡x, w =1=x, andL = ¡m2 as arguments in the Sturm{Liouville operator<br />

produces ode1 .<br />

> ode1:=SL(x,-x,1/x,-m^2);<br />

μ<br />

d<br />

ode1 :=<br />

dx y(x)<br />

μ <br />

2 d<br />

+ x y(x) + x y(x) =<br />

dx2 m2 y(x)<br />

x<br />

To illustrate that Maple is able to identify this ODE, Jennifer loads the DEtools<br />

package and applies the odeadvisor command to ode1 .<br />

> with(DEtools): odeadvisor(ode1);<br />

[ Bessel]<br />

So, ode1 is Bessel's di®erential equation, whose general solution y(x)<br />

> sol(ode1);<br />

y(x) = C1 BesselJ(m; x)+ C2 BesselY(m; x)


132 CHAPTER 3. LINEAR ODE MODELS<br />

is a linear combination of a Bessel function of the ¯rst kind (BesselJ(m; x)) and<br />

of the second kind (BesselY(m; x)), with C1 and C2 arbitrary constants. In<br />

traditional mathematical notation, the Bessel functions are written as Jm(x)<br />

and Ym(x), m being referred to as the order of the Bessel function. Highlighting<br />

BesselJ(m; x) orBesselY(m; x) on the computer screen will open a Help page<br />

with some (but not much) information about these special functions.<br />

If you wish to know what other special functions are known to Maple, execute<br />

the following inifcns (initially known mathematical functions) command<br />

line and use the hyperlinks provided in the lengthy list of functions. Remember<br />

to close the Help page when you're done.<br />

> ?inifcns;<br />

The Bessel functions are actually in¯nite Frobenius power series solutions of<br />

the Bessel ODE, i.e., a series expansion about x = 0 is sought of the form<br />

y(x) = P1 m=0 cm xm+s . The allowed values of the index s and the forms of the<br />

coe±cients cm are determined5 by substituting y(x) intotheBesselODE.<br />

The series command can be used to obtain the form of the Frobenius series.<br />

For example, since the most commonly occurring order in physical problems<br />

involves positive-integer values of m, Jennifer calculates the Frobenius series of<br />

Jm(x) form = 0 to 2, terms of order x8 and higher being omitted here.<br />

> seq(J[m]=series(BesselJ(m,x),x=0,8),m=0..2);<br />

J0 =1¡ 1<br />

4 x2 + 1<br />

64 x4 ¡ 1<br />

2304 x6 +O(x8 );<br />

J1 = 1 1<br />

x ¡<br />

2 16 x3 + 1<br />

384 x5 ¡ 1<br />

18432 x7 +O(x8 );<br />

J2 = 1<br />

8 x2 ¡ 1<br />

96 x4 + 1<br />

3072 x6 +O(x8 )<br />

Note that at x =0,wehaveJ0 =1andJ1 = J2 =0. Asiseasilycon¯rmedby<br />

increasing the range of m in the seq command, Jm(0) = 0 for m =3; 4 :::<br />

Looking at the above truncated series does not convey much of an idea of<br />

the shapes of J0(x), J1(x), and J2(x). Jennifer will now plot these functions<br />

and attach appropriate identifying labels to each curve. First, in the graph gr1<br />

she plots Jm(x) overtherangex =0to20form =0to2.<br />

> gr1:=plot(fseq(BesselJ(m,x),m=0..2)g,x=0..20,thickness=2):<br />

She uses the textplot command in gr2 to place appropriate labels on the<br />

Bessel function curves. The horizontal and vertical coordinates of the names<br />

(entered as strings) were determined by observing the picture generated by gr1.<br />

> gr2:=textplot([[1.5,0.9,"J0"],[3,0.6,"J1"],[5,0.4,"J2"]]):<br />

The two graphs are superimposed to yield Figure 3.6.<br />

> display(fgr1,gr2g,tickmarks=[2,2]);<br />

The Jm(x) are oscillatory with amplitudes that decrease with increasing x.<br />

Unlike sin(x) orcos(x), the Jm(x) do not cross the horizontal axis at equal<br />

5 A recipe is given in <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong> for Mathematical Physics [Enn05].


3.3. SPECIAL FUNCTION MODELS 133<br />

1<br />

0<br />

J0<br />

J1<br />

J2<br />

10 20<br />

x<br />

Figure 3.6: Bessel functions of the ¯rst kind of order 0, 1, and 2.<br />

intervals of x. The zeros of a particular Bessel function, for example J2, canbe<br />

approximately determined by clicking the mouse on the computer screen plot<br />

with the cursor placed at the location of a zero. The coordinates of the cursor<br />

are displayed in a small window at the top left of the computer screen. Moreaccurate<br />

values of the Bessel J2 zeros can be determined with the BesselJZeros<br />

command. The ¯rst six zeros are now determined to 4-digit accuracy.<br />

> Zeros:=evalf(BesselJZeros(2,0..5),4);<br />

Zeros := 0; 5:136; 8:417; 11:62; 14:80; 17:96<br />

What do the integer-order Bessel functions of the second look like? Jennifer ¯rst<br />

examines the analytic forms of the Frobenius series for Y0(x), Y1(x), and Y2(x),<br />

terms of order x8 and higher again being omitted. Because the expressions are<br />

lengthy, only Y0 isshownhereinthetext.<br />

> seq(Y[m]=series(BesselY(m,x),x=0,8),m=0..2);<br />

2(¡ln(2) + ln(x))<br />

Y0 =( +<br />

¼<br />

2 °<br />

¼ )+<br />

0<br />

B<br />

@¡ 1 ¡ln(2) + ln(x) ¡<br />

¡<br />

2 ¼<br />

1<br />

1<br />

°<br />

+<br />

2 2C<br />

A x<br />

¼<br />

2<br />

0<br />

3<br />

B<br />

+ @¡ 64<br />

¡ °<br />

32<br />

¼<br />

+ 1<br />

32<br />

0<br />

¡<br />

B<br />

+ @¡<br />

11 °<br />

+<br />

6912 1152<br />

¼<br />

1<br />

¡ln(2) + ln(x) C<br />

A x<br />

¼<br />

4<br />

¡ 1<br />

1152<br />

1<br />

¡ln(2) + ln(x) C<br />

A x<br />

¼<br />

6 +O(x8 )<br />

The constant ° in the above output is the Euler{Mascheroni constant. It is


134 CHAPTER 3. LINEAR ODE MODELS<br />

de¯ned as<br />

° = lim<br />

n!1<br />

à nX<br />

i=1<br />

!<br />

1<br />

¡ ln(n) ¼ 0:5772157:<br />

i<br />

Because of the ln(x) terms,Y0(x) divergesto¡1 at x = 0. A similar behavior<br />

occurs for Y1(x), Y2(x), etc. Because of this divergence, positive integer-order<br />

Bessel functions of the second kind are rejected in physical problems (where<br />

they often occur) in regions that include the origin.<br />

Again the truncated series do not reveal the shapes of Y0(x), Y1(x), etc.<br />

In the next three command lines, Jennifer plots Ym(x) over the range x =0<br />

to 20 for m =0; 1; 2 and adds identifying labels to the curves. Note that in<br />

the display command, she limits the vertical range of the ¯nal ¯gure to be<br />

between ¡1 and +1 so the oscillations are clearly seen.<br />

> gr3:=plot(fseq(BesselY(m,x),m=0..2)g,x=0..20,thickness=2):<br />

> gr4:=textplot([[2,.65,"Y0"],[3.7,.55,"Y1"],[6,.4,"Y2"]]):<br />

> display(fgr3,gr4g,view=[0..20,-1..1],tickmarks=[2,2]);<br />

1<br />

0<br />

–1<br />

Y0<br />

Y1<br />

Y2<br />

10 x 20<br />

Figure 3.7: Bessel functions of the second kind of order 0, 1, and 2.<br />

The Bessel functions Y0(x), Y1(x), and Y2(x) areshowninFigure3.7.Aswith<br />

the Bessel functions of the ¯rst kind, the zeros are not evenly spaced along the<br />

x-axis. Their locations can be determined with the fsolve command.<br />

As a second example of a special-function solution to a S{L ODE, Jennifer<br />

takes p = 1 ¡ x 2 , q = 0, w = 1, and L = n (n + 1) as arguments in the<br />

Sturm{Liouville functional operator and then derives the general solution.<br />

> ode2:=SL(1-x^2,0,1,n*(n+1)); sol(ode2);<br />

μ<br />

d<br />

ode2 := ¡2 x<br />

dx y(x)<br />

<br />

+(1¡ x2 μ <br />

2 d<br />

) y(x) = ¡n (n +1)y(x)<br />

dx2 y(x) = C1 LegendreP(n; x)+ C2 LegendreQ(n; x)


3.3. SPECIAL FUNCTION MODELS 135<br />

The general solution y(x) is a linear combination of a Legendre function of<br />

the ¯rst kind (LegendreP(n; x)) and of the second kind (LegendreQ(n; x)), n<br />

indicating the order. In problems of physical interest, n often takes on positiveinteger<br />

values, the Legendre functions of the ¯rst kind then being ¯nite polynomials,<br />

denoted by the symbol Pn(x), with x ranging6 from x = ¡1 to+1.<br />

Jennifer now derives the ¯rst few Legendre polynomials,<br />

> polynomials:=seq(P[n]=simplify(LegendreP(n,x)),n=0..4);<br />

3 x2 1<br />

polynomials := P0 =1;P1 = x; P2 = ¡<br />

2 2 ;P3 = 5<br />

2 x3 ¡ 3<br />

2 x;<br />

P4 = 35<br />

8 x4 ¡ 15<br />

4 x2 + 3<br />

8<br />

and plots them with identifying labels added to the curves.<br />

> gr5:=plot(fseq(LegendreP(n,x),n=0..4)g,x=-1..1,thickness=2):<br />

> gr6:=textplot([[.3,.9,"P0"],[.5,.65,"P1"],[.2,-.55,"P2"],<br />

[-.5,.55,"P3"],[.15,.45,"P4"]]):<br />

> display(fgr5,gr6g,tickmarks=[2,3]);<br />

P3<br />

1<br />

–1<br />

P4<br />

P2<br />

P0<br />

P1<br />

–1 1<br />

x<br />

Figure 3.8: The Legendre polynomials Pm(x) form =0to4.<br />

The Legendre polynomials are shown in Figure 3.8. They take on the values<br />

¡1 and +1 at the ends of the range.<br />

What do the Legendre functions of the second kind look like? For physical<br />

problems where x varies from ¡1 to +1, the following environment command<br />

line must be entered to pick out the correct solution branch.<br />

> _EnvLegendreCut:=1..infinity:<br />

TheanalyticformsofQm(x) are then calculated for m =0,1,and2.<br />

> seq(Q[m]=simplify(LegendreQ(m,x)),m=0..2);<br />

6 The variable x can be the cosine of a polar angle, whose range is from 0 to ¼ radians. So<br />

x =cosμ varies from ¡1 to+1.


136 CHAPTER 3. LINEAR ODE MODELS<br />

Q0 = 1<br />

1<br />

ln(x +1)¡<br />

2 2 ln(1 ¡ x); Q1 = 1<br />

1<br />

x ln(x +1)¡ x ln(1 ¡ x) ¡ 1;<br />

2 2<br />

Q2 = ¡ 1<br />

ln(x +1)+1 ln(1 ¡ x)+3<br />

4 4 4 x2 ln(x +1)¡ 3<br />

4 x2 3 x<br />

ln(1 ¡ x) ¡<br />

2<br />

The Qm(x) formequal to zero or a positive integer diverge to in¯nity at x = ¡1<br />

and +1 and must therefore be rejected as being unphysical.<br />

PROBLEMS:<br />

Problem 3-15: A Sturm{Liouville equation<br />

Show that the following ODE is of the Sturm{Liouville form:<br />

y 00 (x) ¡ 2 xy 0 (x)+2ny(x) =0:<br />

Determine the general solution of this ODE and plot the included special functions<br />

over a suitable range of the independent variable x.<br />

Problem 3-16: Recurrence Formula<br />

Bessel functions of di®erent orders can be related through recurrence relations.<br />

Use Maple to prove the following Bessel function recurrence relations.<br />

² Jm¡1(x)+Jm+1(x) =(2m=x) Jm(x);<br />

² 4 d2Jm(x) dx 2 = Jm+2(x) ¡ 2 Jm(x)+Jm¡2(x).<br />

Problem 3-17: Bessel function solutions<br />

Find the general solution of each of the following ODEs in terms of Bessel<br />

functions and identify the order. Identify any other new functions that occur.<br />

(a) y00 (x)+y(x)= p x =0;<br />

(b) y00 (x)+xy(x) =0, Hint: Useconvert( ,Bessel);<br />

<br />

¡ x 8<br />

5 y(x) =0;<br />

(c) d2<br />

dx 2<br />

μ<br />

x 16<br />

5 d2 y<br />

dx 2<br />

Problem 3-18: Orthogonality<br />

An important general property that all solutions yn(x) of the Sturm{Liouville<br />

equation corresponding to a given ¸n possess is orthogonality. Provided that<br />

y(x) ory 0 (x) orp(x) vanishes at the endpoints a and b of the range (referred<br />

to as Sturm{Liouville boundary conditions), then<br />

Z b<br />

a<br />

w(x) ym(x) yn(x) dx =0; for m 6= n; (3.3)<br />

where w(x) isreferredtoastheweight function. Con¯rm the orthogonality<br />

property for Legendre functions of the second kind of orders 2 and 3 over the<br />

range x = ¡1 to +1. Which of the possible Sturm{Liouville boundary conditions<br />

is satis¯ed?


3.3. SPECIAL FUNCTION MODELS 137<br />

3.3.2 The Vibrating Bungee Cord<br />

Wisdom consists in being able to distinguish among dangers<br />

and make a choice of the least harmful.<br />

Niccolμo Machiavelli, from The Prince (1469{1527)<br />

While on vacation in Rainbow County, Jennifer is nervously watching her sister<br />

Heather getting ready to bungee jump from an abandoned railway bridge<br />

spanning a deep gorge. At present, the uniform elastic bungee cord has no one<br />

attached to its lower end, but is simply hanging vertically downward and displaying<br />

small vibrations transverse to its length. This reminds Jennifer that the<br />

famous mathematician Daniel Bernoulli ¯rst studied this vibrational problem<br />

nearly 300 years ago, and was able to solve it. To put a modern spin on an old<br />

problem, Jennifer recently showed her mathematical physics class a computer<br />

algebra derivation of the solution.<br />

With Jennifer's permission, we shall now reproduce her treatment. To aid<br />

in understanding the physics of the problem, a free-body diagram is shown in<br />

Figure 3.9, which shows the relevant forces on the bungee cord and introduces<br />

the notation that will be used.<br />

y<br />

y+dy<br />

T () y θ<br />

ψ ( y,t) ψ(<br />

y+dy,t )<br />

dy<br />

ds<br />

dψ<br />

T(<br />

y+dy)<br />

Figure 3.9: Free-body diagram for a segment of vibrating bungee cord.<br />

Jennifer begins her recipe by loading the plots and plottools library packages,<br />

which will be needed for the animation of the transverse vibrations of the<br />

vertical cord.


138 CHAPTER 3. LINEAR ODE MODELS<br />

> restart: with(plots): with(plottools):<br />

Measuring y vertically downward, the origin y = 0 is chosen to be at the top<br />

end of the bungee cord (length L) where it is attached to the bridge. If the cord<br />

has a mass density ² per unit length, and g is the acceleration due to gravity,<br />

the tension T in the cord is given by T = ²g(L ¡ y), which is entered.<br />

> T:=epsilon*g*(L-y);<br />

T := ²g(L ¡ y)<br />

At the top end (y = 0), the cord has a tension T = ²gL, because the cord must<br />

support its entire weight. At the bottom end, y = L andthetensioniszero.<br />

The cord is now allowed to undergo a small transverse displacement dÃ(y; t)<br />

at time t from the equilibrium position. The above expression for T will still<br />

be valid. To understand this, consider the cord segment of arc length<br />

ds = p (dy) 2 +(dÃ) 2 = p 1+(dÃ=dy) 2 dy<br />

showninFigure3.9. Lettingμ be the angle with the vertical, and noting that<br />

the forces still balance in the y-direction, then<br />

(T cos μ) y ¡ (T cos μ) y+dy =(²ds) g; (3.4)<br />

with cos μ = dy=ds. Assuming that dÃ=dy ¿ 1, one has ds ¼ dy and cos μ ¼ 1,<br />

so the vertical force equation (3.4) reduces to<br />

T (y) ¡ T (y + dy) =(²dy) g: (3.5)<br />

Taylor expanding the left-hand side of (3.5) to the ¯rst power in dy, and dividing<br />

both sides by dy, yields @T=@y = ¡²g. The expression T = ²g(L ¡ y) follows<br />

on integrating and evaluating the constant at y =0.<br />

In the Ã-direction, Newton's second law yields<br />

(T sin μ) y+dy ¡ (T sin μ) y =(²ds) @2Ã @t2 (3.6)<br />

with sin μ = dÃ=ds. For dÃ=dy ¿ 1, sin μ ¼ @Ã=@y, partial derivatives being<br />

used because one also has time as an independent variable. So (3.6) becomes<br />

μ<br />

T (y) @Ã<br />

μ<br />

¡ T (y)<br />

@y y+dy<br />

@Ã<br />

<br />

=(²dy)<br />

@y y<br />

@2Ã ; (3.7)<br />

@t2 or, on Taylor expanding the left-hand side for small dy, dividing by dy, and<br />

taking the limit dy ! 0,<br />

μ<br />

@<br />

T (y)<br />

@y<br />

@Ã<br />

<br />

= ²<br />

@y<br />

@2Ã : (3.8)<br />

@t2 This equation of motion is now entered,<br />

> eq:=diff(T*diff(psi(y,t),y),y)=epsilon*diff(psi(y,t),t,t);<br />

μ <br />

μ μ <br />

2<br />

2<br />

@<br />

@ @<br />

eq := ¡²g Ã(y; t) + ²g(L ¡ y) Ã(y; t) = ² Ã(y; t)<br />

@y @y2 @t2


3.3. SPECIAL FUNCTION MODELS 139<br />

the expression for the tension being automatically substituted.<br />

The equation of motion is a linear partial di®erential equation. Solving linear<br />

PDEs is the subject matter of Chapters 5 and 6. The PDE may be converted<br />

into an ODE by assuming a solution of the form Ã(y;t) =X(y)cos(!t), with<br />

! taken to be a positive angular frequency.<br />

> psi(y,t):=X(y)*cos(omega*t);<br />

Ã(y; t) :=X (y)cos(!t)<br />

With the assumed solution automatically substituted, the resulting output of<br />

eq is divided by cos(!t) and expanded to produce the ODE eq2 .<br />

> eq2:=expand(eq/cos(omega*t));<br />

μ μ μ <br />

2<br />

2<br />

d<br />

d d<br />

eq2 := ¡²g X (y) + ²g X (y) L ¡ ²g X (y) y = ¡² X (y) !<br />

dy dy2 dy2 2<br />

The second derivative terms are collected in eq2 ,<br />

> eq3:=collect(eq2,diff(X(y),y,y));<br />

μ μ 2 d d<br />

eq3 := (²gL¡ ²gy) X (y) ¡ ²g<br />

dy2 dy<br />

and a general analytic solution to eq3 obtained.<br />

<br />

X (y) = ¡² X (y) ! 2<br />

> sol:=dsolve(eq3,X(y));<br />

μ r <br />

μ r <br />

L ¡ y<br />

L ¡ y<br />

sol := X (y) = C1 BesselJ 0; 2 ! + C2 BesselY 0; 2 !<br />

g<br />

g<br />

The general solution is a linear combination of zeroth-order Bessel functions of<br />

the ¯rst and second kinds with arbitrary constants C1 and C2 . The Bessel<br />

Y0 function diverges to ¡1 at y = L so must be removed on physical grounds.<br />

> X:=remove(has,rhs(sol),BesselY);<br />

μ r <br />

L ¡ y<br />

X := C1 BesselJ 0; 2 !<br />

g<br />

To remove the arbitrary constant C1 ,theop command is used to select the<br />

second operand in X.<br />

> X:=op(2,X);<br />

μ r<br />

L ¡ y<br />

X := BesselJ 0; 2<br />

Taking the bungee cord length to be L = 30 meters, its density ² = 1<br />

2 kilogram/meter,<br />

and g =9:8 meter/second 2 ,theformofX is as follows:<br />

> L:=30: g:=9.8: epsilon:=1/2: X:=X;<br />

X := BesselJ(0; 2 p 3:061224489 ¡ 0:1020408163 y!)<br />

The transverse displacement X of the cord at y = 0 is zero, which is entered as<br />

a boundary condition, bc.<br />

g<br />

<br />

!<br />

> bc:=eval(X,y=0)=0;<br />

bc := BesselJ(0; 3:499271060 !) =0


140 CHAPTER 3. LINEAR ODE MODELS<br />

The boundary condition implies that there are certain allowed frequencies (eigenfrequencies)<br />

! of vibration, each frequency corresponding to a possible normal<br />

mode solution. A general transverse motion of the cord will involve a linear combination<br />

of normal modes, the combination depending on the initial conditions<br />

imposedonthecord.<br />

The eigenfrequencies will now be determined. First, the op command is<br />

used to extract the ¯rst element of the second argument on the lhs of bc.<br />

> c:=op([2,1],lhs(bc));<br />

c := 3:499271060<br />

Using the BesselJZeros command, the ¯rst 10 eigenfrequencies are numerically<br />

evaluated, and assigned.<br />

> freq:=seq(omega[n]=evalf(BesselJZeros(0,n)/c),n=1..10);<br />

freq := !1 =0:6872361462; !2 =1:577493717; !3 =2:473008739;<br />

!4 =3:369711645; !5 =4:266865142; !6 =5:164236682;<br />

!7 =6:061730076; !8 =6:959298411; !9 =7:856916100;<br />

!10 =8:754568007<br />

> assign(freq):<br />

A functional operator for creating the nth normal mode, with the time dependence<br />

included, is formed.<br />

> mode:=n->eval(X,omega=omega[n])*cos(omega[n]*t):<br />

As an explicit example, choosing n = N = 3 produces the normal mode X3<br />

corresponding to the third eigenfrequency.<br />

> N:=3: X[N]:=mode(N);<br />

X3 := BesselJ(0; 4:946017478 p 3:061224489 ¡ :1020408163 y)cos(2:473008739 t)<br />

The normal mode is now animated, the plot being rotated by ¡ ¼<br />

2 radians using<br />

the rotate command, so that the animated string is hanging vertically in equilibrium,<br />

rather than being pictured as horizontal. The scaling is constrained,<br />

so that the transverse displacement is small compared to the length of the cord.<br />

The axes are also removed so that the small vibrations are better viewed.<br />

> rotate(animate(plot,[X[N],y=0..L],t=0..10,color=red,<br />

frames=100,scaling=constrained,axes=none),-Pi/2);<br />

The animation can be observed on your computer by executing the above command<br />

line, clicking on the computer plot, and on the start arrow in the tool<br />

bar. You should also look at the other transverse vibrational modes as well, by<br />

changing the value of N from 3 to some other integer between 1 and 10. Or, if<br />

you want, you could generate even higher-integer normal modes.<br />

While we have been looking at Jennifer's computer algebra treatment of the<br />

transverse vibrations of the cord, Heather has completed her bungee jump, the<br />

largest of the vertical oscillations bringing her head to within a meter of the<br />

river far below the bridge. Looking rather pale, Heather attempts to persuade<br />

Jennifer to also do a bungee jump, but Jennifer sensibly declines.


3.3. SPECIAL FUNCTION MODELS 141<br />

PROBLEMS:<br />

Problem 3-19: Vibrations of a weighted bungee cord<br />

Determine the transverse normal modes of vibration of the bungee cord if a<br />

mass M = 60 kg hangs from the lower end. Animate one of the normal modes.<br />

Problem 3-20: A sti®ening spring<br />

A vibrating spring is governed by the ODE<br />

Äx(t)+a _x(t)+kx(t) =0;<br />

where the spring coe±cient is k = b + cedt , and initially x(0) = A, _x(0) = 0.<br />

Determine the analytic form of x(t). Taking a = p 5, b = 1<br />

4 , c =1,d =1,<br />

and A =1,plotx(t) over a time interval for which the oscillations e®ectively<br />

vanish. Determine the threshold on ® for critical damping.<br />

Problem 3-21: The growing pendulum<br />

Consider a pendulum that consists of a point mass m at the bottom end of<br />

a light supporting rod of length L that is allowed to move in a vertical plane<br />

about a pivot point at its top end. Suppose that L increases at a steady rate,<br />

i.e., L = L0 + vt,wherev>0 is a constant speed and t the time. Letting<br />

the rod make an angle μ(t) with the vertical and neglecting drag, use Newton's<br />

second law to derive the ODE for small μ. Solve the ODE for L0 =1 meter,<br />

g =9:8 m/s2 , μ(0)=¼=6 radians, _ μ(0) = 0 radians/s, and v =0:5 m/s.Animate<br />

the motion of the pendulum arm (representing it as a thick line) over the time<br />

interval t=0 to 100 seconds, taking 100 frames and using constrained scaling.<br />

Problem 3-22: Onset of bending<br />

A thin, vertical steel wire of length L and circular cross section of radius a is<br />

clamped at its bottom and is free at its top. Let μ be the angular de°ection of<br />

the wire from the vertical at a distance y from the top. If L is small, the wire<br />

is stable in the vertical position, i.e., μ = 0 for all values of y. As L increases,<br />

there is a critical value Lcr beyond which the wire is unstable and will bend<br />

from the vertical.<br />

The relevant ODE for small angular displacements μ is<br />

d2μ dy2 = ¡c2 yμ; where c = 2<br />

r<br />

½g<br />

: (3.9)<br />

a Y<br />

Here ½ is the mass density, g is the acceleration due to gravity, and Y is Young's<br />

modulus.<br />

(a) Determine the solution of the ODE, subject to the boundary conditions<br />

μ =0 aty = L (wire clamped at bottom) and dμ=dy =0 at y =0 (wireis free at top).<br />

(b) Show that the onset of bending occurs at Lcr ¼ (2:8=c) 2=3 .<br />

(c) Determine Lcr for a steel (Y =2:1 £ 1011 N/m2 and ½=7800 kg/m3 )wire<br />

of radius 1 mm. Take g =9:8 m/s2 .


142 CHAPTER 3. LINEAR ODE MODELS<br />

3.3.3 Mathieu's Spring<br />

In every tyrant's heart there springs in the end<br />

This poison, that he cannot trust a friend.<br />

Aeschylus, Greek dramatist, Prometheus, in Prometheus Bound (525{456 BC)<br />

Emile Mathieu (1835{1890), a French mathematician, introduced the special<br />

functions that bear his name as solutions to the problem of determining the<br />

transverse vibrations of an elliptically shaped elastic membrane. As illustrated<br />

in the following recipe, Mathieu functions also occur for the vibrations of a unit<br />

mass attached to the end of a linear spring having a time-dependent spring<br />

coe±cient k = a + b cos(ct), where a, b, andcare real constants. The mass is<br />

allowed to slide on a smooth horizontal surface, but experiences a viscous drag<br />

force given by Stokes's law, Fdrag = ¡¡(dx=dt), where x(t) is the displacement<br />

of the mass from equilibrium at time t and ¡ is the damping coe±cient.<br />

To see what mathematical approach Maple uses in solving the relevant ODE,<br />

the infolevel[dsolve] command is set to 2.<br />

> restart: infolevel[dsolve]:=2:<br />

The mathematical form of the spring coe±cient is entered.<br />

> k:=a+b*cos(c*t);<br />

k := a + b cos(ct)<br />

A functional operator ode is introduced to generate the ODE governing the<br />

motion of the unit mass for a given value of the damping coe±cient ¡.<br />

> ode:=Gamma->diff(x(t),t,t)+Gamma*diff(x(t),t)+k*x(t)=0;<br />

μ μ <br />

2 d d<br />

ode := ¡ ! x(t) +¡ x (t) + k x(t) =0<br />

dt2 dt<br />

An operator X is formed to analytically solve ode for x(t) for a speci¯ed ¡ value<br />

and the initial condition x(0) = A, _x(0) = 0.<br />

> X:=Gamma->rhs(dsolve(fode(Gamma),x(0)=A,D(x)(0)=0g,x(t))):<br />

As speci¯c parameter values, let's take a =10,b =2,c =2,andA =1.<br />

> a:=10: b:=2: c:=2: A:=1:<br />

The analytic solution for, say, ¡ = 2 is generated.<br />

> sol:=simplify(X(2)); #example<br />

Methods for second order ODEs:<br />

| Trying classi¯cation methods |<br />

¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢<br />

¡> Trying a Liouvillian solution using Kovacic's algorithm<br />

Trying a solution in terms of special functions:<br />

¡> Bessel<br />

¡> elliptic<br />

¡> Legendre<br />

¡> Whittaker


3.3. SPECIAL FUNCTION MODELS 143<br />

¡> hypergeometric<br />

¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢<br />

¡> Mathieu<br />


144 CHAPTER 3. LINEAR ODE MODELS<br />

3.3.4 Quantum-Mechanical Tunneling<br />

If we see light at the end of the tunnel,<br />

It'sthelightoftheoncomingtrain.<br />

Robert Lowell, American poet commenting on pessimism (1917{1977)<br />

The SchrÄodinger equation [Gri95] describing the one-dimensional motion of a<br />

particle of mass m moving in a potential V (x) attimet is<br />

¡ ¹h2 @<br />

2 m<br />

2 ª(x; t)<br />

@x2 + V (x)ª(x; t) =I ¹h<br />

@ª(x; t)<br />

; (3.10)<br />

@t<br />

where ª(x; t)isthewave function, I = p ¡1, and ¹h=h=(2 ¼), where h is Planck's<br />

constant. Assuming a stationary-state solution, ª(x; t)=Ã(x) e ¡IEt=¹h , reduces<br />

the PDE (3.10) to the time-independent SchrÄodinger ODE,<br />

d2Ã(x) dx2 2 m<br />

+ 2 (E ¡ V (x)) Ã(x) =0 (3.11)<br />

¹h<br />

The probability of ¯nding the particle between x and x + dx at time t is<br />

jª(x; t)j2 dx = jÃ(x)j2 dx ´ P (x) dx. The total probability of ¯nding the particle<br />

somewhere in the range x = ¡1 to +1 is R +1<br />

P (x) dx =1.<br />

¡1<br />

Although classically impossible, a particle with energy E incident on a ¯nite<br />

potential barrier of maximum height Vmax >Ehas a nonzero probability of<br />

quantum-mechanically tunneling through the barrier to the opposite side. This<br />

is the basis of ®-emission, inwhich® particles are able to escape from the nucleus<br />

through the nuclear potential barrier. For a particle incident on a barrier<br />

with incident amplitude Ãinc, re°ected amplitude Ãrefl, andtransmittedamplitude<br />

Ãtrans, one can de¯ne the re°ection coe±cient R = jÃreflj2 =jÃincj2 and<br />

the transmission coe±cent T = p (E ¡ Vtrans)=(E ¡ Vinc) jÃtransj2 =jÃincj2 .<br />

The factor 2 m=¹h 2 can be removed from equation (3.11) by rescaling the<br />

spatial variable, letting x now stand for ( p 2 m=¹h) x. Usingthe\scaled"ODE,<br />

our goal in this recipe is to determine the re°ection and transmission coe±cients<br />

for a particle of energy E > 0 incident on a potential barrier V (x) =ax2 ,<br />

with a = 1, located between x = 0 and x = L = 1. Outside the barrier,<br />

V (x) = 0, i.e., Vtrans = Vinc =0soT = jÃtransj2 =jÃincj2 . Then we will plot<br />

both coe±cients as a function of the energy E.<br />

The DEtools library package is loaded, because it contains the expsols command,<br />

which will enable us to generate exponential solutions to the SchrÄodinger<br />

ODE rather than the default sine and cosine solutions that would otherwise occur<br />

in the regions xL,whereV (x) =0.<br />

> restart: with(DEtools):<br />

The parameter values a =1andL = 1 are entered, along with the assumed<br />

condition E>0.<br />

> a:=1: L:=1: assume(E>0):<br />

The scaled SchrÄodinger ODE is entered for V (x) =0,<br />

> de1:=diff(psi(x),x,x)+E*psi(x);


3.3. SPECIAL FUNCTION MODELS 145<br />

μ <br />

2 d<br />

de1 := Ã(x) + EÃ(x)<br />

dx2 and two independent exponential solutions obtained.<br />

> sol1:=expsols(de1,psi(x));<br />

h<br />

sol1 := e (pExI) (¡I ;e p i<br />

Ex)<br />

Remembering that the spatial forms are to be mentally multiplied by the time<br />

factor e ¡IEt=¹h , the ¯rst term in sol1 corresponds to a plane wave traveling to<br />

the right, the second term to a plane wave traveling to the left. In region 1<br />

(x psi1:=sol1[1]+A*sol1[2];<br />

Ã1 :=e (p ExI) + Ae (¡I p Ex)<br />

In region 3 (x >L), there is only a transmitted wave traveling to the right,<br />

which is now entered. The transmission coe±cient will be T = jBj 2 .<br />

> psi3:=B*sol1[1];<br />

Ã3 :=Be (p ExI)<br />

In the barrier (0


146 CHAPTER 3. LINEAR ODE MODELS<br />

There are four unknown coe±cients, A, B, C1 ,andC2, sofourequations<br />

are needed to determine them. Continuity of the amplitudes Ã1 andÃ2 at<br />

x = 0 is imposed in the ¯rst boundary (or matching) condition bc1 .Thelatter<br />

waveform must be carefully handled. One cannot simply evaluate Ã2 atx =0,<br />

because the error message \division by zero" will appear. One must take the<br />

limit as x approaches zero from the right, i.e., from x>0. The quantity ¡<br />

appearing in the output is the gamma function.<br />

> bc1:=eval(psi1,x=0)=limit(psi2,x=0,right);<br />

C2<br />

bc1 := 1 + A =<br />

p ¼<br />

μ <br />

3 E<br />

¡ ¡<br />

4 4<br />

In the second boundary condition, Ã2 andÃ3 areequatedatx = L.<br />

> bc2:=eval(psi2,x=L)=eval(psi3,x=L);<br />

μ<br />

C2 HermiteH ¡ 1<br />

<br />

E<br />

+ ; 1<br />

2 2<br />

= Be (pEI) μ <br />

E 1<br />

bc2 := C1 WhittakerM ; ; 1 +<br />

4 4<br />

E<br />

2<br />

(¡1=2+ 2 ) e (1=2)<br />

Because the second derivative is ¯nite, the ¯rst derivative (slope) of the wave<br />

formsmustbecontinuousatx = 0. This condition is imposed in bc3 ,the<br />

limiting process again being used for the derivative dÃ2=dx.<br />

> bc3:=eval(diff(psi1,x),x=0)=limit(diff(psi2,x),x=0,right);<br />

bc3 := p EI¡ A p EI =<br />

μ <br />

5 E<br />

E<br />

C1 ¡ ¡ 2<br />

(¡1=2+ 2<br />

4 4<br />

) E<br />

¡ C2 2<br />

(¡3=2+ 2 ) p E<br />

¼ + C2 2<br />

(¡3=2+ 2 ) p ¼E<br />

μ <br />

5 E<br />

E<br />

¡ ¡ 2<br />

(¡1=2+ 2<br />

4 4<br />

)<br />

The slope continuity condition is also imposed at x = L (lengthy output not<br />

shown here).<br />

> bc4:=eval(diff(psi2,x),x=L)=eval(diff(psi3,x),x=L);<br />

The four boundary conditions are solved for the four unknown coe±cients, and<br />

the solution is assigned.<br />

> sol3:=solve(fbc1,bc2,bc3,bc4g,fA,B,_C1,_C2g): assign(sol3):<br />

The re°ection and transmission coe±cients are calculated, the very lengthy<br />

expressions being suppressed with line-ending colons. Noting that the amplitudes<br />

are complex, these coe±cients are given by R = jAj2 = A £ A ¤ and<br />

T = jBj2 = B £ B ¤ , where the asterisk denotes the complex conjugate. The<br />

conjugate command is used to enter the complex conjugates.<br />

> R:=A*conjugate(A): T:=B*conjugate(B):<br />

The re°ection and transmission coe±cients are now plotted over the energy<br />

range E = 0 to 1, the two curves being colored blue and red on the computer<br />

screen. The black-and-white version is shown in Figure 3.10.


3.3. SPECIAL FUNCTION MODELS 147<br />

> plot([R,T],E=0..1,color=[blue,red],tickmarks=[3,3],<br />

view=[0..1,0..1]);<br />

1<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

0.2 0.4 E 0.8 1<br />

Figure 3.10: Re°ection and transmission coe±cients versus energy E.<br />

The transmission coe±cient rapidly increases from 0 and approaches 1 as E<br />

is increased. Conversely, the re°ection coe±cient rapidly decreases with increasing<br />

E. By energy conservation, the sum of the re°ection and transmission<br />

coe±cients should sum to 1 for all values of the energy E. From the ¯gure, this<br />

appears to be the case, the con¯rmation being left for you as a problem. Note<br />

that the re°ection coe±cient is not equal to zero at E =1,eventhoughthe<br />

energy of the incoming particle is equal to that at the top of the barrier.<br />

PROBLEMS:<br />

Problem 3-25: R+T=1<br />

Con¯rm that the sum of the re°ection and transmission coe±cients is equal to<br />

1forallE. You may do this either graphically or analytically.<br />

Problem 3-26: Equality<br />

Determine the energy at which the re°ection and transmission coe±cients are<br />

equal by (i) using the mouse, (ii) using the fsolve command.<br />

Problem 3-27: Exponential barrier<br />

Determine the transmission and re°ection coe±cients as a function of energy<br />

E if the barrier has the form V (x) =Ve ¡x=L between x =0andL =1,<br />

with V = 1. Outside the barrier region, V (x) = 0. Plot the re°ection and<br />

transmission coe±cients in the same ¯gure and discuss how the results compare<br />

with those obtained in the text recipe.


Chapter 4<br />

Nonlinear ODE Models<br />

The elegant body of mathematical theory pertaining to linear<br />

systems ... tends to dominate even moderately advanced university<br />

courses. The mathematical intuition so developed ill equips the<br />

student to confront the bizarre behavior exhibited by the simplest of<br />

...nonlinear systems. Yet such nonlinear systems are surely the rule,<br />

not the exception .... Not only in research, but also in the everyday<br />

world of politics and economics, we would all be better o® if more<br />

people realized that simple nonlinear systems do not necessarily<br />

possess simple dynamic properties.<br />

Robert M. May, mathematical biologist, Nature, Vol. 261, 459 (1976)<br />

In Chapter 1, phase-plane portraits were used to explore some simple nonlinear<br />

ODE models whose temporal evolution could not have been predicted, even<br />

qualitatively, before the portraits were numerically constructed. An example<br />

was the period-doubling route to chaos exhibited by the Du±ng equation<br />

Äx +2° _x + ®x+ ¯x 3 = F cos(!t) (4.1)<br />

when the amplitude F of the driving force was increased, the other parameters<br />

being held ¯xed. If the nonlinear term, ¯x 3 , were not present, this \bizarre"<br />

period-doubling behavior would not even be possible. If we were to change the<br />

various coe±cient values in (4.1), the response of the nonlinear system would<br />

in general be entirely di®erent and not easily predicted on the basis of mathematical<br />

or physical intuition alone. To aid in the qualitative understanding of<br />

the behavior of nonlinear ODE systems such as this one, the concepts of ¯xed<br />

points and phase-plane analysis were discussed in Chapter 2.<br />

One might well ask whether there are mathematical techniques for obtaining<br />

the exact analytic solutions to nonlinear ODEs, and if so, whether Maple<br />

can be used to ¯nd these solutions. The answer is that the vast majority of<br />

nonlinear ODEs of interest to physicists and engineers do not possess exact<br />

analytic solutions. Only a handful of ODEs of physical interest can be solved<br />

exactly, and for those equations Maple can be used to ¯nd the solutions. Some<br />

examples of ¯rst-order nonlinear ODEs for which this is the case are illustrated<br />

in the following section.<br />

149


150 CHAPTER 4. NONLINEAR ODE MODELS<br />

4.1 First-Order Models<br />

4.1.1 An Irreversible Reaction<br />

I shall use the phrase \time's arrow" to express this one-way property<br />

of time which has no analogue in space.<br />

Arthur Eddington, British astrophysicist (1882{1944)<br />

As our ¯rst example, we consider the following problem, which the reader was<br />

previously asked to solve numerically (see Problem 2-29).<br />

Consider the irreversible chemical reaction<br />

2K 2Cr 2O 7 +2H 2O+3S ! 4KOH+2Cr 2O 3 +3SO 2<br />

with initially N1 molecules of potassium dichromate (K 2Cr 2O 7), N2 molecules of<br />

water (H2O), N3 atoms of sulphur (S), and 0 molecules of potassium hydroxide<br />

(KOH). The number x of KOH molecules at time t seconds is given by the<br />

nonlinear rate equation<br />

_x = k (2 N1 ¡ x) 2 (2 N2 ¡ x) 2 (4 N3=3 ¡ x) 3<br />

with k =1:64 £ 10 ¡20 s ¡1 . Taking N1 = 2000, N2 = 2000, and N3 = 3000,<br />

analytically determine the number of KOH molecules at arbitrary time t>0<br />

and plot the solution for the ¯rst second after the chemical reaction begins.<br />

How many KOH molecules are present at 0:2 seconds? How many are present<br />

in the limit t !1?<br />

To observe Maple's method of solution, the infolevel[dsolve] command<br />

is set equal to 2, and the rate equation entered.<br />

> restart: infolevel[dsolve]:=2:<br />

> de:=diff(x(t),t)=k*(2*N1-x(t))^2*(2*N2-x(t))^2<br />

*(4*N3/3-x(t))^3;<br />

de := d<br />

dt x (t) =k (2 N1 ¡ x(t))2 (2 N2 ¡ x(t)) 2<br />

μ<br />

4 N3<br />

3<br />

3<br />

¡ x(t)<br />

Theratecoe±cientk and the initial molecule numbers are speci¯ed.<br />

> k:=1.64*10^(-20): N1:=2000: N2:=2000: N3:=3000:<br />

The di®erential equation de is analytically solved for x(t), subject to x(0) = 0.<br />

> sol:=dsolve(fde,x(0)=0g,x(t));<br />

Methods for ¯rst order ODEs:<br />

| Trying classi¯cation methods |<br />

trying a quadrature<br />

trying 1st order linear<br />

trying Bernoulli<br />

trying separable<br />


4.1. FIRST-ORDER MODELS 151<br />

equation is separable. Thatistosay,itcanbewrittenintheformdx=dt =<br />

f(t)=g(x), where f(t) andg(x) are given functions. So, on rearranging and<br />

integrating, one has R g(x) dx = R f(t) dt, the answer following if the integrals<br />

can be performed (which is the case here).<br />

The right-hand side of the solution sol can be converted into a functional<br />

operator x using the unapply command. Then entering x(t) will evaluate x at<br />

the speci¯ed value of t.<br />

> x:=unapply(rhs(sol),t);<br />

4000 5<br />

x := t !¡<br />

(2=3)<br />

+4000<br />

(251904 t +625) (1=6)<br />

The number x(t) of KOH molecules at time t is plotted over the time interval<br />

t = 0 to 1 second.<br />

> plot(x(t),t=0..1,labels=["t","x"]);<br />

2500<br />

2000<br />

1500<br />

x<br />

1000<br />

500<br />

0<br />

0.2 0.4 0.6 0.8 1<br />

t<br />

Figure 4.1: Number of KOH molecules as a function of time.<br />

The number of KOH molecules present after 0.2 seconds is determined,<br />

> number:=evalf(x(0.2));<br />

number := 2079:400844<br />

and rounded o® to the nearest integer.<br />

> KOH:=round(number);<br />

KOH := 2079<br />

So, 2079 KOH molecules are present 0.2 seconds after the reaction begins.<br />

The number of KOH molecules appears to be leveling o® in Figure 4.1 as<br />

the time increases. From the analytic form of the solution, clearly the limiting<br />

number N is 4000 KOH molecules as t !1. This can be con¯rmed by applying<br />

the following limit command to x(t):<br />

> N:=limit(x(t),t=infinity);<br />

N := 4000


152 CHAPTER 4. NONLINEAR ODE MODELS<br />

PROBLEMS:<br />

Problem 4-1: Falling basketball<br />

A spherical object (diameter d meters and mass m kg) falling from rest experiences<br />

[FC99] a drag force Fdrag = ¡Av¡ Bv2 newtons, where v is the velocity<br />

in m/s and A =1:55 £ 10 ¡4 d, B =0:22 d2 . Derive the nonlinear ODE governing<br />

the velocity of the falling sphere. If the sphere is a basketball of diameter<br />

25 cm and mass 0.60 kg, analytically determine v(t). Does Maple recognize the<br />

ODE as being separable? Plot v(t) and show that the ball will reach a terminal<br />

velocity. Determine the terminal velocity. How long does it take the basketball<br />

to come within 1 percent of the terminal velocity?<br />

Problem 4-2: It's separable<br />

Consider the ODE dy<br />

dx = 2 x3 y ¡ y4 x4 ; y(1) = 5:<br />

¡ 2 xy3 Does this ODE appear to be separable? Show that assuming y(x) =xz(x)leads<br />

to a separable equation for z(x). Making use of this transformation, determine<br />

y(x) and plot the solution, starting at x = 1, over the range for which it remains<br />

real. What is the x value at the upper end of this real range?<br />

4.1.2 The Struggle for Existence<br />

The mathematics of uncontrolled growth are frightening. A single<br />

cell of the bacterium E. coli would, under ideal circumstances, divide<br />

[in two] every twenty minutes .... it can be shown that in a single<br />

day, one cell of E. Coli could produce a super-colony equal in size<br />

and weight to the entire planet Earth.<br />

Michael Crichton, The Andromeda Strain (1969)<br />

A classic experiment in microbiology is to grow yeast, or other microorganisms,<br />

in a nutrient broth inside a test tube or °ask at a suitable ¯xed temperature.<br />

As an assignment associated with her microbiology course in the premed<br />

program at MIT, Heather has been asked to create a Maple worksheet that illustrates<br />

the solution of simple model equations describing the growth of yeast<br />

in a test tube. She is to search the literature and ¯nd realistic numbers for<br />

the parameter values and use these to create suitable plots of the solutions.<br />

Consulting her older sister Jennifer who, recall, is a mathematics faculty member<br />

at MIT, Heather is guided to the text Mathematical Models in Biology by<br />

Leah Edelstein-Keshet [EK88]. This interesting and easy-to-read book describes<br />

some yeast-growing experiments and associated model equations.<br />

After loading the library plots package,<br />

> restart: with(plots):<br />

Heather considers the simplest model of yeast growth, which would apply if<br />

there were an unlimited supply of nutrient. She lets N(t) be the yeast popula-


4.1. FIRST-ORDER MODELS 153<br />

tion density at time t>0andk>0 the rate of reproduction. If k is taken to<br />

be a constant, the following linear yeast equation, YE, results:<br />

> YE:=diff(N(t),t)=k*N(t);<br />

YE := d<br />

N (t) =k N (t)<br />

dt<br />

This growth equation is historically known as Malthus's law, named in honor<br />

of Thomas Malthus (1766{1834), who published a pamphlet (entitled Essay on<br />

Population) on population growth in 1798. Although Heather can solve this<br />

simple linear ODE in her head, she lets Maple generate the solution, subject to<br />

the initial condition N (0) = No.<br />

> ic:=N(0)=No;<br />

ic := N (0) = No<br />

> sol:=dsolve(fYE,icg,N(t));<br />

sol := N (t) =No e (kt)<br />

Malthus's law leads to exponential growth of the yeast population density.<br />

Having read The Andromeda Strain, Heather is curious as to how many<br />

Escherichia coli there would be at the end of 24 hours if the exponential solution<br />

prevailed. According to the Crichton quotation, the doubling time is<br />

20 minutes, or 1=3 of an hour. In the following command line, Heather takes<br />

N(t =1=3)=No = 2 in the exponential solution,<br />

> eq:=2=exp(k/3); #time in hours<br />

k<br />

(<br />

eq := 2 = e 3 )<br />

and numerically solves for the reproductive rate constant, labeled k1 .<br />

> k1:=fsolve(eq,k);<br />

k1 := 2:079441542<br />

Using the Malthus solution, at the end of 24 hours the number of E. coli would<br />

have grown from a single bacterium (No =1),<br />

> Number:=1*exp(k1*24); #in 24 hours<br />

Number := 0:4722366529 1022 to about 1022 bacteria. Talk about explosive growth! Heather wonders how<br />

accurate the Malthus solution is. After all, she need not have formulated the E.<br />

coli growth as a continuous-time ODE, but instead could calculate the growth<br />

directly. In a 24-hour period there would be 24 £ 3 = 72 doublings. At the end<br />

of 24 hours, the number of E. coli is given by the output of the following line:<br />

> Number2:=2^(24.0*3);<br />

Number2 := 0:4722366483 1022 The two numbers di®er only in the eighth decimal place.<br />

Although 1022 E. coli is a large number, Heather notes that since an E. coli<br />

bacterium weighs about 10 ¡12 gm, their total weight is only 10 10 gm, much less<br />

than the 6 £ 1027 gm weight of the earth. Crichton's conclusion seems wrong.


154 CHAPTER 4. NONLINEAR ODE MODELS<br />

This is interesting, but Heather realizes that she should get back to the yeast<br />

problem. Such unlimited growth as seen above clearly cannot occur in a test<br />

tube experiment with only a ¯nite amount of nutrient available. It seems more<br />

reasonable that the growth would depend on the amount of nutrient left in the<br />

test tube. To this end, Heather modi¯es her original model by assuming that<br />

the reproductive rate k is not a constant but is proportional to the concentration<br />

C(t) of nutrient, the proportionality constant being labeled K.<br />

> k:=K*C(t);<br />

k := K C (t)<br />

The new yeast equation then is given by NYE.<br />

> NYE:=YE;<br />

NYE := d<br />

N (t) =K C (t) N (t)<br />

dt<br />

As the yeast density increases, the nutrient concentration must decrease. Heather<br />

assumes that the rate of decrease of C(t) is proportional to the rate of increase of<br />

N(t), the positive proportionality constant being labeled a. The concentration<br />

equation (CE) then is as follows.<br />

> CE:=diff(C(t),t)=-a*diff(N(t),t);<br />

CE := d<br />

μ <br />

d<br />

C (t) =¡a N (t)<br />

dt dt<br />

The problem now involves two coupled ODEs, NYE and CE, but the general<br />

solution of the latter is easily obtained, C1 being the integration constant.<br />

> dsolve(CE,C(t));<br />

C (t) =¡a N (t)+ C1<br />

The last output is then substituted into the new yeast equation.<br />

> NYE:=subs(%,NYE);<br />

NYE := d<br />

N (t) =K (¡a N (t)+ C1) N (t)<br />

dt<br />

It is traditional in mathematical biology to make the form of the equation<br />

notationally simpler, so Heather substitutes C1 = ab and K = r=(ab)into<br />

NYE ,whereband r are new constants.<br />

> subs(f_C1=a*b,K=r/(a*b)g,NYE);<br />

d r (¡a N (t)+ab) N (t)<br />

N (t) =<br />

dt ab<br />

To cancel the constant a, thesimplify command is applied.<br />

> NYE:=simplify(%);<br />

NYE := d r (¡N (t)+b) N (t)<br />

N (t) =<br />

dt b<br />

The resulting nonlinear di®erential equation is known as the logistic equation<br />

and was ¯rst studied by the mathematician Verhulst in 1838.<br />

According to Edelstein-Keshet's text, the logistic equation can be solved in<br />

a straightforward way, and the solution is quoted in her book. If an analytic


4.1. FIRST-ORDER MODELS 155<br />

solution exists, Heather reasons that she should be able to use the dsolve<br />

command to ¯nd it. Setting the infolevel[dsolve] command to be 2, NYE<br />

is solved for N(t), subject to the same initial condition as for Malthus's law.<br />

> infolevel[dsolve]:=2:<br />

> yeastdensity:=dsolve(fNYE,icg,N(t));<br />

Methods for ¯rst order ODEs:<br />

| Trying classi¯cation methods |<br />

trying a quadrature<br />

trying 1st order linear<br />

trying Bernoulli<br />

yeastdensity:=collect(yeastdensity,exp);<br />

No b<br />

yeastdensity := N (t) =<br />

(¡No + b) e (¡rt) + No<br />

This mathematical form is referred to as the logistic curve. Forpositiver, N(t)<br />

approaches the value b as t !1. Unlike Malthus's law, the logistic equation<br />

predicts \saturation" of the yeast number to a constant value at large times,<br />

rather than uncontrolled growth.<br />

Heather notes that by loading the DEtools package, the general Bernoulli<br />

solution to NYE can also be obtained using the bernoullisol command.<br />

> with(DEtools): bernoullisol(NYE,N(t));<br />

trying Bernoulli<br />


156 CHAPTER 4. NONLINEAR ODE MODELS<br />

second. With the initial population density N0 =0:5329 known, the data from<br />

the ¯rst experiment were used to ¯nd the parameter values b and r to use in<br />

the logistic-model solution for each yeast variety. Using a least-squares ¯tting<br />

approach, Gause found that for the kephir, r =0:0607 and b =5:80, while for<br />

the cerevisiae r =0:2183 and b =13:0. The ¯rst experiment was carried out<br />

over a time period of 160 hours. Heather decides to plot the logistic curve for<br />

the kephir, so enters the parameter values,<br />

> b:=5.80: No:=0.5329: r:=0.0607: yeastdensity;<br />

N (t) =<br />

3:090820<br />

5:2671 e (¡0:0607 t) +0:5329<br />

and applies the plot command, adding a title to the picture.<br />

> plot(rhs(yeastdensity),t=0..160,labels=["t","A"],<br />

color=blue,thickness=2,tickmarks=[2,4],<br />

title="Amount of yeast (A) vs. hours (t)");<br />

Amount of yeast (A) vs. hours (t)<br />

5<br />

4<br />

A<br />

3<br />

2<br />

1<br />

0 100<br />

t<br />

Figure 4.2: Growth curve for the yeast kephir.<br />

Thelogisticgrowthcurveofthekephir population is shown in Figure 4.2. The<br />

plot for the cerevisiae would be similar in appearance.<br />

Gause's second experiment studied the competition between the two yeasts<br />

for the available nutrient when they were grown together in the same test tube.<br />

To explore this case Heather labels the kephir population density and parameters<br />

with the subscript k, while the subscript c is used for the cerevisiae. To<br />

account for the interaction between the two species of yeast, Gause assumed<br />

that the probability of an interaction is proportional to the product of the<br />

population densities, i.e., to NkNc, and that the competition for nutrient was<br />

detrimental to both populations. Accordingly, Gause described the growth of


4.1. FIRST-ORDER MODELS 157<br />

the two interacting species by the following pair of coupled nonlinear equations:<br />

Nk _ = rk (bk ¡ Nk ¡ ¯kc Nc) Nk=bk; Nc _ = rc (bc ¡ Nc ¡ ¯ck Nk) Nc=bc; (4.3)<br />

with the interaction parameters experimentally determined to be ¯kc =0:439<br />

and ¯ck =3:15. This set of nonlinear ODEs cannot be solved analytically, but<br />

the behavior of the two competing yeast populations can easily be determined<br />

by making a phase-plane portrait of Nk versus Nc.<br />

Heather unassigns k so that it can be used as a subscript to label the kephir<br />

population and sets the infolevel[dsolve] command to zero.<br />

> unassign('k'): infolevel[dsolve]:=0:<br />

The values determined by Gause for the coe±cients in (4.3) are entered,<br />

> r[k]:=0.0607: b[k]:=5.8: beta[kc]:=0.439: r[c]:=0.2183:<br />

b[c]:=13.0: beta[ck]:=3.15:<br />

as well as the system (sys) ofequations.<br />

> sys:=diff(N[k](t),t)=r[k]*(b[k]-N[k]-beta[kc]*N[c])*N[k]/b[k],<br />

diff(N[c](t),t)=r[c]*(b[c]-N[c]-beta[ck]*N[k])*N[c]/b[c];<br />

sys := d<br />

dt Nk(t) =0:01046551724 (5:8 ¡ Nk(t) ¡ 0:439 Nc(t)) Nk(t);<br />

d<br />

dt Nc(t) =0:01679230769 (13:0 ¡ Nc(t) ¡ 3:15 Nk(t)) Nc(t)<br />

Heather takes Nk(0)=Nc(0)=0:5 inthephaseportrait command,<br />

> phaseportrait([sys],[N[k](t),N[c](t)],t=0..250,<br />

[[N[k](0)=0.5,N[c](0)=0.5]],stepsize=0.1,linecolor=blue);<br />

N[c]<br />

8<br />

6<br />

4<br />

2<br />

0<br />

1 2 4 5<br />

N[k]<br />

Figure 4.3: Phase portrait showing competition between kephir and cerevisiae.


158 CHAPTER 4. NONLINEAR ODE MODELS<br />

producing the phase-plane picture shown in Figure 4.3. In the actual experiment,<br />

the time interval was only about 50 hours. On reducing the time range<br />

to be from t =0to50inthephaseportrait command line, Heather ¯nds that<br />

the curve terminates in the vicinity of the maximum value for Nc. Inthiscase,<br />

both species of yeast survived over the 50 hours of the experiment, with the<br />

cerevisiae dominating over the kephir. However, assuming that enough nutrient<br />

was available, she can see that ultimately only one species would survive over<br />

250 hours and it isn't the cerevisiae, but rather the kephir. This is because the<br />

interaction coe±cient ¯kc is much smaller than ¯ck. In this struggle for existence,<br />

there would be only the victorious kephir and the vanquished cerevisiae.<br />

To see the explicit time evolution of each yeast population, Heather uses the<br />

phase-plane portrait command again, but now creates two plots, one with the<br />

scene option scene=[t,N[k]], the other with scene=[t,N[c]].<br />

> plot1:=phaseportrait([sys],[N[k],N[c]],t=0..300,<br />

[[N[k](0)=0.5,N[c](0)=0.5]],stepsize=0.1,<br />

scene=[t,N[k]],color=red,linecolor=blue):<br />

> plot2:=phaseportrait([sys],[N[k],N[c]],t=0..300,<br />

[[N[k](0)=0.5,N[c](0)=0.5]],stepsize=0.1,<br />

scene=[t,N[c]],color=red,linecolor=red):<br />

On superimposing the two plots with the display command, Figure 4.4 results.<br />

> display(fplot1,plot2g,tickmarks=[3,3]);<br />

8<br />

6<br />

N<br />

4<br />

2<br />

0<br />

100 200 300<br />

t<br />

Figure 4.4: Time evolution of the kephir (saturable curve) and the cerevisiae.<br />

By clicking with the mouse on the plot, the crossover point for the two population<br />

densities occurs at about 164 hours. With her assignment completed,<br />

Heather is grateful that her sister was able to recommend a useful text. She<br />

will have to treat her to a Starbucks latte the next time they get together.


4.1. FIRST-ORDER MODELS 159<br />

PROBLEMS:<br />

Problem 4-3: Nonlinear diode circuit<br />

A linear capacitor with capacitance C is connected in series with a nonlinear<br />

diode that has a current (i){voltage (v) relationoftheformi = av+ bv2 ,with<br />

the coe±cients a and b both positive. The voltage across the capacitor at time<br />

t =0isv = V . Derive the nonlinear ODE governing this circuit. Introducing<br />

the dimensionless variables y = v(t)=V , ¿ = at=C,and¯ = bV=a,rewritethe<br />

ODE in dimensionless form. Analytically solve this ODE, demonstrating that<br />

Maple recognizes the ODE as a Bernoulli equation. For ¯ = 2, plot the solution<br />

overthetimeinterval¿ =0to2.<br />

Problem 4-4: Nonlinear diode revisited<br />

Suppose that the current{voltage relation for the nonlinear diode in the previous<br />

problem is given by the more general relation i = av+bvn ,wheren =2,3,4,5,<br />

::: Derive the corresponding general dimensionless ODE and analytically solve<br />

it for arbitrary n. For the same parameters and time range as in the previous<br />

problem, produce a single plot that shows the solutions for n =2to5. Discuss<br />

the e®ect of increasing n.<br />

Problem 4-5: A potpourri of Bernoulli equations<br />

For each of the following nonlinear ODEs (with prime indicating an x-derivative):<br />

² con¯rm that it is of the Bernoulli type;<br />

² analytically solve the ODE for y(0) = 1;<br />

² plot the solution y(x) overtherangex =0to5.<br />

(a) y 3 y 0 + x ¡1 y 4 = x; (b) y 0 + y = xy 3 ; (c) y ¡ y 0 =3y 3 e ¡2 x ;<br />

(d) y 3 +3y 2 y 0 =4.<br />

Problem 4-6: General solution<br />

Determine the general solution of the following Bernoulli equation:<br />

xy 0 + y = x 3 y 6 :<br />

Problem 4-7: Laser beam competition<br />

In the theory of stimulated thermal scattering [BEP71], the intensities IL and IS<br />

of two interacting collinear laser beams traveling in the z-direction are governed<br />

by the following pair of coupled ¯rst-order nonlinear ODEs:<br />

dIL<br />

dz = ¡gILIS ¡ ®IL; dIS<br />

dz = gILIS ¡ ®IS;<br />

where the gain coe±cient g>0andtheabsorption coe±cient ® ¸ 0.<br />

(a) By adding the two equations and eliminating IL, show that a single<br />

Bernoulli equation can be obtained for the intensity IS.<br />

(b) Analytically solve this Bernoulli equation for IS(z).<br />

(c) Plot ln(IS(z)=IS(0)) for z =0to10cmgiventhatIS(0)=IL(0) = 0:01,<br />

gIL(0) = 1 cm ¡1 ,and(a)® =0,(b)® =0:5 cm ¡1 . Discuss the results.


160 CHAPTER 4. NONLINEAR ODE MODELS<br />

Problem 4-8: Variable transformation<br />

Explicitly show that the general Bernoulli equation (4.2) can be transformed<br />

into a linear ODE by making use of the transformation p =1=yn¡1 .Herenis an arbitrary positive integer greater than or equal to two.<br />

Problem 4-9: Flu epidemic in Spuzzum<br />

In the small town of Spuzzum (population N0 = 2000 people), the number<br />

N(t) of people infected with the °u after t weeks is governed by the logistic<br />

equation, N _ =0:002 N (N0 ¡ N): If two people are initially infected, derive<br />

the analytic formula for N(t): How many weeks does it take before 75% of<br />

Spuzzum's population is infected with the °u? Plot N(t) forthetimethatit<br />

takes 90% of the population to be infected.<br />

Problem 4-10: Hare today, gone tomorrow<br />

The growth of a snowshoe hare population is governed by the logistic equation,<br />

_N = rN(N0 ¡ N); with the rate constant r =0:25=N0, time being measured<br />

in months. A viral epidemic of deadly myxamatosis strikes the population,<br />

suddenly reducing the hare number to 1% of the equilibrium number N0. How<br />

many months does it take for the snowshoe hare population to climb back up to<br />

a level of 50% of its equilibrium number? Plot N(t)=N0 over this time interval.<br />

Problem 4-11: Harvesting of blue whales<br />

In the absence of harvesting, the blue whale population number N(t)isgoverned<br />

by the logistic equation. If a constant rate h of harvesting is included, the<br />

equation becomes<br />

N(t) _ =a (M ¡ N(t)) N(t) ¡ h;<br />

where M is the maximum number of whales in the absence of harvesting and a is<br />

a positive constant. With t in years, it has been estimated that a =6£10 ¡7 and<br />

M=200,000. The steady-state (equilibrium) population occurs when _ N =0.<br />

(a) Plot h versus N for the steady state. Find the maximum value hmax of<br />

h by: (i) clicking the mouse on the maximum point of the curve, and<br />

(ii) working with the algebraic form and then substituting numbers. The<br />

quantity hmax is called the maximum sustained yield. What happens to<br />

the whale population for h À hmax?<br />

(b) Using the dsolve command, solve the logistic equation for the given parameters<br />

and N(0)=100,000, h = 7000. How many years would it take for<br />

the blue whale population to go extinct? It is because of overharvesting<br />

that the blue whale population has been nearly wiped out.<br />

Problem 4-12: Gompertz's law<br />

Gompertz's law is an alternative nonlinear growth model to the logistic equation<br />

and has been used to model the growth of cancerous tumors. The Gompertz<br />

ODE is of the form<br />

_y = ky ln(ym=y);<br />

where k and ym are positive constants. Derive the general analytic solution<br />

to the Gompertz ODE. If k =0:1, ym =0:5, and y(0) = 0:1, determine the<br />

analytic form for y(t) and plot the solution for t = 0 to 75. What is the<br />

interpretation of the constant ym?


4.1. FIRST-ORDER MODELS 161<br />

Problem 4-13: The von Bertalan®y model of growth<br />

The limited-growth von Bertalan®y model is governed by the nonlinear ODE<br />

_y =3ky 2=3 (ym ¡ y 1=3 );<br />

with k and ym positive constants. Derive the general analytic solution to the<br />

von Bertalan®y ODE. If k =0:1, ym =0:5, and y(0) = 0:1, determine the<br />

analytic form for y(t) and plot the solution for t =0to75.<br />

Problem 4-14: The Michaelis{Menton equation<br />

The nonlinear Michaelis{Menton model equation<br />

_y = ¡ay=(b + y);<br />

with a, b positive constants, describes the rate at which an enzyme reaction<br />

takes place. Here y(t) is the amount of substrate that is being transformed by<br />

the enzyme at time t. Takinga = b = y(0) = 1, determine the analytic form of<br />

y(t). Plot the analytic solution for t =0to5.<br />

4.1.3 The Bad Bird Equation<br />

Everyone pushes a falling fence.<br />

Chinese proverb about failure.<br />

In an article by Peastrel and coworkers in the The Physics of Sports [PLA92],<br />

the experimental data for the distance y (in meters) that a badminton bird<br />

(\bad" bird, for short) falls in t seconds from rest is well described by<br />

y =<br />

V 2<br />

g ln<br />

μ<br />

cosh<br />

μ gt<br />

V<br />

<br />

; (4.4)<br />

where V is the terminal velocity and g is the acceleration due to gravity. Vectoria<br />

will now show you how equation (4.4) can be easily derived, using Newton's<br />

second law and assuming that the drag force is given by Newton's law of air<br />

resistance, viz.,Fres = ¡kmv2 ,withkthe drag coe±cient, m the mass of<br />

the bird, and v the speed. The quadratic dependence on v is appropriate for<br />

turbulent air °ow. For the falling bird, the turbulence arises because of the<br />

bird's \feathers." Stokes's law of resistance (Fres / v) prevails for laminar (i.e.,<br />

smooth) °ow. 2<br />

Vectoria begins by loading the DEtools package,<br />

> restart: with(DEtools):<br />

and entering Newton's law of air resistance.<br />

> F[res]:=-k*m*v(t)^2;<br />

Fres := ¡kmv(t) 2<br />

2 The more general resistance law is a combination of linear and quadratic terms in the<br />

velocity. Which term dominates depends on the shape of the moving object and the magnitude<br />

of the velocity.


162 CHAPTER 4. NONLINEAR ODE MODELS<br />

The equation of motion follows on applying Newton's second law to the motion<br />

of the bad bird. Equating the net force on the bird, due to the pull of gravity<br />

and the drag force, to the bird's mass times its acceleration produces eq.<br />

> eq:=m*g+F[res]=m*diff(v(t),t);<br />

eq := mg¡ kmv(t) 2 μ<br />

d<br />

= m<br />

dt v(t)<br />

<br />

The force equation is simpli¯ed by dividing eq through by the mass m.<br />

> eq2:=simplify(eq/m);<br />

eq2 := g ¡ k v(t) 2 = d<br />

dt v(t)<br />

Since the terminal velocity V is reached when the upward and downward forces<br />

balance, so that the acceleration is zero, then g = kV2 .Thus,thedragcoe±cient<br />

k may be eliminated by substituting k = g=V 2 into eq2 .<br />

> ode:=subs(k=g/V^2,eq2); #Riccati equation<br />

g v(t)2<br />

ode := g ¡<br />

V 2<br />

d<br />

=<br />

dt v(t)<br />

Vectoria recognizes the resulting ¯rst-order nonlinear ode as a speci¯c example<br />

of Riccati's equation, which has the general structure<br />

_x + ax 2 + f1(t) x + f2(t) =0; (4.5)<br />

with a a constant. In the present case, Vectoria identi¯es x ´ v, a ´ k = g=V 2 ,<br />

f1 =0,andf2 = ¡g. She recalls that Riccati's equation can be reduced to a<br />

linear ODE involving a new dependent variable z(t) by introducing the transformation<br />

z(t) =exp(a R t<br />

0 x(t) dt): However, it is easier to derive the general<br />

form of v(t) by applying the riccatisol command to ode. The square brackets<br />

are included at the end of the command line to remove the brackets that would<br />

otherwise enclose the output.<br />

> sol:=riccatisol(ode,v(t))[];<br />

sol := v(t) =¡ 1<br />

0 r<br />

Bt<br />

¡<br />

tan B<br />

@<br />

2<br />

4 g2<br />

V 2<br />

r<br />

C1 ¡<br />

¡<br />

2<br />

4 g2<br />

V 2<br />

1<br />

r<br />

C<br />

2 A ¡ 4 g2<br />

2 V<br />

V 2<br />

g<br />

The integration constant C1 is determined by evaluating the right-hand side<br />

of the solution at t = 0, setting the result to zero (since the bird starts from<br />

rest), and solving for the constant.<br />

> _C1:=solve(eval(rhs(sol),t=0)=0,_C1);<br />

C1 := 0<br />

The integration constant is zero. The velocity expression follows on simplifying<br />

the rhs of sol, assuming that g>0, V > 0, and t>0.<br />

> v:=simplify(rhs(sol)) assuming g>0,V>0,t>0;


4.1. FIRST-ORDER MODELS 163<br />

μ <br />

tg<br />

v := tanh V<br />

V<br />

To determine y(t), a second ODE is formed by equating dy=dt to v. To make<br />

the ¯nal expression appear in the desired form, the convert command is used<br />

to reexpress the hyperbolic tangent in terms of the hyperbolic sine and cosine.<br />

> ode2:=diff(y(t),t)=convert(v,sincos);<br />

ode2 := d<br />

μ <br />

tg<br />

sinh V<br />

V<br />

y(t) = μ <br />

dt tg<br />

cosh<br />

V<br />

Analytically solving ode2 for y(t), subject to the initial condition y(0) = 0,<br />

> dsolve(fode2,y(0)=0g,y(t));<br />

V<br />

y(t) =<br />

2 μ μ <br />

tg<br />

ln cosh<br />

V<br />

g<br />

produces an output that is identical in structure to equation (4.4), thus completing<br />

Vectoria's task.<br />

PROBLEMS:<br />

Problem 4-15: Return velocity<br />

A ball of unit mass is thrown vertically upward near the earth's surface with an<br />

initial speed v(0) = U. Assuming that Newton's law of air resistance prevails,<br />

show that after the ball rises to its maximum height and begins to fall it passes<br />

its initial position with a velocity v = (UV)=( p U 2 + V 2 ); where V is the<br />

terminal velocity. Hint: Reexpress the acceleration as<br />

dv<br />

dt =<br />

μ μ μ <br />

dv dx<br />

dv(x)<br />

= v(x)<br />

dx dt<br />

dx<br />

and note that at the maximum height the speed is zero.<br />

Problem 4-16: A Riccati equation<br />

Consider the following Riccati equation:<br />

y 0 (x)+y(x)=x + ay(x) 2 + b =0;<br />

with the initial condition y(0) = A, wherea, b, andAare real constants.<br />

(a) Analytically solve the ODE. Does the answer depend on the value of A?<br />

(b) What does the general solution look like if no initial condition is speci¯ed?<br />

Explain what happens mathematically when y(0) = A is imposed.<br />

(c) Taking a =5andb =2,plotthesolutionfory(0) = A over the range<br />

x = 0 to 2, using the plot option view=[0..2,-5..5].<br />

(d) Explain the origin of the singular points in the graph in terms of the<br />

behavior of Bessel functions.


164 CHAPTER 4. NONLINEAR ODE MODELS<br />

Problem 4-17: Nonlinear drag on Lake Ogopogo<br />

A boat is launched on Lake Ogopogo with initial speed v0. Thewaterexertsa<br />

drag force F (v) =¡aebv ,witha>0, b>0, thus slowing the boat down.<br />

(a) Find an analytic expression for the speed v(t).<br />

(b) Determine the time it takes for the boat to come to rest.<br />

(c) How far does the boat travel along Lake Ogopogo before coming to rest?<br />

4.2 Second-Order Models<br />

The vast majority of second-order nonlinear models that physicists and engineers<br />

are interested in must be solved numerically. However, we begin this<br />

section with a few examples of models that lead to nonlinear ODEs having exact<br />

analytic solutions. Historically, these models have appeared in many equivalent<br />

guises, so keep this in mind when you read the stories.<br />

4.2.1 Patches Gives Chase<br />

Man ... cannot learn to forget, but hangs on the past:<br />

however far or fast he runs, that chain runs with him.<br />

Friedrich Nietzsche, German philosopher (1844{1900)<br />

A loveable beagle, named Patches, is patrolling a °at farm ¯eld, sni±ng contentedly<br />

at gopher holes, when she spots her mistress, Heather, walking at<br />

constant speed along a straight road at the edge of the ¯eld. Patches then<br />

runs at constant speed toward Heather in such a way as to aim always at her<br />

with her sensitive beagle nose. With distances in km, Patches is initially at<br />

(x =1;y= 0) and Heather at (0; 0). The road is described by the equation<br />

x = 0, and the ratio of Heather's speed to Patches' speed is r.<br />

(a) Derive the nonlinear ODE describing Patches' path y(x).<br />

(b) Analytically solve the ODE for y(x). If Heather walks at 3 km/h and<br />

Patches runs at 8 km/h, plot y(x) using constrained scaling.<br />

(c) How many minutes does it take the dog to reach her mistress? How far<br />

has Heather walked in this time? How far has Patches run?<br />

(d) Animate the motion of Patches and Heather, including a tangent line to<br />

Patches' instantaneous position, which points towards Heather. Again,<br />

use constrained scaling.<br />

At some instant in time, Patches' coordinates are (x; y(x)), while Heather's<br />

are (0; h). Patches runs towards Heather in such a way as to aim always at her.<br />

Therefore the slope of the tangent to Patches' path is dy=dx =(h¡y(x)=(0¡x),<br />

whichisnowenteredineq.


4.2. SECOND-ORDER MODELS 165<br />

> restart:<br />

> eq:=diff(y(x),x)=(h-y(x))/(0-x);<br />

eq := d<br />

¡ y(x)<br />

y(x) =¡h<br />

dx x<br />

We solve eq for Heather's vertical coordinate h.<br />

> h:=solve(eq,h);<br />

μ<br />

d<br />

h := ¡<br />

dx y(x)<br />

<br />

x + y(x)<br />

Heather's speed is r times that of Patches, so dh=dt = r (ds=dt), where t is time<br />

and ds = p 1+(dy=dx) 2 dx is an element of arclength along Patches' path.<br />

But then dh = rds,ordh=dx = r (ds=dx) =r p 1+(dy=dx) 2 . Entering this<br />

last relation yields the relevant second-order nonlinear ODE for y(x),<br />

> ode:=diff(h,x)=r*sqrt(1+diff(y(x),x)^2);<br />

μ <br />

s<br />

μ 2 d d<br />

ode := ¡ y(x) x = r 1+<br />

dx2 dx y(x)<br />

2<br />

the expression for h having been automatically substituted. Although ode is<br />

nonlinear, it can be analytically solved. Patches is initially at x =1;y=0and<br />

the tangent line there has zero slope. These starting conditions are used in the<br />

dsolve command.<br />

> sol:=dsolve(fode,y(1)=0,D(y)(1)=0g,y(x));<br />

x xxr<br />

sol := y(x) =¡<br />

¡<br />

2(¡1+r) xr 2(1+r) +<br />

r<br />

;<br />

¡1+r2 x xxr<br />

y(x) =<br />

+<br />

2(¡1+r) xr 2(1+r) ¡<br />

r<br />

¡1+r2 Two forms of the solution are generated, the ¯rst corresponding to Heather<br />

moving downward (in the negative y direction) along the x = 0 line, the second<br />

corresponding to moving upward. The upward (second one here) solution is<br />

selected and simpli¯ed with respect to powers of x.<br />

> y:=simplify(rhs(sol[2]),power);<br />

y := x(1¡r) x(1+r)<br />

+<br />

2(¡1+r) 2(1+r) ¡<br />

r<br />

¡1+r2 Evaluating y at x = 0 yield's Heather's vertical coordinate when Patches reaches<br />

her. Notice that as r approaches 1 from below, Y goes to in¯nity, i.e., Patches<br />

cannot catch Heather in a ¯nite distance. Obviously, Patches must run faster<br />

than Heather can walk to catch her.<br />

> Y:=eval(y,x=0);<br />

r<br />

Y := ¡<br />

The given ratio r = 3<br />

8<br />

> r:=3/8: y:=y; Y:=evalf(Y);<br />

¡1+r 2<br />

is entered, and y and Y are automatically evaluated.


166 CHAPTER 4. NONLINEAR ODE MODELS<br />

4 x(5=8)<br />

y := ¡ +<br />

5<br />

4 x(11=8)<br />

+<br />

11<br />

24<br />

55<br />

Y := 0:4363636364<br />

Heather has walked about 0.44 km before Patches catches her. The times T<br />

in hours and T2 in minutes for Patches to reach Heather are calculated, along<br />

with the distance Sdog that Patches runs. The absolute value is taken for T ,<br />

because Y will be negative if the downward solution branch is chosen.<br />

> T:=abs(Y)/3; T2:=T*60*minutes; Sdog:=8*T;<br />

T := 0:1454545455 T2 := 8:727272730 minutes Sdog := 1:163636364<br />

The time for Patches to catch Heather is about 0:15 hours, or 8:73 minutes.<br />

(Patches is rather slow!) Patches has run about 1:16 km.<br />

A labeled plot of y is now created with constrained scaling,<br />

> pl:=plot(y,x=0..1,thickness=2,tickmarks=[3,3],<br />

labels=["x","y"],scaling=constrained):<br />

and, loading the plots package, displayed in Figure 4.5.<br />

> with(plots): display(pl);<br />

0.4<br />

y<br />

0.2<br />

0<br />

0.2 0.4 0.6 0.8 1<br />

x<br />

Figure 4.5: Patches' path is the curved line.<br />

Finally, an animation of Heather's and Patches' motion is produced. The animation<br />

will contain N = 40 frames, the frames labeled from i =0toN ¡ 1.<br />

The Student[Calculus1] library package is loaded so that the tangent line to<br />

Patches' position on the path can be drawn for each frame.<br />

> N:=40: with(Student[Calculus1]):<br />

The following functional operator X will calculate Patches' horizontal coordinate<br />

for the ith frame. For i =0; 1; 2; etc., X(0) = 1; X(1) = 1 ¡ 1=40 =<br />

0:975; X(2) = 0:95, etc.<br />

> X:=i->1-i/N:


4.2. SECOND-ORDER MODELS 167<br />

The operator hh calculates Heather's y-coordinate for the ith frame. The sign<br />

command is included to pick up the correct sign for the coordinate, whether<br />

Heather's motion is upward or downward.<br />

> hh:=i->sign(-Y)*evalf(int(r*sqrt(1+diff(y,x)^2),x=1..X(i))):<br />

The pointplot command is used to graph Heather's and Patches' positions for<br />

the ith frame as size-16 blue circles.<br />

> gr:=i->pointplot([[X(i),eval(y,x=X(i))],[0,hh(i)]],<br />

symbol=circle,symbolsize=16,color=blue):<br />

The command Tangent(y,x=X(i),0..1) generates the equation of the line<br />

tangent to y at the point x = X(i), the third argument giving the range of x.<br />

A plot of the tangent line is produced by including the arguments showtangent<br />

and output=plot.<br />

> gr2:=i->Tangent(y,x=X(i),0..1,showtangent,output=plot,<br />

thickness=2):<br />

All the graphs are superimposed for the ith frame, using the display command.<br />

> Gr:=i->display([pl,gr(i),gr2(i)],view=[0..1,0..Y]):<br />

Themotionisanimatedusingthedisplay command again, with the option<br />

insequence=true.<br />

> display(seq(Gr(i),i=0..N-1),insequence=true,<br />

scaling=constrained);<br />

On execution of the above command line, the opening frame of the animation<br />

appears on the computer screen. Click on the plot and on the start arrow to<br />

see the animation. The equation of the tangent curve is displayed at the top of<br />

each frame, along with the coordinates at which the tangent line is calculated.<br />

PROBLEMS:<br />

Problem 4-18: Heather slows down<br />

On seeing Patches begin to run toward her, Heather slows down, her speed<br />

being 3 x km/h, where x is Patches' horizontal coordinate. Thus, when Patches<br />

is at x = 1, Heather's speed is 3 km/h, but when Patches reaches her (x =0)<br />

Heather is standing still. If Patches still runs at a constant speed of 8 km/h,<br />

analytically determine the equation y(x) describing Patches' path and plot it.<br />

How far has Heather walked when Patches catches her? How far has Patches<br />

run? How long does it take Patches to reach Heather?<br />

Problem 4-19: Curves of pursuit<br />

Do an Internet search on curves of pursuit and discuss the history and types of<br />

pursuit curves that have been studied in the mathematical literature. Also see<br />

Davis [Dav62]. Create a recipe that generates the pursuit curve of your choice<br />

and motion along it, including the instantaneous tangent line. Depending on<br />

your choice, you may have to solve the relevant ODE numerically.


168 CHAPTER 4. NONLINEAR ODE MODELS<br />

4.2.2 Oh What Sounds We Hear!<br />

A man falls in love through his eyes, a woman through her ears.<br />

Woodrow Wyatt, British journalist, To the Point,\The Ears Have It," 1981<br />

Wyattarguesthatwhatissaidtoawomanbyaman,andwhatshebelieves<br />

about his status, is usually more important than the super¯ciality of good looks.<br />

At the end of the nineteenth century, the famous German scientist Heinrich<br />

Helmholtz knew that the ear perceives frequencies that are not present in the<br />

incident acoustic waves. He attributed this to an asymmetric nonlinear response<br />

of the eardrum's tympanic membrane and developed a simple mechanical model<br />

for the eardrum's vibrations.<br />

In the present century, a nervous young mathematics major by the name of<br />

Mike has an hour or so to fret over his upcoming date with Vectoria. Why is<br />

Mike nervous? This is the night that he plans to reveal his serious intentions for<br />

her hand, and he is worried about possible rejection. To calm him down, let's<br />

try to take his mind o® Vectoria by asking him to reproduce Helmholtz's derivation.<br />

Helmholtz's model involves applying Newton's second law to generate a<br />

phenomenological nonlinear ODE describing the one-dimensional displacement<br />

x(t) of the freely vibrating eardrum about the equilibrium position x =0.<br />

Reluctantly acquiescing to our request, Mike begins by loading the plots<br />

library package, and then formally Taylor expanding the restoring force per<br />

unit mass, F (x), about x = 0 out to third order in x.<br />

> restart: with(plots):<br />

> Force:=taylor(F(x),x=0,3);<br />

Force := F (0) + D(F )(0) x + 1<br />

2 (D(2) )(F )(0) x2 +O(x3 )<br />

The coe±cients D(F )(0) and D (2) (F )(0) in the above output stand for the ¯rst<br />

and second derivatives of F with respect to x, evaluated at x = 0, respectively.<br />

Mike then assumes that the displacement x is su±ciently small that only terms<br />

to second order in x have to be retained. So he removes the O(x3 )term.<br />

> Force:=convert(Force,polynom);<br />

Force := F (0) + D(F )(0) x + 1<br />

2 (D(2) )(F )(0) x2 Why keep the second-order term? The term that is linear in x corresponds to<br />

Hooke's law, while the quadratic term is the ¯rst nonlinear correction to Hooke's<br />

law and is responsible for the asymmetric response noted by Helmholtz. As the<br />

eardrum vibrates about the equilibrium position x = 0, the linear (x) termin<br />

the force changes sign with x, but the quadratic (x2 ) term does not change sign.<br />

In equilibrium the restoring force must vanish, so Mike sets F (0) = 0. He<br />

also makes the symbolic substitutions D(F )(0) = ¡! 2 0 and D(2) (F )(0) = ¡2 ¯,<br />

> Force:=subs(fF(0)=0,D(F)(0)=-omega[0]^2,(D@@2)(F)(0)=<br />

-2*betag,%);<br />

Force := ¡!0 2 x ¡ ¯x 2


4.2. SECOND-ORDER MODELS 169<br />

with !0 and ¯ both positive. Using Newton's second law and substituting<br />

the explicit time dependence into the force yields the relevant second-order<br />

nonlinear ODE.<br />

> ode:=diff(x(t),t,t)-subs(x=x(t),Force)=0;<br />

μ 2 d<br />

ode :=<br />

x (t)<br />

dt2 + !0 2 x (t)+¯ x(t) 2 =0<br />

If ¯ is set equal to zero, then the familiar linear simple harmonic oscillator<br />

equation results, the eardrum vibrating at the characteristic frequency !0. In<br />

this case, the period (time for one complete oscillation) is T =2¼=!0. With<br />

¯ 6= 0, the above ODE is nonlinear, but can be solved analytically, as Mike<br />

will demonstrate. Since he is already furtively looking at his watch, we will not<br />

insist that Mike look for realistic parameter values for the eardrum, but instead<br />

allow him to set !0 =1and¯ =1,sotheode has the following form.<br />

> omega[0]:=1: beta:=1: ode:=ode;<br />

μ 2 d<br />

ode := x(t) + x(t)+x (t)<br />

dt2 2 =0<br />

Applying the dsolve command to ode,<br />

> solution:=dsolve(ode,x(t));<br />

Z x(t)<br />

3<br />

solution := p d a ¡ t ¡ C2 =0;<br />

¡9 a2 ¡ 6 a3 +9 C1<br />

Z x (t)<br />

¡<br />

3<br />

p ¡9 a 2 ¡ 6 a 3 +9 C1 d a ¡ t ¡ C2 =0<br />

produces two general implicit solutions for the time, with positive and negative<br />

square roots. To obtain a positive period, Mike chooses to work with the positive<br />

square root, which is the ¯rst solution for this particular run.<br />

> answer:=solution[1]; #choose positive square root<br />

answer :=<br />

Z x (t)<br />

3<br />

p d a ¡ t ¡ C2 =0<br />

¡9 a2 ¡ 6 a3 +9 C1<br />

The constant C2 in the answer merely shifts the origin of time and so can be<br />

disregarded or set equal to zero. The other arbitrary constant C1 canbeevaluated<br />

by specifying an initial amplitude x(0) = A with zero initial velocity there.<br />

The amplitude sets the total energy E of the system. For a one-dimensional<br />

mechanical system having mass m and speed v, thetotalenergyisthesumof<br />

the kinetic energy and potential energy U(x), i.e.,<br />

E = 1<br />

2 mv2 + U(x): (4.6)<br />

But this can be rewritten as<br />

v = dx<br />

dt<br />

r<br />

2<br />

= § (E ¡ U(x)); (4.7)<br />

m


170 CHAPTER 4. NONLINEAR ODE MODELS<br />

or, on integrating, Z x(t)<br />

dx<br />

t = § p : (4.8)<br />

0 (2=m)(E ¡ U(x))<br />

Comparing the result in answer with the positive square root in (4.8), the<br />

potential energy U(x) for the present problem can be taken (to within an overall<br />

proportionality constant) as<br />

U(x) =9x 2 +6x 3 : (4.9)<br />

Now Mike di®erentiates the answer with respect to time,<br />

> eq:=diff(answer,t);<br />

μ<br />

d<br />

3<br />

dt<br />

eq :=<br />

x(t)<br />

<br />

p ¡ 1=0<br />

¡9 x (t) 2 ¡ 6 x (t) 3 +9 C1<br />

thus removing the unwanted coe±cient C2 from the analysis. Next, he solves<br />

eq for dx=dt, i.e., for the velocity vel.<br />

> vel:=solve(eq,diff(x(t),t));<br />

vel := 1 p<br />

¡9 x(t) 2 ¡ 6 x(t) 3 +9 C1<br />

3<br />

and removes the time dependence for later integration purposes, replacing x(t)<br />

with the dummy variable y.<br />

> vel:=subs(x(t)=y,vel);<br />

p<br />

¡9 y2 ¡ 6 y3 +9 C1<br />

vel :=<br />

3<br />

The unknown constant C1 can be determined by imposing the condition that<br />

the velocity must be zero at the turning point y = A,<br />

> condition:=eval(vel,y=A)=0;<br />

p<br />

¡9 A2 ¡ 6 A3 +9 C1<br />

condition :=<br />

=0<br />

3<br />

and solving for the constant. The velocity expression is then determined.<br />

> _C1:=solve(condition,_C1); vel:=vel;<br />

C1 := A2 + 2<br />

3 A3<br />

p<br />

¡9 y2 ¡ 6 y3 +9A2 +6A3 vel :=<br />

3<br />

To proceed any further, the amplitude A must be given a speci¯c value. Mike<br />

, which is automatically substituted into vel.<br />

enters the nominal value A = 1<br />

3<br />

> A:=1/3: vel:=vel;<br />

vel :=<br />

r<br />

¡9 y 2 ¡ 6 y 3 + 11<br />

9<br />

3


4.2. SECOND-ORDER MODELS 171<br />

In vel, the total energy is identi¯ed to be E =11=9. To get a qualitative feeling<br />

for the eardrum motion, Mike plots the potential energy U as a thick red line<br />

over the range x = ¡1:6 to0:6,<br />

> U:=plot(9*x^2+6*x^3,x=-1.6..0.6,color=red,thickness=2):<br />

and the total energy E as a thick green horizontal line between the points<br />

(x = ¡2; E=11=9) and (x =1;E=11=9).<br />

> E:=plot([[-2,11/9],[1,11/9]],style=line,color=green,<br />

thickness=2):<br />

The two energy curves are superimposed in Figure 4.6.<br />

> display(fU,Eg,tickmarks=[3,3],labels=["x","Energy"]);<br />

-1 x<br />

4<br />

Energy<br />

Figure 4.6: Asymmetric potential well for the eardrum model equation.<br />

The horizontal total energy line in Figure 4.6 intersects the potential energy<br />

curve at three x values. The two intersection points inside the potential well<br />

centered at x =0aretheturning points, the eardrum system oscillating between<br />

these two points if it is placed at one of these two points with zero velocity.<br />

The turning point on the right is the input value x(0) = A = 1<br />

3 . Because the<br />

potential well is slightly asymmetric, the other turning point on the left is not<br />

at x = ¡ 1.<br />

The other turning point is easily determined by ¯rst ¯nding all the<br />

3<br />

intersection points using the solve command.<br />

> points:=solve(vel=0,y);<br />

points := 1 11<br />

; ¡<br />

3 12 +<br />

p<br />

33 11<br />

; ¡<br />

12 12 ¡<br />

p<br />

33<br />

12<br />

Three solutions are produced, corresponding to the three intersection points<br />

of the total energy line with the potential energy curve. The ¯rst answer corresponds<br />

to the turning point on the far right, and the third answer to the<br />

intersection on the far left. So the second answer is selected as corresponding<br />

to the second turning point for motion inside the potential well. This turning<br />

point is labeled B.<br />

2<br />

0


172 CHAPTER 4. NONLINEAR ODE MODELS<br />

> B:=points[2];<br />

B := ¡ 11<br />

12 +<br />

p<br />

33<br />

12<br />

If ¯ = 0, the potential well would have been symmetric about x =0,andthe<br />

second turning point would have been at x = ¡ 1<br />

3 ¼¡0:333. For ¯ =1,the<br />

ppotential well is asymmetric and the second turning point is at B =(¡11 +<br />

33)=12 ¼¡0:438. Clearly, the period of oscillation will be somewhat longer<br />

than the period 2 ¼=!0 ¼ 6:28forthelinearcase.<br />

Mike calculates the period T for the nonlinear situation by multiplying the<br />

time it takes the system to go from B to A by 2, i.e, T =2 R A<br />

(1=vel) dy.<br />

B<br />

> T:=2*int(1/vel,y=B..A);<br />

Ãs<br />

15 ¡<br />

24 EllipticK<br />

T :=<br />

p 33<br />

15 + p !<br />

33<br />

p p<br />

30 + 2 33<br />

The period is expressed in terms of the complete elliptic integral K(k) ofthe<br />

¯rst kind, which is de¯ned as<br />

Z ¼=2<br />

d®<br />

K(k) ´ p<br />

0 1 ¡ k2 sin 2 : (4.10)<br />

®<br />

Maple expresses<br />

q<br />

the complete elliptic integral in the form EllipticK(k), so in<br />

this case k = (15 ¡ p 33)=(15 + p 33): The elliptic integral can be evaluated<br />

numerically,<br />

> T:=evalf(T);<br />

T := 6:747679332<br />

so the period is T ¼ 6:75, which is about 7 1%<br />

longer than for the linear case.<br />

2<br />

To perform the necessary integration to obtain the analytic solution, it is<br />

necessary to assume that the displacement satis¯es x>Band x assume(x>B,x sol:=t=int(1/vel,y=B..x); #implicit solution<br />

à s<br />

45 x +33¡<br />

12 EllipticF 2<br />

sol := t =<br />

p 33 + 3 p 33 x<br />

(15 ¡ p 33) (11 + p 33 + 12 x) ;<br />

s<br />

15 ¡ p 33<br />

15 + p !<br />

33<br />

p p<br />

30 + 2 33<br />

The implicit solution is expressed in terms of the incomplete elliptic integral of<br />

the ¯rst kind, u ´ F (Á; k), which is de¯ned as follows:<br />

Z Á<br />

Z sin Á<br />

d®<br />

dy<br />

u ´ F (Á; k) = p = p<br />

0 1 ¡ k2 2<br />

sin ® 0 1 ¡ y2 p 1 ¡ k2 : (4.11)<br />

y2 Maple expresses the incomplete elliptic integral in the form EllipticF(z; k) with<br />

z ´ sin Á. The complete elliptic integral K(k) corresponds to taking Á = ¼=2.


4.2. SECOND-ORDER MODELS 173<br />

An explicit solution is obtained by solving sol for x.<br />

> x:=solve(sol,x);<br />

x := ¡ 1 88 %1 + 8 %1<br />

3<br />

p 11 p 3 ¡ 77 ¡ 3 p 33<br />

32 %1 ¡ 43 ¡ 5 p 33<br />

%1 := JacobiSN<br />

Ã<br />

t<br />

p<br />

30 + 2 p 33<br />

;<br />

12<br />

s<br />

15 ¡ p 33<br />

15 + p 33<br />

The formidable-looking answer, which is challenging to derive with pen and<br />

paper,isgivenintermsoftheJacobian elliptic sine function, whichMaple<br />

expresses in the form JacobiSN(u; k). When written by hand, the elliptic sine<br />

function is often written as sn(u), the argument k not being explicitly expressed.<br />

How is sn(u) de¯ned? The upper limit Á in the ¯rst integral of equation<br />

(4.11) is referred to as the \amplitude" of u and is written as Á =am(u).<br />

Then, for a given k value, the elliptic sine function, sn(u), is de¯ned by<br />

sn(u) =sinÁ = sin(am(u)): (4.12)<br />

For k =0,itiseasytoverifythatsn(u) reduces to sin(u). As k is increased,<br />

the elliptic sine function deviates away from the \ordinary" sine function shape.<br />

To learn more about the Jacobian elliptic sine function, Mike suggests that you<br />

try some of the relevant problems that follow this recipe.<br />

The solution is now plotted over the time interval t = 0 to 30, displaying<br />

asymmetric oscillation about the equilibrium point.<br />

> plot(x,t=0..30,thickness=2);<br />

0.2<br />

0<br />

–0.2<br />

–0.4<br />

!2<br />

5 10 15 t 20 25 30<br />

Figure 4.7: Asymmetric oscillations of the eardrum.<br />

Unfortunately, Mike has to leave to pick Vectoria up, so let's wish him luck<br />

in his quest for this fair damsel's hand and hope that he will return soon to<br />

explore some more interesting recipes with us.


174 CHAPTER 4. NONLINEAR ODE MODELS<br />

PROBLEMS:<br />

Problem 4-20: Di®erent amplitude<br />

Taking the initial conditions x(0) = ¡ 4<br />

5 ,_x(0) = 0 in the text recipe, determine<br />

the analytic form of the period and its numerical value. Determine the analytic<br />

solution and plot it over a suitable time range.<br />

Problem 4-21: Maximum energy for bounded motion<br />

What is the maximum total energy E for which oscillatory motion of the<br />

eardrum can occur in the text recipe? What are the numerical values of the<br />

turning points?<br />

Problem 4-22: Higher-order correction to the period<br />

For the freely vibrating eardrum, also keep the cubic term in the Taylor expansion<br />

of the force law and express the restoring force per unit mass as<br />

F = ¡! 2 0 x ¡ ¯x2 ¡ °x3 . Taking ! =1,¯ = 3 1<br />

1<br />

4 , ° = 2 ,andA = 3 determine<br />

the period of vibrations of the eardrum. By how much is the period<br />

changed with respect to that predicted by the linear Hooke's law?<br />

Problem 4-23: Plotting the elliptic sine function<br />

Plot the Jacobian elliptic sine function sn(u) over the range u =0to20inthe<br />

same graph for k =0:1, k =0:5, k =0:9, and k =0:995. Discuss the behavior<br />

of sn(u) ask is increased.<br />

Problem 4-24: Plotting the elliptic cosine function<br />

In analogy to the elliptic sine function, the Jacobian elliptic cosine function of u<br />

is de¯ned as cn(u) =cosÁ =cos(am(u)): Noting that the Maple command for<br />

cn(u) isJacobiCN(u,k), plot the elliptic cosine function over the range u =0<br />

to 20 in the same graph for k =0:1, k =0:5, k =0:9, and k =0:995. Discuss<br />

the behavior of cn(u) ask is increased.<br />

Problem 4-25: Properties of elliptic functions<br />

Using the de¯nition of cn(u) in the previous problem and de¯ning another<br />

elliptic function dn(u) = p 1 ¡ k2 sin 2 Á = p 1 ¡ k2 sn2 (u); prove the following:<br />

(a) d<br />

(cn(u)) = ¡ sn(u) dn(u);<br />

du<br />

(b) d2<br />

du 2 (cn(u)) = (2 k2 ¡ 1) cn(u) ¡ 2 k 2 cn 3 (u);<br />

Z<br />

(c) cn(u) du = 1<br />

k arccos(dn(u)).<br />

Problem 4-26: Vibrating hard spring<br />

The equation of motion for a \hard" spring is<br />

Äx(t)+(1+a 2 x(t) 2 ) x(t) =0:<br />

Analytically determine the period and the solution x(t) for the hard spring,<br />

given the initial conditions x(0) = A, _x(0) = 0. Plot the solution over several<br />

cycles for a = A =1.


4.2. SECOND-ORDER MODELS 175<br />

4.2.3 Vectoria Feels the Force and Hits the Bottle<br />

Man your ships, and may the force be with you.<br />

Film line from Star Wars, writtenbyGeorgeLucas,1977<br />

Our fair damsel, Vectoria, has felt the force of Mike's love and can't wait to tell<br />

her girlfriends tonight about becoming engaged. Perhaps a bottle of sparkling<br />

Asti Spumante wine would be in order then, but in the meantime a homework<br />

assignment in her electromagnetics course beckons and an entirely di®erent sort<br />

of bottle awaits her immediate consideration.<br />

She has been asked to create a recipe that illustrates the movement of a<br />

charged particle in a magnetic bottle. The phrase \magnetic bottle" refers to<br />

the carefully designed arrangements of magnetic ¯elds that are used for the<br />

con¯nement of extremely hot plasmas studied in experiments on thermonuclear<br />

fusion. Basically, the magnetic ¯eld is approximately uniform in the center of<br />

the \bottle" but gets stronger and pinches inward at the ends of the bottle.<br />

A charged particle starting in the central region, and given an initial velocity<br />

toward one end of the bottle, spirals around a ¯eld line traveling toward that<br />

end. As it approaches the end, the orbits become smaller and smaller, and<br />

¯nally at some point the charge re°ects o® the \end" of the bottle and reverses<br />

direction. It then travels to the other end of the bottle and repeats the scenario.<br />

In her recipe, Vectoria will make use of the Lorentz force law and a magnetic<br />

¯eld con¯guration of her own mathematical design. A particle of charge q<br />

moving with velocity ~v in an external electric ¯eld ~ E and magnetic ¯eld ~ B will<br />

experience the Lorentz force ~ F = q ~ E + q (~v £ ~ B). If present, the electric ¯eld<br />

produces a contribution to the Lorentz force in the direction of ~ E, while the<br />

magnetic force contribution is perpendicular to the velocity vector. So, the<br />

electric force will accelerate the charge, while the magnetic force de°ects it.<br />

Vectoria begins her recipe by loading the VectorCalculus and plots packages,<br />

the former being needed for creating and manipulating vectors.<br />

> restart: with(VectorCalculus): with(plots):<br />

Using Cartesian coordinates, with ^ex,^ey, and^ezpointing along the x-, y-, and zaxes<br />

respectively, the position vector ~r = x(t)^ex + y(t)^ey + z(t)^ez of the charge<br />

at time t is entered, and its velocity ~v = d~r=dt and acceleration ~a = d~v=dt<br />

calculated. The position vector is entered here with the \shorthand" syntax,<br />

the longer form being Vector([x(t),y(t),z(t)]). The default output is in<br />

terms of Cartesian unit vectors, although Maple does not place \hats" on them.<br />

> r:=; v:= diff(r,t); a:=diff(v,t);<br />

r := x (t)ex + y(t)ey + z(t)ez<br />

μ<br />

d<br />

v :=<br />

dt x(t)<br />

μ<br />

d<br />

ex +<br />

dt y(t)<br />

μ<br />

d<br />

ey +<br />

dt z(t)<br />

<br />

ez<br />

μ μ μ <br />

2<br />

2<br />

2<br />

d d d<br />

a := x(t) ex + y(t) ey + z(t) ez<br />

dt2 dt2 dt2


176 CHAPTER 4. NONLINEAR ODE MODELS<br />

The radial distance R = p x(t) 2 + y(t) 2 at time t is entered. The coordinates<br />

and initial conditions will be chosen so that spirals are traced out in the radial<br />

direction with translation of the spirals along the z-axis.<br />

> R:=sqrt(x(t)^2+y(t)^2);<br />

R := p x(t) 2 + y(t) 2<br />

For the magnetic bottle ¯elds, Vectoria takes the electric ¯eld to be zero, and<br />

starts to build up the magnetic ¯eld structure, inputting the x-, y-, and zcomponents<br />

but with the mathematical forms of the radial function Br and<br />

longitudinal function Bz not yet speci¯ed.<br />

> E:=; B:=;<br />

E := 0 ex<br />

Br x (t)<br />

B := ¡ p<br />

x(t) 2 + y(t) 2 ex ¡<br />

Br y(t)<br />

p x(t) 2 + y(t) 2 ey + Bz ez<br />

TheLorentzforceonthechargeq is calculated, the short-hand form v&xBbeing<br />

used to enter the cross product ~v £ ~ B. The long form is CrossProduct(v,B).<br />

> F:=q*E+q*(v &x B);<br />

0<br />

μ<br />

B<br />

F := q B<br />

d<br />

@ dt y(t)<br />

μ<br />

d<br />

<br />

dt<br />

Bz +<br />

z(t)<br />

1<br />

Br y(t)<br />

C<br />

p C<br />

x (t) 2 + y(t) 2<br />

0<br />

B<br />

+q B<br />

@ ¡<br />

μ<br />

d<br />

dt z(t)<br />

<br />

Br x(t)<br />

p<br />

x(t) 2 + y(t) 2 ¡<br />

A ex<br />

1<br />

μ <br />

d C<br />

x (t) BzC<br />

dt<br />

A ey<br />

0<br />

B<br />

+q B<br />

@ ¡<br />

μ<br />

d<br />

dt x(t)<br />

<br />

Br y(t)<br />

p<br />

x(t) 2 + y(t) 2 +<br />

μ<br />

d<br />

dt y(t)<br />

1<br />

Br x (t)<br />

C<br />

p C<br />

x(t) 2 + y(t) 2<br />

A ez<br />

Taking the mass of the charge to be m, Newton's second law gives the system<br />

of three component equations. Only the ¯rst ODE is shown here in the text.<br />

> sys:=seq(m*a[i]=F[i],i=1..3);<br />

0<br />

μ μ 2 d B<br />

sys := m x(t) = q B<br />

d<br />

dt2 @ dt y(t)<br />

μ<br />

d<br />

<br />

dt<br />

Bz +<br />

z(t)<br />

1<br />

Br y(t)<br />

C<br />

p C<br />

x(t) 2 + y(t) 2 A ;:::<br />

Vectoria uses the piecewise command to build up the functional forms of Br<br />

and Bz . The structure of Br is such that there is no radial component of the<br />

magnetic ¯eld between z = ¡1 andz = +1. In this region, the magnetic ¯eld<br />

is completely in the z-direction. Outside this central region, the radial ¯eld


4.2. SECOND-ORDER MODELS 177<br />

component is allowed to vary with z according to a hyperbolic cosine function.<br />

The function Bz is taken to be constant inside the region z = ¡0:5 to0:5 and<br />

allowed to grow linearly stronger outside this region.<br />

> Br:=piecewise(z(t)>1,cosh(z(t)),z(t) Bz:=piecewise(abs(z(t)) B1:=subs(fx(t)=x,z(t)=z,y(t)=0g,B[1]):<br />

B3:=subs(fx(t)=x,z(t)=zg,B[3]):<br />

She uses the fieldplot command to represent the direction and magnitude<br />

of the ¯eld with thick red arrows. A cross-sectional plot of the symmetrical<br />

magnetic ¯eld is shown in Figure 4.8. Note that the size of the arrows is an<br />

indication of ¯eld strength, bigger arrows for stronger ¯elds. The ¯eld con¯guration<br />

shown in the ¯gure should allow magnetic bottle behavior.<br />

> fieldplot([B3,B1],z=-1.5..1.5,x=-1..1,arrows=THICK,grid=<br />

[15,15],color=red,scaling=constrained,tickmarks=[3,3]);<br />

x<br />

1<br />

–1 0<br />

1<br />

z<br />

–1<br />

Figure 4.8: Magnetic ¯eld con¯guration to produce a magnetic bottle.<br />

To animate the motion of a charge in her magnetic bottle, Vectoria chooses the<br />

nominal mass and charge values m =1andq = 1 and the initial conditions


178 CHAPTER 4. NONLINEAR ODE MODELS<br />

x(0) = 0:5, y(0) = 0, z(0) = 0, _x(0) = 0, _y(0) = ¡2, and _z(0) = ¡0:2.<br />

> m:=1: q:=1:<br />

> ic:=(x(0)=0.5,y(0)=0,z(0)=0,D(x)(0)=0,D(y)(0)=-2,D(z)(0)=0.2):<br />

Maple is not able to produce an explicit closed-form analytic solution for the<br />

nonlinear ODE system, sys, so a numerical solution is generated, the output<br />

being given as a \listprocedure."<br />

> sol:=dsolve(fsys,icg,fx(t),y(t),z(t)g,numeric,<br />

output=listprocedure):<br />

Evaluating x(t), y(t), and z(t) withsol will allow Vectoria to calculate the<br />

charge's position at an arbitrary time t.<br />

> X:=eval(x(t),sol): Y:=eval(y(t),sol): Z:=eval(z(t),sol):<br />

For example, the charge's x-coordinate at t = 2 time units is now evaluated.<br />

> X(2);<br />

¡0:0727500262205896948<br />

Vectoria will now animate the motion of the charge in the magnetic bottle. She<br />

takes the total time to be T =24:0time units and will have N =200time<br />

steps in her animation. The time step size T=N is then calculated.<br />

> T:=24.0: N:=200: step:=T/N;<br />

step := 0:1200000000<br />

The spacecurve command is used to plot (but not display) the entire trajectory<br />

overthetimeintervalt =0toT , the trajectory being colored with the zhue<br />

option. To obtain a smooth curve, the minimum number of plotting points is<br />

taken to be 1000.<br />

> sc:=spacecurve([X(t),Y(t),Z(t)],t=0..T,shading=zhue,<br />

numpoints=1000):<br />

Using a do loop running from n =0toN, the charge is plotted on each time step<br />

in 3 dimensions as a size-18 red circle superimposed on the entire trajectory.<br />

> for n from 0 to N do<br />

> t:=step*n;<br />

> pp[n]:=pointplot3d([X(t),Y(t),Z(t)],symbol=circle,<br />

symbolsize=18,color=red);<br />

> gr[n]:=display(fsc,pp[n]g);<br />

> end do:<br />

The motion of the charge in the magnetic bottle is animated with the display<br />

command, using the insequence=true option. To see the animation execute<br />

the worksheet, click on the plot, and on the start arrow in the tool bar.<br />

> display(seq(gr[n],n=0..N),insequence=true,axes=frame,<br />

labels=["x","y","z"]);<br />

Vectoria is quite pleased that her piecewise model mimics magnetic bottle behavior.<br />

But now she has to forsake this bottle for another one, as she rushes<br />

o® to join her girlfriends and share a bottle of Asti Spumante.


4.2. SECOND-ORDER MODELS 179<br />

PROBLEMS:<br />

Problem 4-27: Crossed electric and magnetic ¯elds<br />

Consider a charge q and mass m moving in the crossed electric and magnetic<br />

¯elds described by ~ E = E0 sin(!t)^ez, ~ B = B0 ^ex, whereE0, B0, and! are real<br />

constants. Using the Lorentz force law, derive the system of ODEs governing<br />

the motion of the charge. Is the system linear or nonlinear? Analytically derive<br />

the solution of the system, given the initial conditions x(0) = 0, y(0) = 0,<br />

z(0) = 0, _x(0) = 0, _y(0) = 0, and _z(0) = 0. Taking m =1,q =1,! =5:1,<br />

E0 =2,andB0 =2:3, animate the motion of the charge (represented as a<br />

circle), superimposing the motion on the entire trajectory.<br />

Problem 4-28: Altering the magnetic bottle ¯eld<br />

In the text recipe, experiment with di®erent functional forms of Br and Bz and<br />

discuss the e®ect of your alterations on magnetic bottle behavior. Optional:<br />

Create a continuous ¯eld con¯guration that produces magnetic bottle behavior<br />

and check that div ~ B=0.<br />

4.2.4 Golf Is Such an \Uplifting" Experience<br />

If you watch a game, it's fun. If you play it, it's recreation.<br />

If you work at it, it's golf.<br />

Bob Hope, American comedian, Readers Digest, October 1958.<br />

Heather's girlfriends have invited her to go gol¯ng, but they still need another<br />

woman to make up a foursome for the Thursday afternoon ladies' day at the<br />

Metropolis Country Club. Heather assures them that she can probably twist<br />

her older sister Jennifer's arm to go with them. Jennifer, who has been busy<br />

preparing lectures for her applied mathematics course, has had little time to<br />

play golf recently, but is persuaded to go on the basis that a gourmet bu®et<br />

supper will be available in the clubhouse after the 18 holes are completed.<br />

Although it won't help her to play golf any better, Jennifer's inborn curiosity<br />

about how she would go about realistically modeling the °ight of a golf ball<br />

is piqued, so she trots over to the university science library to look up some<br />

articles on the physics of golf [Erl83], [MA88], [MH91]. She recalls from her<br />

undergraduate physics courses that the trajectory of a golf ball was calculated<br />

assuming that there was no atmospheric drag on the ball, and also not taking<br />

any possible uplift due to backspin of the ball into account. Jennifer wonders<br />

what e®ect the inclusion of these two contributions might have on the ball's<br />

°ight path? For example, can the uplift compensate su±ciently for the aerodynamic<br />

drag to enable the ball to °y farther? After photocopying the cited<br />

references, she makes a beeline back to her o±ce, where she commences to simulate<br />

the °ight of the golf ball with both drag and uplift included. Fortunately,<br />

the references also provide actual parameter values that can be used in her<br />

computer modeling.


180 CHAPTER 4. NONLINEAR ODE MODELS<br />

As she was taught way back in ¯rst-year physics, Jennifer begins by making<br />

a free-body diagram showing all the forces acting on the golf ball. This diagram<br />

is reproduced in Figure 4.9.<br />

φ<br />

golf ball<br />

F<br />

F F<br />

drag<br />

lift<br />

θ<br />

V<br />

gravity<br />

Figure 4.9: Free-body diagram for a golf ball, including drag and lift.<br />

Three forces are included, the pull of gravity ~ Fgravity downward, the drag force<br />

~Fdrag in the direction opposite to the instantaneous velocity vector ~ V , and<br />

the lift force ~ Flift in a direction perpendicular to ~ V . For simplicity, Jennifer<br />

assumes that the ball's spin axis is in the z-direction and that the translational<br />

motion is in the x-y plane with x horizontal and y vertical. She makes a call to<br />

the plots and VectorCalculus packages,<br />

> restart: with(plots): with(VectorCalculus):<br />

and enters the velocity vector ~ V = Vx ^ex + Vy ^ey.<br />

> Velocity:=;<br />

Velocity := Vx ex + Vy ey<br />

Since the speed V will be needed, it is calculated by taking the dot product of<br />

the velocity vector with itself and then taking the square root. The dot product<br />

is entered with the shorthand3 dot syntax. The unit vector (assigned the name<br />

uv) in the direction of ~ V is then equal to the velocity divided by the speed.<br />

> Speed:=sqrt(Velocity . Velocity); u[v]:=Velocity/Speed;<br />

uv := q<br />

q<br />

Speed :=<br />

Vx<br />

Vx 2 + Vy 2<br />

ex +<br />

V<br />

x<br />

Vx 2 + Vy 2<br />

q<br />

3 The long form is DotProduct(Velocity,Velocity).<br />

V<br />

y<br />

Vy<br />

Vx 2 + Vy 2<br />

ey


4.2. SECOND-ORDER MODELS 181<br />

Referring to the freebody diagram, sin(μ) =Vy=V and cos(μ) =Vx=V .<br />

> sin(theta):=V[y]/Speed; cos(theta):=V[x]/Speed;<br />

sin(μ) := q<br />

Vy<br />

Vx 2 + Vy 2<br />

cos(μ) := q<br />

Vx<br />

Vx 2 + Vy 2<br />

The unit vector ^ Á pointing in the lift direction is related to the Cartesian unit<br />

vectors ^ex and ^ey pointing along the x- andy-directions, respectively, by the<br />

relation ^ Á = ¡ sin μ ^ex +cosμ ^ey. This relation is entered and labeled uÁ.<br />

> u[phi]:=;<br />

uÁ := ¡ q<br />

Vy<br />

Vx 2 + Vy 2<br />

ex +<br />

q<br />

Vx<br />

Vx 2 + Vy 2<br />

ey<br />

The gravitational force ~ Fgravity = ¡mg^ey, wherem is the mass of the ball and<br />

g is the acceleration due to gravity.<br />

> F[gravity]:=;<br />

Fgravity := ¡mgey<br />

According to the photocopied references, both the drag force ~ Fdrag and the<br />

lift force ~ Flift are proportional to the square of the speed. Jennifer labels the<br />

proportionality constants (per unit mass) as Kdrag and Klift, respectively, and<br />

enters the two forces.<br />

> F[drag]:=-K[drag]*m*Speed^2*u[v];<br />

q<br />

Fdrag := ¡Kdrag m<br />

Vx 2 + Vy 2 Vx ex ¡ Kdrag m<br />

q<br />

Vx 2 + Vy 2 Vy ey<br />

> F[lift]:=K[lift]*m*Speed^2*u[phi];<br />

q<br />

Flift := ¡Klift m Vx 2 + Vy 2 q<br />

Vy ex + Klift m Vx 2 + Vy 2 Vx ey<br />

The net force ~ F acting on the golf ball is the vector sum of the three forces.<br />

> F:=F[gravity]+F[drag]+F[lift]:<br />

Now, Vx = dx(t)=dt and Vy = dy(t)=dt, wherex(t) andy(t) are the horizontal<br />

and vertical coordinates of the golf ball at time t.<br />

> V[x]:=diff(x(t),t): V[y]:=diff(y(t),t):<br />

Newton's second law of motion is applied in the x- andy-directions.<br />

> xeq:=diff(V[x],t)=simplify(F[1]/m);<br />

xeq := d2<br />

s<br />

μ 2 μ<br />

d d<br />

x(t) =¡ x (t) +<br />

dt2 dt dt y(t)<br />

2μ μ μ<br />

d<br />

d<br />

Kdrag x (t) + Klift<br />

dt dt y(t)<br />

<br />

> yeq:=diff(V[y],t)=simplify(F[2]/m);


182 CHAPTER 4. NONLINEAR ODE MODELS<br />

yeq := d2<br />

y(t) =¡g ¡ Kdrag<br />

dt2 +Klift<br />

s μ d<br />

s μ d<br />

x (t)<br />

dt<br />

x (t)<br />

dt<br />

2<br />

2<br />

μ<br />

d<br />

+<br />

dt y(t)<br />

2 μ<br />

d<br />

dt y(t)<br />

<br />

μ<br />

d<br />

+<br />

dt y(t)<br />

2 μ<br />

d<br />

dt x(t)<br />

<br />

Jennifer's task is now to solve the coupled nonlinear ODEs, xeq and yeq, numerically,<br />

since they do not have analytic solutions. To accomplish this, the<br />

parameter values must be entered. From the references, she ¯nds that the drag<br />

and lift parameters for a British golf ball of mass m =0:046 kg and radius<br />

r =0:0207 m launched at an initial speed V0 =61m/sandwithabackspinof<br />

about 60 rev/s are approximately equal to each other with a value 0:28. The<br />

density ½ of dry air at 1 atm pressure and 20 ± Cis½ =1:21 kg/m 3 . Jennifer<br />

takes g =9:81 m/s and the initial launch angle of the ball to be 16 ± .<br />

> rho:=1.21: m:=0.046: r:=0.0207: g:=9.81: V0:=61: Angle:=16:<br />

Drag:=0.28: Lift:=0.28:<br />

According to the references, the drag and lift coe±cient are given by Kdrag =<br />

½¼r 2 Drag=(2 m) andKlift = ½¼r 2 Lift=(2 m). These two coe±cients are numerically<br />

evaluated and temporarily labeled KDrag and KLift.<br />

> KDrag:=evalf(rho*Pi*r^2*Drag/(2*m));<br />

KLift:=evalf(rho*Pi*r^2*Lift/(2*m));<br />

KDrag := 0:004957310686 KLift := 0:004957310686<br />

The initial angle is converted from degrees into radians,<br />

> Theta:=convert(Angle*degrees,radians);<br />

4 ¼<br />

£:=<br />

45<br />

and the initial velocity of the golf ball calculated.<br />

> Vo:=evalf(V0*);<br />

Vo := 58:63696345 ex +16:81387871 ey<br />

The ball starts with a horizontal velocity component of 58:6 m/s and a vertical<br />

component of 16:8 m/s. Taking the golf ball to be initially positioned at the<br />

origin of the coordinate system, the initial conditions are then entered.<br />

> ic:=x(0)=0,D(x)(0)=Vo[1],y(0)=0,D(y)(0)=Vo[2]:<br />

Jennifer wishes to compare the path followed by the ball when both drag and<br />

lift are included with the trajectory that results when both contributions are<br />

absent. So in the following do loop, n = 2 corresponds to the former, while<br />

n = 1 produces the latter situation.<br />

> for n from 1 to 2 do<br />

For n = 1 in the following command line, Kdrag =0andKlift = 0, while n =2<br />

produces Kdrag = KDrag and Klift = KLift.<br />

> K[drag]:=(n-1)*KDrag: K[lift]:=(n-1)*KLift:<br />

The nonlinear ODEs xeq and yeq are solved numerically for x(t) andy(t),


4.2. SECOND-ORDER MODELS 183<br />

> sol:=dsolve(fxeq,yeq,icg,fx(t),y(t)g,type=numeric);<br />

and the odeplot command used to plot the trajectory of the ball. The time<br />

interval for the golf ball to strike the ground again is di®erent for the two<br />

trajectories. Without drag and lift, the time interval is about 3:42 s, while<br />

the time interval lengthens to about 7 s when these contributions are both<br />

included. Jennifer allows for this in the following command line. The linestyle<br />

option, linestyle=3-n, isusedtoproduceasolidcurveforthesituationthat<br />

both lift and drag are included (n = 2), and a dashed line when they are not.<br />

> pl[n]:=odeplot(sol,[x(t),y(t)],0..3.42+3.6*(n-1),<br />

labels=["x","y"],linestyle=3-n,thickness=2):<br />

> end do:<br />

On ending the do loop, Jennifer muses about what usually happens when she<br />

goes gol¯ng. Invariably, she ends up in the rough, in a sand trap, or has to<br />

shoot over a tree. So in her simulation, she places a thick brown \tree" 30<br />

meters high at a distance of 120 meters from where the ball is struck.<br />

> tree:=plot([[120,0],[120,30]],color=brown,thickness=3):<br />

Thetwopossibletrajectoriesaresuperimposedwiththetreeplottoproduce<br />

> display([seq(pl[i],i=1..2),tree],scaling=constrained);<br />

y<br />

30<br />

20<br />

10<br />

0<br />

100 x 200<br />

Figure 4.10: Solid curve: drag and lift included. Dashed curve: no drag or lift.<br />

Figure 4.10. Jennifer notes a number of important di®erences between the two<br />

trajectories. Despite the e®ect of drag, her simulation indicates that a golf ball<br />

in the real world rises higher (thus, clearing the \tree" here) and consequently<br />

travels farther because of the lift on the golf ball due to backspin. This is not<br />

too surprising, since the ball stays in the air about twice as long as when both<br />

drag and lift are neglected. She further notices that the ball's path actually<br />

bends upward before reaching the zenith of its trajectory, a phenomenon that<br />

she has seen on the golf course, especially when the club pro is playing. In<br />

her model calculation the ball has traveled about 203 m (222 yards), hardly a<br />

long shot by the standards of someone like Tiger Woods, who averages about<br />

300 yards a drive. However, she is con¯dent that she could modify the initial<br />

conditions to mimic one of Tiger's shots. Undoubtedly Heather, who is a big<br />

Tiger Woods fan, will ask her to do it when she learns about the simulation.


184 CHAPTER 4. NONLINEAR ODE MODELS<br />

As much fun as she has had, Jennifer suddenly realizes that she had better<br />

spend a little time hitting balls down at the local driving range before she goes<br />

out with Heather and her friends. Otherwise, she might end up proving to be<br />

an embarrassment to her sister. Now where did she put those golf clubs?<br />

PROBLEMS:<br />

Problem 4-29: The Bo®o brothers go gol¯ng<br />

Syd and Benny Bo®o have taken an afternoon o® from their realty business<br />

and gone gol¯ng at the Metropolis Country Club. After a good approach shot<br />

on a level fairway, Benny Bo®o has placed his golf ball 100 m from the hole.<br />

He selects a 9-iron and hits the ball perfectly, landing practically at the hole.<br />

If both lift and drag are included and all other parameters of the text recipe<br />

prevail, at what angle to the horizontal (in degrees) was the ball hit? How high<br />

did the ball rise?<br />

Problem 4-30: Syd Bo®o makes a hole in one<br />

Syd and Benny Bo®o's golf match continues and they move onto the next hole,<br />

a par 3. The tee-o® point is elevated 20 m above the hole, the ball having to<br />

travel over an intervening lily pond. The horizontal distance from the tee-o®<br />

position to the hole is 160 m. Syd miraculously scores a hole in one, which<br />

means that drinks are on him at the clubhouse after the match. Assuming<br />

that both lift and drag are included and all other parameters of the text recipe<br />

prevail, at what angle did Syd's ball ascend in order for him to make the hole<br />

in one? How high did the ball rise relative to the hole? If the green is circular<br />

(radius 5 m) with the hole at its center, and the pond stretches up to the edge of<br />

the green, would the ball have ended up in the pond if lift had been neglected?<br />

Or would the ball have overshot the green?<br />

Problem 4-31: Rocky Mountain high<br />

At a Rocky Mountain golf resort, the elevation is such that the density of air is<br />

½ =1:0 kg/m3and g =9:8 m/s2 .Howmuchfartherwouldtheballtravelthan<br />

for the sea-level data given in the text recipe?<br />

Problem 4-32: Horizontal drive<br />

A golf ball that has been teed up 3 cm above the ground is hit badly and leaves<br />

the tee horizontally. Including lift and drag and taking all other parameters as<br />

in the text recipe, plot the trajectory of the ball and determine where it strikes<br />

the ground, assuming that the fairway is level. How does the distance compare<br />

to the situation in which there is no lift?<br />

Problem 4-33: Vertical shot<br />

As part of its testing routine, a golf ball manufacturing company tests the<br />

performance of one of its golf balls by shooting it vertically into the air with<br />

the same spin and other parameters as in the text recipe. If lift and drag are<br />

included, where would the golf ball land?


4.3. VARIATIONAL CALCULUS MODELS 185<br />

4.3 Variational Calculus Models<br />

The models in this section are based on the following mathematical framework<br />

developed by the mathematicians Euler and Lagrange. Consider a function<br />

y(x) with¯xedvaluesy(x0) =y0 and y(x1) =y1 at two distinct points A and<br />

B, respectively. Form a speci¯c function F of x, y(x) andy 0 ´ dy(x)=dx, i.e.,<br />

F = F (x; y; y 0 ). In our examples, F will be determined by the speci¯cation of<br />

the problem. Among all functions y(x) connectingA and B, ¯ndthosethat<br />

give an extremum (minimum or maximum, usually) to the integral<br />

I[ y ]=<br />

Z x1<br />

x0<br />

F (x; y(x);y 0 (x)) dx: (4.13)<br />

The value I of the integral depends on the functional form chosen for y(x).<br />

Rather than trying di®erent y(x) ad in¯nitum, it turns out that the y(x) that<br />

yields an extremum value for I must satisfy the Euler{Lagrange equation [FC99]<br />

μ<br />

@F d @F<br />

¡<br />

@y dx @y 0<br />

<br />

=0: (4.14)<br />

The resulting ODE is often nonlinear in nature, but may be susceptible to<br />

analytic solution. If not, it can be solved numerically.<br />

4.3.1 Dress Design, the Erehwonese Way<br />

Haute Couture should be fun, foolish and almost unwearable.<br />

Christian Lacroix, French couturier (1951{)<br />

On the planet Erehwon the leading dress designer, Gino Spoo¯a, has created a<br />

new design, called the lampshade look, 4 as shown in Figure 4.11, to accommo-<br />

Figure 4.11: The lampshade look in dress design.<br />

4 The supporting straps are not displayed.<br />

x<br />

y


186 CHAPTER 4. NONLINEAR ODE MODELS<br />

date the shapes of its most beautiful (by Erehwon standards) female citizens.<br />

Being an amateur scientist on the side and also to keep down material cost, he<br />

wantsthesurfaceareaofclothintheone-piecedresstobeaminimum. The<br />

smaller upper ring at x = 0 is of radius y = 1 sretem (the local unit of length),<br />

and the lower, larger, ring at x = 1 sretem is of radius y = 2 sretem. To answer<br />

the question of what the shape of the surface should be to minimize the area,<br />

Gino consults one of Erehwon's most prominent mathematicians, Greg Arious<br />

Nerd, who says that this problem was solved many millennia ago. Greg then<br />

proceeds to outline the solution to the problem for his dress-designing friend.<br />

For the bene¯t of readers who may not understand the peculiar Northern ErehwonesedialectspokenbyGreg,weshalltranslatewhathehastosay.<br />

The<br />

authors are not totally °uent in this language, so bear with us if we occasionally<br />

are in doubt about the exact words and thus resort to paraphrasing what Greg<br />

says instead of reporting his remarks verbatim.<br />

\It's all very simple," Greg starts out. \The surface area of the dress can be<br />

generated by revolving the curve y(x) aboutthex-axis. So what 5 is the shape<br />

of y(x)?<br />

ds<br />

y<br />

y(x)<br />

Figure 4.12: Determining the surface area of the dress.<br />

Referring to Figure 4.12, an element dA of surface area is given by<br />

dA =(2¼y) ds =2¼y p (dx) 2 +(dy) 2 =2¼y p 1+(y 0 ) 2 dx; (4.15)<br />

where the prime indicates a derivative with respect to x. So the surface area<br />

between x =0andx =1is<br />

A =2¼<br />

Z 1<br />

0<br />

y p 1+(y 0 ) 2 dx: (4.16)<br />

5Author's note: This appears to be a rhetorical question on Greg's part, since Gino hasn't<br />

opened his mouth yet.<br />

x


4.3. VARIATIONAL CALCULUS MODELS 187<br />

The goal is to ¯nd the shape y(x) that minimizes A."<br />

\I know that, Greg," Gino interjects, \but get to the point. As my business<br />

associates from Earth say, time is money. What is the bottom line? How many<br />

square sretem of cloth will I need?"<br />

A little perturbed by this sign of impatience, Greg's dialect has become<br />

stronger and his response is di±cult for us to precisely translate, but the gist of<br />

it goes something like this. Long ago, some ancestors on his mother's side had<br />

adopted a trial-and-error approach to ¯nding y(x). This consisted in choosing<br />

some form for y(x) and performing the integration to calculate A. Then the<br />

venerable ancestors would choose another form and see whether it generated a<br />

smaller value for A. With a touch of hyperbole, we think, Greg said that some<br />

kept repeating this process until either they became residents in the Erehwon<br />

asylum or inductees into the Erehwon Academy of Mathematics. According<br />

to his unbiased (?) version of history, a better approach was discovered long<br />

ago by one of Greg's illustrious ancestors on his father's side, Hil Arious Nerd.<br />

Evidently, Hil independently discovered the same method as developed by Euler<br />

and Lagrange on far-distant Earth. The method is as follows.<br />

Label the integrand of the area integral as F , i.e., F =2¼y p 1+(y0 ) 2 .<br />

The curve y(x) that minimizes the area is the solution of the Euler{Lagrange<br />

equation(knownastheNerdequationonErehwon)<br />

@F d @F<br />

¡ =0: (4.17)<br />

@y dx @y 0<br />

Solving this type of problem by hand has been a standard assignment given in<br />

the past by perverse professors on Erehwon6 to their students.<br />

It appears that Greg has calmed down so that we can understand him better,<br />

so let's pick up Greg's detailed narrative once again.<br />

\It'snowfrownedupontoin°ictmentalpainonstudents(anddressdesigners)<br />

by performing hand calculations when computers can do all the algebra for<br />

you with no errors. At the Erehwon Institute of Technology we use the Elpam<br />

computer algebra system, so let's use it to crack your problem.<br />

I will begin by loading the VariationalCalculus library package which contains<br />

the EulerLagrange command for generating the left-hand side of the<br />

Euler{Lagrange (Nerd) equation (4.17).<br />

> restart: with(VariationalCalculus):<br />

Next let's enter the integrand, F = y(x) p 1+(dy(x)=dx) 2 ,omittingthefactor<br />

of 2 ¼, which would ultimately cancel out of the equation,<br />

> F:=y(x)*sqrt(1+diff(y(x),x)^2);<br />

s<br />

μ<br />

d<br />

F := y(x) 1+<br />

dx y(x)<br />

2<br />

The EulerLagrange command is applied to F , the second argument (x) being<br />

the independent variable, the third argument the dependent variable. The<br />

result is then simpli¯ed.<br />

6 Author's note: This quaint, but archaic, custom is still widely practiced on Earth.


188 CHAPTER 4. NONLINEAR ODE MODELS<br />

> eq:=simplify(EulerLagrange(F,x,y(x)));<br />

8<br />

><<br />

y(x)<br />

eq := s<br />

μ<br />

d<br />

>: 1+<br />

dx y(x)<br />

μ<br />

d<br />

1+<br />

dx<br />

<br />

= K1;<br />

2 y(x)<br />

2 μ <br />

2 d<br />

¡ y(x) y(x)<br />

dx2 Ã μ<br />

d<br />

1+<br />

dx y(x)<br />

9<br />

>=<br />

!<br />

2<br />

(3=2)<br />

>;<br />

Two results are generated in eq. The expression not involving the constant K1<br />

is just the lhs of the Euler{Lagrange equation. It can be extracted using the<br />

remove command to remove the expression containing K1 from eq.Inclusionof<br />

the brackets at the end of the command line removes the brackets that would<br />

otherwise enclose the following answer.<br />

> eq2:=remove(has,eq,K[1])[];<br />

μ<br />

d<br />

1+<br />

dx<br />

eq2 :=<br />

y(x)<br />

2 μ <br />

2 d<br />

¡ y(x) y(x)<br />

dx2 Ã μ<br />

d<br />

1+<br />

dx y(x)<br />

!<br />

2<br />

(3=2)<br />

The relevant governing nonlinear ODE that must be solved for y(x) follows on<br />

setting the numerator of eq2 equal to zero. This ODE would have been tedious<br />

to derive by hand.<br />

> ode:=numer(eq2)=0; #relevant ODE<br />

μ<br />

d<br />

ode := 1 +<br />

dx y(x)<br />

2 μ <br />

2 d<br />

¡ y(x) y(x) =0<br />

dx2 If proceeding by hand, one could reduce the second-order ode to a ¯rst-order<br />

ODE by setting p = dy=dx, sothatd2y=dx2 = dp=dx =(dy=dx)(dp=dy) =<br />

p (dp=dy). The variables can then be separated and the integrations performed,<br />

yielding p ´ dy=dx with one arbitrary constant. But this ¯rst integral is already<br />

contained in eq, being the term involving the constant K1. This ¯rst integral<br />

can be extracted from eq using the following select command:<br />

> eq3:=select(has,eq,K[1])[]; #first integral<br />

y(x)<br />

eq3 := s<br />

μ<br />

d<br />

1+<br />

dx y(x)<br />

<br />

= K1<br />

2<br />

The ¯rst-order ODE eq3 is solved for y(x), a second constant C1 appearing in<br />

the solution, which contains two equivalent answers (not displayed).<br />

> sol:=dsolve(eq3,y(x));<br />

I will select the ¯rst answer in sol and simplify the rhs of the result.<br />

> y:=simplify(rhs(sol[1]));<br />

y := 1<br />

2 (K1 2 2(x¡ C1) x¡ C1<br />

( ) (¡ )<br />

+ e K1 ) e K1


4.3. VARIATIONAL CALCULUS MODELS 189<br />

We now have the general curve y that will minimize the area, but we have to<br />

determine the two constants K1 and C1 . Evaluating y at x = 0 and setting<br />

the result to 1 yields the ¯rst boundary condition, while evaluating y at x =1<br />

and setting the result to 2 yields the second one. The two boundary conditions<br />

are then solved numerically for K1 and C1 and the solution is assigned.<br />

> bc1:=eval(y,x=0)=1: bc2:=eval(y,x=1)=2:<br />

> sol2:=fsolve(fbc1,bc2g,fK[1],_C1g); assign(sol2):<br />

sol2 := fK1 =0:9499888273; C1 = ¡0:2581775581g<br />

On expanding and simplifying, y is now completely determined,<br />

> y:=simplify(expand(y));<br />

y := 0:3438580549 e (¡1:052643959 x) (1:052643959 x)<br />

+0:6561419450 e<br />

and can be plotted, the vertical view being controlled."<br />

> plot(y,x=0..1,view=[0..1,0..2.5],tickmarks=[4,4]);<br />

2.5<br />

2<br />

1.5<br />

1<br />

0.5<br />

0<br />

0.2 0.4 x 0.8 1<br />

Figure 4.13: The curve y(x) that minimizes the surface area of the dress.<br />

\That's O.K., Greg," Gino interrupts, \but a 3-dimensional picture of the dress<br />

would be nicer, and more importantly, what is the minimum surface area?"<br />

\Since you're getting impatient, let's load the Student[Calculus1] package,<br />

> with(Student[Calculus1]):<br />

and use the SurfaceOfRevolution command to obtain the minimum area A.<br />

> A:=evalf(SurfaceOfRevolution(y,x=0..1));<br />

A := 13:06167468<br />

The minimum surface area of your lampshade dress is about 13 square sretem.<br />

Using the same command, but with the option output=plot included,<br />

> SurfaceOfRevolution(y,x=0..1,output=plot);<br />

will yield the desired surface of revolution, i.e., your \dress," with the form of<br />

y(x) included. The dress will be oriented horizontally on the computer screen<br />

but can be `dragged' into a vertical position."


190 CHAPTER 4. NONLINEAR ODE MODELS<br />

PROBLEMS:<br />

Problem 4-34: Other curves<br />

Calculate the surface areas for dresses generated with some other curves y(x)<br />

joining the endpoints (x = 0, y = 1) and (x = 1, y = 2). How do these<br />

areas compare with the area obtained in the text recipe? Plot the surfaces of<br />

revolution generated by the curves.<br />

Problem 4-35: Brachistochrone<br />

Consider the smooth curve y(x) joining the two points A and B in Figure 4.14.<br />

A<br />

y<br />

bead<br />

x<br />

B<br />

(x ,y)<br />

0 0<br />

Figure 4.14: Brachistochrone problem.<br />

(a) If a small bead slides without friction between A and B, whaty(x) corresponds<br />

to the shortest time? This famous brachistochrone (\shortest<br />

time" in Greek) problem was proposed and solved by Jakob and Johann<br />

Bernoulli. Hint: First show that the time is given by<br />

t =<br />

Z x0<br />

0<br />

p (1+(y 0 ) 2 )=(2 gy) dx;<br />

where g is the acceleration due to gravity.<br />

(b) Let the coordinates of B be x0 =0:5 m,y0 =0:5 mfortheremainderof<br />

this problem. What is the shortest time for the bead to slide from point<br />

A at the origin to point B?<br />

(c) Plot the path of the bead from A to B.<br />

(d) What is the speed of the bead when half the shortest time has elapsed?<br />

(e) What is the position of the bead at this latter time?<br />

Problem 4-36: Fermat's principle and mirages<br />

Fermat's principle states that a ray of light in a medium with a variable refractive<br />

index will follow the path that requires the shortest traveling time. For<br />

a two-dimensional situation, write down the integral that must be minimized<br />

to obtain such a path. Note that the speed of light in a medium of refractive<br />

index n is c=n, wherec is the vacuum speed of light. If the refractive index<br />

varies vertically from ground level according to the formula n = n0 (1 + ®y),<br />

with n0 > 0and®>0, determine the equation for the path taken by a light


4.3. VARIATIONAL CALCULUS MODELS 191<br />

ray. By plotting a light ray path for physically reasonable parameter values,<br />

discuss how your answer may be related to the phenomenon of mirages.<br />

Problem 4-37: A di®erent refractive index<br />

Making use of Fermat's principle, prove that a light ray will follow a semicircular<br />

path in a medium whose refractive index n(x; y) equals1=y. Plot a typical path.<br />

Problem 4-38: Geodesic<br />

The geodesic between two points is the curve that gives the shortest distance.<br />

Show that the geodesics on the surface of a sphere are the arcs of great circles.<br />

(A great circle is a curve resulting from the intersection of a sphere with a plane<br />

passing through the center of that sphere.) Create a three-dimensional plot of<br />

the geodesic between New York City and Sydney, Australia, assuming that the<br />

Earth is spherical. You will have to look up the necessary parameter values.<br />

4.3.2 Queen Dido Wasn't a Dodo<br />

Mathematics is the queen of the sciences.<br />

Carl Friedrich Gauss, German mathematician (1777{1855)<br />

According to the Aeneid, written by the Roman poet Virgil in the ¯rst century<br />

BC, the Phoenician Queen Dido was able to convince the North African<br />

ruler King Jambas to give her as much land as she could enclose with an oxhide.<br />

Being rather clever, she had the hide cut into very thin strips, the ends<br />

stitched together, and was able to stake out a sizable area along the Mediterranean<br />

coast on which she built the city of Carthage (now Tunis). Queen Dido's<br />

problem was to lay out the joined oxhide strips that had a total ¯xed length in<br />

such a way as to maximize the area enclosed. Can you suggest what shape the<br />

perimeter traced out by the joined strips might take? Problems of this type<br />

that involve maximizing an area enclosed by a perimeter of ¯xed length are<br />

called isoperimetric (constant perimeter) problems.<br />

A recipe is now given to solve Queen Dido's problem. A strip of oxhide of<br />

¯xed length L>ais connected at its ends to the points (x =0,y =0)and<br />

(x = a, y = 0). The area enclosed by a strip of shape y(x) andthex-axis<br />

between x =0andx = a is A = R a<br />

y(x) dx and the length of the strip is given<br />

by L = R a<br />

p 0<br />

1+(y0 ) 2 7 dx: If, say, a = 1 milion and L =1:5 milion, what is<br />

0<br />

the shape y(x) that maximizes the area subject to the length constraint? Plot<br />

y(x) and determine the value of the maximum area.<br />

If the integrands of A and L are labeled as F and G, respectively, the shape<br />

y(x) may be found by solving the Euler{Lagrange equation of the previous<br />

subsection with F replaced by FF = F + ¸G,where¸ is an undetermined<br />

parameter. See, e.g., references [MW71] and [Boa83].<br />

The VariationalCalculus package is loaded,<br />

> restart: with(VariationalCalculus):<br />

7 A milion is a Roman mile, so this recipe involve one very big oxhide!


192 CHAPTER 4. NONLINEAR ODE MODELS<br />

and the integrands F and G are entered.<br />

> F:=y(x); G:=sqrt(1+diff(y(x),x)^2);<br />

s<br />

μ<br />

d<br />

F := y(x) G := 1+<br />

dx y(x)<br />

2<br />

Then FF = F + ¸G is formed.<br />

> FF:=F+lambda*G;<br />

s<br />

μ<br />

d<br />

FF := y(x)+¸ 1+<br />

dx y(x)<br />

2<br />

The EulerLagrange commandisappliedtoFF .<br />

> eq:=EulerLagrange(FF,x,y(x));<br />

8<br />

μ<br />

d<br />

>< ¸<br />

dx<br />

eq := 1+<br />

>:<br />

y(x)<br />

2 μ <br />

2 d<br />

y(x)<br />

dx2 Ã μ<br />

d<br />

1+<br />

dx y(x)<br />

μ <br />

2 d<br />

¸ y(x)<br />

dx2 ! ¡ s<br />

2<br />

(3=2) μ<br />

d<br />

1+<br />

dx y(x)<br />

<br />

;<br />

2<br />

s<br />

μ<br />

d<br />

y(x)+¸ 1+<br />

dx y(x)<br />

μ<br />

d<br />

2<br />

dx<br />

¡<br />

y(x)<br />

2<br />

¸<br />

s<br />

μ<br />

d<br />

1+<br />

dx y(x)<br />

9<br />

>=<br />

<br />

= K1<br />

2<br />

>;<br />

The ¯rst integral is extracted from eq by selecting the term that has K1 in it,<br />

and removing the brackets that would otherwise appear in ode.<br />

> ode:=select(has,eq,K[1])[];<br />

s<br />

μ<br />

d<br />

ode := y(x)+¸ 1+<br />

dx y(x)<br />

μ<br />

d<br />

2<br />

dx<br />

¡<br />

y(x)<br />

2<br />

¸<br />

s<br />

μ<br />

d<br />

1+<br />

dx y(x)<br />

<br />

= K1<br />

2<br />

A general analytic solution to the ¯rst-order nonlinear ode is sought, yielding<br />

two answers that di®er by the sign in front of the square root.<br />

> sol:=dsolve(ode,y(x));<br />

p<br />

sol := y(x) =K1 + ¸2 ¡ C1 2 ¡ x2 +2x C1 ;<br />

p<br />

y(x) =K1 ¡ ¸2 ¡ C1 2 ¡ x2 +2x C1<br />

The rhs of, say, the negative square root result (second one) is chosen.<br />

> Y:=rhs(sol[2]);<br />

p<br />

Y := K1 ¡ ¸2 ¡ C1 2 ¡ x2 +2x C1


4.3. VARIATIONAL CALCULUS MODELS 193<br />

The boundary conditions that Y =0atx =0andatx = a are imposed in bc1<br />

and bc2 , which are then solved for K1 and C1 insol2 .<br />

> bc1:=eval(Y,x=0)=0; bc2:=eval(Y,x=a)=0;<br />

p<br />

bc1 := K1 ¡ ¸2 ¡ C1 2 =0<br />

p<br />

bc2 := K1 ¡ ¸2 ¡ C1 2 ¡ a2 +2a C1 =0<br />

> sol2:=solve(fbc1,bc2g,fK[1],_C1g);<br />

sol2 := f C1 = a<br />

2 ;K1<br />

p<br />

4 ¸2 ¡ a2 =<br />

g<br />

2<br />

Assigning sol2 ,weobtainYin the following form.<br />

> assign(sol2): Y:=Y;<br />

p r<br />

4 ¸2 ¡ a2 Y :=<br />

¡ ¸<br />

2<br />

2 ¡ 1<br />

4 a2 ¡ x2 + xa<br />

To determine ¸, the constraint condition R a<br />

G(y(x) =Y ) dx = L is imposed.<br />

0<br />

> eq2:=simplify(int(eval(G,y(x)=Y),x=0..a))=L;<br />

r<br />

¸<br />

eq2 := ¡<br />

2<br />

¡4 ¸2 + a2 p p<br />

¡4 ¸2 + a2 (¡ln(¡a + ¡4 ¸2 + a2 )<br />

+ln(a + p ¡4 ¸2 + a2 )) = L<br />

The values a =1andL =1:5 are entered, and eq2 numerically solved for ¸,<br />

the search range ¸ =0to0:6being speci¯ed.<br />

> a:=1: L:=1.5: lambda:=fsolve(eq2,lambda=0..0.6);<br />

¸ := 0:5014101096<br />

The ¯nal form of Y is then displayed, and jY j plotted in Figure 4.15.<br />

> Y:=Y; plot(abs(Y),x=0..a,scaling=constrained);<br />

Y := 0:03757789244 ¡ p 0:0014120980 ¡ x2 + x<br />

0.4<br />

0.3<br />

0.2<br />

0.1<br />

0<br />

0.2 0.4 0.6 0.8 1<br />

x<br />

Figure 4.15: Shape of the oxhide strip that maximizes the enclosed area.


194 CHAPTER 4. NONLINEAR ODE MODELS<br />

TheabsolutevalueofY was plotted, because in some executions of the work<br />

sheet Y will be negative because the ordering of the answers in sol is reversed.<br />

The shape of the strip that maximizes the area is a circular arc.<br />

The area R a<br />

Ydxis now calculated, the absolute value being taken to avoid<br />

0<br />

a possible negative area if the \wrong" solution is selected in sol.<br />

> A:=abs(int(Y,x=0..a));<br />

A := 0:3572686358<br />

The maximum area is about 0:36 square milions. Without doing any mathematical<br />

calculation, can you suggest why this is a maximum and not a minimum?<br />

PROBLEMS:<br />

Problem 4-39: Maximum volume of a solid<br />

Acurvey(x) of length 2 is drawn between the points (0, 0) and (1, 0) in such<br />

a way that the solid obtained by rotating the curve about the x-axis has the<br />

largest possible volume.<br />

(a) Determine y(x).<br />

(b) Plot y(x) over the range x =0to1.<br />

(c) What is the value of y at x =0:5?<br />

(d) Make a three-dimensional plot of the solid.<br />

(e) What is the volume of the solid?<br />

Problem 4-40: The catenary curve<br />

Consider a uniform cable of length L =1:5 km and mass per unit length ² =1<br />

kg/m suspended between the two endpoints (¡a=2, b) and(a=2, b), where<br />

a = b =1km.<br />

(a) Determine the equilibrium shape (referred to as a catenary curve) of the<br />

cable. Hint: The potential energy of the cable will be at a minimum when<br />

the cable has its equilibrium shape. Take g =10m/s2 .<br />

(b) Plot the equilibrium shape of the cable.<br />

(c) If the cable crosses a very deep Himalayan gorge with the river located a<br />

distance b below the endpoints of the cable, what is the distance between<br />

the minimum in the cable and the river?<br />

(d) What is the distance down to the river from a point one-third of the way<br />

along the cable?<br />

(e) What force is exerted on the supports at the endpoints of the cable?<br />

(f) What length of cable should be used if the sag in the middle of the cable<br />

is not to exceed 50 m?


4.3. VARIATIONAL CALCULUS MODELS 195<br />

4.3.3 The Human Fly Plans His Escape Route<br />

A product of the untalented, sold by the unprincipled<br />

to the utterly bewildered.<br />

Al Capp, American cartoonist, comment on abstract art (1907{1979)<br />

Mr. X, whom the popular press have dubbed the \human °y," plans to scale the<br />

outside vertical wall of one of Metropolis's tallest skyscrapers, the Metropolis<br />

Stock Exchange, using a combination of his rock-climbing skills and suction<br />

cups. Knowing that once the climb has begun, the police will quickly learn of<br />

his exploit and try to capture him, Mr. X plans to execute a daring escape.<br />

He intends to evade the law enforcement o±cers by sliding down a thin, but<br />

strong, wire to a yet-undetermined window at a lower elevation in the slanted<br />

roof of the Museum of Modern Art directly across the street (see Figure 4.16).<br />

The window will be left open so that Mr. X can zoom through to the room in-<br />

y<br />

Figure 4.16: Mr. X sliding down wire with a police helicopter hovering nearby.<br />

side, brake rapidly, and make a (hopefully) relatively soft landing on the °oor.<br />

Catching the police by surprise and taking advantage of the museum's many<br />

exits, Mr. X hopes once again to avoid capture and expand his ever-growing<br />

legend. However, being somewhat cautious, despite an otherwise harebrained<br />

scheme, Mr. X decides to check the details of the escape route by conferring<br />

with his mathematician friend Mike.<br />

\Mike, the roof of the stock exchange is slightly over 200 meters above<br />

street level and the police will surely be waiting for me on the rooftop and in<br />

the street below. They will probably even have a police helicopter hovering<br />

nearby. If I were to connect a wire to the stock exchange outer wall at the 200<br />

meter point, what shape should the wire have, and what point on the slanting<br />

x


196 CHAPTER 4. NONLINEAR ODE MODELS<br />

museum surface should it be connected to, in order to minimize the time of<br />

descent? What is the time of descent and what speed would I have acquired<br />

on reaching the slanted museum roof? Fortunately, the museum roof has many<br />

windows to let in light and I could arrange for the appropriate window to be<br />

left open. A few relevant facts are as follows. The museum roof slants at 45 ±<br />

to the horizontal. The street is 50 meters wide, and the vertical section of the<br />

museum wall adjoining the slanted roof is 50 meters tall."<br />

\You're crazy," Mike replies, \but you do pose an interesting mathematical<br />

problem. I can tackle the solution using the Euler{Lagrange equation. Referring<br />

to Figure 4.16, let's choose to measure x to the right and y downward from the<br />

point at which the wire is attached to the stock exchange building. We need<br />

to ¯nd a general expression for the time of descent along the wire. Let the<br />

equation of the wire be y(x). Neglecting friction and equating the increase<br />

in kinetic energy of a falling mass to its decrease in potential energy yields a<br />

speed v = p 2 gy,wheregistheacceleration due to gravity. But v = ds=dt,<br />

where ds = p 1+(dy=dx) 2 dx is an element of arc length along the wire. If the<br />

(unknown) coordinates of the contact point on the museum roof are (x1 , y1 ),<br />

the time of descent will be given by<br />

Z p<br />

x1<br />

1+(dy=dx) 2<br />

T = p dx:<br />

0 2 gy<br />

Since the factor p 2 g will cancel out, the integrand to use in the Euler{Lagrange<br />

equation can be taken to be<br />

F =( p 1+(dy=dx) 2 )= p y:<br />

I will now use Maple to solve the problem. Loading the necessary library<br />

packages, I enter the integrand F .<br />

> restart: with(VariationalCalculus): with(plots):<br />

> F:=sqrt((1+diff(y(x),x)^2)/y(x));<br />

v<br />

u<br />

t<br />

F :=<br />

1+<br />

μ<br />

d<br />

dx y(x)<br />

2<br />

y(x)<br />

The EulerLagrange command is applied to F , and the ¯rst integral result, involving<br />

the constant K1, is selected from the output (not shown) and simpli¯ed<br />

in ode.<br />

> EL:=EulerLagrange(F,x,y(x));<br />

> ode:=simplify(select(has,EL,K[1])[]);<br />

1<br />

ode := v<br />

u<br />

t 1+<br />

μ<br />

d<br />

dx y(x)<br />

= K1<br />

2<br />

y(x)<br />

y(x)<br />

A general solution to the ¯rst-order nonlinear ode is sought.


4.3. VARIATIONAL CALCULUS MODELS 197<br />

> sol:=dsolve(ode,y(x)); #implicit solution<br />

q<br />

y(x) ¡ K1<br />

sol := x +<br />

2 y(x) 2<br />

¡<br />

K1<br />

1<br />

0p<br />

K1 B<br />

arctanB<br />

@<br />

2<br />

2<br />

μ<br />

y(x) ¡ 1 1<br />

2 K1 2<br />

<br />

q<br />

y(x) ¡ K1 2 y(x) 2<br />

1<br />

C<br />

A<br />

p<br />

K1 K1 2<br />

¡ C1 =0;<br />

q<br />

y(x) ¡ K1<br />

x ¡<br />

2 y(x) 2 0p<br />

K1 B<br />

arctan B<br />

@<br />

+ 1<br />

K1 2<br />

2<br />

μ<br />

y(x) ¡ 1 1<br />

2 K1 2<br />

<br />

q<br />

y(x) ¡ K1 2 y(x) 2<br />

1<br />

C<br />

A<br />

p<br />

K1 K1 2<br />

¡ C1 =0<br />

A formidable-looking implicit solution has been produced, with two forms<br />

present. It turns out that we must select the form having the positive square<br />

root (the ¯rst solution for this particular run). For later convenience, I will also<br />

replace the awkward constant symbols K1 and C1 with1= p A and B.<br />

> ans:=subs(fK[1]=1/sqrt(A),_C1=Bg,sol[1]); #select + root<br />

ans := x + p r<br />

A y(x) ¡ y(x)2<br />

0r<br />

1 A<br />

p B (y(x) ¡<br />

A arctan B A 2<br />

@<br />

1<br />

¡<br />

A 2<br />

)<br />

r<br />

y(x) ¡ y(x)2<br />

1<br />

C<br />

A<br />

r<br />

A<br />

¡ B =0<br />

1<br />

A<br />

To proceed any further with the implicit answer, its square-root structure suggests<br />

a trigonometric substitution of the form y = A sin 2 μ,whereμisan angular<br />

parameter not connected to any geometrical feature in our picture. Here A and<br />

B are assumed to be positive, as are sinμ and cos μ as well.<br />

> assume(A>0,B>0,sin(theta)>0,cos(theta)>0):<br />

> Y:=y(x)=A*sin(theta)^2;<br />

Y := y(x) =A sin(μ) 2<br />

Then Y is substituted into the answer, and simpli¯ed with the trig option.<br />

> sol1:=simplify(subs(Y,ans),trig);<br />

sol1 := x + A sin(μ)cos(μ)+ 1<br />

μ<br />

1 ¡1+2cos(μ)<br />

A arctan<br />

2 2<br />

2 <br />

¡ B =0<br />

sin(μ)cos(μ)<br />

Then we solve sol1 for x and combine with respect to trig terms.<br />

> x:=combine(solve(sol1,x),trig);<br />

x := ¡ 1<br />

μ <br />

1<br />

cos(2 μ)<br />

A sin(2 μ) ¡ A arctan<br />

+ B<br />

2 2 sin(2 μ)<br />

So, now we have expressions for the coordinates x and y of our sought-after<br />

curve in terms of A, B, andμ. If A and B can be found and the range of μ


198 CHAPTER 4. NONLINEAR ODE MODELS<br />

determined, the curve that minimizes the time of descent will be known.<br />

At the starting point x = 0, we shall choose to set the parameter μ equal<br />

to zero. Some care must be taken in evaluating the arctan term at μ =0. The<br />

limit must be taken from the positive side (i.e., from the \right") of μ =0.<br />

> eq:=limit(x,theta=0,right)=0;<br />

eq := B ¡ A¼<br />

4 =0<br />

The resulting eq is easily solved for the constant B.<br />

> sol2:=B=solve(eq,B);<br />

sol2 := B = A¼<br />

4<br />

The solution sol2 is assigned and x displayed.<br />

> assign(sol2); x:=x;<br />

x := ¡ 1<br />

μ <br />

1<br />

cos(2 μ)<br />

A sin(2 μ) ¡ A arctan<br />

+<br />

2 2 sin(2 μ)<br />

A¼<br />

4<br />

We still have to determine the constant A and the range of μ. Now it gets a bit<br />

tricky. Wehavenoideayetwhatthecoordinates(x1 ; y1 ) of the endpoint on<br />

the museum roof should be.<br />

Hand me that copy of Mathematical Methods in Physics [MW71]. Ah, here<br />

we go. The case in which one endpoint of the sought-after curve is ¯xed and<br />

the other endpoint is allowed to vary along a line g(x; y) = 0 is considered.<br />

It is shown that if the Euler{Lagrange function F is of the structure8 F =<br />

f(x; y) p 1+(y0 ) 2 ; which it is in our case, then the condition for determining<br />

the unknown endpoint is that the slope of y(x) must satisfy the condition y 0 =<br />

(@g=@y)=(@g=@x) atthatpoint. Butthisisjustamathematicalstatement<br />

that the curve y(x) of quickest descent must intersect the destination curve<br />

g(x; y) = 0 at right angles. Here the equation for the slanting museum roof is<br />

the straight line g(x; y) =y + x ¡ 200 = 0: But both @g=@y and @g=@x are<br />

equal to 1, so we have y 0 = 1 at the museum roof. Since the parameter μ has<br />

been introduced, the slope of y(x) mustbecalculatedintermsofμ.<br />

> slope:=simplify(diff(rhs(Y),theta)/diff(x,theta));<br />

slope := cos(μ)<br />

sin(μ)<br />

Setting the slope to 1, the value £ that the parameter μ must have at the<br />

museum roof is determined, assuming that μ is positive.<br />

> Theta:=solve(slope=1,theta) assuming theta>0;<br />

£:= ¼<br />

4<br />

8If F is not of this structure, the endpoint condition is more complicated, taking the form<br />

³<br />

0 @F<br />

F ¡ y<br />

@y 0<br />

´<br />

@g @F<br />

¡<br />

@y @y 0<br />

@g<br />

@x =0:


4.3. VARIATIONAL CALCULUS MODELS 199<br />

Evaluating x at μ =£mustyieldx1 ,<br />

> eq1:=x1=eval(x,theta=Theta);<br />

eq1 := x1 = ¡ 1 1<br />

A +<br />

2 4 A¼<br />

while evaluating the rhs of Y at μ =£mustyieldy1 .<br />

> eq2:=y1=eval(rhs(Y),theta=Theta);<br />

eq2 := y1 = A<br />

2<br />

Finally, the straight-line equation for the museum roof at (x1; y1 )isentered,<br />

> eq3:=x1+y1=200;<br />

eq3 := x1 + y1 =200<br />

and the three equations solved for A, x1, andy1 .<br />

> sol3:=fsolve(feq1,eq2,eq3g,fA,x1,y1g); assign(sol3):<br />

sol3 := fA =254:6479090; y1 =127:3239545; x1 =72:67604557g<br />

Thus, the endpoint of the wire on the museum roof has coordinates x1 ¼ 72:7,<br />

y1 ¼ 127:3. The endpoint is about 127 meters below the starting point on the<br />

stock exchange wall. I hope you realize, X, that this means that you will be<br />

dropping more than 40 stories as you slide along the wire!<br />

I will plot the curve (colored blue in graph gr1) of minimum descent to the<br />

museum roof (colored red in gr2).Thewireandroofarelabeledingr3.<br />

> gr1:=plot([x,-rhs(Y)+200,theta=0..Theta],color=blue):<br />

> gr2:=plot([[50,0],[50,50],[125,125]],color=red,thickness=2):<br />

> gr3:=textplot(f[40,140,"wire"],[100,85,"roof"]g):<br />

> display(fgr1,gr2,gr3g,scaling=constrained,tickmarks=[3,3]);<br />

200<br />

100<br />

0<br />

wire<br />

roof<br />

50 100<br />

Figure 4.17: Shape of wire that minimizes the descent time to the roof.


200 CHAPTER 4. NONLINEAR ODE MODELS<br />

OK, X, there's your curve shown in Figure 4.17. You can arrange for a window<br />

to be left open at the point where the curve intersects the museum roof.<br />

Now that we know the distance through which you will be dropping, we<br />

can easily calculate your velocity from the expression v = p 2 g y1. Takingthe<br />

gravitational acceleration to be g =9:81 m/s 2 ,<br />

> g:=9.81: vel:=sqrt(2*g*y1);<br />

vel := 49:98095625<br />

you will be traveling at almost 50 m/s as you pass through the window on<br />

the museum roof, if you haven't been braking. This is an upper bound on<br />

your speed, of course, because we have completely neglected friction and air<br />

resistance. I can see by the look on your face that you don't quite appreciate<br />

how fast this is. So, let me convert the velocity to kilometers per hour.<br />

> vel2:=convert(vel,units,m/s,km/h)*km/h;<br />

179:9314425 km<br />

vel2 :=<br />

h<br />

Your theoretical speed would be almost 180 km/hr but, as I said, in reality it<br />

would be somewhat less. The time of descent can now be calculated from<br />

Z £<br />

T =<br />

p<br />

(dx=dμ) 2 +(dy=dμ) 2<br />

dμ;<br />

2 gy(μ)<br />

viz:;<br />

μ=0<br />

> T:=int(sqrt(diff(x,theta)^2+diff(rhs(Y),theta)^2)<br />

/sqrt(2*g*rhs(Y)),theta=0..evalf(Theta));<br />

T := 5:659009626<br />

The minimum time of descent is about 5:7 seconds. Again, friction, air resistance,<br />

and any braking on your part would lengthen this time. Given the<br />

estimates that we have come up with, do you still want to go through with your<br />

bizarreescaperoute?"<br />

\Sure, Mike," Mr. X replies, \and I am counting on you to help attach the<br />

wire to the appropriate window in the museum roof and leave it open for me."<br />

\Oh no," Mike groans. \If I get caught, Vectoria's parents are sure to call<br />

o® our recently announced engagement."<br />

PROBLEMS:<br />

Problem 4-41: A di®erent escape route<br />

Determine Mr. X's escape route if the museum roof slanted at 30 ± to the horizontal,<br />

the street is 50 m wide, and the vertical section of the museum wall<br />

adjoining the slanted roof is 25 m tall. Make a plot similar to that in Figure<br />

4.17. How close to the edge of the roof would Mr. X land? What would be<br />

his speed at this point? Neglect friction and air resistance.<br />

Problem 4-42: In search of reality<br />

Suppose that Mr. X decides that sliding down a steel wire at nearly 180 km/hr<br />

is a little too insane even for his bizarre tastes. His friend Mike is unavailable for<br />

technical advice because he is busy with preparations for his upcoming wedding


4.3. VARIATIONAL CALCULUS MODELS 201<br />

to Vectoria. So Mr. X comes to you and asks what speed he would reach and<br />

how long would his slide take if air resistance and friction are included, the same<br />

wire shape being used. He tells you that his mass is about 60 kg. You may<br />

assume that the force due to air resistance is 0:5 v 2 newtons, where v is Mr. X's<br />

speed, and that the coe±cient of kinetic friction is about 0:6 (appropriate for<br />

steel on steel). Mr. X would also like to know the maximum speed and trip time<br />

if a braking action is applied. You may assume that the brakes exert a force of<br />

400 newtons on the wire. Hint: You may ¯nd that using a do loop to compute<br />

the tangential velocity and position of Mr. X at discrete time intervals is the<br />

easiest way to attack this problem.<br />

4.3.4 This Would Be a Great Amusement Park Ride<br />

To gyre is to go around and round like a gyroscope.<br />

To gimble is to make holes like a gimlet.<br />

Lewis Carroll, English writer and mathematician (1832{1898)<br />

Consider the following possible amusement park ride consisting of a small cage<br />

of mass m (including the screaming victims inside) being swung around at the<br />

end of a light, but strong, connecting arm of ¯xed radius r as in Figure 4.18.<br />

The cage can trace out various spherical surface trajectories depending on the<br />

y<br />

z<br />

θ<br />

Figure 4.18: Con¯guration of the amusement park ride.<br />

conditions imposed by the slightly sadistic ride operator. What kind of trajectories<br />

can the victims be subjected to?<br />

Our task is to investigate this question using Lagrange's equations of motion,<br />

an alternative approach to the Newtonian formulation. The Lagrangian L is<br />

de¯ned as L = T ¡ V ,whereT is the kinetic energy and V is the potential<br />

energy of the system being studied. Formulating the Lagrangian is often much<br />

easier than determining all the forces and their components that are required to<br />

r<br />

x<br />

φ<br />

m


202 CHAPTER 4. NONLINEAR ODE MODELS<br />

apply Newton's second law. If L depends on the coordinates q1, q2,:::, qi,:::, qN<br />

and the \velocities" qi _ ´ @qi=@t, it is shown in standard mechanics texts [FC99]<br />

that the equations of motion are given by Lagrange's equations,<br />

@L<br />

¡<br />

@qi<br />

d<br />

μ <br />

@L<br />

=0; (4.18)<br />

dt @qi _<br />

with i =1; 2;:::; N. Since each component equation is of the Euler{Lagrange<br />

structure, it should come as no surprise that the EulerLagrange command can<br />

be used to derive the relevant ODEs, given a speci¯ed form of L. Let'snowuse<br />

this approach for the amusement park ride.<br />

After we load the plots and VariationalCalculus library packages,<br />

> restart: with(plots): with(VariationalCalculus):<br />

the Cartesian coordinates of the mass m are expressed in terms of the spherical<br />

polar coordinates r (which is ¯xed), μ(t), and Á(t), as in Figure 4.18.<br />

> x:=r*sin(theta(t))*cos(phi(t));<br />

x := r sin(μ(t)) cos(Á(t))<br />

> y:=r*sin(theta(t))*sin(phi(t));<br />

y := r sin(μ(t)) sin(Á(t))<br />

> z:=r*cos(theta(t));<br />

z := r cos(μ(t))<br />

The kinetic energy of the mass at time t is calculated and simpli¯ed.<br />

> T:=simplify((m/2)*(diff(x,t)^2+diff(y,t)^2+diff(z,t)^2));<br />

T := ¡ 1<br />

2 mr2<br />

à μ<br />

d<br />

¡<br />

dt Á(t)<br />

2 μ<br />

d<br />

+<br />

dt Á(t)<br />

2<br />

cos(μ(t)) 2 μ<br />

d<br />

¡<br />

dt μ(t)<br />

!<br />

2<br />

The potential energy V = ¡mgr cos(μ(t)), with g the gravitational acceleration,<br />

is entered and the Lagrangian L = T ¡ V calculated.<br />

> V:=-m*g*r*cos(theta(t)): L:=T-V;<br />

L := ¡ 1<br />

2 mr2<br />

à μ<br />

d<br />

¡<br />

dt Á(t)<br />

2 μ<br />

d<br />

+<br />

dt Á(t)<br />

2<br />

cos(μ(t)) 2 μ<br />

d<br />

¡<br />

dt μ(t)<br />

!<br />

2<br />

+mgrcos(μ(t))<br />

The EulerLagrange command is applied to L, the independent variable t being<br />

speci¯ed, and the two angular coordinates Á(t) andμ(t) being entered as a list.<br />

The lengthy output is suppressed here in the text.<br />

> eq:=EulerLagrange(L,t,[phi(t),theta(t)]);<br />

The ¯rst integral in eq containing the constant K1 is selected.<br />

> ode1:=select(has,eq,K[1])[];<br />

ode1 := ¡ 1<br />

2 mr2<br />

μ μ<br />

d<br />

¡2<br />

dt Á(t)<br />

μ<br />

d<br />

+2<br />

dt Á(t)<br />

<br />

cos(μ(t)) 2<br />

<br />

= K1


4.3. VARIATIONAL CALCULUS MODELS 203<br />

A second ODE relating μ(t) toÁ(t) is required. To this end, we select the<br />

expression in eq containing d 2 μ(t)=dt 2 and set the result to zero.<br />

> ode2:=select(has,eq,diff(theta(t),t,t))[]=0;<br />

ode2 := mr2 μ<br />

d<br />

dt Á(t)<br />

2<br />

cos(μ(t)) sin(μ(t)) ¡ mgrsin(μ(t)) ¡ mr2 μ 2 d<br />

μ(t) =0<br />

dt2 With ode1 and ode2 , we have two coupled nonlinear ODEs. However, we can<br />

solve the former for dÁ=dt by isolating this term on the lhs of the equation,<br />

> ode1b:=isolate(ode1,diff(phi(t),t));<br />

ode1b := d<br />

2 K1<br />

Á(t) =¡<br />

dt<br />

mr2 (¡2+2cos(μ(t)) 2 )<br />

and then simplifying with the algebraic substitution cos(μ(t)) 2 =1¡ sin(μ(t)) 2 .<br />

> ode1c:=algsubs(cos(theta(t))^2=1-sin(theta(t))^2,ode1b);<br />

ode1c := d<br />

K1<br />

Á(t) =<br />

dt mr2 sin(μ(t)) 2<br />

Then substituting ode1c and g = r! 2 ,where! is a frequency, into ¡ode2 =(mr2 )<br />

and expanding,<br />

> ode2b:=expand(subs(fode1c,g=r*omega^2g,-ode2/(m*r^2)));<br />

ode2b := ¡ K1 2 cos(μ(t))<br />

m2 r4 sin(μ(t)) 3 + !2 μ 2 d<br />

sin(μ(t)) + μ(t) =0<br />

dt2 yields the second-order nonlinear ODE ode2b entirely in terms of μ(t). This<br />

ODE cannot be solved analytically. Before seeking a numerical solution, it is<br />

instructive to consider some simpler special cases ¯rst.<br />

Consider the situation in which the ride operator is feeling in a rare mellow<br />

mood and allows the cage to swing to and fro at a constant angle Á, so_ Á =0<br />

and, from ode1c, K1 =0. Thenode2b reduces to the well-known linear ODE for<br />

the simple undamped plane pendulum with characteristic frequency !. Those<br />

readers who have gone to an amusement park lately may have seen a \boat"<br />

ride that behaves as a driven simple pendulum. This ride is much too tame for<br />

our ride operator and the large teenage market that he is after.<br />

Another special case corresponds to the cage orbiting in a horizontal circle<br />

at a ¯xed angle μ(t) = £. (A popular young children's ride does exactly this.)<br />

We evaluate ode2b at this ¯xed angle.<br />

> eq2:=eval(ode2b,theta(t)=Theta);<br />

eq2 := ¡ K1 2 cos(£)<br />

m 2 r 4 sin(£) 3 + !2 sin(£) = 0<br />

At the ¯xed angle £, K1 is given from ode1c by the following command line,<br />

where we have set the angular velocity dÁ(t)=dt =−.<br />

> K[1]:=Omega*m*r^2*sin(Theta)^2;<br />

K1 := − mr 2 sin(£) 2


204 CHAPTER 4. NONLINEAR ODE MODELS<br />

The angular velocity needed to maintain the horizontal circular motion at the<br />

¯xed angle μ(t) = £ is then obtained by solving eq2 for −.<br />

> Omega:=solve(eq2,Omega);<br />

! !<br />

−:= p ; ¡ p<br />

cos(£) cos(£)<br />

The two angular velocity solutions given above correspond to rotations in the<br />

opposite sense.<br />

The two rides described so far are not su±ciently exciting to the teenage<br />

generation. Taking the nominal values r =1,m =1,and! = 1 for the parameters<br />

(the reader can experiment with more realistic numbers), can one create<br />

a more interesting trajectory? For a horizontal circular orbit at an inclination<br />

to the vertical of £ = 60 ± , the constant K1 is given by<br />

K1 = !mr2 sin 2 £<br />

p cos £<br />

=<br />

r<br />

9<br />

¼ 1:06:<br />

8<br />

To create a more interesting ride let's take K1 =0:5. The trajectory of the ride<br />

will be plotted over T = 20 time units.<br />

> r:=1: m:=1: omega:=1: K[1]:=0.5: T:=20:<br />

Let's suppose that initially, Á(0) = 0, μ(0) = ¼=3 radians, and _ μ(0) = 0,<br />

> ic:=phi(0)=0,theta(0)=Pi/3,D(theta)(0)=0:<br />

and numerically solve ode1c and ode2b subject to this initial condition.<br />

> sol:=dsolve(fode1c,ode2b,icg,ftheta(t),phi(t)g,numeric):<br />

To get a feeling for the three-dimensional motion, the spherical surface on which<br />

the cage can move is created with the sphereplot command. The radius r =1<br />

of the sphere is speci¯ed as well as the angular ranges μ =0to2¼ and Á =0<br />

to ¼. Awireframe style is used to represent the spherical surface.<br />

> gr1:=sphereplot(r,theta=0..2*Pi,phi=0..Pi,style=wireframe):<br />

The odeplot command is now used to plot the numerically determined trajectory<br />

of the mass m overthetimeintervalt =0toT . Normal axes are chosen,<br />

and the minimum number of plotting points is taken to be 500 to obtain a<br />

smooth curve.<br />

> gr2:=odeplot(sol,[x,y,z],0..T,axes=normal,numpoints=500,<br />

thickness=3):<br />

The display command is used to overlay the two graphs. Axis labels are added,<br />

and the orientation and size of the 3-dimensional viewing box controlled, as well<br />

as the number of tickmarks.<br />

> display(gr1,gr2,labels=["x","y","z"],orientation=[50,-100],<br />

view=[-1..1,-1..1,-1..1], tickmarks=[2,2,4]);<br />

Figure 4.19 shows the 3-dimensional trajectory. The viewing box can be rotated<br />

to observe the trajectory from di®erent angles by dragging the box on the<br />

computer screen with your mouse.


4.3. VARIATIONAL CALCULUS MODELS 205<br />

x<br />

1<br />

-1<br />

-1<br />

-0.5<br />

0<br />

0.5<br />

z<br />

1<br />

Figure 4.19: A wild amusement park ride trajectory on a spherical surface.<br />

If this trajectory isn't wild enough, feel free to create your own crazy ride.<br />

You could also try using more realistic values for the parameters instead of the<br />

nominal values used in the above recipe.<br />

Haveastomach-churningride!<br />

PROBLEMS:<br />

Problem 4-43: A twirling-loop ride<br />

A vertically oriented circular loop of radius ` rotates with angular velocity !<br />

about the z-axis as shown in Figure 4.20. A cage of unit mass (m = 1) is allowed<br />

to slide along the frictionless loop. If the plane of the loop is oriented along the<br />

x<br />

z<br />

θ<br />

ω<br />

m<br />

y<br />

y<br />

1<br />

-1<br />

Figure 4.20: Rotating circular loop with cage (mass m) free to slide.


206 CHAPTER 4. NONLINEAR ODE MODELS<br />

y-axis at t =0,whatarethex-, y-, and z-coordinates of the cage at time t?<br />

Using the Lagrangian approach, show that the cage's motion is described by<br />

Äμ + ! 2 1<br />

0 sin μ ¡<br />

2 !2 sin(2 μ) =0;<br />

with !0 = p g=`. Numerically solve the equation of motion for !0 =1and<br />

varying values of ! and discuss the behavior to which the cage is subjected.<br />

Problem 4-44: Ride into the jaws of chaos<br />

The pivot point O for the simple pendulum is undergoing vertical oscillations<br />

given by A sin(!t) as indicated in Figure 4.21.<br />

Asin(ωt) O<br />

Figure 4.21: An example of parametric excitation.<br />

Show that the relevant equation of motion is<br />

Äμ + ! 2 μ<br />

0 1 ¡ A!2<br />

<br />

sin(!t) sin μ =0;<br />

g<br />

with !0 = p g=`. This nonlinear ODE with a time-dependent coe±cient is<br />

referred to in the mathematics literature as an example of parametric excitation.<br />

Taking !0 =1and! = 1, numerically study the e®ect of changing the ratio<br />

A=g. Then take this ratio equal to 1, and study the e®ect of changing !.<br />

Problem 4-45: Horizontally oscillating pivot point<br />

The pivot point O in the previous problem is undergoing horizontal oscillations<br />

given by A sin(!t). Derive the relevant equation of motion. Taking !0 =1,<br />

! =1,andg = 10, numerically study the e®ect of changing the amplitude A.<br />

θ<br />

m


Chapter 5<br />

Linear PDE Models. Part 1<br />

Because linear partial di®erential equations play such an important role in the<br />

mathematical description of electromagnetic waves, heat °ow, elastic vibrations,<br />

and many other scienti¯c phenomena, there is an abundance of wonderful examples<br />

that can be solved using computer algebra. For this reason, this topic<br />

is split over two chapters. We begin with examples of checking PDE solutions,<br />

either obtained by intelligent guessing or quoted, without derivation, in some<br />

scienti¯c reference. Di®usion and Laplace's equation models are then presented.<br />

5.1 Checking Solutions<br />

5.1.1 The Palace of the Governors<br />

The knowledge of the world is only acquired in the world,<br />

and not in a closet.<br />

Phillip Dormer Stanhope, Earl of Chester¯eld (1694{1773)<br />

While driving back to Phoenix from Los Alamos, where he attended an engineering<br />

conference at the Los Alamos National Laboratory, Russell stops in<br />

Sante Fe to have something to eat and to tour the historic Plaza area of town.<br />

After treating himself to a gourmet lunch, consisting of a tasty rattlesnake<br />

burger washed down with a Corona beer, he strolls around the Plaza. As an<br />

engineer, Russell is particularly impressed by the massively thick walls of the<br />

Palace of the Governors. This long, low adobe structure, which was built in<br />

1610 by the Spanish, is the oldest continuous seat of government in the United<br />

States. The thick walls, which is a design feature of many historic buildings in<br />

the American Southwest, not only o®ered protection from attackers but helped<br />

to keep the heat of the summer sun at bay as well as excluding the cold breath<br />

of winter.<br />

On completing his tour of the Plaza, Russell is intrigued by the question<br />

of how e®ective a very thick adobe wall is in cutting down the incident solar<br />

radiation from the summer sun. Pulling out his laptop computer, and ¯nding<br />

a shady spot, he formulates the following relevant model. For simplicity, he<br />

207


208 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

considers a semi-in¯nite solid medium whose bounding planar surface is periodicallyheatedbythesun.<br />

Thedirectiontransversetothesurfaceistakento<br />

be the x-direction, with the surface located at x =0,andpositivextaken to<br />

be inside the surface. In order to animate the temperature pro¯le inside the<br />

surface, Russell loads the plots library package.<br />

> restart: with(plots):<br />

From undergraduate thermodynamics, he knows that the time-dependent temperature<br />

distribution T (x; t) obeys the one-dimensional heat di®usion equation<br />

@T<br />

@t = d @2T ; (5.1)<br />

@x2 with the heat di®usion coe±cient d = K=(½C), where K is the thermal conductivity,<br />

½ the density, and C the speci¯c heat. Russell enters the heat equation.<br />

> heateq:=diff(T(x,t),t)-d*diff(T(x,t),x,x)=0;<br />

³ ´ μ<br />

heateq := @@tT (x; t) ¡ d @ 2<br />

<br />

2 T (x; t) =0<br />

@x<br />

To account for the periodic heating of the planar surface due to the sun, he<br />

takes the temperature variation at x =0tobeT (0;t)=T0 cos(!t). Rather<br />

than derive the temperature variation T (x; t) forx > 0, Russell decides to<br />

make an intelligent guess as to its mathematical form and check it by substituting<br />

the form back into the di®usion equation. Since he is looking for a<br />

steady-state response and the temperature should decrease as x increases inside<br />

the surface, Russell conjectures that the solution should be of the structure<br />

T (x; t) =T0 e ¡®x cos(!t¡ ¯x), with the parameters ® and ¯ as yet undetermined.<br />

At x = 0, the boundary condition is satis¯ed, and an exponentially<br />

decaying cosine solution seems reasonable inside the surface. Both ® and ¯<br />

must be positive for a waveform propagating in the positive x-direction.<br />

What forms should ® and ¯ have? From the structure of the heat di®usion<br />

equation, the units of d are m 2 /s, so 1= p d has units of s 1=2 ¢m ¡1 . Since the<br />

argument in the exponential function must be dimensionless, ® must have the<br />

dimensions of m ¡1 . The only other parameter in the problem involving a time<br />

unit is the frequency ! with units s ¡1 . So, noting that the combination p !=d<br />

has the units m ¡1 ,Russelltakes® = a p !=d, wherea is a numerical factor, yet<br />

to be determined. By similar reasoning, the constant ¯ is set equal to b p !=d,<br />

with b another numerical factor. Both a and b must be positive.<br />

To check the postulated solution and determine a and b, Russell enters<br />

T (x; t), which will be automatically substituted into the heat equation.<br />

> T(x,t):=T[0]*exp(-a*sqrt(omega/d)*x)<br />

*cos(omega*t-b*sqrt(omega/d)*x);<br />

T (x; t) :=T0 e (¡a p !<br />

d x) cos<br />

Russell then simpli¯es the heat equation,<br />

> eq:=simplify(heateq);<br />

μ<br />

¡!t+ b<br />

r !<br />

d x


5.1. CHECKING SOLUTIONS 209<br />

and collects the coe±cients of the cosine and sine terms.<br />

> collect(eq,fcos,sing);<br />

¡T0 !e (¡a p !<br />

d x) (a2 ¡ b2 μ r<br />

!<br />

)cos ¡!t+ b<br />

d x<br />

<br />

¡ T0 !e (¡a p !<br />

d x) μ r<br />

!<br />

(¡1+2ab)sin ¡!t+ b<br />

d x<br />

<br />

=0<br />

For the left-hand side of the above output to be equal to zero for arbitrary x<br />

and t, one must have b = a and ¡1+2ab =0,sothata =1= p 2=b. These<br />

values of a and b are entered, numerically evaluated, and labeled aa and bb.<br />

> aa:=evalf(1/sqrt(2)): bb:=aa:<br />

Adobe brick is made up of a mixture of dried clay and straw, so Russell consults<br />

a handbook of physical constants that he just happens to have brought along<br />

with him. He ascertains that for dried clay, the major component of the bricks,<br />

K =0:4 W/(m¢K), ½ =2000kg/m3 ,andC = 920 J/(kg¢K). Russell then is<br />

able to calculate the di®usion coe±cient dclay for clay, which he will use as an<br />

estimate for the adobe brick.<br />

> K:=0.4: rho:=2000: C:=920: d[clay]:=K/(rho*C);<br />

dclay := 0:2173913043 10 ¡6<br />

The rotational period of the earth is about 24 hours, or 24 £ 60 £ 60 = 86;400<br />

seconds, so its rotational frequency, freq, can be calculated.<br />

> period:=24*60*60; freq:=evalf(2*Pi/period);<br />

period := 86400 freq := 0:00007272205218<br />

Summer temperatures in the American Southwest can vary from daily highs of<br />

100 ± F or more, to overnight minima in the low to mid-60s. For his calculation,<br />

Russell takes a mean daily temperature of 80 ± F with a variation of 20 ± on either<br />

side. Converting to degrees Celsius, this translates into a mean temperature<br />

of 26:6 ± CandT0 =11 ± for the amplitude of the temperature variation. Now<br />

T (x; t) is evaluated using the parameter values that have been obtained.<br />

> T:=eval(T(x,t),fa=aa,b=bb,T[0]=11,d=d[clay],omega=freqg);<br />

T := 11:e (¡12:93293161 x) cos(¡0:00007272205218 t +12:93293161 x)<br />

Russell creates a plot of the mean daily temperature, representing the temperature<br />

by a dashed (linestyle=3) blue line. The spatial range of the plot is<br />

from x =0to0:5 meters.<br />

> meantemp:=plot(26.6,x=0..0.5,color=blue,linestyle=3):<br />

Thetotaltemperaturepro¯leovera0:5-meter spatial range is animated over<br />

a time interval of one complete period (day). Fifty frames are included in the<br />

animation. The mean temperature line is included with the background option.<br />

> animate(plot,[T+26.6,x=0..0.5],t=0..period,frames=50,<br />

thickness=2,background=meantemp);<br />

The initial temperature pro¯le in the animation is similar to the solid curve<br />

shown in Figure 5.1, the horizontal dashed line being the mean temperature.


210 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

35<br />

30<br />

25<br />

20<br />

0 0.1 0.2 0.3 0.4 0.5<br />

x<br />

Figure 5.1: Initial temperature pro¯le inside the adobe wall.<br />

On running the animation, the temperature curve will oscillate up and down<br />

as the externally imposed temperature on the surface varies during the day.<br />

However, the temperature variation drops to zero within a penetration depth<br />

of less than 0:4 m or 40 cm (16 in). Well within the surface, the temperature<br />

is in thermal equilibrium with the mean exterior temperature. Since the adobe<br />

walls of many of the historic buildings of Arizona and New Mexico are substantially<br />

thicker than 16 inches, the interior temperature of these buildings is quite<br />

insensitive to external temperature variations.<br />

PROBLEMS:<br />

Problem 5-1: A house of wood<br />

In the text recipe, make the following modi¯cations:<br />

(a) The region x>0 is composed of solid wood for which K =0:15 W/(m¢K),<br />

½ = 700 kg/m3 ,andC = 1800 J/(kg¢K).<br />

(b) The mean daily temperature is 30 ± Candtheamplitudeofthetemperature<br />

variation is 20 ± .<br />

Run the animation and determine the approximate depth in centimeters at<br />

which the temperature variation is essentially zero.<br />

Problem 5-2: Pulsating sphere<br />

The surface of a sphere of radius r = a, surrounded by an ideal compressible<br />

°uid, pulsates radially with frequency !. The radial velocity of the surface is<br />

given by V = U cos(!t). It is stated in an advanced calculus text that the<br />

steady-state °uid velocity at an arbitrary point r>ais of the form<br />

V =<br />

Ua2 (c2 + a2 ! 2 ) r2 £ ¤ 2 2<br />

(c +ar! )cos(μ)+c!(r ¡ a)sin(μ) ;


5.1. CHECKING SOLUTIONS 211<br />

where μ ´ ! (r ¡ a)=c ¡ !tand c is the speed of sound in the °uid.<br />

(a) Check that the solution satis¯es the boundary condition.<br />

(b) The velocity V is related to the velocity potential © by V = ¡@©=@r.<br />

Determine the radial dependence of the velocity potential.<br />

(c) Since © depends only on the distance r from the center of the sphere, it<br />

satis¯esthewaveequationintheform<br />

@ 2 (r ©)<br />

@r 2<br />

1<br />

=<br />

c2 @2 (r ©)<br />

@t2 :<br />

Verify that © satis¯es the wave equation, thus ensuring that it is the<br />

correct solution to the pulsating sphere problem.<br />

(d) Taking the nominal values U =1,a =1,c =1,and! = 1, animate the<br />

analytic formula for V in the region outside the spherical surface.<br />

(e) How far from the surface does the velocity oscillation amplitude drop to<br />

5% of the value at the surface?<br />

5.1.2 Play It, Sam<br />

You just pick a chord, go twang, and you've got music.<br />

Syd Vicious, British rock musician (1957{1979)<br />

In a famous scene from the classic movie Casablanca, Humphrey Bogart is<br />

annoyed by the musical piece that the nightclub pianist is playing and doesn't<br />

want to hear it. But Ingrid Bergman turns to the piano player, and says \Play<br />

it, Sam." Humphrey Bogart then echoes her, by saying \If she can stand it, I<br />

can. Play it."<br />

To a certain undergraduate physics student watching this old movie, an<br />

individual who tends to look for deeper understanding rather than simply enjoying<br />

the movie and the music, the sounds that emanate are of course due to<br />

the transverse vibrations of the piano strings as each is successively struck by<br />

a piano hammer. This student is our old friend Vectoria, who is spending a<br />

lonely evening by herself, since her ¯ance Mike is out of town at a mathematics<br />

conference. Hoping that Mike will phone before it gets too late, Vectoria<br />

decides in the meantime to look at the mathematical vibrations of an elastic<br />

string ¯xed at its ends.<br />

Not yet having taken the necessary mathematics prerequisites to study the<br />

topic of vibrating strings in depth, Vectoria consults a physics text that gives<br />

no derivation but simply the formula for the transverse displacement of a light,<br />

horizontal, elastic string of length a ¯xed at both ends when struck and given a<br />

certain initial velocity pro¯le. The information that Vectoria gleans from this<br />

particular text is as follows.


212 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

Neglecting sti®ness, we can model the transverse displacement Ã(x; t) ofa<br />

light, initially horizontal (Ã(x; 0) = 0) piano string by the wave equation<br />

@2Ã 1<br />

¡<br />

@x2 c2 @2Ã =0; (5.2)<br />

@t2 where the wave velocity c equals p T=², T being the tension in the string and<br />

² the mass per unit length. If a string of length a is held ¯xed at both ends<br />

(Ã(0;t)=Ã(a; t) = 0) for all times, and is given an initial transverse velocity<br />

8<br />

< 4 vx=a; 0


5.1. CHECKING SOLUTIONS 213<br />

a piecewise function, is slightly harder to verify. One approach is to plot the<br />

velocity pro¯le predicted by the series solution at t =0andcompareitwiththe<br />

analytic piecewise form. Adding, say, the ¯rst ¯ve terms in the series solution,<br />

> psi:=add(psi[n],n=1..5);<br />

8 va(<br />

à :=<br />

p ³<br />

¼x<br />

´ μ <br />

¼ct<br />

2¡1) sin sin<br />

a a<br />

¼3 μ μ <br />

2 ¼x 2 ¼ct<br />

2 vasin sin<br />

a<br />

a<br />

+<br />

c<br />

¼3 c<br />

+ 8<br />

va(<br />

27<br />

p μ μ <br />

3 ¼x 3 ¼ct<br />

2+1)sin sin<br />

a<br />

a<br />

¼3 c<br />

+ 8<br />

va(¡<br />

125<br />

p μ μ <br />

5 ¼x 5 ¼ct<br />

2 ¡ 1) sin sin<br />

a<br />

a<br />

¼3 c<br />

and di®erentiating with respect to time, yields the velocity in the transverse<br />

direction (output suppressed here).<br />

> vel:=diff(psi,t);<br />

To plot the transverse velocity at t = 0, some representative values must be<br />

substituted for the parameters. Vectoria chooses v =5,a =2,andc =1.<br />

> t:=0: v:=5: a:=2: c:=1:<br />

To compare the series representation at t = 0 with the given piecewise initial<br />

velocity distribution, the latter is entered,<br />

> V:=piecewise(x


214 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

solution isn't too bad, but not great either. Increasing the n value, Vectoria<br />

observes an increasingly better ¯t. The reader should be the judge of how many<br />

terms su±ce to give a good ¯t for the parameters chosen.<br />

Although reasonably satis¯ed that the quoted Fourier series expansion is<br />

correct, Vectoria still isn't entirely happy until the actual motion predicted<br />

by the formula is observed. After all, it is not obvious from the series solution<br />

exactly what the behavior of the string is after being struck. So the displacement<br />

Ã(x; t) is animated for the time interval t = 0 to 50. First, the time variable t<br />

must be unassigned. Otherwise, Maple will remember the value t =0usedto<br />

check the initial velocity pro¯le.<br />

> unassign('t'):<br />

Finally, the animation command is given with 100 frames being used.<br />

> animate(plot,[psi,x=0..a],t=0..50,frames=100,thickness=2);<br />

On running the animation, Vectoria observes that the wave form begins to grow<br />

in the region where the string was struck. This makes intuitive sense. Because<br />

thewaveformiscreatedontheleftsideofthestring,itthenmoveswithwave<br />

velocity c to the right and re°ects o® the boundary at x = a. On re°ection<br />

the wave form is inverted, a characteristic feature for a ¯xed-ends boundary<br />

condition. The wave then propagates to the left boundary at x =0before<br />

inverting again and repeating the oscillatory behavior.<br />

Finally, with a feeling of accomplishment, Vectoria is able to appreciate the<br />

deeper content underlying the simple remarks made by Ingrid Bergman and<br />

Humphrey Bogart. She will be even more content if Mike phones soon.<br />

PROBLEMS:<br />

Problem 5-3: Plucked string<br />

An elastic string ¯xed between x =0andL, and initially at rest, is \plucked,"<br />

its initial shape being given by the following symmetric triangular pro¯le,<br />

Ã(x; 0) =<br />

½ 2 hx=L; 0 · x · L=2;<br />

2 h (L ¡ x)=L; L=2 · x · L:<br />

Verify that the motion for t>0 may be described by the Fourier series solution<br />

8 h<br />

Ã(x; t) =<br />

¼2 1X sin(n¼=2)<br />

n<br />

n=1<br />

2 sin(n¼x=L)cos(n¼ct=L)<br />

and animate the solution for parameter values of your own choosing.<br />

Problem 5-4: A striking piano hammer<br />

A piano string ¯xed between x =0 anda is struck by a piano hammer in a<br />

region of width d centered at x=x0. Its initial velocity distribution is<br />

½<br />

Ã(x; _ v cos(¼ (x ¡ x0)=d); jx ¡ x0j d=2:


5.1. CHECKING SOLUTIONS 215<br />

Neglecting sti®ness and assuming Ã(x; 0) = 0,<br />

4 vd<br />

Ã(x; t) =<br />

¼2 1X 1 sin(n¼x0=a)cos(n¼d=(2 a))<br />

c n (1 ¡ (nd=a) 2 sin(n¼x=a)sin(n¼ct=a)<br />

)<br />

n=1<br />

istheshapeofthestringattimet. Verify that this series solution is correct<br />

and animate it for parameter values of your own choosing.<br />

5.1.3 Three Easy Pieces<br />

I would advise you Sir, to study algebra, if you are not already an<br />

adept in it: your head would be less muddy ...<br />

Samuel Johnson, English writer and lexicographer (1709{1784)<br />

Spurred by her earlier success, and feeling happier after her long phone conversation<br />

last night with Mike, Vectoria is pursuing another vibrating string<br />

example, which she has entitled Three Easy Pieces. Thisdoesnotrefertothe<br />

old Jack Nicholson movie with a similar title (cf. Five Easy Pieces), but to<br />

the fact that the algebraic manipulations involved in dealing with plane-wave<br />

propagation along a three-piece string are easy if one uses computer algebra.<br />

When an intermediate section of a very long horizontal string has a greater<br />

mass density ² than the remaining two identical portions of the string, a transverse<br />

plane wave incident on that section will in general experience partial<br />

re°ection and transmission. Recall that the velocity of the transverse wave is<br />

given by c = p T =², whereT is the tension in the string. The wave number is<br />

k = !=c =2¼=¸, where! is the angular frequency and ¸ is the wavelength.<br />

Since the frequency of the wave and the tension must remain the same in each<br />

region, the ratio r of wave numbers in two di®erent regions of mass density ²2<br />

and ²1 is given by r = k2=k1 = p ²2=²1. Vectoria reads in a certain physics<br />

text that for the case k1 = K, theratior = 3, and the more massive segment<br />

(labeled 2) stretches from x =0tox = L, the energy transmission (T )and<br />

re°ection (R) coe±cientsaregivenby,<br />

9<br />

8 ¡ 8cos(6KL)<br />

T =<br />

; R =<br />

17 ¡ 8cos(6KL) 17 ¡ 8cos(6KL) :<br />

Here T and R measure the fraction of the incident power that is transmitted and<br />

re°ected. The power here is proportional to the square of the string amplitude.<br />

Vectoria's objective is to verify the cited re°ection and transmission coe±cients<br />

and plot them for K =1asafunctionofL. Hermethodofattackisto<br />

write down plane-wave expressions in each region, determine the coe±cients by<br />

matching the solutions at x =0andx = L, and then calculate T and R.<br />

She begins by entering r =3,k1 = K, andk2 = rk1.<br />

> restart: r:=3: k[1]:=K; k[2]:=r*k[1];<br />

k1 := K k2 := 3 K


216 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

The plane wave is assumed to be traveling in the positive x-direction, its time<br />

part being e ¡I!t ,whereI = p ¡1. In the ¯rst region, x psi[1]:=exp(I*k[1]*x)+a*exp(-I*k[1]*x);<br />

Ã1 := e (KxI) (¡I Kx)<br />

+ ae<br />

The ¯rst term is the incident plane wave, while the second term is the re°ected<br />

wave with amplitude a. Since the transmission and re°ection coe±cients involve<br />

ratios of squared amplitudes, the amplitude of the incident wave has been set<br />

equal to one without loss of generality. The energy re°ection coe±cient then is<br />

given by R = jaj2 =1=jaj2 .<br />

In region 2 (0 · x · L), the wave form must be made up of waves traveling<br />

in the positive and negative x-directions, viz., Ã2 = beIk2x + ce ¡Ik2x ,with<br />

undetermined amplitudes b and c.<br />

> psi[2]:=b*exp(I*k[2]*x)+c*exp(-I*k[2]*x);<br />

Ã2 := be (3 IKx) (¡3 IKx)<br />

+ ce<br />

In the third region, x>L, there will be only a transmitted plane wave, with<br />

spatial part Ã3 = deIk1x ,thewavenumberbeingk1 = K since the string<br />

density is the same as in the ¯rst region. The fraction of the energy incident in<br />

region 1 that is transmitted into region 3 is given by the transmission coe±cient<br />

T = jdj2 =1=jdj2 .<br />

> psi[3]:=d*exp(I*k[1]*x);<br />

Ã3 := de (KxI)<br />

To evaluate the four unknown coe±cients a, b, c, and d, four independent<br />

equations are needed. The ¯rst two equations, eq1 and eq2 ,followfromthe<br />

physical continuity of the string. The string segment in region 2 is joined to<br />

the segment in region 1 at x =0andtothesegmentinregion3atx = L.<br />

> eq1:=eval(psi[1]=psi[2],x=0);<br />

eq1 := 1 + a = b + c<br />

> eq2:=eval(psi[2]=psi[3],x=L);<br />

eq2 := be (3 IKL) + ce (¡3 IKL) = de (KLI)<br />

Since the wave equation, and therefore the second spatial derivative, remains<br />

¯nite everywhere along the string, the ¯rst derivative of à with respect to x<br />

must be continuous. So, continuity of the slope at x =0andx = L yields the<br />

third and fourth equations.<br />

> eq3:=eval(diff(psi[1],x)=diff(psi[2],x),x=0);<br />

eq3 := KI¡ aKI =3IbK¡ 3 IcK<br />

> eq4:=eval(diff(psi[2],x)=diff(psi[3],x),x=L);<br />

eq4 := 3 IbKe (3 IKL) ¡ 3 IcKe (¡3 IKL) = dKe (KLI) I<br />

The system of four equations is now solved for the four unknown amplitudes,<br />

and the solution is assigned.


5.1. CHECKING SOLUTIONS 217<br />

> sol:=solve(feq1,eq2,eq3,eq4g,fa,b,c,dg); assign(sol):<br />

(¡3 IKL) 2 e<br />

(3 IKL) e<br />

sol := fb = ¡<br />

e (3 IKL) ;c= ¡<br />

¡ 4 e (¡3 IKL) e (3 IKL) ¡ 4 e (¡3 IKL)<br />

a = ¡ 2(e(3 IKL) ¡ e (¡3 IKL) )<br />

e (3 IKL) 3 e<br />

;d= ¡<br />

¡ 4 e (¡3 IKL) (¡3 IKL) (3 IKL) e<br />

e (KLI) e (3 IKL) g<br />

¡ 4 e (¡3 IKL)<br />

Since the amplitudes are complex, the transmission coe±cient is given by T =<br />

jdj2 = d £ d ¤ , where the asterisk denotes the complex conjugate. The command<br />

conjugate(d) is used to enter d ¤ . The complex evaluation command, evalc,<br />

which breaks a complex quantity into real and imaginary parts, is used to<br />

generate a completely real answer. Finally, the result is simpli¯ed.<br />

> T:=simplify(evalc(d*conjugate(d)));<br />

9<br />

T := ¡<br />

¡25+16cos(3KL) 2<br />

Applying the combine command, with the trig option, produces the desired<br />

form of the transmission coe±cient.<br />

> T:=combine(T,trig);<br />

9<br />

T := ¡<br />

¡17+8cos(6KL)<br />

Similarly, the re°ection coe±cient is given by R = a £ a ¤ , and the desired form<br />

follows on using the same command structure as for deriving T .<br />

> R:=simplify(evalc(a*conjugate(a)));<br />

R := 16 (¡1+cos(3KL)2 )<br />

¡25 + 16 cos(3 KL) 2<br />

> R:=combine(R,trig);<br />

R := ¡8+8cos(6KL)<br />

¡17 + 8 cos(6 KL)<br />

By energy conservation the sum of the re°ection and transmission coe±cients<br />

should add up to one. This is checked in the next command line. The value<br />

K = 1 is also entered for plotting purposes.<br />

> check:=simplify(R+T); K:=1:<br />

check := 1<br />

Finally, Vectoria plots the re°ection and transmission coe±cients in the same<br />

¯gure over the range L = 0 to 5, using a solid (linestyle=1) red curve for<br />

R, andadashed(linestyle=3) bluecurveforT . To maintain order, lists are<br />

used here for the energy coe±cients, the colors, and the line styles. For better<br />

visualization, thick curves are employed. Labels are also added to the plot,<br />

entered as strings.<br />

> plot([R,T],L=0..5,color=[red,blue],linestyle=[1,3],<br />

thickness=2,labels=["L","R,T"]);<br />

The resulting picture is shown in Figure 5.3.


218 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

1<br />

0.8<br />

0.6<br />

R, T<br />

0.4<br />

0.2<br />

0<br />

1 2 3 4 5<br />

L<br />

Figure 5.3: Re°ection (upper curve) and transmission (lower) coe±cients vs. L.<br />

When L = n¼=3, with n = 0 or a positive integer, the re°ection coe±cient<br />

vanishes and there is 100% transmission. Looking back at the expression for<br />

R, and recalling that k2 =3K here, Vectoria notes that this situation will<br />

occur whenever k2 L = n¼ or L = n (¸2=2), i.e., when the length L of the thick<br />

portion exactly accommodates an integer number of half-wavelengths in that<br />

region. Does this condition make sense to you?<br />

PROBLEMS:<br />

Problem 5-5: Variation on the text example<br />

If ²1 =1,²2 =16,k1 =1,andL = 2, what fraction of the incident plane wave<br />

energy is transmitted through the middle segment into the third region?<br />

Problem 5-6: As simple as 1-2-3<br />

Consider a plane wave of frequency ! traveling from x = ¡1 along an in¯nitely<br />

long string with three regions of di®erent density, the middle one being located<br />

between x =0andL. Suppose that the wave number in region 1 (x


5.1. CHECKING SOLUTIONS 219<br />

(e) What is the maximum value of T ,andforwhatL value does this transmission<br />

occur?<br />

Problem 5-7: Five easy pieces (not the movie)<br />

Consider an in¯nitely long string that has a linear density ²1 =1inregion1<br />

(x


220 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

5.1.4 Complex, Yet Simple<br />

I adore simple pleasures. They are the last refuge of the complex.<br />

Oscar Wilde, Anglo-Irish playwright (1854{1900)<br />

Consider the complex function w = u(x; y)+Iv(x; y) =z+1=z,wherez = x+Iy<br />

with I = p ¡1. It is stated in a certain mathematical physics text that because<br />

the real functions u and v satisfy the Cauchy{Riemann conditions,<br />

@u @v<br />

=<br />

@x @y ;<br />

@v<br />

@x<br />

@u<br />

= ¡ ; (5.5)<br />

@y<br />

then both u(x; y) andv(x; y) satisfyLaplace's equation,<br />

r 2 u = @2u @x2 + @2u @y2 =0; r2v = @2v @x2 + @2v =0; (5.6)<br />

@y2 and therefore can represent possible real potentials. It is further stated that<br />

the constant-v curves can be used to represent the equipotentials outside an<br />

in¯nitely long grounded conducting cylinder of unit radius placed in a previously<br />

uniform electric ¯eld oriented perpendicular to the cylinder. The electric ¯eld<br />

lines outside the cylinder are given by the constant-u curves, and the electric<br />

¯eld vectors by ~ E = ¡rv.<br />

Our goal in this recipe is to illustrate how simple it is to check these statements<br />

using Maple. Loading the plots and VectorCalculus packages,<br />

> restart: with(plots): with(VectorCalculus):<br />

both z = x + Iyand w = z +1=z are entered.<br />

> z:=x+I*y; w:=z+1/z;<br />

1<br />

z := x + yI w:= x + yI+<br />

x + yI<br />

The complex function w is separated into real and imaginary parts.<br />

> w:=evalc(w);<br />

w := x +<br />

x<br />

x2 +<br />

+ y2 μ<br />

y ¡<br />

y<br />

x 2 + y 2<br />

<br />

I<br />

The term involving I is removed from w, thus yielding u. The term containing<br />

I is selected and divided by I to produce v.<br />

> u:=remove(has,w,I); v:=select(has,w,I)/I;<br />

u := x +<br />

x<br />

x 2 + y 2<br />

v := y ¡<br />

y<br />

x 2 + y 2<br />

We now check that both Cauchy{Riemann conditions (5.5) are satis¯ed.<br />

> CR1:=simplify(diff(u,x)-diff(v,y));<br />

CR1 := 0<br />

> CR2:=simplify(diff(v,x)+diff(u,y));<br />

CR2 := 0<br />

A functional operator L is formed to calculate and simplify the Laplacian (r 2 )<br />

of a function f expressed in terms of the Cartesian coordinates x and y.


5.1. CHECKING SOLUTIONS 221<br />

> L:=f->simplify(Laplacian(f,'cartesian'[x,y])):<br />

Applying L to u and to v yields zero, con¯rming that these functions satisfy<br />

Laplace's equation and can be regarded as real potentials.<br />

> L(u); L(v);<br />

0 0<br />

To con¯ne our attention to the region outside the cylinder, two piecewise functions,<br />

pw1 and pw2 , are formed which are equal to zero for x2 + y2 < 1andu<br />

and v, respectively, outside this circular region.<br />

> pw1:=piecewise(x^2+y^2=1,u);<br />

( 2 2 0 x + y < 1<br />

pw1 := x<br />

x + 1 · x2 + y2 x 2 + y 2<br />

> pw2:=piecewise(x^2+y^2=1,v):<br />

A contour plot operator CP is formed to plot the equipotentials for a given<br />

potential function f. The color C must also be speci¯ed. The contours are<br />

drawn for potentials equal to 0:2 n, withn ranging from ¡11 to +11. The grid<br />

spacing is taken to be 90 £ 90, and constrained scaling is imposed.<br />

> CP:=(f,C)->contourplot(f,x=-2..2,y=-2..2,contours=<br />

[seq(0.2*n,n=-11..11)],grid=[90,90],color=C,<br />

scaling=constrained,thickness=2):<br />

The curves corresponding to constant u are colored red, those corresponding<br />

to constant v colored blue. The two sets of curves are superimposed. A blackand-white<br />

version of the plot is shown in Figure 5.4.<br />

> display(fCP(pw1,red),CP(pw2,blue)g);<br />

2<br />

y<br />

–2 x 2<br />

–2<br />

Figure 5.4: Equipotentials and electric ¯eld lines outside a conducting cylinder.


222 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

The horizontal curves are the equipotentials (constant v) and the vertical curves<br />

are the electric ¯eld lines (constant u). The two sets of curves intersect at<br />

right angles, as would be expected. The electric ¯eld lines also intersect the<br />

cylindrical surface perpendicularly, because the conducting surface is also an<br />

equipotential.<br />

Instead of showing the electric ¯eld lines, one can plot the electric ¯eld<br />

vectors. The electric ¯eld ~ E = ¡rv can be calculated in Cartesian coordinates<br />

using the Gradient command.<br />

> E:=-Gradient(v,'cartesian'[x,y]);<br />

E := ¡<br />

2 yx<br />

(x 2 + y 2 ) 2 ex +<br />

μ<br />

¡1+<br />

1<br />

x2 ¡<br />

+ y2 2 y 2<br />

(x 2 + y 2 ) 2<br />

Since we are interested only in the electric ¯eld outside the cylinder, two piecewise<br />

functions are formed to calculate the x and y components of the electric<br />

¯eld in the region x 2 + y 2 ¸ 1.<br />

> Ex:=piecewise(x^2+y^2=1,E[1]):<br />

> Ey:=piecewise(x^2+y^2=1,E[2]):<br />

The fieldplot command is used to plot the electric ¯eld vectors as thick red<br />

arrows, the grid being 12 £ 12. The arrows will point in the direction of ~ E,<br />

their size being a measure of the magnitude, j ~ Ej.<br />

> FP:=fieldplot([Ex,Ey],x=-2..2,y=-2..2,arrows=THICK,<br />

grid=[12,12],color=red):<br />

The equipotentials and electric ¯eld vectors are superimposed in the same picture,<br />

a black-and-white rendition being shown in Figure 5.5.<br />

> display(fCP(pw2,blue),FPg,labels=["x","y"],tickmarks=[2,2]);<br />

y<br />

2<br />

–2 0 x 2<br />

–2<br />

Figure 5.5: Equipotentials and electric ¯eld vectors outside the cylinder.<br />

<br />

ey


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 223<br />

PROBLEMS:<br />

Problem 5-9: Intersecting conducting plates<br />

In the text recipe replace the complex function with w = u + Iv = z2 ,with<br />

z = x + Iy. Con¯rm that u(x; y) andv(x; y) satisfy the Cauchy{Riemann<br />

conditions and Laplace's equations. Con¯rm by making a suitable plot that<br />

the equipotentials and electric ¯eld lines are appropriate to the quarter-space<br />

bounded by two semi-in¯nite conducting plates intersecting at right angles.<br />

Make another plot that shows the electric ¯eld vectors and equipotentials.<br />

Problem 5-10: Fluid °ow around a plate<br />

Consider the function w = u + iv= p z2 ¡ 1, with z = x + iy. By creating a<br />

suitable ¯gure in the x-y plane, show that the constant-u curves can represent<br />

the streamlines (tracks of the °uid particles) for °uid °ow around an in¯nitely<br />

long plate of ¯nite width, lying between x=¡1 and +1, inserted perpendicular<br />

to a previously uniform °uid °ow in the y direction. Include the plate and the<br />

equipotentials (constant v curves) in your ¯gure.<br />

5.2 Di®usion and Laplace's Equation Models<br />

In this section, di®usion and Laplace's equation models are solved in Cartesian<br />

and other common coordinate systems, using some of the standard methods<br />

of mathematical physics. Of course, we will let Maple do the heavy slogging,<br />

concentrating on the underlying physics.<br />

5.2.1 Freeing Excalibur<br />

A sleeping presence is always a mystery ... seemingly peaceful,<br />

yet in reality o® on wild adventures in strange landscapes.<br />

A. Alvarez, British novelist (1929{)<br />

Russell works as a control systems engineer for an aerospace company in the<br />

Phoenix area. Earlier in the day, several of his old ASU engineering classmates<br />

dropped by his workplace and persuaded him to go to the Monastery, a local<br />

outdoor pub, after work. There they ate chicken wings and pizza, drank pitchers<br />

of Mexican beer, and swapped stories about their undergraduate days and<br />

what had happened to each of them since graduating from engineering school.<br />

Later that night, probably triggered by the day's events, Russell is having<br />

a wild dream in which he has been transported back to the mythical times of<br />

Merlin the magician. Merlin has wrapped the fabled sword Excalibur in thin<br />

insulating material and has embedded it in a large rock with only the tip and<br />

hilt protruding. The legend is that whoever manages to pull out the sword will<br />

become ruler of the Kingdom with all its associated wealth. Many have tried,


224 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

but all 1 have failed to pull the sword out of the rock. Having taken a course<br />

in thermodynamics as an engineering undergraduate, Russell speculates as to<br />

whether the sword could be pulled out by cooling the ends of the sword with<br />

large buckets of ice, thus causing heat to °ow out of the warmer interior of the<br />

sword's blade to the ends. If the sword were cooled su±ciently, its diameter<br />

might shrink slightly, and just possibly he could pull the sword out.<br />

But remembering the thermodynamics course causes Russell's dream to alter<br />

direction, and he then dreams of a related problem that appeared on that<br />

course's ¯nal exam many years ago. A thin 1-m-long rod (the sword's shaft)<br />

whose lateral surface is insulated to prevent heat °ow through that surface has<br />

its ends suddenly held at the freezing point of water, 0 ± C(contactwiththe<br />

buckets of ice). Taking one end of the rod to be at x = 0 and the other at x =<br />

L = 1, the initial temperature (T ) distribution was T (x; t =0)=100x (1 ¡ x),<br />

a parabolic pro¯le with a maximum temperature of 25 ± at the midpoint x = 1<br />

2 .<br />

In the exam, he was asked to determine the temperature distribution T (x; t) for<br />

any time t>0. Despite the passage of time, Russell remembers his approach to<br />

solving this problem very well. His method of attack was to solve the di®usion<br />

equation<br />

@T(x; t)<br />

@t<br />

by the method of separation of variables, i.e., assume that T (x; t)=S(x) F (t).<br />

Substituting this assumed form into (5.7) and dividing by T (x; t) yields<br />

1 dF (t) d d<br />

=<br />

F (t) dt S(x)<br />

2S(x) dx2 : (5.8)<br />

Since the lhs of (5.8) involves a function of t alone and the rhs involves a function<br />

of x alone, the only way that it can be generally true is for both sides to be<br />

equal to a common constant, called the separation constant. The separated<br />

ODE for S(x) is solved, subject to the boundary conditions, and the complete<br />

product solution constructed, subject to the initial condition.<br />

Russell's wild dream is interrupted by the roar of a big jet passing over his<br />

house on its way into Sky Harbor Airport. Waking up, and unable to get back<br />

to sleep, he decides to make a cup of instant decaf co®ee and implement an<br />

animated Maple solution of the heat di®usion problem on his computer. To<br />

carry out the animation, the plots library package is loaded. Noting that the<br />

di®usion coe±cient d could be absorbed into either the spatial or time variable,<br />

Russell sets d = 1 without loss of generality. He also speci¯es the rod's length,<br />

L = 1, and enters the heat equation (5.7).<br />

> restart: with(plots): d:=1: L:=1:<br />

> heateq:=diff(T(x,t),t)=d*diff(T(x,t),x,x);<br />

= d @2 T (x; t)<br />

@x 2 ; (5.7)<br />

heateq := @<br />

@2<br />

T (x; t) = T (x; t)<br />

@t @x2 A general solution to the heat equation is sought using the PDE solve (pdsolve)<br />

command, the HINT option explicitly telling Maple to separate variables.<br />

1 King Arthur has not shown up yet.


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 225<br />

> pdsolve(heateq,HINT=S(x)*F(t));<br />

·½<br />

d<br />

(T (x; t) =S (x) F (t)) &where<br />

dt F (t) = c1 F (t); d2<br />

dx2 S(x) = c1<br />

¾¸<br />

S(x)<br />

The heat equation has been separated into two ODEs, c1 being the separation<br />

constant. If the INTEGRATE option is also included, the general solution of each<br />

ODE will be generated as Russell now illustrates.<br />

> pdsolve(heateq,HINT=S(x)*F(t),INTEGRATE);<br />

(T (x; t) =S (x) F (t)) &where<br />

[ffF (t) = C3 e ( c1 t) g; fS (x) = C1 e ( p c1 x) + C2 e (¡ p c1 x) gg]<br />

There are three unknown constants in the output, namely C1 , C2 ,and C3 .<br />

Finally, including the build option produces the general product solution, sol.<br />

> sol:=pdsolve(heateq,HINT=S(x)*F(t),INTEGRATE,build);<br />

sol := T (x; t) = C3 e ( c1 t) C1 e (p c1 x) + C3 e ( c1 t) C2<br />

e (p c1 x)<br />

Russell then substitutes c1 = ¡k 2 on the rhs of sol and applies the simplify<br />

command with the symbolic option, which is equivalent to assuming that k>0.<br />

> temp:=simplify(subs(_c[1]=-k^2,rhs(sol)),symbolic);<br />

temp := C3 ( C1 e (k (¡tk+xI)) + C2 e (¡k (tk+xI)) )<br />

The resulting form is complex in appearance, so the complex evaluation command<br />

is applied to separate temp into real and imaginary terms.<br />

> temp:=evalc(temp);<br />

temp := C3 ( C1 e (¡k2 t) (¡k cos(kx)+ C2 e 2 t) cos(kx))<br />

+ C3 ( C1 e (¡k2 t) (¡k sin(kx) ¡ C2 e 2 t) sin(kx)) I<br />

The temperature has been expressed in terms of cosine, sine, and exponential<br />

terms, which are now successively collected.<br />

> temp:=collect(%,[cos,sin,exp]);<br />

temp := C3 ( C1 + C2) e (¡k2 t) cos(kx)+ C3 ( C1 ¡ C2 ) e (¡k 2 t) sin(kx) I<br />

Since T (x =0;t) = 0 for all times and cos(kx) does not vanish at x =0,Russell<br />

removes it from temp. This is the ¯rst boundary condition (bc1).<br />

> temp:=remove(has,temp,cos); #bc1<br />

temp := C3 ( C1 ¡ C2 ) e (¡k2 t) sin(kx) I<br />

Similarly, the temperature must also vanish at x = L =1forallt (the second<br />

boundary condition). Therefore sin(kL)=0,sok = n¼=Lwith n =1; 2; 3;:::<br />

The general solution must involve a linear combination of terms involving all<br />

possible n values. With the coe±cient labeled An, thenth term in the Fourier<br />

series representation of the temperature will be of the following form.<br />

> T[n]:=A[n]*subs(k=n*Pi/L,exp(-k^2*t)*sin(k*x)); #bc2<br />

Tn := An e (¡n2 ¼ 2 t) sin(n¼x)


226 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

The complete series solution is T = P1 n=1 Tn, withtheformofAnto be determined<br />

from the initial condition. At t = 0, one must have<br />

1X<br />

T (x; 0) = An sin(n¼x)=100x (1 ¡ x):<br />

n=1<br />

If T (x; 0) is multiplied by sin(m¼x) and integrated from x =0tox = L =1,<br />

the lhs will integrate to zero for every term in the series except for the term<br />

corresponding to m = n. This is a result of the independence, or orthogonality,<br />

of the sine terms in the series. The resulting equation can then be solved for<br />

An. Russell will now apply this approach. He evaluates Tn at t =0,andenters<br />

the initial temperature pro¯le, T0 .<br />

> X:=eval(T[n],t=0); T0:=100*x*(1-x);<br />

X := An sin(n¼x) T0 := 100 x (1 ¡ x)<br />

Since only the nth term in the series survives, Russell forms T0 ¡ X, multiplies<br />

this by sin(n¼x), and integrates from x =0to1ineq.Theneq is set equal to<br />

zero and solved for An.<br />

> eq:=int((T0-X)*sin(n*Pi*x),x=0..1);<br />

> A[n]:=solve(eq=0,A[n]);<br />

200 (¡2+n¼sin(n¼)+2cos(n¼))<br />

An := ¡<br />

n2 ¼2 (n¼¡ sin(n¼)cos(n¼))<br />

Assuming that n is an integer, the nth Fourier term Tn is simpli¯ed, An having<br />

been automatically substituted. The double colon in assuming is a \type<br />

match" command.<br />

> T[n]:=simplify(T[n]) assuming n::integer;<br />

Tn := ¡ 400 (¡1+(¡1)n ) e (¡n2 ¼ 2 t) sin(n¼x)<br />

n3 ¼3 Thus, the temperature distribution in the rod satisfying the boundary and<br />

initial conditions is given by the following in¯nite Fourier series:<br />

> Temp:=Sum(T[n],n=1..infinity);<br />

1X<br />

Ã<br />

Temp := ¡ 400 (¡1+(¡1)n ) e (¡n2 ¼ 2 t) sin(n¼x)<br />

n3 ¼3 !<br />

n=1<br />

The sum of the ¯rst ¯ve terms gives a good approximation to T (x; t), because<br />

the contribution of higher-order terms drops very rapidly with increasing time.<br />

> TT:=sum(T[n],n=1..5);<br />

TT := 800 e(¡¼2 t) sin(¼x)<br />

¼3 + 800 e<br />

27<br />

(¡9 ¼2 t) sin(3 ¼x)<br />

¼3 + 32 e<br />

5<br />

(¡25 ¼2 t) sin(5 ¼x)<br />

¼3 Then TT is animated so its spatial and temporal evolution can be clearly seen.<br />

> animate(plot,[TT,x=0..1],t=0..1,frames=50);<br />

Russell is feeling sleepy, so is going back to bed. If you wish to see how the<br />

initial parabolic temperature pro¯le decays to zero everywhere inside the rod,<br />

execute the work sheet, click on the plot, and then on the play arrow.


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 227<br />

PROBLEMS:<br />

Problem 5-11: Hot rod<br />

For the heated rod discussed in the text, at what time is the temperature at<br />

the center of the rod equal to one-third of its initial value?<br />

Problem 5-12: The switch<br />

The temperatures at the ends x =0andx = 100 of a rod (insulated on its<br />

sides) 100 cm long are held at 0 ± and 100 ± , respectively, until steady state<br />

is achieved. Then at the instant t = 0, the temperatures of the two ends<br />

are interchanged. Determine the resultant temperature distribution T (x; t).<br />

Animate your solution and discuss its behavior.<br />

5.2.2 Aussie Barbecue<br />

He who does not mind his belly, will hardly mind anything else.<br />

Samuel Johnson, English author and lexicographer (1709{1784)<br />

When coauthor Richard spent a sabbatical leave at the Australian National<br />

University, in Canberra, he constructed a barbecue consisting of a scrap of<br />

rectangular iron plate placed on a primitive 2 brickwork support. The myriad<br />

eucalyptus trees that dot the landscape of the Australian Capital Territory and<br />

New South Wales constantly shed branches, which were gathered to be used<br />

as free barbecue fuel. With the iron plate slightly tilted to allow the grease<br />

from the sizzling lamb chops (accompanied with a cask of wine, the staple of<br />

the Australian outback barbecue) to drip o® into the ¯re, the °ames on the<br />

downhill edge of the plate tended to make that edge considerably hotter than<br />

the other edges of the plate. The temperature distribution in the plate was<br />

uneven, and vigilance was necessary to prevent the chops from being turned<br />

into charcoal. The Aussie barbecue is the inspiration for the following twodimensional<br />

boundary value example, in which the steady-state temperature<br />

pro¯le in a thin rectangular plate, with prescribed temperatures on the edges,<br />

is found.<br />

Consider a uniform solid rectangular plate stretching between x =0 and<br />

x = L and y =0 and y = h, whereL and h are measured in meters. Since<br />

what is important is the temperature di®erences across the plate, without loss<br />

of generality the coldest edge can be set equal to zero. Speci¯cally, we shall<br />

imagine the plate to have three \cold" edges whose temperatures are set equal to<br />

zero, i.e., T (0;y)=T (x; 0)=T (x; h)=0. The \hot" edge x=L will be assumed<br />

to have a parabolic temperature distribution given by T (L; y)=400y (h¡y) ± C.<br />

If, for example, h=1 m, the temperature along the hot edge will vary from zero<br />

at the corners to a temperature 100 ± hotter in the middle of that edge. Our goal<br />

is to determine the steady-state temperature distribution T (x; y) in the plate.<br />

2 Note: Richard is a theoretician, not an experimentalist.


228 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

The answer will require that the two-dimensional form of Laplace's equation,<br />

@ 2 T (x; y)<br />

@x 2<br />

+ @2 T (x; y)<br />

@y 2 =0; (5.9)<br />

be solved, subject to the four boundary conditions. After loading the plots<br />

package, we enter Laplace's equation (LE).<br />

> restart: with(plots):<br />

> LE:=diff(T(x,y),x,x)+diff(T(x,y),y,y)=0;<br />

μ μ <br />

2<br />

2<br />

@ @<br />

LE := T (x; y) + T (x; y) =0<br />

@x2 @y2 Using the pdsolve commandwiththeHINT=f(x)*g(y),INTEGRATE, andbuild<br />

options, we generate the general product solution of Laplace's equation.<br />

> sol:=pdsolve(LE,HINT=f(x)*g(y),INTEGRATE,build);<br />

sol := T (x; y) = C3 sin( p c1 y) C1 e (p c1 x) + C3 sin( p c1 y) C2<br />

e (p c1 x)<br />

+ C4 cos( p c1 y) C1 e (p c1 x) + C4 cos( p c1 y) C2<br />

e (p c1 x)<br />

The solution involves one separation constant c1 and four unknown coe±cients.<br />

For notational convenience, we substitute p c1 = m in the rhs of sol.<br />

> T:=subs(sqrt(_c[1])=m,rhs(sol));<br />

T := C3 sin(my) C1 e (mx) +<br />

+ C4 cos(my) C2<br />

e (mx)<br />

C3 sin(my) C2<br />

e (mx)<br />

+ C4 cos(my) C1 e (mx)<br />

The coe±cients are determined from the four boundary conditions. To satisfy<br />

T (x; 0) = 0, the cos(my) terms are removed since they don't vanish at y =0.<br />

> T:=remove(has,T,cos(m*y)); #bc1<br />

T := C3 sin(my) C1 e (mx) C3 sin(my) C2<br />

+<br />

e (mx)<br />

Then T is converted completely to trigonometric form.<br />

> T:=expand(convert(T,trig));<br />

T := C3 sin(my) C1 cosh(mx)+ C3 sin(my) C1 sinh(mx)<br />

C3 sin(my) C2<br />

+<br />

cosh(mx) + sinh(mx)<br />

The second boundary condition is that T (0;y) = 0. Since cosh(mx)doesn't<br />

vanish at x = 0, terms involving cosh(mx) are removed from T .<br />

> T:=remove(has,T,cosh(m*x)); #bc2<br />

T := C3 sin(my) C1 sinh(mx)<br />

The third boundary condition, T (x; h) = 0, requires that sin(mh)=0,sothat<br />

m = n¼=hwith n a positive integer. This relation is substituted into T ,and


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 229<br />

the awkward coe±cient combination replaced with An. The resulting form,<br />

labeled Tn, isthenthterm in the in¯nite Fourier series solution.<br />

> T[n]:=A[n]*subs(m=n*Pi/h,T)/(_C3*_C1); #bc3<br />

³<br />

n¼y<br />

´ ³<br />

n¼x<br />

´<br />

Tn := An sin sinh<br />

h<br />

h<br />

The remaining boundary condition must be applied along the \hot" edge at<br />

x = L. ThenTnis evaluated at this value in S, and the temperature distribution<br />

T0 =400y (h ¡ y) along the hot edge entered.<br />

> S:=eval(T[n],x=L); T0:=400*y*(h-y);<br />

³<br />

n¼y<br />

´ μ <br />

n¼L<br />

S := An sin sinh<br />

T0 := 400 y (h ¡ y)<br />

h<br />

h<br />

On the edge x = L, wehave<br />

1X ³<br />

n¼y<br />

´ μ <br />

n¼L<br />

T (L; y) = An sin sinh = T0 = 400 y (h ¡ y):<br />

h<br />

h<br />

n=1<br />

If T (L; y) is multiplied by sin(m¼y=h) and integrated from y =0toh, thelhs<br />

will yield zero except for m = n. Thus, the coe±cient An can be determined<br />

in a manner similar to the last recipe. The next two command lines carry out<br />

this procedure and calculate An.<br />

> eq:=int((S-T0)*sin(n*Pi*y/h),y=0..h)=0: #bc4<br />

> A[n]:=solve(eq,A[n]):<br />

Assuming that n is an integer, the nth Fourier term is simpli¯ed, An having<br />

been automatically substituted.<br />

> T[n]:=simplify(T[n]) assuming n::integer;<br />

1600 h<br />

Tn := ¡<br />

2 (¡1+(¡1) n ³<br />

n¼y<br />

´ ³<br />

n¼x<br />

´<br />

)sin sinh<br />

h<br />

h<br />

n3 μ <br />

n¼L<br />

sinh ¼<br />

h<br />

3<br />

The complete solution is T (x; y) = P1 n=1 Tn. To plot the solution, we will take<br />

L =1,h = 1, and keep terms in the series up to n =7,<br />

> L:=1: h:=1: Temp:=sum(T[n],n=1..7);<br />

Temp :=<br />

3200 sin(¼y) sinh(¼x)<br />

sinh(¼) ¼ 3<br />

+ 3200<br />

27<br />

sin(3 ¼y) sinh(3 ¼x)<br />

sinh(3 ¼) ¼ 3<br />

+ 128 sin(5 ¼y) sinh(5 ¼x)<br />

5 sinh(5 ¼) ¼3 + 3200 sin(7 ¼y) sinh(7 ¼x)<br />

343 sinh(7 ¼) ¼3 which is su±ciently accurate here. By itself, the series representation doesn't<br />

tell us much. To see the steady-state temperature distribution T (x; y) inthe<br />

plate, a three-dimensional colored contour plot with 20 equally spaced contours<br />

is created.<br />

> plot3d(Temp,x=0..L,y=0..h,axes=boxed,style=patchcontour,<br />

contours=20,orientation=[-132,35],tickmarks=[2,2,2]);


230 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

100<br />

0<br />

1<br />

y<br />

0<br />

Figure 5.6: Three-dimensional contour plot of the temperature distribution.<br />

The resulting picture is shown in Figure 5.6. From the ¯gure, the reader can<br />

get a good feeling for how the temperature distribution drops o® from the hot<br />

edge. If it is desired to know the temperature at a particular point, a more<br />

accurate answer can be obtained by substituting the coordinates of the point<br />

into the series solution. For example, the temperature in the middle (x = L=2,<br />

y = h=2) of the plate is evaluated,<br />

> middle:=evalf(eval(Temp,fx=L/2,y=h/2g));<br />

and found to be about 20 1<br />

2<br />

0<br />

x<br />

middle := 20:53145858<br />

± warmer than on the cold edges.<br />

PROBLEMS:<br />

Problem 5-13: Electric potential<br />

An in¯nitely long hollow conductor has a rectangular cross section with sides L<br />

and 2 L. One of the longer sides is charged to a potential V =V0 and the other<br />

three sides are held at zero potential. By solving Laplace's equation, determine<br />

the potential distribution in the interior region. Taking V0 =1 andL =1, plot<br />

the equipotential lines. Calculate the electric ¯eld ~ E = ¡rV in the interior<br />

region. Plot ~ E on the same graph as the equipotential lines.<br />

Problem 5-14: Barbecue plate<br />

Suppose that a rectangular barbecue plate has a ¯nite thickness c =0:01 m<br />

in the z-direction and dimensions a =0:5 mandb =0:5 minthex- and<br />

y-directions, respectively. Assuming that the bottom of the plate is uniformly<br />

heated and is 100 ± hotter than the other ¯ve sides, determine the steady-state<br />

temperature distribution T (x; y; z) inside the plate and make a suitable plot.<br />

1


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 231<br />

5.2.3 Benny's Solution<br />

A good scientist is a person with original ideas. A good engineer is<br />

a person who makes a design that works with as few original ideas<br />

as possible. There are no prima donnas in engineering.<br />

Freeman Dyson, British-born U.S. physicist (1923{)<br />

Greg Arious Nerd is currently teaching the mathematical physics course to a<br />

mixture of future engineers and physicists at Erehwon's most famous academic<br />

institution, EIT (Erehwon Institute of Technology). The students are being<br />

instructed in the use of the Elpam computer algebra system in solving their<br />

mathematical physics problems. As a classroom example, Greg selects a somewhat<br />

arti¯cial, but pedagogically useful, two-dimensional static potential problem.<br />

A circular annulus has an angular potential distribution Á(10;μ)=15cosμ<br />

speci¯ed on the inner radius r1 =10cmandapotentialÁ(20;μ)=30sinμ on<br />

the outer radius r2 = 20 cm. The question to be answered is, \What is the<br />

potential distribution in the annular region, and what do the equipotentials<br />

look like in this region?"<br />

The following recipe for solving this problem has been submitted by one of<br />

Greg's engineering students, Benjamin Beetlebrox III. Although, as a descendent<br />

of one of the founding families on Erehwon, he doesn't like his ¯rst name<br />

shortened, we shall take Freeman Dyson's words to heart and call him Benny.<br />

In addition to the plots package needed for plotting the equipotentials,<br />

Benny loads the VectorCalculus package, because it contains the Laplacian<br />

command, which will enable him to easily generate Laplace's equation for the<br />

potential Á(r; μ) in polar coordinates. The radial (r) and angular (μ) polarcoordinates<br />

are related to the Cartesian coordinates (x; y) through the relations<br />

x = r cos μ, y = r sin μ.<br />

> restart: with(plots): with(VectorCalculus):<br />

Curious about the coordinate systems that the Elpam system supports, Benny<br />

enters the following command line. On executing this line, a list of the available<br />

two- and three-dimensional coordinate systems appears in a Help page.<br />

> ?coords;<br />

Through the hyperlinks at the bottom of the Help page, Benny is led to the<br />

coordplot and coordplot3d commands for plotting representative curves and<br />

surfaces in two and three dimensions, corresponding to holding each coordinate<br />

equal to a constant value. Closing the Help window, Benny uses coordplot<br />

to plot the lines r =constantandμ = constant in polar coordinates. The<br />

grid option is used to control the number of constant values and therefore<br />

the number of lines drawn. The default is grid=[12,12]. The values of the<br />

constants are added to the graph by including labeling=true. More detailed<br />

explanations and other options may be found on the coordplot Help page.<br />

> coordplot(polar,grid=[5,7],labelling=true,<br />

scaling=constrained);


232 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

Pi<br />

2/3*Pi 1/3*Pi<br />

4/3*Pi<br />

0<br />

1/4<br />

1/2<br />

5/3*Pi<br />

3/4<br />

Figure 5.7: Constant r and μ lines in polar coordinates.<br />

The resulting picture is reproduced in Figure 5.7, circles being produced for<br />

r =0; 1 1 3 ; ; ; 1 and polar lines for μ =0;¼=3; 2 ¼=3; ¼;::::<br />

4 2 4<br />

Benny now enters Laplace's equation (LE ) in polar coordinates.<br />

> LE:=expand(Laplacian(phi(r,theta),'polar'[r,theta]))=0;<br />

LE :=<br />

@<br />

Á(r; μ)<br />

@r<br />

r<br />

μ 2 @<br />

+<br />

Á(r; μ)<br />

@r2 <br />

+<br />

1<br />

@2 Á(r; μ)<br />

@μ2 The pdsolve commandwiththeHINT=f(r)*g(theta), INTEGRATE and build<br />

options is used to ¯nd the general product solution of Laplace's equation.<br />

> sol:=pdsolve(LE,HINT=f(r)*g(theta),INTEGRATE,build);<br />

r 2<br />

=0<br />

sol := Á(r; μ) = C3 sin( p c1 μ) C1 r (p c1) + C3 sin( p c1 μ) C2<br />

r (p c1)<br />

+ C4 cos( p c1 μ) C1 r (p c1) + C4 cos( p c1 μ) C2<br />

r (p c1)<br />

Benny notes that the solution must reduce to a cos μ form on one boundary<br />

and a sin μ form on the other, so he accordingly sets the separation constant<br />

p c1 = 1 on the rhs of sol.<br />

> phi:=subs(sqrt(_c[1])=1,rhs(sol));<br />

C3 sin(μ) C2<br />

C4 cos(μ) C2<br />

Á := C3 sin(μ) C1 r + + C4 cos(μ) C1 r +<br />

r<br />

r<br />

The terms are then grouped by successively collecting cos μ, sinμ, andrterms.


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 233<br />

> phi:=collect(phi,[cos(theta),sin(theta),r]);<br />

μ<br />

μ<br />

<br />

C4 C2<br />

C3 C2<br />

Á := C4 C1 r + cos(μ)+ C3 C1 r + sin(μ)<br />

r<br />

r<br />

To simplify the coe±cients in Á, Benny makes the following substitutions.<br />

> phi:=subs(_C3=a/_C1,_C2=b*_C1/a,_C4=c/_C1,phi);<br />

μ<br />

Á := cr+ cb<br />

μ<br />

cos(μ)+ ar+<br />

ar<br />

b<br />

<br />

sin(μ)<br />

r<br />

> phi:=algsubs(c*b=a*d,phi);<br />

μ<br />

Á := cos(μ) cr+ d<br />

μ<br />

+ ar+<br />

r<br />

b<br />

<br />

sin(μ)<br />

r<br />

To determine the four unknown coe±cients a, b, c, andd, four boundary conditions<br />

are required. On the inner boundary, r = 10 cm, the coe±cient of the<br />

cos μ term must equal 15, while the coe±cient of the sin μ term must equal zero.<br />

This yields two boundary conditions, labeled bc1 and bc2 .<br />

> bc1:=eval(coeff(phi,cos(theta)),r=10)=15;<br />

bc1 := 10 c + d<br />

10 =15<br />

> bc2:=eval(coeff(phi,sin(theta)),r=10)=0;<br />

bc2 := 10 a + b<br />

10 =0<br />

On the outer boundary, r =20cm,thecoe±cientofthesinμterm must equal<br />

30, while the coe±cient of the cos μ term is equal to zero. This yields two more<br />

boundary conditions, bc3 and bc4 .<br />

> bc3:=eval(coeff(phi,sin(theta)),r=20)=30;<br />

bc3 := 20 a + b<br />

20 =30<br />

> bc4:=eval(coeff(phi,cos(theta)),r=20)=0;;<br />

bc4 := 20 c + d<br />

20 =0<br />

The four boundary condition equations are solved for a, b, c, andd,<br />

> coefficients:=solve(fbc1,bc2,bc3,bc4g,fa,b,c,dg);<br />

½<br />

coe±cients := d =200;a=2;c= ¡1<br />

¾<br />

;b= ¡200<br />

2<br />

which are assigned to produce the ¯nal solution Á to the potential problem.<br />

> assign(coefficients): phi:=phi;<br />

μ<br />

Á := cos(μ) ¡ r<br />

μ<br />

200<br />

+ + 2 r ¡<br />

2 r<br />

200<br />

<br />

sin(μ)<br />

r<br />

As requested by Professor Nerd, Benny will now use Á to plot the equipotentials<br />

in the annular region between r = 10 and 20. He ¯rst converts the potential<br />

into Cartesian coordinates by substituting r = p x2 + y2 ,cosμ = x= p x2 + y2 ,<br />

and sin μ = y= p x2 + y2 ,intoÁ.


234 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

> phi:=subs(fr=sqrt(x^2+y^2),cos(theta)=x/sqrt(x^2+y^2),<br />

sin(theta)=y/sqrt(x^2+y^2)g,phi):<br />

He then creates a piecewise potential function © equal to Á for 100 · x2 + y2 ·<br />

400 and zero otherwise. (The © output is suppressed here.)<br />

> Phi:=piecewise(100implicitplot(fPhi=5*ig,x=-20..20,y=-20..20,<br />

scaling=constrained,grid=[100,100]):<br />

The sequence of constant-potential plots is then displayed for i = ¡6 to+6,<br />

the result being shown in Figure 5.8.<br />

> display(fseq(F(i),i=-6..6)g);<br />

20<br />

y<br />

10<br />

–20 –10 10 20<br />

x<br />

–10<br />

–20<br />

Figure 5.8: Equipotential lines for the circular annulus.<br />

Although, he hasn't bothered to label the equipotential lines, Benny feels that<br />

the plot already conveys a better sense of the equipotentials than could be<br />

gained by staring at the formula, simple as it is. He has left the labeling of the<br />

equipotentials for you to carry out as a problem.<br />

PROBLEMS:<br />

Problem 5-15: Labeling of equipotential lines<br />

Using the textplot command, add appropriate potential values to Figure 5.8<br />

so that the equipotential lines are clearly identi¯ed.


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 235<br />

Problem 5-16: Split potential<br />

Along the circumference of a circle of radius r =1,thepotentialÁ(r; μ) has<br />

the value Á =1fortheangularrange0


236 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

5.2.4 Hugo and the Atomic Bomb<br />

If the radiance of a thousand suns were to burst forth at once in the<br />

sky, that would be like the splendor of the Mighty One.<br />

Bhagavad Gita, a philosophical dialogue that is a sacred Hindu text, found in<br />

the Mahabharata, one of the ancient Sanskrit epics (250 BC{250 AD)<br />

Hugo, who was formerly a scientist in country X, has emigrated to the New<br />

World in search of a better life. Unfortunately, he has been forced to temporarily<br />

drive taxis until he can ¯nd a job more suitable to his educational training.<br />

While waiting for his next fare, he tries to keep his mind sharp by carrying out<br />

model calculations on his laptop computer. At this particular moment, Hugo is<br />

working on the problem of the growth of the neutron density in a nuclear chain<br />

reaction. Let's eavesdrop on what Hugo is doing.<br />

Hugo knows that if uranium nuclei are bombarded with neutrons, a given<br />

nucleus may absorb a neutron, resulting in the splitting of the uranium nucleus<br />

into two parts with the release of substantial energy as well as two or three of<br />

the neutrons that were already present in the nucleus. This splitting process<br />

is called nuclear ¯ssion andisthe¯rststepinachain reaction. Whether the<br />

reaction will keep on going depends on how many of the released neutrons are<br />

available to initiate another ¯ssion process. The factor by which the number of<br />

neutrons increases between one step and the next in the chain reaction is called<br />

the multiplication factor. In a nuclear reactor, the multiplication factor is kept<br />

at unity (called the critical condition) by using boron or cadmium control rods<br />

to \soak up" excess neutrons. In this case, the chain reaction proceeds at a<br />

constant rate with a steady output of energy. If the multiplication factor is<br />

greater than unity (the supercritical condition), the chain reaction leads to a<br />

geometrically increasing number of ¯ssions in a very short time interval with the<br />

accompanying release of an enormous amount of energy. A nuclear explosion<br />

takes place | the basis of the atomic bomb.<br />

Hugo decides that he can learn more about the underlying role that the<br />

neutrons play in the chain reaction by modeling the time evolution of some<br />

speci¯ed initial neutron distribution inside a mass of ¯ssionable material. For<br />

calculational purposes, he takes the mass to be cylindrical in shape with a radius<br />

r = a, the lower face of the cylinder at z = 0 and the upper face at z = h.<br />

For simplicity, Hugo takes the neutron density N (number of neutrons per unit<br />

volume) to be independent of the angular coordinate μ, i.e., N = N(r; z; t). In<br />

the absence of any production of neutrons by ¯ssion, the neutron density would<br />

obey the linear di®usion equation. To account for the production of neutrons<br />

by ¯ssion, Hugo adds a neutron source term ¯N,where¯is a positive rate<br />

constant, to the di®usion equation, viz.,<br />

@N<br />

@t = d r2N + ¯N: (5.10)<br />

In order to use the cylindrical polar form of the Laplacian, he calls up the<br />

VectorCalculus package.


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 237<br />

> restart: with(plots): with(VectorCalculus):<br />

The di®usion equation is entered with the Laplacian in cylindrical coordinates.<br />

> de:=diff(N(r,z,t),t)-beta*N(r,z,t)<br />

=d*Laplacian(N(r,z,t),'cylindrical'[r,theta,z]);<br />

de := @<br />

N (r; z; t) ¡ ¯ N (r; z; t)<br />

@t<br />

μ 2 @<br />

μ 2 @<br />

μμ<br />

@<br />

N (r; z; t)<br />

@r<br />

d<br />

+ r N (r; z; t) + r N (r; z; t)<br />

@r2 @z2 =<br />

r<br />

The di®usion equation de is solved with the pdsolve command, the HINT option<br />

being omitted, because Maple already assumes a general product solution. After<br />

the introduction of two separation constants c1 and c2, the PDE is separated<br />

into three ODEs which are solved and the product formed.<br />

> sol:=pdsolve(de,INTEGRATE,build);<br />

sol := N (r; z; t)<br />

= e (p p c2 z) (td c1) (td c2) (t¯) C5 e e e C1 BesselJ(0; ¡ c1 r) C3<br />

+ C5 e(td c1) e (td c2) e (t¯) C1 BesselJ(0; p ¡ c1 r) C4<br />

e (p c2 z)<br />

+ e (p c2 z) (td c1) (td c2) (t¯) p<br />

C5 e e e C2 BesselY(0; ¡ c1 r) C3<br />

+ C5 e(td c1) e (td c2) e (t¯) C2 BesselY(0; p ¡ c1 r) C4<br />

e (p c2 z)<br />

The solution sol involves a linear combination of a zeroth-order Bessel function<br />

of the ¯rst kind (J0( p ¡ c1 r) in math notation) and a zeroth-order Bessel function<br />

of the second kind (Y0( p ¡ c1 r)). The latter Bessel function diverges at<br />

r = 0 at arbitrary time, so Hugo imposes the ¯rst boundary condition, removing<br />

terms involving BesselY from the rhs of the solution.<br />

> N:=remove(has,rhs(sol),BesselY); #bc1<br />

N := e (p p c2 z) (td c1) (td c2) (t¯) C5 e e e C1 BesselJ(0; ¡ c1 r) C3<br />

+ C5 e(td c1) (td c2) (t¯) p<br />

e e C1 BesselJ(0; ¡ c1 r) C4<br />

e (p c2 z)<br />

Hugo simpli¯es N by substituting c1 = ¡¹ 2 and c2 = ¡º 2 and applying the<br />

simplify command with the symbolic option.<br />

> N:=simplify(subs(f_c[1]=-mu^2,_c[2]=-nu^2g,N),symbolic);<br />

N := C5 C1 BesselJ(0; ¹r) e (¡td¹2 ¡tdº 2 +t¯) ( C3 e (ºzI) + C4 e (¡I ºz) )<br />

The complex form is split into real and imaginary parts with the complex<br />

evaluation command.<br />

> N:=evalc(N);


238 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

N := C5 C1 BesselJ(0; ¹r) e (¡td¹2 ¡tdº 2 +t¯) ( C3 cos(ºz)+ C4 cos(ºz))<br />

+ C5 C1 BesselJ(0; ¹r) e (¡td¹2 ¡tdº 2 +t¯) ( C3 sin(ºz) ¡ C4 sin(ºz)) I<br />

Hugo assumes that the neutron density at the surface of the cylindrical mass is<br />

zero. Thus, since it doesn't go to zero at z =0,thecos(ºz) term is removed<br />

(a second boundary condition) from N and the result factored.<br />

> N:=factor(remove(has,N,cos)); #bc2<br />

N := C5 C1 BesselJ(0; ¹r) e (¡t (¡¯+d¹2 +dº 2 )) sin(ºz)(¡ C4 + C3) I<br />

In the next command line, Hugo removes the \ugly" Maple coe±cient combination<br />

from N by forming the product of the 4th, 5th, and 6th operands of N,<br />

the other operands corresponding to the various constants.<br />

> N2:=op(4,N)*op(5,N)*op(6,N);<br />

N2 := BesselJ(0; ¹r) e (¡t (¡¯+d¹2 +dº 2 )) sin(ºz)<br />

Since the neutron density is zero on the cylindrical surface r = a and at the end<br />

z = h, two more boundary conditions must be imposed. At r = a, J0(¹a)=0,<br />

so that ¹ = ¸m=a, where ¸m is the mth zero of J0. These zeros may be<br />

found with the command BesselJZeros(0,m), wherem =1; 2;:::: At z = h,<br />

sin(ºh)=0,soº = n¼=h,withn a positive integer. This pair of boundary<br />

condition relations is substituted into N2.<br />

> N2:=subs(fmu=BesselJZeros(0,m)/a,nu=n*Pi/hg,N2); #bcs<br />

μ<br />

N2 := BesselJ 0;<br />

<br />

BesselJZeros(0; m) r<br />

a<br />

d BesselJZeros(0;m)2<br />

e<br />

(¡t (¡¯ + a2 + dn2 ¼ 2<br />

h2 ³<br />

)) n¼z<br />

´<br />

sin<br />

h<br />

By the principle of linear superposition, the complete solution will be<br />

1X 1X<br />

1X 1X<br />

N(r; z; t) = Cm;n N2 ´ Nm;n;<br />

m=1 n=1<br />

m=1 n=1<br />

with the Cm;n determined by the initial neutron density N(r; z; 0) = f. Evaluating<br />

N2 at t = 0, and labeling the result g,<br />

> g:=eval(N2,t=0);<br />

μ<br />

<br />

BesselJZeros(0; m) r<br />

³<br />

n¼z<br />

´<br />

g := BesselJ 0; sin<br />

a<br />

h<br />

one has<br />

1X 1X<br />

N(r; z; 0) = Cm;n g = f:<br />

m=1 n=1<br />

If we multiply both sides of N(r; z; 0) by rJ0(¸m0 r=a)sin(n0¼z=h)andinte grate r from 0 to a and z from 0 to h, the lhs will yield zero unless m = m 0<br />

and n = n 0 . Solving for Cm 0 ;n 0, and dropping the primes, the coe±cients can<br />

be calculated from<br />

R a R h<br />

0 0<br />

Cm;n =<br />

rfgdrdz<br />

R a R h<br />

0 0 rg2 dr dz :


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 239<br />

For an initial neutron density satisfying the boundary conditions, Hugo takes<br />

f to be of the following simple structure:<br />

> f:=(1-r^2/a^2)*sin(Pi*z/h);<br />

f :=<br />

μ<br />

1 ¡ r2<br />

a2 <br />

³<br />

¼z<br />

´<br />

sin<br />

h<br />

The coe±cients Cm;n are calculated, and then the Fourier term Nm;n.<br />

> C[m,n]:=int(int(r*f*g,z=0..h),r=0..a)<br />

/int(int(r*g^2,z=0..h),r=0..a):<br />

> N[m,n]:=C[m,n]*N2;<br />

For integer n>1, Nm;n should be equal to zero, since only an n =1term<br />

occurs in f. Hugo checks that this is the case.<br />

> simplify(N[m,n]) assuming n::integer,n>1;<br />

0<br />

To determine Nm;1 greater care must be exercised, and the limit taken as n ! 1.<br />

The result then is simpli¯ed with respect to the exponentials.<br />

> N[m,1]:=simplify(limit(N[m,n],n=1),exp);<br />

Nm; 1 := 8 sin<br />

³<br />

¼z<br />

´ μ<br />

BesselJ 0;<br />

h<br />

<br />

BesselJZeros(0; m) r<br />

a<br />

e (¡ (¡¯ a2 h 2 +d BesselJZeros(0;m) 2 h 2 +d¼ 2 a 2 ) t<br />

a2 h2 )<br />

Á<br />

BesselJ(1; BesselJZeros(0; m)) BesselJZeros(0; m) 3<br />

The total neutron density at time t then is P 1<br />

m=1 Nm;1. To plot the density,<br />

Hugo takes the nominal values a =1,h =1,andd = 1. In the time-dependent<br />

part of the density, the coe±cient of t is ¯ ¡ d (¸ 2 m =a2 + ¼ 2 =h 2 ). The largest<br />

possible positive value of this coe±cient occurs when m = 1, corresponding to<br />

the ¯rst zero of J0. Inthiscase¸1 ¼ 2:405. If<br />

¯


240 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

> Density:=sum(eval(N[m,1],fa=1,h=1,d=1,beta=15.7g),m=1..3);<br />

Density :=<br />

(0:047209632 t)<br />

1:108022261 sin(3:141592654 z)BesselJ(0:; 2:404825558 r) e<br />

(¡24:64086674 t)<br />

¡ 0:1397775054 sin(3:141592654 z)BesselJ(0:; 5:520078110 r) e<br />

(¡69:05661119 t)<br />

+0:04547647069 sin(3:141592654 z)BesselJ(0:; 8:653727913 r) e<br />

The numerical coe±cient of t in the ¯rst term of the output is slightly positive<br />

while the coe±cients of t in the other terms are large negative numbers.<br />

Thus, the ¯rst term in the series will grow with time and all remaining terms<br />

exponentially decay. If the neutron density grows fast enough, an uncontrolled<br />

chain reaction, i.e., an explosion, will occur.<br />

To create a dynamic 3-dimensional picture of the explosive growth in neutron<br />

density (the \nuclear explosion"), Hugo makes use of the animation command.<br />

> animate(plot3d,[Density,r=-1..1,z=0..1],t=0..100,<br />

frames=25,orientation=[65,40],shading=zhue,<br />

style=patchnogrid,grid=[25,25],axes=framed);<br />

As Hugo contentedly looks at the \explosion" on his computer screen, running<br />

in the loop mode and with 200% zoom magni¯cation, he hears a gru® voice.<br />

\Hey Buddy, if you don't mind, I am running late and have to get to the<br />

airport."<br />

Interrupted by harsh reality, Hugo puts his computer away, but hopes that<br />

one of his job applications will pan out soon.<br />

PROBLEMS:<br />

Problem 5-23: Spherical mass<br />

Carry out a calculation similar to that in the text recipe for a ¯ssionable spherical<br />

mass of radius r = a andaninitialneutrondensityf(r) =1¡ r2 =a2 .<br />

Make an animated plot of the neutron density inside the sphere when the mass<br />

slightly exceeds the critical mass.<br />

Problem 5-24: Semicircular plate<br />

A thin semicircular plate of radius r = 1 has its edges held at zero temperature<br />

and its °at faces insulated. If the initial temperature distribution inside the<br />

plate is T (r; μ; 0) = 100 r2 cos(2 μ), determine the temperature T (r; μ; t) for<br />

t>0. Taking the di®usion constant d = 1, animate the temperature pro¯le.<br />

Problem 5-25: Temperature distribution<br />

A solid has the shape of an in¯nitely long quarter-cylinder of radius r =1<br />

and di®usion constant d. The °at sides are insulated, so no heat °ows through<br />

them, while the curved surface is kept at 100 ± C. Assuming that the temperature<br />

initially varies as the fourth power of the distance from the axis, ¯nd<br />

the temperature distribution at any point inside the solid for t>0. Choosing<br />

nominal parameter values, create an animated plot of the temperature pro¯le.<br />

Problem 5-26: Cylindrical temperature pro¯le<br />

A cylinder of unit radius and unit height has its circular ends z =0andz =1


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 241<br />

kept at T =0andT = 1, respectively, while the circular surface is kept at<br />

T = 1. Determine the steady-state temperature pro¯le inside the cylinder and<br />

plot the contours of equal temperature.<br />

Problem 5-27: Elliptic cross section<br />

An in¯nitely long bar of elliptic cross section has its curved surface, x2 +4 y2 =1,<br />

kept at T =0 ± . Determine the temporal evolution of T in the cylinder if initially<br />

T =100 ± everywhere inside and the di®usion constant d=1. Animate the result.<br />

5.2.5 Hugo Prepares for His Job Interview<br />

I'm notorious for giving a bad interview. I'm an actor and I can't<br />

help but feel I'm boring when I'm on as myself.<br />

Rock Hudson, American movie actor (1925{1985)<br />

Hugo has been invited by International Hydrodynamics Inc. to interview for a<br />

research position with their company, which specializes in designing streamlined<br />

hulls for surface vessels as well as underwater craft. As part of his preparation,<br />

Hugo decides to create some ¯les for the interview that demonstrate his skills<br />

at simulating liquid °ow around a variety of rigid geometrical shapes. As a<br />

\warm-up" exercise, he recalls from his undergraduate days a problem involving<br />

uniform incompressible °uid °ow around a sphere, a problem that can be<br />

solved analytically. Hugo remembers that the °uid can be characterized by a<br />

velocity potential U that satis¯es Laplace's equation. The velocity ~ V of a °uid<br />

element is then given by ~ V = ¡rU.<br />

Since a spherical boundary of, say, radius a is involved, Hugo chooses to use<br />

spherical coordinates (r; μ; Á) with the origin at the center of the sphere and the<br />

physicist's convention that μ is measured from the positive z-axis and Á from<br />

the positive x-axis. Then, the Cartesian and spherical polar coordinates are<br />

connected by the relations x = r sin μ cos Á, y = r sin μ sin Á, andz = r cos μ.<br />

The range of r is from 0 to 1, μ from 0 to ¼, andÁfrom0to2¼. At a distance r far from the sphere, the °uid °ow is assumed to be uniform<br />

and directed along the z-axis.Theasymptotic(larger) form of the velocity is<br />

~V = V0 ^ez where V0 is the undisturbed °uid speed. Thus, since<br />

~V = ¡ @U<br />

@x ^ex ¡ @U<br />

@y ^ey ¡ @U<br />

@z ^ez = V0 ^ez; (5.11)<br />

then, on equating vector components and integrating, the asymptotic velocity<br />

potential is given (to within an arbitrary constant) by U = ¡V0 z = ¡V0 r cos μ.<br />

This will serve as one of the boundary conditions on the solution. The other<br />

boundary condition is at the surface of the sphere. If the surface is idealized to<br />

be absolutely rigid, it will acquire no momentum from the °uid. This implies<br />

that the normal component of the °uid velocity vector must vanish at r = a.<br />

Writing the gradient operator in spherical polar coordinates, this means that<br />

the velocity potential must satisfy the boundary condition @U=@rjr=a =0.


242 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

To solve Laplace's equation, Hugo loads the VectorCalculus package,<br />

> restart: with(plots): with(VectorCalculus):<br />

and inputs Laplace's equation in spherical coordinates. He notes that the problem<br />

has rotational symmetry about the z-axis, the direction of °uid °ow, so<br />

that there should be no Á dependence in the ¯nal solution. Accordingly, he<br />

takes U = U(r; μ).<br />

LE:=<br />

> LE:=expand(Laplacian(U(r,theta),'spherical'[r,theta,phi]))=0;<br />

μ <br />

@<br />

2 U (r; μ)<br />

@r<br />

r<br />

μ 2 @<br />

+<br />

U (r; μ)<br />

@r2 <br />

+<br />

μ <br />

@<br />

cos(μ) U (r; μ)<br />

@μ<br />

r 2 sin(μ)<br />

+<br />

@2 U (r; μ)<br />

@μ2 With no HINT provided, a general product solution is built with the pdsolve<br />

command, the answer involving one separation constant, c1, and four arbitrary<br />

constants. The result is then expanded.<br />

> sol:=expand(pdsolve(LE,INTEGRATE,build));<br />

sol := U (r; μ) =<br />

+<br />

+<br />

+<br />

C1 r (1=2 p μ<br />

1+4 c1) 1<br />

C3 LegendreP<br />

C1 r (1=2 p 1+4 c1) C4 LegendreQ<br />

p r<br />

μ 1<br />

2<br />

C2 r (¡1=2 p μ<br />

1+4 c1) 1<br />

C3 LegendreP<br />

p r<br />

C2 r (¡1=2 p μ<br />

1+4 c1) 1<br />

C4 LegendreQ<br />

p r<br />

2<br />

p r<br />

2<br />

r 2<br />

=0<br />

p<br />

1+4 c1 ¡ 1<br />

<br />

; cos(μ)<br />

2<br />

p<br />

1+4 c1 ¡ 1<br />

<br />

; cos(μ)<br />

2<br />

2<br />

p<br />

1+4 c1 ¡ 1<br />

<br />

; cos(μ)<br />

2<br />

p<br />

1+4 c1 ¡ 1<br />

<br />

; cos(μ)<br />

2<br />

The solution is expressed in terms of Legendre functions of the ¯rst kind<br />

(LegendreP) and of the second kind (LegendreQ). The former are well-behaved<br />

polynomial functions of cos μ, but the latter diverge at the ends of the angular<br />

range and therefore must be removed on physical grounds.<br />

> U:=remove(has,rhs(sol),LegendreQ);<br />

U :=<br />

C1 r (1=2 p μ<br />

1+4 c1) 1<br />

C3 LegendreP<br />

p r<br />

C2 r (¡1=2 p μ<br />

1+4 c1) 1<br />

C3 LegendreP<br />

2<br />

p<br />

1+4 c1 ¡ 1<br />

<br />

; cos(μ)<br />

2<br />

p<br />

1+4 c1 ¡ 1<br />

<br />

; cos(μ)<br />

2<br />

+<br />

p<br />

r<br />

2<br />

In standard math notation, the Legendre polynomials of the ¯rst kind would


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 243<br />

be written as Pn(cos μ), where n = 1p<br />

1+4 c1 ¡ 2<br />

1.<br />

To express U in the<br />

2<br />

Maple equivalent of the math notation, Hugo substitutes c1 = ¡ 1<br />

1 +(n + 4 2 )2 ,<br />

and simpli¯es the square root that would otherwise appear by including the<br />

symbolic option.<br />

> U:=simplify(subs(_c[1]=-1/4+(n+1/2)^2,U),symbolic);<br />

U := C3 LegendreP(n; cos(μ)) ( C1 r(n+1=2) + C2 r (¡n¡1=2) )<br />

p<br />

r<br />

To simplify the notation, and without any loss of generality, Hugo sets C3 =1,<br />

C1 =A, andC2 =B, inU. On some executions of the recipe the coe±cient<br />

C3 inU is replaced with C4, so the latter is also set equal to one.<br />

> U:=subs(f_C3=1,_C4=1,_C1=A,_C2=Bg,U);<br />

U := LegendreP(n; cos(μ)) (Ar(n+1=2) + Br (¡n¡1=2) )<br />

p r<br />

Only two coe±cients, A and B, remain to be evaluated, so the two boundary<br />

conditions mentioned earlier are used. The radial derivative of U must be zero<br />

at r = a, which is now entered, and solved for B in terms of A.<br />

> bc:=eval(diff(U,r),r=a)=0;<br />

> B:=simplify(solve(bc,B));<br />

n+1) nAa(2<br />

B :=<br />

n +1<br />

Now Hugo recalls that the ¯rst few Legendre polynomial functions of the ¯rst<br />

kind are P0(cos μ) =1,P1(cos μ) =cosμ, andP2(cos μ) = 1<br />

2 (3 cos2 μ ¡ 1), ::::<br />

Although the general solution will involve a sum over n from 1 to 1, only the<br />

n = 1 term has the correct cos μ dependence to match the asymptotic form of<br />

the velocity potential. The coe±cients of all terms for which n 6= 1mustbe<br />

equal to zero. As r !1, U ! AP1(cos μ) r = ¡V0 r cos μ, soA = ¡V0. The<br />

potential U is now evaluated with A = ¡V0 and n = 1, and simpli¯ed.<br />

> U:=simplify(eval(U,fA=-V[0],n=1g));<br />

U := ¡ 1 cos(μ) V0 (2 r<br />

2<br />

3 + a3 )<br />

r2 So the velocity potential U is now completely known. In standard texts, the<br />

potential and velocity distributions would probably only be sketched, if drawn<br />

at all. Hugo knows that this is not good enough for his prospective employers.<br />

He decides to create a plot of the region outside the sphere that shows the<br />

equipotential lines as well as the velocity vectors ~ V = ¡rU. For graphing<br />

purposes, he chooses V0 =1anda = 1, and switches to Cartesian coordinates,<br />

taking x = 0 so that a two-dimensional plot can be made.<br />

> U:=subs(fV[0]=1,a=1,cos(theta)=z/sqrt(z^2+y^2),<br />

r=sqrt(z^2+y^2)g,U):<br />

Since the region of interest is outside the sphere, Hugo forms a piecewise function<br />

U2 that is equal to U for z2 + y2 ¸ 1, and zero otherwise.<br />

> U2:=piecewise(z^2+y^2>=1,U,0);


244 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

U2 :=<br />

(<br />

¡ z (2 (z2 + y 2 ) (3=2) +1)<br />

2(z 2 + y 2 ) (3=2)<br />

1 · z 2 + y 2<br />

0 otherwise<br />

A functional operator F, whichmakesuseoftheimplicitplot command, is<br />

formed to plot the equipotentials in steps of 0:25 i, wherei will be taken to be<br />

an integer. Instead of the 25 £ 25 default grid, which is too coarse here, Hugo<br />

take the grid to be 100 £ 100.<br />

> F:=i->implicitplot(U2=.25*i,z=-2..2,y=-2..2,grid=[100,100]):<br />

Next, Hugo wants to form a graph of the velocity vectors. He calculates the<br />

velocity in the z-y plane and again forms piecewise functions to give the velocity<br />

components outside the sphere.<br />

> Vel:=Gradient(-U,'cartesian'[z,y]);<br />

> Ve[1]:=piecewise(z^2+y^2>=1,Vel[1],0):<br />

> Ve[2]:=piecewise(z^2+y^2>=1,Vel[2],0):<br />

The fieldplot command is used to produce a graph of the velocity vectors.<br />

> gr:=fieldplot([Ve[1],Ve[2]],z=-2..2,y=-2..2,grid=[18,18],<br />

arrows=MEDIUM,color=blue):<br />

The velocity vectors and the equipotential lines corresponding to i = ¡8 to8<br />

(U = ¡2 to+2instepsof0.25)aredisplayedinFigure5.9.<br />

> display(fgr,seq(F(i),i=-8..8)g,axes=boxed,<br />

scaling=constrained);<br />

Looking at the ¯gure, Hugo can easily \see" the °uid °ow around the sphere,<br />

with the velocity vectors perpendicular to the equipotentials and varying in<br />

magnitude near the sphere.<br />

2<br />

1<br />

y<br />

0<br />

–1<br />

–2<br />

–2 –1 0 1 2<br />

z<br />

Figure 5.9: Velocity vectors and equipotentials for °uid °ow around a sphere.


5.2. DIFFUSION AND LAPLACE'S EQUATION MODELS 245<br />

With this simple example under his belt, Hugo feels con¯dent that if he can<br />

come up with some °uid °ow examples for di®erent hull shapes, he might make<br />

a good impression on his interviewers and be hired. He realizes that for more<br />

complicated shapes he will probably have to use Maple's numerical capability.<br />

So let's leave Hugo to ¯nish his job interview preparation, so he doesn't pull<br />

aRockHudsonandgiveabadinterview.<br />

PROBLEMS:<br />

Problem 5-28: Split potential<br />

On the surface of a hollow sphere of radius a, the electric potential is<br />

½<br />

+V; 0 · μ


Chapter 6<br />

Linear PDE Models. Part 2<br />

In the previous chapter, the computer algebra recipes concentrated on mathematical<br />

models formulated in terms of the di®usion and Laplace equations. In<br />

this continuation of our study of linear PDE models, the wave equation and a<br />

variety of models involving semi-in¯nite and in¯nite domains are presented.<br />

6.1 Wave Equation Models<br />

Thewaveequation,<br />

r 2 Ã(~r; t) = 1<br />

c2 @2Ã(~r; t)<br />

@t2 ; (6.1)<br />

with r2 the Laplace operator, Ã a scalar or vector function of position ~r and<br />

time t, andcthe wave velocity, applies to many di®erent types of waves, e.g.,<br />

² electromagnetic waves (with à a vector);<br />

² sound waves;<br />

² tidal waves in an incompressible °uid;<br />

² elastic waves in a solid;<br />

² vibrations of elastic strings and membranes.<br />

In our ¯rst example, Vectoria plucks the humble string.<br />

6.1.1 Vectoria Encounters Simon Legree<br />

\We called him Tortoise because he taught us," said the Mock Turtle<br />

angrily. \Really you are very dull!"<br />

Lewis Carroll, Alice's Adventures in Wonderland, 1865<br />

It is some time later in the undergraduate career of Vectoria, the physics student<br />

who has been featured in several of our earlier stories. Recall that, inspired by<br />

the movie Casablanca, Vectoria used Maple to check and animate a textbook<br />

formula for the transverse motion of an initially horizontal piano string that has<br />

been struck. Since then Vectoria has progressed in her studies and is currently<br />

enrolled in a mathematical physics course. She has begun to learn how to solve<br />

wave equation problems using the separation of variables method.<br />

247


248 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

Professor Simon Legree, 1 who is teaching the course, has a reputation for<br />

assigning large numbers of often di±cult problems, so Vectoria decides once<br />

again to let Maple help her in deriving the solutions. Although she could do<br />

the problems by hand, it seems smarter in the long run to develop a computer<br />

algebra approach to lighten the workload and to avoid mathematical mistakes.<br />

On talking to the professor, she ¯nds out that, surprisingly, Legree not only<br />

agrees but suggests that it might be wise to start with a relatively simple<br />

problem, before tackling the more di±cult ones. Amazed that Legree, despite<br />

his hard-nosed reputation, has been so helpful, Vectoria decides to follow his<br />

advice and selects a problem involving the transverse motion of a string that<br />

has been plucked and released from rest.<br />

Since she doesn't yet know how to include sti®ness in the string, she opts<br />

to make use of the linear wave equation that neglects sti®ness. The horizontal<br />

string is ¯xed at its endpoints, x =0andx = L>0, and is given an initial<br />

transverse displacement Ã(x; t =0)=2hx=L for 0 · x · L=2 andÃ(x; 0) =<br />

2 h (L ¡ x)=L for L=2 · x · L. Vectoria recognizes that this is a triangular<br />

pro¯le with a maximum displacement h at the center (x = L=2) of the string.<br />

Professor Legree has also stressed that his marking assistant has been instructed<br />

not to give full credit for a problem solution unless it is accompanied by some<br />

sort of meaningful plot as well as some pertinent discussion.<br />

So Vectoria, anticipating that she will animate the vibrational motion of the<br />

string, begins her recipe with a call to the plots package, and enters the wave<br />

equation WE for the tranverse displacement Ã(x; t) ofthestringattimet.<br />

> restart: with(plots):<br />

> WE:=diff(psi(x,t),x,x)=(1/c^2)*diff(psi(x,t),t,t);<br />

WE := @2<br />

@<br />

Ã(x; t) =<br />

@x2 2<br />

Ã(x; t)<br />

@t2 c2 On applying the pdsolve command to WE without any options,<br />

> pdsolve(WE);<br />

Ã(x; t) = F1 (ct+ x)+ F2 (ct¡ x)<br />

Vectoria ¯nds that the solution is given by Ã(x; t) = F 1(ct+ x)+ F 2(ct¡ x),<br />

where F 1and F 2 are arbitrary functions. This is the well-known general<br />

solution of the wave equation, which is not too useful for solving the present<br />

problem with speci¯ed boundary and initial conditions. Clearly, a hint should<br />

be provided. She could be quite general and enter HINT=f(x)*g(t), butshe<br />

realizes that sine and cosine functions clearly satisfy the wave equation. Since<br />

sin(kx), where k is an undetermined constant, is equal to zero at x =0andthus<br />

satis¯es the boundary condition there, she provides the HINT=sin(k*x)*g(t)<br />

and integrates and builds up the solution.<br />

1 Unfortunately, Mrs. Legree, when naming her newborn son, chose Simon as a ¯rst name.<br />

She was unaware that Simon Legree was the cruel plantation owner in Harriet Beecher Stowe's<br />

novel, Uncle Tom's Cabin.


6.1. WAVE EQUATION MODELS 249<br />

> sol:=pdsolve(WE,HINT=sin(k*x)*g(t),INTEGRATE,build);<br />

sol := Ã(x; t) =sin(kx) C1 sin(ckt)+sin(kx) C2 cos(ckt)<br />

The string is initially at rest, so the transverse velocity _ Ã(x; 0) is equal to 0.<br />

Mentally di®erentiating the above output, clearly only the cos(ckt) term should<br />

be retained, since its derivative vanishes at t = 0, whereas the derivative of the<br />

sin(ckt) term does not. So Vectoria selects the term on the rhs of the solution<br />

containing the cosine term.<br />

> sol2:=select(has,rhs(sol),cos);<br />

sol2 := sin(kx) C2 cos(ckt)<br />

The displacement of the string must also vanish at x = L for arbitrary times, so<br />

onemusthavesin(kL) = 0, which yields k = n¼=L,withnapositive integer.<br />

She substitutes this result into sol2 , and temporarily removes any coe±cients<br />

by setting C1 and C2 equal to 1.<br />

> F[n]:=subs(fk=n*Pi/L,_C1=1,_C2=1g,sol2);<br />

³<br />

n¼x<br />

´ μ <br />

cn¼t<br />

Fn := sin cos<br />

L<br />

L<br />

The general solution satisfying the boundary conditions at x =0andL, and<br />

with zero initial transverse velocity, then is<br />

1X<br />

1X ³<br />

n¼x<br />

´ μ <br />

cn¼t<br />

Ã(x; t) = An Fn = An sin cos ; (6.2)<br />

L<br />

L<br />

n=1<br />

n=1<br />

where the coe±cients An have to be determined from the initial string pro¯le.<br />

This pro¯le is given by the piecewise function f.<br />

> f:=piecewise(xL/2,2*h*(L-x)/L);<br />

8<br />

><<br />

2 hx<br />

x<<br />

f := L<br />

>:<br />

L<br />

2<br />

2 h (L ¡ x) L<br />

L 2 0.<br />

> A[n]:=int(f*sin(n*Pi*x/L),x=0..L)/int(sin(n*Pi*x/L)^2,x=0..L)<br />

assuming L>0:<br />

The nth Fourier term in the in¯nite series representing the string displacement<br />

is then Ãn =An Fn, the result being simpli¯ed by assuming that n is an integer.<br />

> psi[n]:=simplify(A[n]*F[n]) assuming n::integer;<br />

³<br />

n¼<br />

´ ³<br />

n¼x<br />

´ μ <br />

cn¼t<br />

8 h sin sin cos<br />

2 L<br />

L<br />

Ãn :=<br />

n2 ¼2 0


250 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

The<br />

P<br />

transverse displacement of the string at arbitrary time t is Ã(x; t) =<br />

1<br />

n=1 Ãn. For animation purposes, Vectoria takes L =10,h =1,andc =1.<br />

> L:=10: h:=1: c:=1:<br />

To obtain a good approximation to the initial string pro¯le, Vectoria keeps<br />

terms in the series up to n = 25, only the partial output being shown here.<br />

> psi:=sum(psi[n],n=1..25);<br />

³<br />

¼x<br />

´ μ <br />

¼t<br />

8sin cos<br />

10 10<br />

à :=<br />

¼2 ¡ 8<br />

μ μ <br />

3 ¼x 3 ¼t<br />

sin cos<br />

10 10<br />

9 ¼2 + 8<br />

³<br />

¼x<br />

´ μ <br />

¼t<br />

sin cos<br />

2 2<br />

25 ¼2 + ¢¢¢¢¢¢+ 8<br />

μ μ <br />

21 ¼x 21 ¼t<br />

sin cos<br />

10 10<br />

441<br />

¼2 ¡ 8<br />

μ μ <br />

23 ¼x 23 ¼t<br />

sin cos<br />

10 10<br />

529<br />

¼2 + 8<br />

μ μ <br />

5 ¼x 5 ¼t<br />

sin cos<br />

2 2<br />

625<br />

¼2 The displacement à is animated over the time interval t = 0 to 20, with 100<br />

equally spaced time frames.<br />

> animate(plot,[psi,x=0..L],t=0..20,frames=100);<br />

On running the animation command, Vectoria is at ¯rst surprised by the behavior<br />

of the string, but on thinking about it decides that it makes sense. After<br />

executing the recipe, does the behavior make sense to you? What should Vectoria<br />

write in her explanation of the wave motion?<br />

PROBLEMS:<br />

Problem 6-1: Another plucked string<br />

A light homogeneous horizontal string of length L ¯xed at its ends initially<br />

has a parabolic shape with height h in the middle. If it is released from rest,<br />

solve the wave equation to determine its subsequent transverse displacement at<br />

arbitrary time t. Animate the vibrations for parameters of your own choice and<br />

choose enough frames to produce a smooth animation.<br />

Problem 6-2: Struck piano string<br />

If a horizontal piano string ¯xed at x =0andx = L is struck in such a way<br />

that its initial displacement Ã(x; 0) is zero and its initial transverse velocity is<br />

8<br />

< 4 vx=L; 0


6.1. WAVE EQUATION MODELS 251<br />

6.1.2 Homer's Jiggle Test<br />

The fundamental cause of trouble in the world today is that the stupid<br />

are cocksure while the intelligent are full of doubt.<br />

Bertrand Russell, British mathematician and philosopher (1872{1970)<br />

Having successfully used Maple to solve the plucked string problem, Vectoria<br />

now tackles the ¯rst problem on Professor Legree's wave equation assignment.<br />

She is asked to determine the transverse displacement Ã(x; y; t) of a light, horizontal,<br />

rectangular elastic membrane having sides of length a and 2 a that<br />

is held ¯xed along all four edges. Speci¯cally, the boundary conditions are<br />

Ã(0;y;t)=Ã(a; y; t) =0for0· y · 2 a and Ã(x; 0;t)=Ã(x; 2 a; t) =0for<br />

0 · x · a. The membrane is given an initial displacement<br />

Ã(x; y; 0) ´ f = 4 hx2 (a ¡ x) y3 (2 a ¡ y)<br />

a7 and is released from rest. Professor Legree also requests that the membrane<br />

displacement be animated for a =1,h = 1, and wave velocity c =1.<br />

Vectoria realizes that this membrane problem is mathematically equivalent<br />

to two ¯xed-ends string problems in the x and y directions. So her \shortcut"<br />

approach to separating variables in the last recipe can be easily extended.<br />

After loading the plots package, she enters the wave equation WE in two<br />

dimensions.<br />

> restart: with(plots):<br />

> WE:=diff(psi(x,y,t),x,x)+diff(psi(x,y,t),y,y)<br />

=(1/c^2)*diff(psi(x,y,t),t,t);<br />

μ μ @<br />

2<br />

2<br />

@ @<br />

WE := Ã(x; y; t) + Ã(x; y; t) =<br />

@x2 @y2 2<br />

Ã(x; y; t)<br />

@t2 c2 The pdsolve command is applied to WE with HINT=sin(p*x)*sin(q*y)*T(t),<br />

where p and q are constants. The assumed form satis¯es the boundary conditions<br />

along the ¯xed edges x =0andy =0.<br />

> sol:=pdsolve(WE,HINT=sin(p*x)*sin(q*y)*T(t),INTEGRATE,build);<br />

sol := Ã(x; y; t) =sin(px)sin(qy) C1 sin(c p p2 + q2 t)<br />

+sin(px)sin(qy) C2 cos(c p p2 + q2 t)<br />

The initial transverse velocity is zero, so once again only the term involving<br />

cos(c p p2 + q2 t)iskept.<br />

> sol2:=select(has,rhs(sol),cos);<br />

sol2 := sin(px)sin(qy) C2 cos(c p p 2 + q 2 t)<br />

At x = a, sin(pa)=0,sop = m¼=a,wherem is a positive integer. Similarly,<br />

at y =2a, sin(q 2 a) =0,soq = n¼=(2 a), n being a positive integer. Vectoria<br />

substitutes the p and q relations into sol2 , and temporarily removes all<br />

coe±cients by setting C1 = C2 =1.


252 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

> F[m,n]:=subs(fp=m*Pi/a,q=n*Pi/(2*a),_C1=1,_C2=1g,sol2);;<br />

Fm; n := sin<br />

à r<br />

³<br />

m¼x<br />

´ ³<br />

n¼y<br />

´<br />

2 2 m ¼<br />

sin cos c<br />

a 2 a<br />

a2 + n2 ¼2 !<br />

t<br />

4 a2 Since she will need it for determining the coe±cients, Vectoria evaluates Fm;n<br />

at t = 0, labeling the result gm;n.<br />

> g[m,n]:=eval(F[m,n],t=0);<br />

³<br />

m¼x<br />

´ ³<br />

n¼y<br />

´<br />

gm;n := sin sin<br />

a 2 a<br />

The initial pro¯le of the rectangular membrane is entered.<br />

> f:=4*h*x^2*(a-x)*y^3*(2*a-y)/a^7;<br />

f := 4 hx2 (a ¡ x) y3 (2 a ¡ y)<br />

a7 Now, the general form of the transverse displacement at time t will be given by<br />

the following linear superposition,<br />

1X 1X<br />

1X 1X<br />

Ã(x; y; t) = Am;n Fm;n ´ Ãm;n; (6.3)<br />

m=1 n=1<br />

m=1 n=1<br />

with the coe±cients Am;n determined by the initial pro¯le f. Setting t =0in<br />

(6.3) yields<br />

X1<br />

1X<br />

Am;n gm;n = f:<br />

m=1 n=1<br />

Multiplying both sides by sin(m 0¼x=a)sin(n0¼y=(2 a)), integrating over x from<br />

0toa and over y from0to2a, and taking the double sum will yield zero unless<br />

m = m 0 =andn = n 0 . Removing the primes and solving for Am;n yields<br />

Z 2 a Z a<br />

Á Z 2 a Z a<br />

Am;n = fgm;n dx dy<br />

g<br />

0 0<br />

0 0<br />

2 m;n dx dy:<br />

Using this relation, we calculate Am;n in the next command line.<br />

> A[m,n]:=int(int(f*g[m,n],x=0..a),y=0..2*a)/int(int(g[m,n]^2,<br />

x=0..a),y=0..2*a):<br />

Then, the general Fourier term Ãm;n = Am;n Fm;n is determined, the result<br />

being simpli¯ed assuming that m and n are integers and a>0.<br />

> psi[m,n]:=simplify(A[m,n]*F[m,n]) assuming m::integer,<br />

n::integer,a>0;<br />

Ãm; n := 3072 h ¡ 4+8(¡1) m + ¼2 n2 (¡1) n +2(¡1) (m+n) ¼2 n2 +8 (¡1) (1+m+n) +4(¡1) (1+n)¢ ³<br />

m¼x<br />

´ ³<br />

n¼y<br />

´<br />

sin sin<br />

Ã<br />

a 2 a<br />

c¼<br />

cos<br />

p 4 m2 + n2 !<br />

t<br />

.<br />

(m<br />

2 a<br />

3 ¼8 n5 )<br />

Given the mathematical form of f, Vectoria is not surprised at how complicated<br />

the coe±cient turns out to be in Ãm;n.


6.1. WAVE EQUATION MODELS 253<br />

The parameter values suggested by Professor Legree are entered,<br />

> a:=1: h:=1: c:=1:<br />

and the membrane displacement approximated by the ¯nite sum<br />

à =<br />

X15<br />

m=1 n=1<br />

X15<br />

Ãm;n:<br />

Vectoria claims that she has kept 15 2 = 225 terms so as to get an accurate<br />

animation. We will let you be the judge of this, but we have overruled her desire<br />

to show the lengthy result and advised her to put a colon on the command line.<br />

> psi:=sum(sum(psi[m,n],m=1..15),n=1..15):<br />

Finally, a 3-dimensional zhue colored animation of à is produced over the time<br />

interval t = 0 to 5, with 40 frames.<br />

> animate(plot3d,[psi,x=0..a,y=0..2*a],t=0..5,<br />

frames=40,axes=frame,shading=zhue,orientation=[-130,50],<br />

tickmarks=[2,2,3]);<br />

On executing the animation, Vectoria is reminded of a rerun of an episode<br />

of a popular cartoon series that she watched recently with her ¯ance, Mike.<br />

The main character, Homer Simpson, who has a rather fat stomach, went to<br />

the doctor for a medical checkup. The doctor supposedly measured the fat<br />

content of Homer's stomach by giving it a jiggle and studying the motion of the<br />

resulting wave form. The initial shape of the membrane in this animation and<br />

its subsequent movement somewhat resembles that of Homer's stomach in the<br />

doctor's jiggle test. Vectoria wonders whether Professor Legree was partially<br />

motivated in setting up this problem by watching the same cartoon episode.<br />

Perhaps, underneath his stern exterior, Professor Legree has a sense of humor.<br />

PROBLEMS:<br />

Problem 6-3: Vibrations of a square membrane<br />

A square membrane whose sides are of unit length is given an initial transverse<br />

displacement Ã(x; y; 0) = xy(1 ¡ x)(1¡ y) and then released. Determine the<br />

displacement Ã(x; y; t) of the membrane for t>0 and animate the solution for<br />

nominal values of the parameters.<br />

Problem 6-4: Free edges<br />

Consider a rectangular membrane having sides of length a between x =0and<br />

x = a and sides of length 2 a between y =0andy =2a. The edges at x =0<br />

and x = a are ¯xed, while those at y =0andy =2a are \free." At a free edge,<br />

the slope is zero. Explicitly determine Ã(x; y; t) if the membrane is initially at<br />

rest and has the initial shape<br />

½<br />

2 xh=a; 0 · x · a=2;<br />

Ã(x; y; 0) =<br />

(2 h=a)(a ¡ x); a=2 · x · a:<br />

Animate the solution for a =1,h =1,andc =1.


254 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

6.1.3 Vectoria's Second Problem<br />

Ohyes,thereisavastdi®erencebetweenthesavageandthecivilized<br />

man, but it is never apparent to their wives until after breakfast.<br />

Helen Rowland, American journalist, AGuidetoMen,1922<br />

The second problem on Professor Legree's assignment is to determine the transverse<br />

displacement Ã(r; μ; t) of a light, horizontal, circular membrane or drum-<br />

head of radius a ¯xed on its perimeter, given the initial conditions<br />

μ<br />

Ã(r; μ; 0) ´ f =20r 1 ¡ r2<br />

a2 <br />

sin(2 μ); Ã(r; _ μ; 0) = 0:<br />

The motion of the drumhead is then to be animated for a =1andwavevelocity<br />

c = 1, and its behavior discussed.<br />

After loading the plots and VectorCalculus packages, Vectoria uses the<br />

Laplacian command to enter the wave equation in polar coordinates.<br />

> restart: with(plots): with(VectorCalculus):<br />

> WE:=expand(Laplacian(psi(r,theta,t),'polar'[r,theta])<br />

=(1/c^2)*diff(psi(r,theta,t),t,t));<br />

WE :=<br />

@<br />

Ã(r; μ; t)<br />

@r<br />

r<br />

μ 2 @<br />

+<br />

Ã(r; μ; t)<br />

@r2 <br />

+<br />

@2 Ã(r; μ; t)<br />

@μ2 r 2<br />

=<br />

@2 Ã(r; μ; t)<br />

@t2 c2 Based on her experience with the ¯rst problem on the assignment, the initial<br />

condition _ Ã(r; μ; 0) = 0 can be satis¯ed if she assumes a general product solution<br />

of the form F (r) G(μ) cos(ckt), where the functions F and G and the constant<br />

k remain to be determined. The assumed form is provided as a HINT in the<br />

pdsolve command.<br />

> sol:=pdsolve(WE,HINT=F(r)*G(theta)*cos(c*k*t),INTEGRATE,<br />

build);<br />

sol := Ã(r; μ; t) =cos(ckt) C3 sin( p c1 μ) C1 BesselJ( p c1; kr)<br />

+cos(ckt) C3 sin( p c1 μ) C2 BesselY( p c1; kr)<br />

+cos(ckt) C4 cos( p c1 μ) C1 BesselJ( p c1; kr)<br />

+cos(ckt) C4 cos( p c1 μ) C2 BesselY( p c1; kr)<br />

The Bessel functions of the second kind (Y) diverge at r =0,soareremoved.<br />

> sol2:=remove(has,rhs(sol),BesselY);<br />

sol2 := cos(ckt) C3 sin( p c1 μ) C1 BesselJ( p c1; kr)<br />

+cos(ckt) C4 cos( p c1 μ) C1 BesselJ( p c1; kr)<br />

Vectoria simpli¯es the separation constant by substituting p c1 = p into sol2 .<br />

> sol3:=subs(sqrt(_c[1])=p,sol2);<br />

sol3 := cos(ckt) C3 sin(pμ) C1 BesselJ(p; k r)<br />

+cos(ckt) C4 cos(pμ) C1 BesselJ(p; k r)


6.1. WAVE EQUATION MODELS 255<br />

Recognizing that the sines and cosines are independent functions and to be<br />

consistent with the sin(2 μ) term in the initial displacement, Vectoria removes<br />

the cos(pμ)termfromsol3 and sets p = 2 in the resulting expression.<br />

> sol4:=eval(remove(has,sol3,cos(p*theta)),p=2);<br />

sol4 := cos(ckt) C3 sin(2 μ) C1 BesselJ(2; kr)<br />

Thedrumheadis¯xedonitsperimeterforallt, i.e.,Ã(a; μ; t) = 0, so that the<br />

Bessel function J2(ka) equals 0. The allowed k values are the zeros of J2(x).<br />

The mth zero, km, is entered,<br />

> k[m]:=BesselJZeros(2,m)/a;<br />

BesselJZeros(2; m)<br />

km :=<br />

a<br />

and substituted into sol4 with all Maple constants removed.<br />

> F[2,m]:=subs(k=k[m],BesselJ(2,k*r)*sin(2*theta)*cos(c*k*t));<br />

μ<br />

<br />

μ <br />

BesselJZeros(2; m) r<br />

c BesselJZeros(2; m) t<br />

F2;m:= BesselJ 2; sin(2 μ)cos<br />

a<br />

a<br />

The displacement of the drumhead at time t will be given by<br />

1X<br />

1X<br />

Ã(r; μ; t) =<br />

Ã2;m;<br />

m=1<br />

A2;m F2;m ´<br />

with the coe±cients A2;m determined by the initial pro¯le f, whichisentered.<br />

> f:=20*r*(1-r^2/a^2)*sin(2*theta);<br />

μ<br />

f := 20 r 1 ¡ r2<br />

<br />

sin(2 μ)<br />

a 2<br />

m=1<br />

Evaluating F2;m at t =0yieldsg2;m.<br />

> g[2,m]:=eval(F[2,m],t=0);<br />

μ<br />

<br />

BesselJZeros(2; m) r<br />

g2;m := BesselJ 2; sin(2 μ)<br />

a<br />

The mth coe±cient A2;m is given by<br />

Z a Z 2 ¼<br />

Á Z a Z 2 ¼<br />

A2;m = rfg2;m dμ dr<br />

r (g2;m) 2 dμ dr;<br />

0<br />

0<br />

which is now calculated.<br />

> A[2,m]:=int(int(r*f*g[2,m],theta=0..2*Pi),r=0..a)<br />

/int(int(r*g[2,m]^2,theta=0..2*Pi),r=0..a):<br />

Then, the mth Fourier term Ã2;m = A2;m F2;m is determined, the lengthy and<br />

quite formidable result being suppressed here in the text.<br />

> psi[2,m]:=A[2,m]*F[2,m];<br />

For animation purposes Ã2;m is evaluated at a =1,c =1,<br />

> psi[2,m]:=eval(psi[2,m],fa=1,c=1g):<br />

and converted to Cartesian coordinates by noting that sin(2 μ) =2sinμcos μ<br />

and substituting r = p x2 + y2 and sin(2 μ) =2xy=(x2 + y2 ).<br />

0<br />

0


256 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

> psi[2,m]:=subs(fr=sqrt(x^2+y^2),sin(2*theta)=2*x*y<br />

/(x^2+y^2)g,psi[2,m]):<br />

Vectoria will animate the sum P5 m=1 Ã2;m, which is su±cient to give a good<br />

animation. Labeling this result as Ã, she numerically evaluates the terms and<br />

displays them.<br />

> psi:=evalf(sum(psi[2,m],m=1..5));<br />

à := 33:78863892 BesselJ(2:; 5:135622302 p x 2 + y 2 ) xycos(5:135622302 t)<br />

x 2 + y 2<br />

+ 1:727434530 BesselJ(2:; 8:417244140 p x 2 + y 2 ) xycos(8:417244140 t)<br />

x 2 + y 2<br />

+ 4:730070500 BesselJ(2:; 11:61984117 p x 2 + y 2 ) xycos(11:61984117 t)<br />

x 2 + y 2<br />

+ 0:8068048260 BesselJ(2:; 14:79595178 p x 2 + y 2 ) xycos(14:79595178 t)<br />

x 2 + y 2<br />

+ 1:787787351 BesselJ(2:; 17:95981949 p x 2 + y 2 ) xycos(17:95981949 t)<br />

x 2 + y 2<br />

Since the displacement à applies only to the drumhead, not the region outside,<br />

Vectoria forms a piecewise function that is equal to à for x2 + y2 · 1 and equal<br />

to zero otherwise.<br />

> psi2:=piecewise(x^2+y^2 animate(plot3d,[psi2,x=-1..1,y=-1..1],t=0..2,frames=15,<br />

axes=framed,shading=zhue,style=PATCHCONTOUR,<br />

orientation=[45,30]);<br />

On executing the animation, Vectoria observes that in the initial frame of the<br />

animation the membrane displays two up peaks and two down peaks, located<br />

radially at r = a= p 3 and separated into four quadrants by perpendicular intersecting<br />

nodal lines. These nodal lines correspond to sin(2 μ) =0,orμ =0,<br />

¼=2, ¼, and3¼=2. The up and down peaks correspond to plus and minus signs<br />

as μ ranges from 0 to 2 ¼ in sin(2 μ). For μ =0to¼=2 and¼to 3 ¼=2, sin(2 μ)<br />

is positive; for μ = ¼=2 to¼ and 3 ¼=2 to2¼, it is negative.<br />

As time progresses the up peaks become down peaks and vice versa, the<br />

\°ipping" of peaks occurring periodically. Having written down her observations,<br />

she decides that this is enough for the time being, since she has three<br />

more problems to do on Professor Legree's assignment. She can add more discussion,<br />

if necessary, when she does a ¯nal review of all her answers. She has a<br />

date with Mike and would like to ¯nish the assignment before he calls on her.


6.1. WAVE EQUATION MODELS 257<br />

PROBLEMS:<br />

Problem 6-5: Circular drumhead<br />

A circular drumhead of radius r = a and ¯xed on its perimeter is displaced a<br />

distance h at its center at time t = 0 so that it has a conical shape. Determine<br />

the displacement of the membrane for t>0. Taking a = h =1andc =1,<br />

animate the motion of the membrane.<br />

Problem 6-6: A di®erent initial shape<br />

A circular drumhead of radius a ¯xed on its outer edge has an initial displacement<br />

Ã(r; μ; 0) = (1 ¡ r 2 =a 2 )sin(4μ) and its initial velocity is zero. Determine<br />

the subsequent displacement Ã(r; μ; t), and animate the solution for parameters<br />

of your own choosing.<br />

6.1.4 Sound of Music?<br />

Music is spiritual. The music business is not.<br />

Van Morrison, Irish rock musician, Times, London, 6 July 1990<br />

The third problem on Vectoria's assignment, which Professor Legree has worded<br />

as follows, might be considered to be noteworthy.<br />

Some musically inclined people like to sing in the shower stall when taking<br />

a shower. Suppose that a large \shower stall" is empty without the water<br />

running and consists of a completely enclosed hollow vertical metal cylinder of<br />

radius a and height h with (approximately) rigid walls and all ¯xtures removed.<br />

The speed of sound for the air inside the cylinder is c. By solving the scalar<br />

Helmholtz equation for the spatial part of the velocity potential, determine<br />

the allowed normal modes inside the cylinder. For rigid walls, the normal<br />

component of the °uid velocity (or the normal derivative of the potential) must<br />

vanish at each wall. Taking a=1:83 m, h=3:04 m, and c=344 m/s (assuming<br />

dry air), determine the three lowest eigenfrequencies. By either consulting a<br />

musically inclined friend or a music reference book, or going to the Internet, ¯nd<br />

the closest musical notes on the equal-tempered scale to these eigenfrequencies<br />

and relate these notes to those found on a piano keyboard.<br />

Vectoria knows that the velocity potential Á satis¯es the scalar wave equation,<br />

with c the speed of sound. The velocity of a °uid element is given by<br />

~v = ¡rÁ. A normal mode of frequency ! is obtained by assuming a solution of<br />

the form Á(~r; t) =S(~r) cos(!t).Thewaveequationthenreducestothescalar<br />

Helmholtz equation,<br />

r 2 S + k 2 S =0; with k = !=c: (6.4)<br />

Professor Legree in his lectures uses the acronym SHE for the scalar Helmholtz<br />

equation, and jokingly refers to this equation as \she who must be obeyed".<br />

Evidently, this refers to a standard phrase uttered by the main character, a<br />

British barrister, about his wife in a PBS television series (Rumpole of the<br />

Bailey) thatLegreesawsomeyearsago.


258 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

Vectoria begins her solution by loading the VectorCalculus package,<br />

> restart: with(VectorCalculus):<br />

and entering SHE in cylindrical coordinates. The z direction is taken along the<br />

cylinder axis, r is the radial coordinate measured perpendicular to the z-axis,<br />

and μ is the angular coordinate measured about this axis.<br />

> SHE:=expand(Laplacian(S(r,theta,z),'cylindrical'[r,theta,z])<br />

+k^2*S(r,theta,z))=0;<br />

SHE :=<br />

@<br />

S(r; μ; z) μ <br />

2<br />

@r @<br />

+ S (r; μ; z) +<br />

r @r2 @2 S (r; μ; z)<br />

@μ2 r2 μ <br />

2 @<br />

+ S (r; μ; z)<br />

@z2 +k 2 S(r; μ; z) =0<br />

SHE is solved with the pdsolve command, a general product solution of the<br />

form S(r; μ; z) =R(r)£(μ) Z(z) being assumed.<br />

> S:=rhs(pdsolve(SHE,HINT=R(r)*Theta(theta)*Z(z),INTEGRATE,<br />

build));<br />

S := e (p c3 z) e ( p c2 μ) C5 C3 C1 %2 + e ( p c3 z) e ( p c2 μ) C5 C3 C2 %1<br />

+ e(p c3 z) C5 C4 C1 %2<br />

e (p c2 μ)<br />

+ e(p c2 μ) C6 C3 C1 %2<br />

+ C6 C4 C1 %2<br />

e (p c3 z)<br />

e (p c3 z) e ( p c2 μ)<br />

+ e(p c3 z) C5 C4 C2 %1<br />

e (p c2 μ)<br />

+ e(p c2 μ) C6 C3 C2 %1<br />

e (p c3 z)<br />

C6 C4 C2 %1<br />

+<br />

e (p c3 z) e ( p c2 μ)<br />

%1 := BesselY( p ¡ c2; p c3 + k2 r)<br />

%2 := BesselJ( p ¡ c2; p c3 + k2 r)<br />

The Bessel functions of the second kind diverge at r = 0 and must be removed.<br />

> S2:=remove(has,S,BesselY);<br />

S2 := e (p c3 z) e ( p c2 μ) C5 C3 C1 %1 + e (p c3 z) C5 C4 C1 %1<br />

e (p c2 μ)<br />

+ e(p c2 μ) C6 C3 C1 %1<br />

+ C6 C4 C1 %1<br />

e (p c3 z)<br />

e (p c3 z) e ( p c2 μ)<br />

%1 := BesselJ( p ¡ c2; p c3 + k2 r)<br />

To simplify the notation for matching the boundary conditions, the separation<br />

constants c2 and c3 are replaced with ¡m2 and ¡q2 in S2 . Vectoria also<br />

substitutes k2 = ® 2 + q2 , and simpli¯es the result with the symbolic option.<br />

> S3:=simplify(subs(f_c[2]=-m^2,_c[3]=-q^2,k^2=alpha^2+q^2g,<br />

S2),symbolic);<br />

S3 := C1 BesselJ(m; ® r)( C5 C3 e ((qz+mμ) I) ((qz¡mμ) I)<br />

+ C5 C4 e<br />

+ C6 C3 e (¡I (qz¡mμ)) + C6 C4 e (¡I (qz+mμ)) )


6.1. WAVE EQUATION MODELS 259<br />

Then S3 is converted to trig form and the result expanded.<br />

> S4:=expand(convert(S3,trig));<br />

S4 := C1 BesselJ(m; ® r) C5 C3 cos(qz)cos(mμ)<br />

¡ C1 BesselJ(m; ® r) C5 C3 sin(qz)sin(mμ)<br />

+ ¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢<br />

Approximating the metallic walls of the cylinder as being rigid, the normal<br />

component of the °uid velocity must vanish at the walls. Since the velocity<br />

is equal to minus the gradient of the potential, this implies that the normal<br />

derivative of the potential must vanish at the walls. In the z direction, one<br />

must have dZ=dz =0atz = 0, so only terms involving cos(qz)areselected.<br />

> S5:=select(has,S4,cos(q*z));<br />

S5 := C1 BesselJ(m; ® r) C5 C3 cos(qz)cos(mμ)+¢¢¢<br />

To satisfy the derivative boundary condition on the top face of the cylinder at<br />

z = h, one must have sin(qh)=0,orq = n¼=h,withn =0; 1; 2;::::<br />

For the angular part to remain single-valued as μ increases by 2 ¼, onemust<br />

have cos(m (μ +2¼)) = cos(μ), which is satis¯ed if m =0; 1; 2; :::: Negative<br />

integer values of m need not be considered because the minus sign can be<br />

absorbed in the arbitrary constants. Similar remarks apply to sin(mμ), which<br />

also appears in S5 . So the allowed Bessel functions are J0; J1; J2; etc.<br />

To satisfy the derivative condition on the cylindrical wall, one must have<br />

(d=dr)Jm(®m;s r)jr=a =0,whereslabels the zeros of the derivative of the mthorder<br />

Bessel function. For later convenience, Vectoria sets ®m;s = ¼pm;s=a,<br />

the values of pm;s still to be determined. The allowed values of q and ® are<br />

subsituted into S5 and the result factored.<br />

> S6:=factor(subs(fq=n*Pi/h,alpha=Pi*p[m,s]/ag,S5));<br />

S6 := (¡cos(mμ) C3 I ¡ cos(mμ) C4 I +sin(mμ) C3 ¡ sin(mμ) C4)<br />

³<br />

n¼z<br />

´ ³<br />

cos BesselJ m;<br />

h<br />

¼pm; s r<br />

´<br />

C1 ( C5 + C6 ) I<br />

a<br />

Replacing the awkward coe±cient combinations with An;m;s and Bn;m;s gives<br />

normal modes of the following form. For each m value, except m =0,thereare<br />

actually two modes corresponding to cos(mμ) and sin(mμ).<br />

> NM:=(A[n,m,s]*cos(m*theta)+B[n,m,s]*sin(m*theta))<br />

*select(has,S6,fcos(n*Pi*z/h),BesselJg);<br />

³<br />

n¼z<br />

´ ³<br />

NM := (An; m; s cos(mμ)+Bn; m; s sin(mμ)) cos BesselJ m;<br />

h<br />

¼pm; s r<br />

´<br />

a<br />

Noting that the boundary condition (d=dr)(Jm(¼pm;s r=a)jr=a = 0 may be<br />

rewritten as (d=dp)(Jm(¼p)jp = pm;s = 0, Vectoria creates a functional operator<br />

f to apply the derivative boundary condition at the cylinder wall.<br />

> f:=m->diff(BesselJ(m,Pi*p),p)=0:<br />

Then using f, she employs a do loop to numerically determine pm;s for m =0<br />

and 1 and s =0tos =4.


260 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

> for m from 0 to 1 do<br />

> sol[m]:=seq(p[m,s]=fsolve(f(m),p,s..s+1),s=0..4);<br />

> assign(sol[m]):<br />

> end do;<br />

sol 0 := p0; 0 =0:; p0; 1 =1:219669891; p0; 2 =2:233130594;<br />

p0; 3 =3:238315484;p0; 4 =4:241062864<br />

sol 1 := p1; 0 =0:5860669999; p1; 1 =1:697050942; p1; 2 =2:717193891;<br />

p1; 3 =3:726137088; p1; 4 =4:731227206<br />

Recalling that ! = ck = c p ® 2 + q 2 , the eigenfrequencies are given by<br />

!n;m;s = ¼c<br />

r<br />

³ ´<br />

pm;s<br />

2<br />

+<br />

a<br />

³<br />

n<br />

´ 2<br />

h<br />

radians per second;<br />

or, on using ! =2¼º,<br />

ºn;m;s = c<br />

r<br />

³pm;s ´ 2 ³<br />

n<br />

´ 2<br />

+ hertz:<br />

2 a h<br />

A functional operator F is formed to calculate the ºn;m;s.<br />

> F:=(n,m,s)->(c/2)*sqrt((p[m,s]/a)^2+(n/h)^2):<br />

The given values of the cylinder radius a, cylinder height h, and speed of sound<br />

c are entered,<br />

> a:=1.83: h:=3.04: c:=344:<br />

and the three lowest allowed frequencies calculated using F.<br />

> nu[0,1,0]:=F(0,1,0);<br />

º0; 1; 0 := 55:08389289<br />

> nu[1,0,0]:=F(1,0,0);<br />

º1; 0; 0 := 56:57894736<br />

> nu[1,1,0]:=F(1,1,0);<br />

º1; 1; 0 := 78:96462843<br />

Consulting The Acoustical Foundations of Music, by John Backus [Bac69], Vectoria<br />

determines that the closest musical notes are A1 (55.000 Hz) for the ¯rst<br />

two frequencies and D2 # (77.782 Hz) for the third. Not having much of a<br />

feeling for these numbers, Vectoria goes to the Internet and ¯nds that the<br />

lowest-frequency note on a piano is 27.500 Hz and the highest frequency is<br />

4186.0 Hz. So the allowed frequencies in this \shower stall" example are at the<br />

low-frequency end of the piano keyboard.<br />

PROBLEMS:<br />

Problem 6-7: Acoustical waveguide<br />

A sound wave of frequency ! is generated at one end (z =0)ofaverylong<br />

straight cylindrical pipe of radius a having rigid walls.


6.2. SEMI-INFINITE AND INFINITE DOMAINS 261<br />

(a) Determine and discuss in detail the allowed modes of propagation and<br />

the cuto® frequency for wave propagation. The cuto® frequency is the<br />

minimum frequency for propagation of a speci¯c mode.<br />

(b) If the speed of sound in air is 1100 feet per second and if the frequency of<br />

the sound wave is 500 Hz, show that only a plane wave will be propagated<br />

if a


262 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

that vanishes at x = 1 is de¯ned as<br />

r Z 1<br />

2<br />

FST (f(x)) ´ F (s) = f(x)sin(sx) dx; (6.5)<br />

¼ 0<br />

and the inverse Fourier sine transform of F (s) by<br />

r Z 1<br />

2<br />

f(x) = F (s)sin(sx) ds: (6.6)<br />

¼ 0<br />

For the present problem, the temperature distribution will satisfy the onedimensional<br />

heat di®usion equation (with d the heat di®usion coe±cient),<br />

@T(x; t)<br />

= d<br />

@t<br />

@2T (x; t)<br />

@x2 : (6.7)<br />

Taking the FST of (6.7) with respect to x and integrating the rhs twice by parts,<br />

and assuming f 0 (x !1) ! 0, will convert the PDE into a ¯rst-order ODE for<br />

the transformed quantity F (s; t). The ODE will depend on the boundary condition<br />

T (0;t). The ODE is then solved for F (s; t) making use of the Fourier sine<br />

transform of the initial condition. Finally, on performing the inverse transform<br />

with respect to s, the temperature distribution T (x; t) is found.<br />

Once again, Vectoria disdains doing the problem \the old-fashioned way"<br />

favored by some instructors, but instead intends to let the computer assist her.<br />

To this end, she loads the plots and integral transform packages,<br />

> restart: with(plots): with(inttrans):<br />

and enters the di®usion equation DE,<br />

> DE:=diff(T(x,t),t)=d*diff(T(x,t),x,x);<br />

DE := @ T (x; t) =d<br />

@t<br />

μ<br />

@ 2<br />

2 T (x; t)<br />

@x<br />

and the boundary condition T (0;t)=T0.<br />

> T(0,t):=T0:<br />

To keep the recipe general for the moment, Vectoria has not yet speci¯ed the<br />

value of T0 . She then takes the FST of DE with respect to x, the integration<br />

by parts and boundary condition substitution being automatically done.<br />

> FST:=fouriersin(DE,x,s);<br />

FST := @<br />

@t fouriersin(T (x; t);x;s)=ds(p 2 T0 ¡ s fouriersin(T (x; t);x;s) p ¼)<br />

p<br />

¼<br />

To simplify the notation and facilitate solving the above ODE, she replaces<br />

fouriersin(T (x; t);x;s)withF (t), temporarily suppressing the argument s.<br />

> FST:=subs(fouriersin(T(x,t),x,s)=F(t),FST);<br />

FST := d<br />

dt F (t) = ds(p2 T0 ¡ s F (t) p ¼)<br />

p<br />

¼<br />

The Fourier sine transform of the initial condition is zero, so Vectoria solves<br />

the ¯rst-order linear di®erential equation FST for F (t), subject to F (0) = 0.<br />

> eq:=dsolve(fFST,F(0)=0g,F(t));


6.2. SEMI-INFINITE AND INFINITE DOMAINS 263<br />

p<br />

2 T0<br />

eq := F (t) =<br />

s p ¼ ¡ e(¡ds2 t) p 2 T0<br />

s p ¼<br />

The Fourier (inverse) sine transform of the rhs of eq with respect to s is taken,<br />

> T:=fouriersin(rhs(eq),s,x);<br />

μ<br />

x<br />

T := T0 ¡ T0 erf<br />

2 p <br />

dt<br />

yielding the temperature T expressed in terms of the error function. Now T is<br />

evaluated with the given parameter values (d=100, T0 =100) and simpli¯ed.<br />

> T:=simplify(eval(T,fd=100,T0=100g));<br />

μ<br />

x<br />

T := 100 ¡ 100 erf<br />

20 p <br />

t<br />

Choosing the spatial range to be x = 0 to 400 cm, Vectoria animates T over<br />

the time interval t = 0 to 150 seconds, 50 frames being taken.<br />

> animate(plot,[T,x=0..400],t=0..150,frames=50,thickness=2);<br />

On running the animation, Vectoria is pleased with the \sweetness" of the whole<br />

computer algebra derivation.<br />

Looking at her watch, she realizes that Mike will be picking her up at 5:00<br />

p.m., so she had better ¯nish the last problem on Professor Legree's assignment<br />

before he shows up. She will enjoy her dinner at Gira®es on the waterfront more<br />

if she has ¯nished her work.<br />

PROBLEMS:<br />

Problem 6-9: Fourier sine transform<br />

Calculate the Fourier sine transform of each f(x) belowandplottheanswers:<br />

(a) f(x) =e ¡3 jxj ; (b) f(x) =cos(2x); (c) f(x) =sin(x) 2 ;<br />

(d) f(x) =x=(x2 +1).<br />

Problem 6-10: A di®erent T (x; 0)<br />

Use the Fourier sine transform approach to solve the heat conduction problem<br />

for d =10cm2 /s in a semi-in¯nite rod (0 · x ·1) that has the boundary<br />

condition T (0;t) = 0 and initial interior temperature distribution T (x; 0) =<br />

10 x=(x2 + 1). Animate the plot.<br />

6.2.2 Assignment Complete!<br />

It is not knowledge, but the act of learning, not possession, but the<br />

act of getting there, which grants the greatest enjoyment.<br />

Carl Friedrich Gauss, German mathematician (1777{1855)<br />

The last problem on Vectoria's assignment is similar to the fourth one, but involves<br />

a di®erent boundary condition and initial condition. It is now supposed<br />

that the semi-in¯nite rod (0 · x ·1) has an initial temperature distribution


264 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

T (x; 0) = A±(x ¡ a), i.e., is a Dirac delta function 2 of amplitude A located at<br />

x = a>0. The end x = 0 is perfectly insulated so that no heat can °ow across<br />

this end. For no heat °ow to occur, the boundary condition is @T=@xjx=0 =0,<br />

i.e., the gradient of the temperature is zero. The evolution of the temperature<br />

pro¯le is to be animated over the spatial range x = 0 to 20 for the time interval<br />

t = 1 to 200, with a =5,A = 5, and a heat di®usion constant d =1.<br />

In her mathematical physics course, Vectoria has learned that when a gradient<br />

boundary condition is involved for a semi-in¯nite domain problem the<br />

Fourier cosine transform should be used. The Fourier cosine transform F (s) of<br />

a function f(x) forwhichbothf(x) andf 0 (x) ! 0asx !1and its inverse<br />

transform are<br />

r<br />

de¯ned as<br />

Z 1<br />

2<br />

F (s) = f(x) cos(sx) dx; f(x) =<br />

¼<br />

0<br />

r 2<br />

¼<br />

Z 1<br />

F (s) cos(sx) ds:<br />

Guided by her easy conquest of the previous problem, Vectoria realizes that she<br />

will be done by the time Mike arrives to pick her up.<br />

She again loads the plots and integral transform library packages, and enters<br />

the 1-dimensional heat di®usion equation.<br />

> restart: with(plots): with(inttrans):<br />

> DE:=diff(T(x,t),t)=d*diff(T(x,t),x,x);<br />

DE := @ μ<br />

T (x; t) =d @<br />

@t 2<br />

<br />

2 T (x; t)<br />

@x<br />

The boundary condition bc and the initial condition ic are speci¯ed. The differential<br />

command D[1](T)(0,t) is used to enter @T(x; t)=@xjx=0, while the<br />

Dirac delta function is entered with the Dirac command.<br />

> bc:=D[1](T)(0,t)=0; ic:=A*Dirac(x-a);<br />

bc := D1(T )(0; t)=0 ic := A Dirac(¡x + a)<br />

The Fourier cosine transforms of the initial condition (assuming that a>0) and<br />

the di®usion equation are calculated. The boundary condition is substituted<br />

into the latter result.<br />

> F0:=fouriercos(ic,x,s) assuming a>0;<br />

F0 := A p 2cos(sa)<br />

p<br />

¼<br />

> FCT:=subs(bc,fouriercos(DE,x,s));<br />

FCT := @<br />

@t fouriercos(T (x; t); x;s)=¡ds2 fouriercos(T (x; t); x;s)<br />

As in the previous recipe, fouriercos(T (x; t); x;s) is replaced with F (t)inFCT .<br />

> FCT:=subs(fouriercos(T(x,t),x,s)=F(t),FCT);<br />

FCT := d<br />

dt F (t) =¡ds2 F (t)<br />

2 The Dirac delta function ±(x ¡ a) is an in¯nitely tall spike located at x = a and is equal<br />

to zero for x 6= a. One of its most important properties is the sifting property, viz., for a<br />

smooth function f(x) (not another delta function) and ²>0, R a+²<br />

f(x) ±(x ¡ a) dx = f(a):<br />

a¡²<br />

0


6.2. SEMI-INFINITE AND INFINITE DOMAINS 265<br />

Then, the ordinary di®erential equation FCT is analytically solved for F (t),<br />

subject to the initial condition F (0) = F0 ,<br />

> eq:=dsolve(fFCT,F(0)=F0g,F(t));<br />

eq := F(t) = A p 2cos(sa) e (¡ds2 t)<br />

p<br />

¼<br />

and the inverse transform performed on the rhs of eq.<br />

> T:=fouriercos(rhs(eq),s,x);<br />

r<br />

¼<br />

A<br />

td<br />

T :=<br />

e(¡ a2 +x 2<br />

4 td ) ³<br />

ax<br />

´<br />

cosh<br />

2 td<br />

¼<br />

Looking at the analytic result for T , Vectoria is pleased that she has spent time<br />

learning how to use the Maple computer algebra system. Once she has set up<br />

a template for a certain type of problem, then any other problem of that type<br />

is generally trivial to tackle. In the real world, certain integrals and other steps<br />

may not be carried out analytically, but traditionally in the world of academia,<br />

problems are assigned by instructors for which analytic answers exist.<br />

To ¯nish o® the problem and complete the assignment, Vectoria evaluates<br />

T with the given parameter values (d =1,a =5,A =5),<br />

> T:=eval(T,fd=1,a=5,A=5g);<br />

r μ <br />

¼ 25+x2<br />

5 e(¡<br />

) 5 x<br />

4 t cosh<br />

t 2 t<br />

T :=<br />

¼<br />

and animates the solution over the suggested time interval t = 1 to 200. Clearly,<br />

the solution cannot be plotted at t = 0, because the initial pro¯le has been<br />

assumed to be a Dirac delta function. The number of points is controlled to<br />

product a smooth curve.<br />

> animate(plot,[T,x=0..20],t=1..200,numpoints=200,<br />

frames=50,thickness=2);<br />

As she watches the animation on the computer screen, Mike arrives to whisk<br />

her o® on their date.<br />

PROBLEMS:<br />

Problem 6-11: Fourier cosine transform<br />

Calculate the Fourier cosine transform of each f(x) belowandplottheanswers<br />

where possible:<br />

(a) f(x) =e ¡3 jxj ; (b) f(x) =cos(2x); (c) f(x) =sin(x) 2 ;<br />

(d) f(x) =x=(x2 +1).<br />

Problem 6-12: Di®erent initial condition<br />

Modify the text recipe to ¯nd the temperature distribution inside a semi-in¯nite<br />

rod (0 · x ·1) that is insulated at x = 0 and has the initial temperature<br />

distribution T (x >0; 0) = 25 x2 =(x2 +25)andd =1. AnimateT (x; t).


266 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

6.2.3 Radioactive Contamination<br />

The unexamined life is not worth living.<br />

Socrates, Greek philosopher (470{399 BC)<br />

When coauthor Richard was a student, he worked one summer as a chemistry<br />

lab assistant at a uranium mine on Great Bear Lake, which straddles the<br />

Arctic Circle in Northern Canada. Because it was a summer job, there was a<br />

period of several weeks when the sun never set, so evening baseball games were<br />

never called o® because of darkness. The baseball diamond was located on the<br />

leveled mine tailings, the only relatively °at spot in the small northern min-<br />

0<br />

x<br />

Figure 6.1: The radioactive disposal site.<br />

ing town of Port Radium, which is perched on almost treeless primordial rock<br />

formations. The author has always wondered what long-term health problems<br />

eventually arose among the permanent workers because of working in the mine<br />

and playing baseball on the radioactive mine tailings. Motivated by these reminiscences,<br />

we could not resist including a related example involving radioactive<br />

contamination.<br />

A radioactive gas is di®using at a steady rate into the atmosphere from<br />

a leveled contaminated disposal site. The ground and the atmosphere will<br />

be taken to be semi-in¯nite media with X = 0 at the boundary as shown in<br />

Figure 6.1. The concentration C(X; T) of radioactive gas in the atmosphere<br />

obeys the concentration equation (a modi¯ed di®usion equation)<br />

@C(X; T)<br />

@T<br />

= d @2 C(X; T)<br />

@X 2 ¡ ¸C(X; T); (6.8)<br />

where d is the di®usion constant and ¸ is the decay rate of the radioactive gas.<br />

The boundary condition at X =0isgivenbyFick's law,<br />

¡d @C(0;T)<br />

= K; (6.9)<br />

@X


6.2. SEMI-INFINITE AND INFINITE DOMAINS 267<br />

where K is a positive constant with units in kg/(m 2 ¢ s). The coe±cients can be<br />

eliminated and the two equations cast into dimensionless form by introducing<br />

the new variables t ´ ¸T, x ´ p ¸=d X, and c = ( p ¸d=K) C. Then the<br />

concentration equation becomes<br />

@c(x; t)<br />

@t<br />

= @2c(x; t)<br />

¡ c(x; t); (6.10)<br />

@x2 with @c=@x = ¡1 as the boundary condition at x =0.<br />

Assuming that initially c =0forx¸ 0, we want to determine the distribution<br />

of radioactive gas in the atmosphere for times t ¸ 0 and animate the<br />

solution. The method of attack will be to make use of the Laplace transform.<br />

The Laplace transform of a function f(t) isde¯nedas<br />

Z 1<br />

L(f(t)) ´ F (s) = f(t) e ¡st dt: (6.11)<br />

Integrating by parts and assuming that e ¡stf(t)!0 ast!1,then<br />

μ <br />

μ 2 df<br />

d f<br />

L = sF(s) ¡ f(0); and L<br />

dt<br />

dt2 <br />

= s 2 df (0)<br />

F (s) ¡ sf(0) ¡ : (6.12)<br />

dt<br />

To solve the concentration equation (6.10), subject to the boundary and<br />

initial conditions, the Laplace transform can be applied to the time part of the<br />

equation, the resultant second-order ODE in x solved, and the inverse Laplace<br />

transform performed to regain the time dependence.<br />

This program is now carried out using the laplace command contained in<br />

the integral transform library package.<br />

> restart: with(plots): with(inttrans):<br />

The dimensionless concentration equation is entered,<br />

> CE:=diff(c(x,t),t)=diff(c(x,t),x,x)-c(x,t);<br />

CE := @ μ 2 <br />

@<br />

c(x; t) = c(x; t) ¡ c(x; t)<br />

@t @x2 and the initial concentration speci¯ed.<br />

> c(x,0):=0:<br />

The Laplace transform of CE is taken with respect to the time variable, and<br />

the function laplace(c(x; t); t;s) then replaced with f (x) inLT .<br />

> LT:=laplace(CE,t,s);<br />

> LT:=subs(laplace(c(x,t),t,s)=f(x),LT);<br />

μ 2 d<br />

LT := s f(x) = f (x) ¡ f (x)<br />

dx2 This second-order ODE is solved for f(x), the following DEtools command line<br />

being used to obtain exponential solutions, which are convenient here.<br />

> sol:=DEtools[expsols](LT,f(x));<br />

sol := [e (p s+1 x) ;e (¡ p s+1 x) ]<br />

0


268 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

As x !1, the concentration must go to zero, so the negative exponent solution<br />

is selected and multiplied by an arbitrary coe±cient B to yield f.<br />

> f:=B*sol[2];<br />

f := Be (¡ps+1 x)<br />

The Laplace-transformed boundary condition bc takes the following form:<br />

> bc:=eval(diff(f,x),x=0)=laplace(-1,t,s);<br />

bc := ¡B p s +1=¡ 1<br />

s<br />

Then bc is solved for B, and the result BB substituted into f.<br />

> BB:=solve(bc,B); f:=subs(B=BB,f);<br />

BB :=<br />

1<br />

p s +1s<br />

f := e(¡p s+1 x)<br />

p s +1s<br />

To perform the inverse Laplace transform, the substitution s = y ¡ 1is¯rst<br />

made in f. Looking back at the de¯nition of the Laplace transform, it is then<br />

necessary to multiply this result by e ¡t , producing f2 .<br />

> f2:=exp(-t)*subs(s=y-1,f);<br />

f2 := e(¡t) e (¡p yx)<br />

p y (y ¡ 1)<br />

The inverse Laplace transform of f2 with respect to y is carried out assuming<br />

that x>0. This yields the analytic form c for the concentration, expressed in<br />

terms of the complementary error function (erfc(z) =1¡ erf(z)).<br />

> c:=invlaplace(f2,y,t) assuming x>0;<br />

c := ¡ 1<br />

2 erfc<br />

μ<br />

x +2t<br />

2 p <br />

e<br />

t<br />

x + 1<br />

2 erfc<br />

μ<br />

¡ ¡x +2t<br />

2 p <br />

e<br />

t<br />

(¡x)<br />

The concentration is animated over the spatial region x =0to5andtime<br />

interval t =0to3.<br />

> animate(plot,[c,x=0..5],t=0..3,frames=100,thickness=2);<br />

On running the code and observing the animated concentration pro¯le in the<br />

region x>0, you will see the radioactive gas di®using into the atmosphere,<br />

with the concentration attaining a steady-state pro¯le that decreases (approximately)<br />

exponentially from the contaminated surface as the distance x increases<br />

from zero. Steady state occurs when there is a balance between the rate at which<br />

radioactive gas atoms are di®using into the atmosphere and the rate at which<br />

they are decaying.<br />

PROBLEMS:<br />

Problem 6-13: Laplace transform<br />

Calculate the Laplace transforms of the following functions, simplifying the<br />

answer where necessary, and identifying any special functions that occur:<br />

(a) f(t) =e ¡a p t with a>0; (b) f(t) =t cos(at); (c) f(t) = arctan(t);


6.2. SEMI-INFINITE AND INFINITE DOMAINS 269<br />

(d) f(t) =tn ln(t) withn>0; (e) f(t) = tanh(t); (f) f(t) =tanh ¡1 (t);<br />

(g) f(t) = sin(3 p t)<br />

; (h) f(t) =J0(t) J1(t).<br />

t 1=4<br />

Problem 6-14: Inverse Laplace transform<br />

Calculate the inverse Laplace transforms of the following functions, identifying<br />

any special functions that occur in the answer:<br />

(a) F (s) = 1<br />

; (b) F (s) =<br />

s2 a<br />

s2 ; (c) F (s) =<br />

+ a2 s2 (s2 + a2 ;<br />

) 3=2<br />

1<br />

(d) F (s) = p<br />

s2 + a2 ; (e) F (s) =e¡as ; (f) F (s) = sin(as)<br />

;<br />

s<br />

Problem 6-15: Heat °ow in a semi-in¯nite rod<br />

Consider a semi-in¯nite rod spanning the range x =0tox = 1. The initial<br />

temperature of the rod is zero. For t>0, the temperature at x =0is<br />

T (x; 0) = T0. By Laplace transforming the temporal part of the di®usion equation,<br />

determine the temperature distribution inside the rod for t>0. Animate<br />

the temperature pro¯le for nominal values of the parameters.<br />

Problem 6-16: Heat °ow in a bar of varying cross section<br />

The heat °ow along an insulated semi-in¯nite bar whose cross section varies<br />

exponentially is described by<br />

μ <br />

@ ®x @T ®x @T<br />

e = e<br />

@x @x @t :<br />

If T (x; 0) = 0 for x>0, T (0;t) = 1, and T (1;t) = 0, use the Laplace transform<br />

approach to show that for t>0, the temperature distribution in the bar is<br />

T (x; t) = e¡®x<br />

μ μ<br />

1<br />

³<br />

erfc xt<br />

2 2<br />

¡1=2 ¡ ®t 1=2´<br />

+ e ®x μ<br />

1<br />

³<br />

erfc xt<br />

2<br />

¡1=2 + ®t 1=2´<br />

:<br />

Taking ® =1,animateT (x; t) over the range x =0to5fort =0to10.<br />

Problem 6-17: Convolution theorem<br />

An important property of the Laplace transform is the convolution theorem. If<br />

f1(t) andf2(t) are two functions, their convolution is de¯ned to be<br />

C(T )=<br />

Z T<br />

0<br />

f1(T ¡ t) f2(t) dt:<br />

If F (s), F1(s), and F2(s) are the Laplace transforms of C(T ), f1(t), and f2(t),<br />

respectively, the convolution theorem states that<br />

F (s) =F1(s) F2(s):<br />

Using the integral transform package, take the Laplace transform of C(t) and<br />

con¯rm the convolution theorem.


270 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

6.2.4 \Play It, Sam" Revisited<br />

How can you tell Al Gore from a roomful of Secret Service agents?<br />

He's the sti® one.<br />

Al Gore, former U.S. Vice President, joking about his reputation for sti®ness,<br />

New York Times, 14 September 1996<br />

As pointed out in the subsection, Play It, Sam, the small transverse vibrations<br />

of a light, horizontal, stretched, elastic string are well modeled by the<br />

linear wave equation. However, a piano \string," the subject of that section,<br />

is not actually a °exible elastic string, but rather a wire, possessing a degree<br />

of sti®ness. To understand the concept of sti®ness, imagine holding a string<br />

at one end between your ¯ngers. The unsupported end of the string will °op<br />

vertically downward at the juncture with your ¯ngers. The internal forces of<br />

thestringareunabletobalancetheshearforceexertedonthestringbyEarth's<br />

gravitational pull. For a wire, the unsupported end will sag, but not °op verticallydownwardatthejuncturepoint.<br />

Thewireissaidtohaveadegreeof<br />

sti®ness.<br />

For a string under tension, the sti®ness is negligible compared to the tension,<br />

but for a piano wire sti®ness should be included in the equation of motion. As<br />

shown in Morse [Mor48], the transverse displacement Ã(x; t) ofahorizontal<br />

wire is governed by the following fourth-order PDE:<br />

@2Ã 1<br />

¡<br />

@x2 2 ® 2<br />

@4Ã 1<br />

=<br />

@x4 c2 @2Ã : (6.13)<br />

@t2 The parameter ® is a measure of the ratio of tension to sti®ness. If ® !1,<br />

tension predominates and the usual string wave equation results. For intermediate<br />

values of ®, the full wire equation must be solved. If, on the other hand,<br />

sti®ness is all important, then ® is very small and the fourth spatial derivative<br />

term dominates over the second spatial derivative. In this limiting case, the<br />

equation relevant to a vibrating \bar" results. As a wire is made thicker and<br />

thicker it becomes a bar. Some common examples of bars are the steel girders<br />

supporting bridges and used in high-rise construction and railway tracks.<br />

Labeling a 2 ´ c 2 =(2 ® 2 ), the transverse vibrations of a bar are governed by<br />

@2Ã @t2 + a2 @4Ã =0: (6.14)<br />

@x4 Because of the fourth spatial derivative, the vibrations of a bar are substantially<br />

di®erent from those of a string.<br />

As a simple example, but one with a complicated answer, suppose that an<br />

in¯nitely long bar is initially at rest (@Ã(x; 0)=@t = 0) and is given a transverse<br />

displacement<br />

Ã(x; 0) = Ae ¡b2x 2<br />

;<br />

with A the amplitude. We want to analytically determine the displacement of<br />

the bar for times t>0 and animate the solution. Our approach will be to make<br />

use of the \full" Fourier transform and its inverse.


6.2. SEMI-INFINITE AND INFINITE DOMAINS 271<br />

Given a function f(x) that (along with all of its derivatives) vanishes as<br />

x !§1, the Fourier transform of f(x) and its inverse are de¯ned as<br />

Z 1<br />

F (k) = f(x) e ¡Ikx dx; f(x) = 1<br />

Z 1<br />

F (k) e<br />

2 ¼<br />

Ikx dk: (6.15)<br />

¡1<br />

If the Fourier transform of f(x) (denoted by F[f(x)]) is F (k), then<br />

· n d f(x)<br />

F<br />

dxn ¸<br />

=(Ik) n F (k):<br />

Fourier transforming the spatial part of the bar equation will involve n =4.<br />

Now let's use the \full" Fourier transform to solve the vibrating bar problem,<br />

¯rst loading the integral transform package, which contains the necessary<br />

fourier and invfourier (inverse Fourier) commands.<br />

> restart: with(plots): with(inttrans):<br />

The parameters a in the bar equation and b in the initial pro¯le are assumed<br />

to be positive, as is the time.<br />

> assume(a>0,b>0,t>0):<br />

The partial di®erential equation of motion for the bar is entered, using the<br />

shortcut x$4 to enter the fourth spatial derivative.<br />

¡1<br />

> pde:=diff(psi(x,t),t,t)+a^2*diff(psi(x,t),x$4)=0;<br />

μ<br />

pde := @ 2<br />

<br />

2 Ã(x; t) + a<br />

@t 2<br />

μ<br />

@ 4<br />

<br />

4 Ã(x; t) =0<br />

@x<br />

The Fourier transform of the spatial part of pde is performed, and the function<br />

fourier(Ã(x; t); x;k) replaced with F (t).<br />

> FT:=fourier(pde,x,k);<br />

> FT:=subs(fourier(psi(x,t),x,k)=F(t),FT);<br />

FT := a2 k4 μ 2 d<br />

F (t)+ F (t) =0<br />

dt2 Since a fourth spatial derivative was involved in the transform, a term (Ik) 4 =<br />

k4 has resulted in the output.<br />

The Fourier transform of the initial pro¯le is calculated,<br />

> F0:=fourier(A*exp(-b^2*x^2),x,k);<br />

k2<br />

F0 := Ae<br />

(¡ 4 b2 ) r ¼<br />

b2 and the second-order di®erential equation FT solved for F (t), subject to the<br />

initial conditions F (0) = F0 , F _ (0) = 0.<br />

> sol:=dsolve(fFT,F(0)=F0,D(F)(0)=0g,F(t));<br />

k2<br />

Ae(¡ 4 b<br />

sol := F (t) = 2 ) p ¼ cos(ak2 t)<br />

b<br />

To facilitate the calculation of the inverse Fourier transform, the right-hand<br />

side of sol is converted to exponential form and simpli¯ed.


272 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

> F2:=simplify(convert(rhs(sol),exp));<br />

F2 := 1<br />

A<br />

2<br />

p μ<br />

¼ e ( k2 (¡1+4 Iatb 2 )<br />

4 b2 b<br />

We temporarily set ¡1+4Iatb2 = ¡B and1+4Iatb2 = C in F2 .<br />

)<br />

+ e<br />

(¡ k2 (1+4 Iatb 2 )<br />

4 b2 ) <br />

> F3:=subs(f-1+4*I*a*t*b^2=-B,1+4*I*a*t*b^2=Cg,F2);<br />

F3 := 1<br />

A<br />

2<br />

p ¼<br />

μ<br />

e (¡ k2 B<br />

4 b2 )<br />

+ e<br />

(¡ k2 C<br />

4 b2 ) <br />

To perform the inverse Fourier transform of F3 , it is necessary to make assumptions<br />

about B and C. Clearly the real part of each is positive and assuming<br />

Re(A) > 0andRe(B) > 0 will work here. A slightly simpler form results if we<br />

assume that both B and C are positive, even though they are really complex.<br />

The inverse Fourier transform of F3 then yields the solution Ã.<br />

> psi:=invfourier(F3,k,x) assuming B>0,C>0;<br />

à := 1<br />

μ<br />

A e<br />

2<br />

(¡ x2 b 2<br />

B ) p C + e (¡ x2 b 2<br />

C ) p <br />

B<br />

p p<br />

B C<br />

The original forms of B and C are substituted back into the displacement Ã,<br />

the lengthy complex output being suppressed.<br />

> psi:=subs(fB=1-4*I*a*t*b^2,C=1+4*I*a*t*b^2g,psi):<br />

Since the initial pro¯le was real, Ã should be real as well. The complex evaluation<br />

command, evalc, is applied and the result simpli¯ed.<br />

> psi:=simplify(evalc(psi));<br />

Ae<br />

Ã:=<br />

(¡ b2 x 2<br />

%1 )μ<br />

μ 4 2 4 b x at p<br />

cos<br />

2<br />

%1<br />

p μ 4 2 4 b x at p<br />

%1+2+sin<br />

2<br />

%1<br />

p <br />

%1 ¡ 2<br />

2 p %1<br />

%1 := 1 + 16 a2 t2 b4 As expected, the displacement à is completely real. Noting the subexpression<br />

%1 (an artifact of exporting the Maple output into the text), the mathematical<br />

form of à is indeed quite complicated, as predicted earlier.<br />

Taking the nominal values A =1,a =0:1, and b =1inÃ,<br />

> psi:=eval(psi,fA=1,a=0.1,b=1g):<br />

the vibrations of the bar are animated over the spatial range x = ¡200 to 200<br />

and time interval t = 0 to 400.<br />

> animate(plot,[psi,x=-200..200],t=0..400,frames=150,<br />

numpoints=500,thickness=2);<br />

On running the animation, you will observe that the initial Gaussian pro¯le<br />

of the bar begins to decrease in the vicinity of x = 0, generating oscillations<br />

that rapidly disperse away from the origin in both directions. The bar does not<br />

b


6.2. SEMI-INFINITE AND INFINITE DOMAINS 273<br />

overshoot the horizontal equilibrium position near the origin, even for longer<br />

times. You should experiment with other values of the parameters.<br />

PROBLEMS:<br />

Problem 6-18: Fourier transform<br />

Calculate the Fourier transforms of the following functions and plot the results:<br />

(a) f(x) =e ¡3 jxj ; (b)f(x) =cos(2x); (c) f(x) =x=(x2 +1).<br />

Problem 6-19: Inverse Fourier transform<br />

Calculate the inverse Fourier transforms of the following functions, simplifying<br />

where necessary, and plot the results:<br />

(a) f(k) =cos(¼k=2) =(1 ¡ k2 );<br />

(b) f(k) =¡2 Ik=(¼ (k2 +2));<br />

(c) f(k) =(1= p 2 ¼)(sink=k) 2 .<br />

Problem 6-20: Bandwidth theorem<br />

An approximately monochromatic plane wave packet in one dimension has the<br />

instantaneous form u(x; 0) = f(x) eIk0x ; with f(x) the envelope function and<br />

k0 the central wave number. Consider the following functions:<br />

(a) f(x) =2e ¡3 jxj=2 ;<br />

(b) f(x) =4e ¡x2 =4 ;<br />

(c) f(x) =5forjxj < 1and0otherwise.<br />

For each function, perform the following:<br />

² Calculate the wave number spectrum jA(k)j2 where A(k) is the Fourier<br />

transform of f(x).<br />

² Plot the intensities ju(x; 0)j 2 and jA(k)j 2 .<br />

² Explicitly evaluate the root mean square deviations from the means, ¢x<br />

and ¢k, de¯ned with respect to the above intensities.<br />

² Show that in each case the bandwidth theorem (the optical analogue of<br />

the uncertainty principle) ¢x ¢k ¸ 1 is satis¯ed.<br />

2<br />

Problem 6-21: Temperature distribution in an in¯nite rod<br />

By Fourier transforming the spatial part of the di®usion equation, determine the<br />

temperature distribution T (x; t) in an in¯nite rod for t>0whenT (x; 0) = T0<br />

for jxj 0whenT (x; 0) =<br />

T0 e ¡®2 x 2<br />

.AnimateT (x; t) for nominal values of the parameters.


274 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

6.3 Numerical Simulation of PDEs<br />

Simulated disorder postulates perfect discipline; simulated fear<br />

postulates courage; simulated weakness postulates strength.<br />

Sun Tzu, Chinese general, The Art of War, c.490BC<br />

To solve some linear and almost all nonlinear PDE models, subject to speci¯ed<br />

initial and/or boundary conditions, one must resort to numerical means and<br />

simulate the behavior of the model equation by replacing the spatial and time<br />

derivatives with ¯nite di®erence approximations and introducing an accurate<br />

numerical representation of any functional forms. In this section, we will illus-<br />

t=jk<br />

k<br />

j<br />

0,2 1,2<br />

0,1 1,1<br />

0,0 1,0<br />

h<br />

i-1,j i, j i+1, j<br />

P<br />

i, j-1<br />

i<br />

i, j+1<br />

x=ih<br />

Figure 6.2: Subdividing the x-t plane with a rectangular computational mesh.<br />

trate how ¯xed-step explicit schemes are created for a one-spatial-dimensional<br />

PDE whose dependent variable is some amplitude Ã(x; t), x being the spatial<br />

coordinate and t the time. The discussion presented here is meant only to give<br />

you the °avor of a vast and important topic.<br />

The general approach is to extend the ideas introduced at the end of Chapter<br />

2 for numerically solving ODEs. Referring to Figure 6.2, the x-t plane can<br />

be subdivided for computational purposes into a rectangular grid or mesh, with<br />

each rectangle having sides of length h and k in the x- andt-directions, respectively.<br />

The coordinates of a representative intersection, or mesh, point P are<br />

taken to be x = ih, y = jk with i; j =0; 1; 2; :::: In a nonadaptive scheme,<br />

since h and k are¯xed,theintegersi and j maybeusedtolabelthemesh<br />

points, the point P being indicated by (i; j). The value of à at P is written as<br />

ÃP = Ã(x = ih;y = jk) ´ Ãi;j. A similar subscript notation may be used for<br />

the spatial and time derivatives.


6.3. NUMERICAL SIMULATION OF PDES 275<br />

For example, in the forward di®erence approximation, the ¯rst spatial and<br />

time derivatives at P are written as<br />

μ <br />

@Ã<br />

=<br />

@x P<br />

(Ãi+1;j<br />

μ <br />

¡ Ãi;j) @Ã<br />

; =<br />

h<br />

@t P<br />

(Ãi;j+1 ¡ Ãi;j)<br />

; (6.16)<br />

k<br />

while the \standard" CDAs for the second derivatives at P are<br />

μ 2 @ Ã<br />

@x2 <br />

=<br />

P<br />

(Ãi+1;j ¡ 2 Ãi;j + Ãi¡1;j)<br />

h2 ; (6.17)<br />

μ 2 @ Ã<br />

@t2 <br />

=<br />

P<br />

(Ãi;j+1 ¡ 2 Ãi;j + Ãi;j¡1)<br />

k2 : (6.18)<br />

Although rectangular meshes are most commonly employed, diamond-shaped<br />

grids can also prove to be useful in certain numerical schemes used to model<br />

wave equations.<br />

6.3.1 Freeing Excalibur the Numerical Way<br />

\Are ¯ve nights warmer than one night, then?"<br />

Alice ventured to ask. \Five times as warm of course."<br />

\But they could be ¯ve times as cold, by the same rule|"<br />

\Just so!" cried the Red Queen.<br />

Lewis Carroll (Charles Lutwidge Dodgson), English writer (1832{1898)<br />

Recall that Russell, the aerospace engineer, was having a wild dream about<br />

freeing the sword Excalibur from its stony tomb by cooling its ends with buckets<br />

of ice water when his dream took a sudden detour and he recalled the<br />

following related problem from his undergraduate thermodynamics course.<br />

A thin 1-meter-long rod (the shaft of the sword), whose lateral surface is<br />

insulated to prevent heat °ow through that surface, has its ends suddenly held<br />

at the freezing point of water, 0 ± C, by placing them in contact with buckets of<br />

ice. Taking one end of the rod to be at x = 0 and the other at x = 1, the initial<br />

temperature distribution was T (x; t =0)=100x (1 ¡ x), a parabolic pro¯le<br />

with a maximum temperature of 25 ± at the midpoint x = 1<br />

2 .<br />

Russell was able to determine the analytic solution to this problem, using<br />

the separation of variables technique with the aid of Maple. Since it is now<br />

necessary in his work to numerically solve a system of nonlinear PDEs, and he<br />

hasn't done any numerical work for a while, he decides to tackle the Excalibur<br />

problem ¯rst, using an explicit ¯nite-di®erence scheme.<br />

In the linear di®usion equation (with di®usion coe±cient d =1), Russell<br />

replaces the time derivative with the forward-di®erence approximation and the<br />

second spatial derivative with the standard CDA, so that<br />

@T<br />

@t = @2T @x2 ) (Ti;j+1 ¡ Ti;j)<br />

=<br />

k<br />

(Ti+1;j ¡ 2 Ti;j + Ti¡1;j)<br />

h2 : (6.19)


276 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

If he sets r ´ k=h 2 and c ´ 1 ¡ 2 r, the explicit scheme is<br />

Ti;j+1 = rTi¡1;j + cTi;j + rTi+1;j: (6.20)<br />

The unknown value Ti;j+1 on time step j + 1 is explicitly determined from the<br />

three known values Ti¡1;j, Ti;j, andTi+1;j on the previous (jth) time step. One<br />

starts with the bottom row (j = 0) in the numerical mesh shown in Figure 6.2,<br />

which corresponds to the initial temperature pro¯le here, and calculates T at<br />

eachinternalmeshpointofthe¯rst(j =1)timerow. Theendmeshpointsof<br />

each time row are held at zero temperature in accordance with the boundary<br />

conditions. Once all the Ti;1 values are known on time step 1, the Ti;2 on time<br />

step 2 are calculated in a similar manner, and so on.<br />

Since he intends to use a matrix multiplication approach, Russell makes a<br />

call to the Linear<strong>Algebra</strong> library package. He divides the spatial range x =0<br />

to x = 1 into 12 equal parts, so that there are M = 11 internal mesh points on<br />

each time row. The value of M is easily increased if necessary.<br />

> restart: with(Linear<strong>Algebra</strong>): M:=11: begin:=time():<br />

To display the M £ M =11£ 11 square matrix that will perform the operation<br />

on the rhs of (6.20), the following interface command is entered. The argument<br />

rtablesize=infinity allows a matrix with M>10 to be explicitly displayed,<br />

instead of being represented by a placeholder.<br />

> interface(rtablesize=infinity):<br />

Russell introduces an M £ M tridiagonal matrix3 A using the BandMatrix<br />

command. In the argument, the list [r,c,r] gives the coe±cients on the rhs of<br />

the explicit scheme (6.20), the number 1 indicates that there is one subdiagonal<br />

on either side of the main diagonal, and M speci¯es the size of the matrix A.<br />

> A:=BandMatrix([r,c,r],1,M,M);<br />

2<br />

6<br />

A := 6<br />

4<br />

c r 0 0 0 0 0 0 0 0 0<br />

r c r 0 0 0 0 0 0 0 0<br />

0 r c r 0 0 0 0 0 0 0<br />

0 0 r c r 0 0 0 0 0 0<br />

0 0 0 r c r 0 0 0 0 0<br />

0 0 0 0 r c r 0 0 0 0<br />

0 0 0 0 0 r c r 0 0 0<br />

0 0 0 0 0 0 r c r 0 0<br />

0 0 0 0 0 0 0 r c r 0<br />

0 0 0 0 0 0 0 0 r c r<br />

0 0 0 0 0 0 0 0 0 r c<br />

Consulting his old numerical analysis text, Russell ¯nds that the ¯xed-step<br />

explicit scheme for the di®usion equation becomes numerically unstable if the<br />

ratio r is greater than 1.<br />

Wanting to carry out a reasonably accurate calcu-<br />

2<br />

lation, he takes r =0:05. Inputting the spatial step size h =1=(M +1), he<br />

3A tridiagonal matrix has nonzero matrix elements only on the central diagonal and two<br />

adjacent diagonals.<br />

3<br />

7<br />

5


6.3. NUMERICAL SIMULATION OF PDES 277<br />

evaluates the time step size k = rh 2 ,aswellastheparameterc. Wanting to<br />

animate his numerical solution, he decides to create N = 50 plots, with each<br />

plotseparatedintimebys =20steps.<br />

> r:=0.05: h:=1.0/(M+1); k:=r*h^2; c:=1-2*r; N:=50: s:=20:<br />

h := 0:08333333333 k := 0:0003472222222 c := 0:90<br />

An operator f will be used to input the initial parabolic temperature pro¯le.<br />

> f:=x->evalf(100*x*(1-x)):<br />

With the help of f, the initial (j = 0 time row) temperatures at the M internal<br />

mesh points are calculated, and expressed as a column vector4 T0 so that matrix<br />

multiplication can be performed.<br />

> T[0]:=; #input temperatures<br />

2<br />

6<br />

T0 := 6<br />

4<br />

7:638888889<br />

13:88888889<br />

18:75000000<br />

22:22222222<br />

24:30555556<br />

25:00000000<br />

24:30555556<br />

22:22222222<br />

18:75000000<br />

13:88888889<br />

7:638888886<br />

A graphing operator is formed to plot the temperature pro¯le on the jth step,<br />

the plotting points being connected by straight lines. The zero temperatures at<br />

the endpoints are included.<br />

> gr:=j->plot([[0,0],seq([i/(M+1),T[j][i,1]],i=1..M),[1,0]],<br />

labels=["x","T"]):<br />

In the following do loop, the temperature pro¯le is calculated every s=20steps. > for n from 1 to N do<br />

> T[n]:=A^s . T[n-1];<br />

> end do:<br />

The CPU time on a 3-GHz personal computer to perform the calculation<br />

> CPUtime:=(time()-begin)*seconds;<br />

CPUtime := 0:350 seconds<br />

is a fraction of a second, hardly worth recording. The plots[display] command<br />

5 with the insequence=true option is employed to produce an animated<br />

sequence of the temperature pro¯le in the rod.<br />

> plots[display]([seq(gr(j),j=0..N)],insequence=true);<br />

4 Entered with the short-hand notation >.<br />

5 Ashortcutto¯rstenteringwith(plots) and then display.<br />

3<br />

7<br />

5


278 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

To see Russell's animated di®usion equation solution, you will have to execute<br />

the program and use the animation tool bar.<br />

PROBLEMS:<br />

Problem 6-23: Numerical Instability<br />

In the text recipe, con¯rm that the solution becomes numerically unstable for<br />

r>0:5. Numerical instability is signaled by the appearance of increasingly<br />

wild oscillations in the solution as time increases.<br />

Problem 6-24: Comparison with exact solution<br />

Explore the change in the percentage error in the numerical mesh values at the<br />

endoftheruncomparedwiththeexactvaluesasM is increased.<br />

Problem 6-25: A di®erent pro¯le<br />

Modify the text recipe to produce an animated numerical solution for the initial<br />

temperature pro¯le T (x; 0) = 25 sin(¼x). Compare the numerical solution in<br />

the center of the rod with the exact solution as a function of time. At what<br />

time is the temperature in the middle equal to one-quarter of the initial value?<br />

6.3.2 Enjoy the Klein{Gordon Vibes<br />

The world is never quiet, even its silence eternally resounds with the<br />

same notes, in vibrations which escape our ears.<br />

Albert Camus, French-Algerian philosopher, writer (1913{1960)<br />

After tackling the Excalibur heat-di®usion example, Russell decides to numerically<br />

investigate the small transverse oscillations of a light stretched horizontal<br />

string embedded in a stretched vertical elastic membrane. In the absence of<br />

the membrane, the instantaneous displacement Ã(x; t) of the string satis¯es the<br />

one-dimensional wave equation. The e®ect of the membrane is to add an additional<br />

Hooke's law restoring force, proportional to Ã, on the string, which tends<br />

to speed up the vibrations. The relevant transverse wave equation, called the<br />

Klein{Gordon equation (KGE), then is<br />

@2Ã @x2 ¡ @2Ã = aÃ; (6.21)<br />

@t2 where a is the elastic coe±cient of the membrane and the wave speed has been<br />

set equal to unity.<br />

If the string is of unit length and ¯xed at both ends, the boundary conditions<br />

are Ã(0;t)=Ã(1;t)=0fort ¸ 0. Supposing that the string has the initial<br />

transverse pro¯le f ´ Ã(x; 0) = x (1 ¡ x) 5 and velocity g ´ _ Ã(x; 0) = x 3 (1¡ x),<br />

Russell wishes to numerically solve the KGE and animate the oscillations.<br />

At the internal mesh points, he uses the standard CDAs for the second<br />

derivatives and approximates the inhomogeneous term with aÃi;j. Thenumer-


6.3. NUMERICAL SIMULATION OF PDES 279<br />

ical algorithm for the KGE then is<br />

(Ãi+1;j ¡ 2 Ãi;j + Ãi¡1;j)<br />

h 2<br />

¡ (Ãi;j+1 ¡ 2 Ãi;j + Ã i;j¡1)<br />

k 2 = aÃi;j; (6.22)<br />

or, setting r ´ k 2 =h 2 and c ´ 2 ¡ 2 r ¡ k 2 a, and rearranging,<br />

Ãi;j+1 = rÃi¡1;j + cÃi;j + rÃi+1;j ¡ Ãi;j¡1; (6.23)<br />

with j = 1; 2; 3; :::: The mesh points involved in this explicit scheme are<br />

schematically depicted in Figure 6.3.<br />

ψ i,j+1<br />

ψ ψ ψ<br />

i−1,j i,j i+1,j<br />

ψ i,j−1<br />

Figure 6.3: Relevant mesh points for numerically solving the KGE.<br />

In this algorithm, the unknown à value on time step (j +1) depends on<br />

its values on the previous two time steps, j and (j ¡ 1). The second time<br />

row, corresponding to taking j = 1, will be the ¯rst to be calculated. The Ã<br />

values are known along the zeroth time row from the initial condition Ã(xi; 0) =<br />

f(xi). To apply the scheme, the à values along the ¯rst time row must also be<br />

known. These may be determined from the initial transverse velocity. Using<br />

the forward-di®erence approximation, the condition _ Ã(x; 0) = g(x) yields 6<br />

Ãi;1 ¡ Ãi;0<br />

= g(xi);<br />

k<br />

or Ãi;1 ´ G = Ãi;0 + kg(xi): (6.24)<br />

Now Russell programs the explicit scheme (6.23), ¯rst loading the Linear-<br />

<strong>Algebra</strong> package so a matrix approach can be used again.<br />

> restart: with(Linear<strong>Algebra</strong>): begin:=time():<br />

6 In the problem set, Russell will show us a better approximation than this one.


280 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

He divides the range x =0to1into50equalspatialintervals,sothatthe<br />

number of internal mesh points is M = 49. The size of the time step is taken<br />

to be k =0:005, the number of time steps is N =200,anda =100.<br />

> M:=49: k:=0.005: N:=200: a:=100:<br />

The values of the spatial step size h, theratior, andc are calculated.<br />

> h:=1.0/(M+1); r:=k^2/h^2; c:=2-2*r-k^2*a;<br />

h := 0:02000000000 r := 0:06250000000 c := 1:872500000<br />

Except for the inclusion of the last term on the rhs (and a di®erent de¯nition of<br />

r), the numerical scheme (6.23) is identical with that for the Excalibur example.<br />

So, Russell forms a tridiagonal matrix A as before. Because of its large size, the<br />

full matrix is not explicitly displayed, but given by the following placeholder.<br />

> A:= BandMatrix([r,c,r],1,M);<br />

2<br />

6<br />

A := 6<br />

4<br />

49 x 49 Matrix<br />

Data Type : anything<br />

Storage : band[1; 1]<br />

Shape : band[1; 1]<br />

Order : Fortran order<br />

Operators are formed to calculate f(x), g(x), and G(x).<br />

> f:=x->evalf(x*(1-x)^5):<br />

> g:=x->evalf(x^3*(1-x)):<br />

> G:=x->evalf(f(x)+k*g(x)):<br />

Using the operator f, the initial (zeroth time row) displacements are calculated<br />

at the M internal mesh points, and put into a column vector format.<br />

> v[0]:=:<br />

Similarly, G is used to calculate the displacements at internal mesh points on<br />

the ¯rst time row and represented as a column vector.<br />

> v[1]:=:<br />

A graphing operator is formed to plot the displacement pro¯le on the jth step.<br />

> gr:=j->plot([[0,0],seq([i/(M+1),v[j][i,1]],i=1..M),[1,0]],<br />

labels=["x","psi"]):<br />

The following loop implements the numerical scheme, calculating the displacements<br />

at the internal mesh points from the second time row to the Nth row.<br />

> for j from 1 to N do<br />

> v[j+1]:=A . v[j]-v[j-1]:<br />

> end do:<br />

The CPU time is a fraction of a second.<br />

> CPUtime:=(time()-begin)*seconds;<br />

CPUtime := 0:540 seconds<br />

Russell animates the transverse oscillations by using the display command<br />

with the insequence=true option.<br />

3<br />

7<br />

5


6.3. NUMERICAL SIMULATION OF PDES 281<br />

> plots[display]([seq(gr(j),j=0..N)],insequence =true);<br />

Once again, you should execute the worksheet to see the oscillations of the<br />

string. Feel free to change the parameter values or initial conditions.<br />

Although the KGE can be solved analytically, since it is a linear PDE,<br />

Russell's numerical approach allows him to tackle nonlinear wave equations<br />

that cannot be solved analytically. For example, the nonlinear KGE<br />

@2Ã @x2 ¡ @2Ã @t2 = aÃ+ bÃ3 ; (6.25)<br />

with a and b positive, might be used to model the symmetric transverse oscillations<br />

of the string when the membrane is stretched su±ciently that a nonlinear<br />

correction to Hooke's law should be included. The modi¯cation of Russell's<br />

numerical scheme is left as a problem for the interested reader.<br />

PROBLEMS:<br />

Problem 6-26: a =0<br />

For a = 0, the KGE reduces to the linear wave equation. Run the code for<br />

a = 0 and then explore how the results are a®ected by increasing a.<br />

Problem 6-27: Nonzero initial velocity<br />

Modify the text recipe for the KGE to handle the initial conditions f(x) =0,<br />

g(x) =sin(¼x). You may have to adjust the viewing box.<br />

Problem 6-28: Nonlinear KGE<br />

Modify the text recipe to numerically simulate the nonlinear KGE (6.25). Take<br />

the same parameters as in text recipe and explore what happens when increasing<br />

positive values of b are considered.<br />

Problem 6-29: Better ¯rst-row approximation<br />

A better approximation to the ¯rst time row to use for solving the KGE is<br />

Ãi;1 = f(xi)+kg(xi)+ r<br />

2 (f(xi+1) ¡ 2 f(xi)+f(xi¡1)) + O(k 3 ):<br />

Execute the text recipe with this improved approximation.<br />

6.3.3 Vectoria's Secret<br />

None are so fond of secrets as those who do not mean to keep them.<br />

C. C. Colton, English writer (1780{1832)<br />

Vectoria's secret is out! She and Mike have announced the date of their wedding,<br />

which will take place in July in a lupine-dappled alpine meadow near<br />

Mount Baker in the North Cascades. Rumor has it that Mike will throw any<br />

guest whose cell phone rings into one of the nearby icy Chain Lakes. Since she<br />

will be too busy making wedding plans, we will not be seeing Vectoria in the<br />

rest of this text. So, we have asked her to favor us with one last recipe for<br />

solving the following problem.


282 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

In a region of space, the potential V (x; y) satis¯es the Poisson equation,<br />

@2V @x2 + @2V @y2 = xey ; 0 · x · 2; 0 · y · 1;<br />

with the four boundary conditions V (0;y)=0, V (2;y)=2ey , V (x; 0) = x,<br />

and V (x; 1) = ex. Using a central di®erence approximation for each second<br />

derivative at a mesh point (i, j) and evaluating the rhs of Poisson's equation at<br />

this point, derive a ¯nite di®erence scheme for solving the equation. Dividing<br />

the x-interval into 30 steps and the y interval into 15 steps, determine V at<br />

each mesh point and plot the numerical solution. Here is Vectoria's solution.<br />

She begins by entering the boundaries and dividing them into the suggested<br />

intervals in the x- andy-directions.<br />

> restart: with(plots): begin:=time():<br />

In the x-direction, the boundaries are at x=a=0 and x=b=2:0. The interval<br />

b ¡ a is divided into m=30 steps, and the x step size h=(b ¡ a)=m calculated.<br />

> a:=0: b:=2.0: m:=30: h:=(b-a)/m;<br />

h := 0:06666666667<br />

In the y-direction, the boundaries are at y = c =0 and y = d=1:0. The interval<br />

d ¡ c is divided into n=15 steps, and the y step size k =(d ¡ c)=n calculated.<br />

> c:=0: d:=1.0: n:=15: k:=(d-c)/n;<br />

k := 0:06666666667<br />

Using central di®erence approximations for the second derivatives, evaluating<br />

the inhomogeneous term at (i; j), setting r =(h=k) 2 , and rearranging, Poisson's<br />

equation becomes<br />

2(1+r) Vi; j ¡ Vi+1;j ¡ Vi¡1;j ¡ r (Vi; j+1 + Vi; j¡1)+h 2 xi e yj =0 (6.26)<br />

The ratio r is now evaluated.<br />

> r:=(h/k)^2;<br />

r := 1:000000000<br />

The grid coordinates in the x- andy-directions are generated.<br />

> Xcoords:=seq(x[i]=i*h,i=0..m):<br />

> Ycoords:=seq(y[j]=j*k,j=0..n):<br />

The potential V at the grid points along the four bounding edges are generated<br />

in the following four boundary conditions.<br />

> bc1:=seq(V[i,0]=i*h,i=0..m):<br />

> bc2:=seq(V[i,n]=evalf(exp(1))*i*h,i=0..m):<br />

> bc3:=seq(V[0,j]=0,j=0..n):<br />

> bc4:=seq(V[m,j]=2*evalf(exp(j*k)),j=0..n):<br />

Vectoria then assigns Xcoords, Ycoords, and the four boundary conditions.<br />

> assign(Xcoords,Ycoords,bc1,bc2,bc3,bc4):<br />

An operator f is formed to calculate equation (6.26) at the grid point (i; j).


6.3. NUMERICAL SIMULATION OF PDES 283<br />

> f:=(i,j)->2*(1+r)*V[i,j]-V[i+1,j]-V[i-1,j]-r*(V[i,j+1]<br />

+V[i,j-1])+h^2*x[i]*exp(y[j])=0;<br />

f := (i; j) ! 2(1+r) Vi; j ¡ Vi+1;j ¡ Vi¡1;j ¡ r (Vi; j+1 + Vi; j¡1)+h 2 xi e yj<br />

The mesh equations are determined for all the internal grid points using two<br />

nested sequences running from i =1tom ¡ 1andfromj =1ton ¡ 1.<br />

> eqs:=fseq(seq(f(i,j),i=1..m-1),j=1..n-1)g:<br />

The unknown potentials at the internal grid points are entered as the variables.<br />

> vars:=fseq(seq(V[i,j],i=1..m-1),j=1..n-1)g:<br />

The mesh equations are solved (to 6 digits) for the variables, and the solution<br />

is assigned.<br />

> sol:=evalf(fsolve(eqs,vars),6): assign(sol):<br />

Three-dimensional plotting points are formed for all the grid points, including<br />

those on the boundaries.<br />

> pts:=seq(seq([x[i],y[j],V[i,j]],i=0..m),j=0..n):<br />

Using the pointplot3d command, the points representing the potential at each<br />

grid point are plotted as size-6 blue circles, the result being shown in Figure 6.4.<br />

> pointplot3d([pts],symbol=circle,symbolsize=6,color=blue,<br />

axes=boxed,orientation=[135,60],tickmarks=[3,3,3],<br />

labels=["x","y","V"]);<br />

4<br />

V<br />

2<br />

0<br />

2<br />

1<br />

x<br />

0<br />

0.5 y<br />

Figure 6.4: Numerical solution of the Poisson equation.<br />

The CPU time to execute the entire recipe is about 6 seconds.<br />

> cpu:=time()-begin;<br />

cpu := 5:978<br />

0


284 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

PROBLEMS:<br />

Problem 6-30: Steady-state temperature distribution<br />

The steady-state temperature distribution T (x; y) in a thin square metal plate<br />

0:5 m on a side satis¯es Laplace's equation, r2T (x; y) = 0.<br />

conditions on the edges of the plate are<br />

The boundary<br />

T (0;y)=0; T(x; 0) = 0; T(x; 0:5) = 200 x; T (0:5;y)=200y:<br />

Using the standard CDA for the second derivatives, and choosing a suitable<br />

mesh spacing, numerically determine the temperature distribution in the plate<br />

and make a 3-dimensional plot.<br />

Problem 6-31: Potential distribution<br />

A square inner conductor 3 cm on a side is held at a potential of 100 V. A<br />

second square conductor, concentric with the ¯rst and 9 cm long on each of its<br />

inner sides, is held at 0 V. The potential ©(x; y) in the region between the two<br />

conductors satis¯es Laplace's equation, r2 ©(x; y) =0.<br />

(a) Taking the mesh spacing in both directions to be 1 cm, make a mesh<br />

diagram showing all the interior mesh points for which © is to be found.<br />

(b) UsingCDAsforthesecondderivatives,writeoutthemeshequationsfor<br />

the interior points. Make use of symmetry arguments to show that only<br />

seven interior points need to be used in the calculation of ©.<br />

(c) Solve the mesh equations and determine © at each interior point.<br />

(d) Plot © in the region stretching from the inner to the outer conductor.


Part III<br />

THE DESSERTS<br />

The way a child discovers the world constantly<br />

replicates the way science began. You start to<br />

notice what's around you, and you get very curious<br />

about how things work. How things interrelate.<br />

It's as simple as seeing a bug that intrigues you.<br />

You want to know where it goes at night;<br />

who its friends are; what it eats.<br />

David Cronenberg, Canadian ¯lmmaker (1943{)<br />

It's food too ¯ne for angels; yet come, take<br />

And eat thy ¯ll! It's Heaven's sugar cake.<br />

Edward Taylor, English poet (1664{1729)<br />

285


Chapter 7<br />

The Hunt for Solitons<br />

There is no better ... door by which you can enter into the study of<br />

natural philosophy than by considering the ... physical phenomena of<br />

acandle.<br />

Michael Faraday, English physicist (1791{1867)<br />

Nonlinear PDEs display a rich spectrum of solutions that in most cases must be<br />

obtained by numerical means. However, there exist special analytic solutions<br />

to some nonlinear PDEs of physical interest, the best known being soliton solutions<br />

of nonlinear wave equations. A soliton is a stable solitary wave, which<br />

is a localized pulse solution that can propagate at some characteristic velocity<br />

without changing shape despite the \tug of war" between \competing terms"<br />

in the governing equation of motion.<br />

A simple physical example [EJMR81] of a solitary wave is provided by the<br />

°ame of an ordinary lit candle. There exists a dynamic balance between the<br />

di®usion of the heat from the °ame into the wax and the nonlinear energy<br />

release as the wax vaporizes. The candle °ame advances into the wax at a<br />

velocity that just maintains the balance. To check whether a solitary wave<br />

is stable, i.e., is a soliton, one can subject the solitary wave to some type of<br />

perturbation and see whether its integrity is preserved. For example, the candle<br />

°ame may °icker because of an ambient air current, but it tends to preserve its<br />

shape as the candle burns, so the °ame displays soliton-like behavior.<br />

Of course, there exist many di®erent possible stability criteria that could be<br />

invoked to decide whether a solitary wave is a soliton. Historically, however,<br />

mathematicians have decided that in order for a solitary wave to be deemed<br />

worthy of the name soliton, it must survive a collision with another solitary-wave<br />

solution of the same PDE completely unchanged in shape. There are two main<br />

approaches to applying this collisional stability criterion, either numerically or<br />

analytically. The numerical simulation approach will be brie°y illustrated in the<br />

last section. Analytic methods are considerably more complicated to implement<br />

(see, e.g., [EM00]) and we will be content here only to quote some of the results<br />

in the form of two-soliton solutions.<br />

Given a nonlinear PDE, how do we know that it even has the possibility<br />

287


288 CHAPTER 7. THE HUNT FOR SOLITONS<br />

of having soliton solutions? This chapter is about the hunt for solitary waves<br />

(possible solitons), using graphical and analytic approaches, and the analytic<br />

con¯rmation that some of these solitary waves are indeed solitons.<br />

First, we should have some idea of what solitary waves look like, and what<br />

well-known nonlinear PDEs of physical interest are known to have them. To<br />

keep the discussion simple, let's restrict our attention to wave motion in one<br />

spatial dimension. Three well-known nonlinear PDEs that describe di®erent<br />

types of wave motion are the Korteweg{de Vries equation (KdVE), the sine{<br />

Gordon equation (SGE), and the nonlinear SchrÄodinger equation (NLSE):<br />

² @Ã<br />

@t<br />

@Ã<br />

+ ®Ã<br />

@x + @3Ã 3 =0, KdVE;<br />

@x<br />

² @2Ã 1<br />

2 =<br />

@x c2 ² i @Ã<br />

@x<br />

@ 2 Ã<br />

2 +sinÃ, SGE;<br />

@t<br />

1 @<br />

§<br />

2<br />

2 Ã<br />

@t 2 + jÃj2 Ã =0, NLSE.<br />

Here x is the spatial coordinate, t is the time, ® is a numerical scale parameter,<br />

i = p ¡1, and Ã(x; t) is the amplitude. All three equations turn out to be very<br />

important in nonlinear dynamics because, under suitable approximations, they<br />

arise in many di®erent contexts.<br />

The KdVE has been used to describe [SCM73] water waves in shallow canals,<br />

magnetohydrodynamic waves in plasmas, longitudinal dispersive waves in elastic<br />

rods, pressure waves in liquid{gas bubble mixtures, and so on.<br />

The SGE is applicable [BEMS71] to the propagation of magnetic spins in<br />

ferromagnets, magnetic °ux in Josephson junctions, crystal dislocations, ultrashort<br />

optical pulses, etc.<br />

Undoubtedly, the most important application of the NLSE [Has90] is to the<br />

propagation of optical pulses in glass ¯bers whose refractive index n is of the<br />

form n = n0 + n1 I, withn0 and n1 positive constants and I the light intensity.<br />

The light intensity is proportional to jÃj 2 , where à is the complex electric<br />

¯eld amplitude that satis¯es the NLSE. The light intensity is experimentally<br />

measured rather than the electric ¯eld amplitude.<br />

The derivation of these three nonlinear wave equations is beyond the scope<br />

of this text. The reader who is interested in such matters should consult the<br />

references cited above. As will be demonstrated, all three nonlinear PDEs<br />

support collisionally stable solitary-wave solutions, i.e., solitons.<br />

What do solitary waves (solitons) look like? Figure 7.1 shows a sketch of the<br />

two commonly occurring types. For the peaked variety (called nontopological<br />

solitary waves by mathematicians), there exists a localized maximum with the<br />

pulse dropping to zero amplitude at §1. Nontopological solitary waves also<br />

exist whose pulse amplitude displays a localized dip to zero with the pulse<br />

increasing to a constant nonzero amplitude at §1. In terms of the intensity,<br />

the NLSE supports both types of nontopological solitary waves. Those optical<br />

solitary waves with peaks are called bright solitary waves, while those with the


289<br />

dip are referred to as black solitary waves. The bright ones occur for the plus<br />

sign in the NLSE, the black ones for the minus sign. The Korteweg{de Vries<br />

(KdV) equation also possesses nontopological solitary-wave solutions.<br />

− ∞<br />

U<br />

peaked kink<br />

z<br />

Figure 7.1: Qualitative shapes of two common types of solitary waves.<br />

For the kink type (referred to as topological solitary waves) in Figure 7.1, the<br />

pulse amplitude U changes from one constant value (e.g., zero in the ¯gure) at<br />

¡1 to a larger constant value at + 1. The region in which the change takes<br />

place is usually quite localized. Antikink solitary waves canalsoexist,forwhich<br />

the amplitude changes from a constant value at ¡1 to a lower constant value<br />

at + 1. The SGE displays both kink and antikink solutions.<br />

Given a nonlinear wave equation, how are these solitary-wave solutions<br />

found? We know that the one-dimensional linear wave equation has a general<br />

solution of the structure Ã(x; t) =f(x ¡ ct)+g(x + ct), where f and g<br />

are arbitrary functions. The function f(x ¡ ct) describes a waveform traveling<br />

with speed c in the positive x-direction, while the form g(x + ct) describes a<br />

wave traveling in the negative x-direction. Let us now con¯ne our attention to<br />

waves traveling in the positive x-direction, the discussion for waves traveling<br />

in the opposite direction being similar. The linear wave equation can support<br />

localized solutions Ã(x; t) =f(z = x ¡ ct) such as the peaked solitary waves<br />

shown in Figure 7.1. These solutions will translate unchanged in shape along<br />

the positive x-axis. For nonlinear wave equations, we can look for similar types<br />

of localized solutions. That is to say, we seek solutions of the mathematical form<br />

Ã(x; t)=Ã(z = x ¡ ct) that have pro¯les qualitatively similar to those shown<br />

in Figure 7.1. Note that this assumed form reduces the number of independent<br />

variables from two (x and t) toone(z), thus reducing the PDE to an ODE.<br />

Borrowing concepts from Chapter 1, we can make a phase-plane portrait for<br />

the nonlinear ODE. As will be shown in the following section, the solitary-wave<br />

solutions will correspond to separatrix solutions,aseparatrixbeingatrajectory<br />

in the phase plane that divides the plane into regions with qualitatively di®erent<br />

behaviors. The graphical method of hunting for solitons is quite important,<br />

because it allows for their possible existence to be established, even if analytic<br />

forms do not exist.<br />


290 CHAPTER 7. THE HUNT FOR SOLITONS<br />

7.1 The Graphical Hunt for Solitons<br />

7.1.1 Of Kinks and Antikinks<br />

If you are idle, be not solitary; if you are solitary, be not idle.<br />

Samuel Johnson, letter, 27 October 1779, to James Boswell<br />

In this ¯rst example, a phase-plane portrait will reveal that the SGE has both<br />

kink and antikink solitary waves. To produce this portrait, the DEtools library<br />

package must be loaded. In order to implement the assumption Ã(x; t) =Ã(z =<br />

x ¡ ct), the dchange command will be employed to make a change of variables,<br />

requiring us also to load PDEtools. The SGE is then entered,<br />

> restart: with(DEtools): with(PDEtools):<br />

> SGE:=diff(psi(x,t),x,x)-diff(psi(x,t),t,t)=sin(psi(x,t));<br />

μ<br />

SGE := @ 2<br />

μ<br />

2 Ã(x; t) ¡ @<br />

@x 2<br />

<br />

2 Ã(x; t) =sin(Ã(x; t))<br />

@t<br />

and a variable transformation tr introduced with the \old" variables x, t, and<br />

Ã(x; t) related to the \new" variables z, ¿, andU(z) byx = z + c¿, t = ¿, and<br />

Ã(x; t) =U(z), where c is an arbitrary velocity parameter.<br />

> tr:=fx=z+c*tau,t=tau,psi(x,t)=U(z)g;<br />

tr := fx = z + c¿; t= ¿; Ã(x; t) =U (z)g<br />

The variable change (dchange) command applies the transformation to SGE.<br />

> de1:=dchange(tr,SGE,[z,tau,U(z)]);<br />

μ <br />

2 d<br />

de1 := U (z) ¡ c<br />

dz2 2<br />

μ 2 d<br />

U (z)<br />

dz2 <br />

=sin(U (z))<br />

The SGE has been reduced to an ODE de1 with z as the independent \spatial"<br />

variable. It can be simpli¯ed by collecting the second derivatives, d 2 U(z)=dz 2 .<br />

> de2:=collect(de1,diff(U(z),z,z));<br />

de2 := (1 ¡ c2 μ <br />

2 d<br />

) U (z) =sin(U (z))<br />

dz2 The nature of the phase-plane portrait will depend on the parameter c. For<br />

c>1(so1¡ c2 < 0), de2 is just the undamped plane-pendulum ODE, whose<br />

portrait was \painted" in Chapter 1. For c1, except that all ¯xed points are shifted by<br />

¼. Forc =1,sin(U(z)) = 0 and U = 0, or an integer multiple of ¼, for all z.<br />

The second-order ODE de2 is now rewritten as two ¯rst-order equations by<br />

setting dU=dz = Y in de3 , and substituting de3 into de2 to produce de4 .<br />

> de3:=diff(U(z),z)=Y(z); de4:=subs(de3,de2);<br />

de3 := d<br />

U (z) =Y (z)<br />

dz<br />

de4 := (1 ¡ c2 μ <br />

d<br />

) Y (z) =sin(U (z))<br />

dz


7.1. THE GRAPHICAL HUNT FOR SOLITONS 291<br />

Four phase-plane trajectories will be drawn corresponding to the following initial<br />

conditions, which are chosen to be close to the saddle points that occur for<br />

c ic:=[[U(0)=0.01,Y(0)=0],[U(0)=-0.01,Y(0)=0],<br />

[U(0)=-6.27,Y(0)=0],[U(0)=6.27,Y(0)=0]]:<br />

An operator F is formed to apply the phaseportrait command to the ODE<br />

system de3 and de4 for, say, c =0:5 for speci¯ed scene parameters A and B.<br />

Choosing A = U and B = Y will generate the phase-plane portrait, while<br />

A = z and B = U will produce a plot of U(z). By trial and error, the z range is<br />

taken to be from 0 to 11. This will produce approximate separatrix trajectories<br />

that leave from one saddle point and end up at another saddle point. The<br />

tangent arrows are colored green and are taken (using arrows=MEDIUM) tobe<br />

\two-headed." The four trajectories are given di®erent colors, so that they are<br />

easily distinguished on the computer screen.<br />

> F:=(A,B)->phaseportrait([de3,eval(de4,c=0.5)],[U(z),Y(z)],<br />

z=0..11,ic,scene=[A,B],U=-6.5..6.5,Y=-6.5..6.5,<br />

stepsize=0.05,dirgrid=[30,30],color=green,linecolor=<br />

[blue,red,black,magenta],arrows=MEDIUM):<br />

Entering F(U,Y)produces the phase-plane portrait shown in Figure 7.2.<br />

> F(U,Y);<br />

6<br />

4<br />

Y<br />

2<br />

–6 –4 –2 0 2 4 6<br />

U<br />

–2<br />

–4<br />

–6<br />

Figure 7.2: Separatixes correspond to kink and antikink solitons.<br />

The solid curves are the separatrixes, two trajectories between the saddle points<br />

(¡2 ¼;0) and (0,0), and two between (0,0) and (+2 ¼; 0). Inside the separatrixes,


292 CHAPTER 7. THE HUNT FOR SOLITONS<br />

the solutions are periodic as the trajectories cycle around vortex points at (U =<br />

§ ¼; Y =0)asz increases. The solutions outside the separatrixes are also<br />

oscillatory, resembling \over-the-top" motion for the undamped pendulum.<br />

What do the separatrix solutions look like? Qualitatively, the answer is quite<br />

simple. A trajectory starting at the saddle point (0,0) at z = ¡1 asymptotically<br />

approaches the right saddle point (2 ¼; 0) as z ! + 1. A similar trajectory<br />

connects the left saddle point at (¡2 ¼; 0) to the one at the origin as z varies<br />

from ¡1 to + 1. These are examples of kink solitary waves, whose pro¯les<br />

U(z) may be seen by entering F(z,U), thus producing Figure 7.3. The curves<br />

connecting U =2¼ to U =0,andU =0to¡2 ¼, are the antikink solutions.<br />

> F(z,U);<br />

U<br />

6<br />

4<br />

2<br />

0<br />

–2<br />

–4<br />

–6<br />

2 4 6 8 10<br />

z<br />

Figure 7.3: Pro¯les of kink and antikink solitary waves.<br />

An important physical example of a kink is a so-called Bloch wall between<br />

two magnetic domains in a ferromagnet as schematically depicted in Figure 7.4.<br />

The magnetic spins rotate from, say, spin down in one domain to spin up in<br />

Figure 7.4: Bloch wall between two ferromagnetic domains.<br />

the adjacent domain. The narrow transition region between down and up spins<br />

is called a Bloch wall in honor of the theoretical physicist and Nobel laureate


7.1. THE GRAPHICAL HUNT FOR SOLITONS 293<br />

Felix Bloch. Under the in°uence of an applied magnetic ¯eld, the Bloch wall<br />

(kink soliton) can propagate according to the SGE without changing in shape.<br />

PROBLEMS:<br />

Problem 7-1: Variation in velocity<br />

Explore how the sine{Gordon solitary waves vary in shape as the velocity c is<br />

altered.<br />

Problem 7-2: Cosine{Gordon equation<br />

If the sine term is replaced with a cosine in the SGE, how would the solitarywave<br />

solutions be a®ected? Con¯rm your reasoning by running the text recipe<br />

with a cosine present, instead of the sine term. You will have to alter the initial<br />

conditions to obtain the new separatrixes.<br />

Problem 7-3: Is there or isn't there?<br />

Suppose that the nonlinear term in the SGE is replaced with sin 2 Ã. Using<br />

the phase-plane portrait approach, determine whether there is a solitary-wave<br />

solution to this modi¯ed SGE.<br />

7.1.2 In Search of Bright Solitons<br />

We're all of us sentenced to solitary con¯nement inside our<br />

own skins, for life!<br />

Tennessee Williams, American dramatist (1914{1983)<br />

Our second example illustrates the existence of a bright solitary-wave solution<br />

to the NLSE for the situation that the equation has the plus sign.<br />

The DEtools library package is loaded,<br />

> restart: with(DEtools):<br />

and the NLSE entered.<br />

> NLSE:=I*diff(E(x,t),x)+(1/2)*diff(E(x,t),t,t)<br />

+abs(E(x,t))^2*E(x,t)=0;<br />

μ <br />

@<br />

NLSE := E (x; t) I +<br />

@x 1<br />

μ <br />

2 @<br />

E(x; t) + jE (x; t)j<br />

2 @t2 2 E (x; t) =0<br />

Because of the complex nature of the equation, a slightly di®erent assumption<br />

is made here than in the sine{Gordon example. In this case, a solitary-wave<br />

solution of NLSE of the form E(x; t) =U(t) e ibx is sought, where the parameter<br />

b, the coordinate x, andU(t) are taken as positive.<br />

> ode:=eval(NLSE,E(x,t)=U(t)*exp(I*b*x))<br />

assuming b>0,x>0,U(t)>0;<br />

ode := ¡U (t) be (bxI) + 1<br />

μ <br />

2 d<br />

U (t) e<br />

2 dt2 (bxI) + U (t) 3 e (bxI) =0<br />

This assumption has reduced the NLSE to an ODE, which is simpli¯ed by<br />

dividing by eibx and multiplying by 2.


294 CHAPTER 7. THE HUNT FOR SOLITONS<br />

> ode2:=simplify(2*ode/exp(I*b*x));<br />

μ <br />

2 d<br />

ode2 := ¡2 U (t) b + U (t) +2U (t)<br />

dt2 3 =0<br />

The second-order ODE is cast into two ¯rst-order ODEs by setting dU=dt = Y<br />

in ode3 , and substituting this expression into ode2 .<br />

> ode3:=diff(U(t),t)=Y(t); ode4:=subs(ode3,ode2);<br />

ode3 := d<br />

U (t) =Y(t)<br />

dt<br />

μ <br />

d<br />

ode4 := ¡2 U (t) b + Y (t) +2U (t)<br />

dt 3 =0<br />

Two phase-plane trajectories will be plotted for initial conditions very close to<br />

the origin. The origin will be revealed to be a saddle point.<br />

> ic:=[[U(0)=.01,Y(0)=0],[U(0)=-.01,Y(0)=0]]:<br />

Taking b =1,anoperatorFis formed to apply the phaseportrait command<br />

to ode3 and ode4 for speci¯ed scene parameters A and B.<br />

> F:=(A,B)->phaseportrait([ode3,eval(ode4,b=1)],[U(t),Y(t)],<br />

t=0..9,ic,scene=[A,B],U=-2..2,Y=-2..2,stepsize=0.05,<br />

dirgrid=[20,20],color=red,linecolor=blue,arrows=MEDIUM):<br />

The phase-plane portrait results on entering F(U,Y),<br />

> F(U,Y);<br />

the result being shown in Figure 7.5.<br />

Y<br />

2<br />

1<br />

–2 –1 0 1 2<br />

U<br />

–1<br />

–2<br />

Figure 7.5: Separatrixes correspond to bright solitary waves.<br />

The arrows indicate the direction of increasing t, while the solid curves to the<br />

left and right of the origin are the two separatrixes. There are vortex points at<br />

(U = § 1, Y =0)andasaddlepointattheorigin. Theseparatrixlinetothe<br />

right of the origin starts at U =0 for t !¡1,growstoamaximumpositive


7.1. THE GRAPHICAL HUNT FOR SOLITONS 295<br />

value at intermediate t, and returns to zero as t ! +1. Recalling that the<br />

intensity is proportional to jÃj 2 = U 2 , we see that the separatrix to the left of<br />

the origin will produce exactly the same solitary-wave pro¯le for the intensity,<br />

which is normally what is measured experimentally. Because this solitary-wave<br />

pro¯le is collisionally stable, it is referred to as a bright soliton. The amplitudes<br />

U(t) corresponding to the two separatrixes are obtained by entering F(t,U),<br />

> F(t,U);<br />

the result being shown in Figure 7.6.<br />

U<br />

2<br />

1<br />

0<br />

–1<br />

–2<br />

2 4 6 8<br />

t<br />

Figure 7.6: Bright solitary-wave amplitudes.<br />

The reader might have been surprised that a di®erent assumed solution was<br />

used for the NLSE than in the previous section to derive the bright soliton.<br />

This is because in the underlying derivation of the NLSE, which is beyond the<br />

scopeofthistext,acoordinatetransformationtoaframemovingatthespeedof<br />

light has already been made. The bright soliton is stationary (has zero velocity)<br />

in this moving frame. In the laboratory frame, the bright-soliton solution can<br />

be interpreted as follows. At a given point in the medium, the bright-soliton<br />

intensity will be essentially zero until the pulse arrives, then grow to a maximum<br />

value, and decrease back toward zero as the pulse passes by.<br />

Bright-soliton solutions have been observed [Has90] experimentally in glass<br />

¯bers, the time interval over which the light intensity is appreciable at a given<br />

point in the ¯ber being of the order of a few picoseconds (1 picosecond (ps) = 10 ¡12<br />

seconds).<br />

Because of their narrow widths and their stability, solitons are envisioned by<br />

telecommunications engineers as high-bit-rate carriers of digitized information<br />

along optical ¯bers, each soliton representing a \one" and a blank space between<br />

adjacent solitons representing a \zero."<br />

Blacksolitonsmaybefoundfortheminus-signcaseintheNLSE,thisbeing<br />

left for you to do as a problem. A few other interesting problems are also<br />

presented for your intellectual amusement.


296 CHAPTER 7. THE HUNT FOR SOLITONS<br />

PROBLEMS:<br />

Problem 7-4: Black solitons<br />

Modify the text recipe to determine the solitary-wave solutions for the minussign<br />

case in the NLSE. Remembering that the physically observed intensity<br />

is proportional to jÃj2 , con¯rm that these solutions are black solitary waves.<br />

These solitary waves are collisionally stable, so are black solitons.<br />

Problem 7-5: Saturable refractive index<br />

The NLSE for a dielectric with a saturable refractive index takes the form<br />

i @Ã 1<br />

+<br />

@x 2<br />

@2Ã jÃj2<br />

+ Ã =0;<br />

@t2 1+a jÃj2 where i = p ¡1andais a positive parameter. Taking a =0:5 and assuming<br />

a solution of the form Ã(x; t) = U(t) eibx with b = 1, use the phase-plane<br />

portrait to demonstrate graphically that a solitary-wave solution exists.<br />

analytic form is not known for this solitary wave.<br />

Problem 7-6: Burgers' equation<br />

An<br />

Burger's equation<br />

@Ã @Ã<br />

+ Ã<br />

@t @x = ¾ @2Ã ;<br />

@x2 with ¾ a positive parameter, is an example of a nonlinear di®usion equation.<br />

Graphically show that an antikink solitary-wave solution exists to Burgers'<br />

equation for a representative value of the di®usion coe±cient ¾.<br />

Problem 7-7: Boussinesq's equation<br />

The Boussinesq wave equation, which was ¯rst derived in an attempt to describe<br />

shallow-water waves (Ã is the surface displacement) propagating in both<br />

directions, is<br />

@2Ã @x2 ¡ @2Ã @t2 +6@2 (Ã2 )<br />

@x2 + @4Ã =0:<br />

@x4 Using the phase-portrait option, show that a bright solitary-wave solution exists<br />

for this equation.<br />

7.1.3 Can Three Solitons Live Together?<br />

... for nothing on earth is solitary ...<br />

Ralph Waldo Emerson, American essayist and philosopher (1803{1882)<br />

An interesting theoretical problem [ER79] in nonlinear optics is the resonant<br />

interaction of three collinear waves consisting of two electromagnetic waves labeled<br />

with subscripts 1 and 2 and a sound wave with subscript 3. The wave<br />

velocities are, respectively, v1, v2, andv3 ¿ v1;v2. The real amplitudes Á1, Á2,<br />

and Á3 satisfy the following set of nonlinear PDEs:


7.1. THE GRAPHICAL HUNT FOR SOLITONS 297<br />

@Á1 @Á1<br />

+ v1<br />

@t @x = ¡¯1 Á2 Á3;<br />

@Á2 @Á2<br />

+ v2<br />

@t @x = ¯2 Á1 Á3;<br />

@Á3 @Á3<br />

+ v3<br />

@t @x = ¡¯3 Á1 Á2:<br />

(7.1)<br />

Here, x is the direction of wave propagation, t is the time, and the coupling<br />

parameters ¯1, ¯2, and¯3 are real and positive. Our goal is to show graphically<br />

that there exists a set of three solitary waves, one for each equation, which will<br />

propagate along together at a common velocity c.<br />

The DEtools and PDEtools library packages are loaded,<br />

> restart: with(DEtools): with(PDEtools):<br />

and the parameter °, which will shortly be introduced, is unprotected from its<br />

Maple assignment as Euler's constant. To generate the N = 3 PDEs<br />

> unprotect(gamma): N:=3:<br />

with a do loop, let's set Á4 = Á1 and Á5 = Á2.<br />

> phi[4](x,t):=phi[1](x,t): phi[5](x,t):=phi[2](x,t):<br />

The following do loop then generates the three relevant PDEs.<br />

> for j from 1 to N do<br />

> pde[j]:=diff(phi[j](x,t),t)+v[j]*diff(phi[j](x,t),x)<br />

=(-1)^j*beta[j]*phi[j+1](x,t)*phi[j+2](x,t);<br />

> end do;<br />

³ ´ ³ ´<br />

pde 1 := @@t Á1(x; t) + @ v1 Á1(x; t) = ¡¯1 Á2(x; t) Á3(x; t)<br />

@x<br />

³ ´ ³ ´<br />

pde 2 := @@t Á2(x; t) + @ v2 Á2(x; t) = ¯2 Á3(x; t) Á1(x; t)<br />

@x<br />

³ ´ ³ ´<br />

pde 3 := @@t Á3(x; t) + @ v3 Á3(x; t) = ¡¯3 Á1(x; t) Á2(x; t)<br />

@x<br />

Solitary-wave solutions are sought that are functions of the single \new" independent<br />

\spatial" variable z = x ¡ ct, c being an arbitrary velocity for the<br />

moment. The relevant variable transformation is entered, with t = ¿ and new<br />

amplitudes U1(z), U2(z), and U3(z).<br />

> tr:=fx=z+c*tau,t=tau,phi[1](x,t)=U[1](z),<br />

phi[2](x,t)=U[2](z),phi[3](x,t)=U[3](z)g;<br />

tr := fx = z+c¿; t= ¿; Á1(x; t) =U1(z); Á2(x; t) =U2(z); Á3(x; t) =U3(z)g<br />

and the dchange command applied to each PDE in the following do loop.<br />

> for j from 1 to N do<br />

> ode[j]:=dchange(tr,pde[j],[z,tau,U[1](z),U[2](z),U[3](z)]);<br />

To simplify the output, the substitution ¯j = °j (vj ¡ c) ismadeinthejth<br />

ODE and each equation divided by (vj ¡ c) and simpli¯ed.<br />

> ode[j]:=subs(beta[j]=gamma[j]*(v[j]-c),ode[j]):


298 CHAPTER 7. THE HUNT FOR SOLITONS<br />

> ode[j]:=simplify(ode[j]/(v[j]-c)):<br />

> end do:<br />

On completion of the do loop, the system sys of three resulting nonlinear ODEs<br />

is put into a list and displayed.<br />

> sys:=[ode[1],ode[2],ode[3]];<br />

sys :=<br />

·<br />

d<br />

dz U1(z) =¡°1 U2(z) U3(z); d<br />

dz U2(z) =°2 U3(z) U1(z);<br />

¸<br />

d<br />

dz U3(z) =¡°3 U1(z) U2(z)<br />

To graphically ¯nd three coexisting solitary-wave solutions, the ° parameters<br />

are all set equal to the value 1.<br />

> gamma[1]:=1: gamma[2]:=1: gamma[3]:=1:<br />

Since the ¯ parameters were all positive, choosing all three ° values to be<br />

positive implies that c is less than the smallest v value, i.e., smaller than v3.<br />

Typically, v1 ¼ v2 ¼ 108 m/s and the speed v3 of sound is about 103 m/s.<br />

So, the electromagnetic solitary waves are very unusual, since they would be<br />

traveling some ¯ve orders of magnitude more slowly than they normally do.<br />

Our graphical procedure will produce a three-dimensional viewing box, so<br />

based on trial and error, it is convenient to choose the following two orientations<br />

> Orient[1]:=[-90,90]: Orient[2]:=[-90,0]:<br />

for the viewing box in the following do loop.<br />

> for i from 1 to 2 do<br />

The DEplot3d plotting command will produce solution trajectories but no tangent<br />

¯eld. The independent variable z is allowed to vary from z = ¡5 toz =20.<br />

Solitary waves are sought that are kinks (antikinks) or peaked solutions. Peaked<br />

solutions would start with U =0atz = ¡1, while kinks would start at some<br />

constant value at this limit. One can't literally start at zero, for example, becausethenitwouldtakeforeverintermsofzto<br />

generate a solution. In the<br />

following, U1 and U3 start out with the value 0:01 (close to zero) and peaked<br />

solutions are sought for these amplitudes. On the other hand, U2 will start with<br />

the value ¡0:99 (close to ¡1) and a kink solution sought for this amplitude.<br />

The scene option is taken to be scene=[z,U[1](z),U[2](z)], so that with the<br />

appropriate orientation, the behavior of U1 and U2 as a function of z can be<br />

observed. 1<br />

> DEplot3d(sys,[U[1](z),U[2](z),U[3](z)],z=-5..20,<br />

[[U[1](0)=0.01,U[2](0)=-0.99,U[3](0)=0.01]],<br />

scene=[z,U[1](z),U[2](z)],U[1]=0..1.2,U[2]=-1.2..1.2,<br />

stepsize=0.05,orientation=Orient[i],linecolor=blue);<br />

> end do;<br />

On completion of the do loop, the two plots are displayed in Figure 7.7.<br />

1To see U3 plotted versus z, youcantakescene = [z,U[2](z),U[3](z)] with an orientation<br />

[-90,90].


7.2. ANALYTIC SOLITON SOLUTIONS 299<br />

U1<br />

1<br />

–5 0 5 z 15 20<br />

0.5<br />

U2<br />

1<br />

–0.5<br />

–1<br />

–5 0 5 z 15 20<br />

Figure 7.7: Solitary-wave pro¯les for U1 (left) and U2 (right).<br />

On the left is shown the peaked solitary wave for electromagnetic wave number<br />

one (U1) and on the right the coexisting kink solitary-wave solution for the<br />

second electromagnetic wave (U2). The sound-wave amplitude U3 (not shown)<br />

displays a peaked solitary-wave pro¯le as well.<br />

David Kaup [Kau76], [KRB79] has extensively investigated the three-wave<br />

problem and analytically established that the three solitary waves are solitons.<br />

However, although many years have elapsed since these solitons were predicted,<br />

there is still no experimental evidence that such solitons can actually be produced<br />

in the laboratory.<br />

PROBLEMS:<br />

Problem 7-8: Solitary sound-wave pro¯le<br />

Modify the recipe in the text to explicitly graph the solitary sound wave pro¯le<br />

as a function of z.<br />

Problem 7-9: Variation with °<br />

Discuss how the three solitary-wave pro¯les vary in shape as the values of °1,<br />

°2, and°3arealtered in the text recipe. For example, try °1 =1,°2 =2,<br />

and °3 = 3. Support your discussion with the pro¯le plots in each case. Note<br />

whether any of the pro¯les is still a solitary wave or is a wave train.<br />

7.2 Analytic Soliton Solutions<br />

In Chapters 5 and 6, the focus was on solving a wide variety of linear di®usion,<br />

Laplace, and wave equation models. The coverage was somewhat lengthy not<br />

only because of the physical importance of these PDEs but also because such<br />

linear PDEs could be solved analytically, the detailed solutions being readily<br />

derived with Maple. The mathematical solution of nonlinear di®usion and wave


300 CHAPTER 7. THE HUNT FOR SOLITONS<br />

equation models is much more di±cult, and analytic approaches have consisted<br />

mainly in ¯nding special solutions, some of which are of physical importance.<br />

Many of these approaches are quite complicated in nature, but the seeking of<br />

analytic solitary-wave pro¯les is relatively easy, provided that analytic solutions<br />

exist. This will now be illustrated in the next two examples.<br />

7.2.1 Follow That Wave!<br />

It's just a job ... waves pound the sand. I beat people up.<br />

Muhammad Ali, American boxer, New York Times, 6April1977<br />

Probably the ¯rst reported observation of soliton behavior recorded in the scienti¯c<br />

literature was made by the Scottish engineer and naval architect John<br />

Scott Russell [Rus44]. In the less formal style of scienti¯c reporting of the day,<br />

he wrote:<br />

I was observing the motion of a boat which was rapidly drawn along a narrow<br />

channel by a pair of horses, when the boat suddenly stopped | not so the<br />

mass of water in the channel which it had put in motion; it accumulated round<br />

the prow of the vessel in a state of violent agitation, then suddenly leaving it<br />

behind, rolled forward with great velocity, assuming the form of a large solitary<br />

elevation, a rounded smooth and well-de¯ned heap of water, which continued its<br />

course along the channel apparently without change of form or diminution of<br />

speed. I followed it on horseback, and overtook it still rolling on at a rate of<br />

some eight or nine miles an hour, preserving its original ¯gure some thirty feet<br />

long and a foot to a foot and a half in height. Its height gradually diminished,<br />

and after a chase of one or two miles I lost it in the windings of the channel.<br />

Such, in the month of August 1834, was my ¯rst chance interview with that<br />

singular and beautiful phenomenon ::::<br />

The \narrow channel" referred to by Russell still exists, being the Union Canal<br />

linking Edinburgh with Glasgow. Actually, Russell was not observing the<br />

\rapidly drawn boat" by accident, but was actually carrying out a series of experiments<br />

to determine the force{velocity characteristics of di®erently shaped<br />

boat hulls in order to determine design parameters for conversion from horse<br />

power to steam power. His solitary-wave observations were followed by extensive<br />

wave-tank experiments in which he established the major properties of<br />

hydrodynamic solitary waves. [EJMR81]<br />

The detailed mathematical explanation of Russell's solitary wave had to wait<br />

50 years until 1895, when the relevant nonlinear Korteweg{de Vries equation,<br />

@Ã @Ã<br />

+ ®Ã<br />

@t @x + @3Ã =0; (7.2)<br />

@x3 was derived by the Dutch mathematicians Diederik Korteweg and Gustav de<br />

Vries. In the KdV equation, Ã is the transverse displacement of the horizontal<br />

water surface, x the spatial coordinate in the direction of wave propagation, t


7.2. ANALYTIC SOLITON SOLUTIONS 301<br />

the time, and ® a numerical factor that can be either scaled out of the equation<br />

or, alternatively, assigned a convenient numerical value. The KdV equation<br />

doesn't look like a wave equation, having a ¯rst time derivative and a third<br />

spatial derivative term. However, it does describe the unidirectional propagation<br />

of lossless shallow-water waves in a rectangular canal quite well. How a<br />

peaked solitary wave solution to the KdV equation occurs is rather interesting.<br />

If the nonlinear term, ®Ã(@Ã=@x), is neglected, the remaining two terms<br />

produce a dispersive (spreading) e®ect. This is easily understood as follows. A<br />

localized propagating pulse can be built up out of a Fourier sum of terms of<br />

the plane wave structure e i(kx+!t) ,wherek is the wave number and ! is the<br />

frequency. Neglecting the nonlinear term, the dispersion relation ! = k 3 results<br />

on substituting the plane wave solution. Solving for k, the phase velocity then<br />

is v = !=k = ! 2=3 . Therefore, high-frequency Fourier components travel faster<br />

than low-frequency components, i.e., dispersion occurs.<br />

On the other hand, if the third-derivative term is ignored, it can be analytically<br />

shown [EM00] that the remaining two terms generate a \shock wave"<br />

e®ect. A shock wave is characterized by a progressive steepening of the leading<br />

edge of a propagating localized pulse. The solitary-wave solution corresponds<br />

to the situation in which the dispersive and shock wave contributions cancel<br />

exactly.<br />

To analytically determine the solitary-wave solution, let's follow the procedure<br />

of the previous section and assume that Ã(x; t) =Ã(z = x ¡ ct), where<br />

c>0 is the velocity, whose value is not yet unspeci¯ed. The e®ect of this simplifying<br />

assumption will be to reduce the nonlinear PDE (7.2) to a nonlinear<br />

ODE. To carry out this reduction explicitly, the PDEtools library is loaded,<br />

> restart: with(plots): with(PDEtools):<br />

and the KdV equation entered.<br />

> KdVE:=diff(psi(x,t),t)+alpha*psi(x,t)*diff(psi(x,t),x)<br />

+diff(psi(x,t),x,x,x)=0;<br />

μ <br />

μ μ <br />

3<br />

@<br />

@<br />

@<br />

KdVE := Ã(x; t) + ®Ã(x; t) Ã(x; t) + Ã(x; t) =0<br />

@t @x @x3 The transformation from the \old" independent variables x and t to the new<br />

variables z and ¿ is entered with x = z + c¿ and t = ¿. The dependent variable<br />

Ã(x; t) is rewritten as U(z).<br />

> tr:=fx=z+c*tau,t=tau,psi(x,t)=U(z)g;<br />

tr := fx = z + c¿; t= ¿; Ã(x; t) =U (z)g<br />

Then, applying the dchange command to KdVE with the transformation tr,<br />

> ode1:=dchange(tr,KdVE,[z,tau,U(z)]);<br />

μ <br />

μ μ <br />

3<br />

d<br />

d<br />

d<br />

ode1 := ¡ U (z) c + ® U (z) U (z) + U (z) =0<br />

dz dz dz3 yields the third-order nonlinear ODE shown in ode1 . The left-hand side of this<br />

equation is easily integrated, yielding ode2 .


302 CHAPTER 7. THE HUNT FOR SOLITONS<br />

> ode2:=int(lhs(ode1),z)=0;<br />

ode2 := ¡c U (z)+ 1<br />

2 ® U (z)2 μ <br />

2 d<br />

+ U (z) =0<br />

dz2 On the right-hand side of ode2 , we have set the integration constant equal to<br />

zero by assuming that we are seeking a peaked solitary wave similar to that<br />

schematically depicted earlier in Figure 7.1. For such a solitary wave, U(z) and<br />

all of its derivatives must vanish as z !1.<br />

To integrate the second-order nonlinear ODE ode2 , we can proceed as follows.<br />

Letting V = dU(z)=dz, then,<br />

d2U(z) dz2 dV dV dU dV<br />

= = = V<br />

dz dU dz dU :<br />

Along with U(z) =U, this result is substituted into ode2 .<br />

> ode3:=subs(fdiff(U(z),z,z)=V(U)*diff(V(U),U),U(z)=Ug,ode2);<br />

ode3 := ¡cU + ®U2<br />

μ <br />

d<br />

+ V (U) V (U) =0<br />

2 dU<br />

Since U ! 0andV (U) ´ dU=dz ! 0asjzj !1, we can apply the dsolve<br />

command to ode3 subject to the condition V (U =0)=0,<br />

> sol:=dsolve(fode3,V(0)=0g,V(U));<br />

p p<br />

¡3 ®U +9cU<br />

¡3 ®U +9cU<br />

sol := V (U) =<br />

; V (U) =¡<br />

3<br />

3<br />

yielding positive and negative square root solutions. The positive answer is<br />

selected and simpli¯ed.<br />

> sol1:=simplify(sol[1],symbolic);<br />

p<br />

¡3 ®U +9cU<br />

sol1 := V (U) =<br />

3<br />

Now, remember that V ´ dU=dz, so from the above output we have<br />

Z<br />

3 dU<br />

z =<br />

U p 9 c ¡ 3 ®U :<br />

This integration is now carried out,<br />

> eq:=z=int(1/rhs(sol1),U);<br />

μp<br />

¡3 ®U +9c<br />

2arctanh<br />

3<br />

eq := z = ¡<br />

p <br />

c<br />

p<br />

c<br />

and eq solved for U using the isolate command and the result simpli¯ed.<br />

> eq2:=simplify(isolate(eq,U));<br />

à μ p !<br />

2<br />

z c<br />

3 c tanh ¡ 1<br />

2<br />

eq2 := U = ¡<br />

®<br />

Then, substituting z = x ¡ ct into the rhs of eq2 yields the solitary wave Ã,<br />

which is converted into a more standard form with the sincos option.


7.2. ANALYTIC SOLITON SOLUTIONS 303<br />

> psi:=subs(z=x-c*t,rhs(eq2));<br />

à μ p !<br />

2<br />

(x ¡ ct) c<br />

3 c tanh<br />

¡ 1<br />

2<br />

à := ¡<br />

®<br />

> psi:=simplify(convert(psi,sincos));<br />

3 c<br />

à := μ p 2<br />

(x ¡ ct) c<br />

cosh<br />

®<br />

2<br />

At z ´ x¡ct= 0, the solitary-wave solution has its maximum amplitude 3 c=®.<br />

For a ¯xed value of ®, the maximum amplitude is proportional to the velocity<br />

c, so by ¯xing this maximum amplitude, the velocity is also ¯xed. Clearly, a<br />

taller KdV solitary wave will have a larger velocity than a shorter solitary wave.<br />

On the other hand, the width of the pulse scales inversely with p c,sotaller<br />

KdV solitary waves are thinner than shorter solitary waves.<br />

To con¯rm that the solitary-wave solution is indeed localized and travels at<br />

constant velocity with unchanging shape, the analytic solution can be animated.<br />

Let's take, for example, ® =1andc = 1<br />

2 ,<br />

> psi:=eval(psi,falpha=1,c=1/2g);<br />

à := 3<br />

1<br />

Ã<br />

2<br />

(x ¡ t=2)<br />

cosh<br />

p ! 2<br />

2<br />

4<br />

and animate the solitary-wave solution.<br />

> animate(plot,[psi,x=-20..70],t=0..100,numpoints=200,<br />

frames=50,axes=frame,thickness=2);<br />

By running the animation, the reader will see that all the features that have<br />

been discussed are con¯rmed. Later, by looking at the collision of one solitary<br />

wave with another, we will con¯rm that the solitary wave is a soliton.<br />

PROBLEMS:<br />

Problem 7-10: Modi¯ed KdV equation<br />

Derive a solitary-wave solution of the modi¯ed KdV equation<br />

@Ã @Ã<br />

+ ®Ã2<br />

@t @x + @3Ã =0;<br />

@x3 which appears in the theory of double layers in plasmas and as a model of ion<br />

acoustic solitons in a multicomponent plasma.<br />

Problem 7-11: Boussinesq's equation<br />

The Boussinesq water wave equation is<br />

@2Ã @x2 ¡ @2Ã @2<br />

+6<br />

@t2 @x2 ¡ 2<br />

à ¢ + @4à =0:<br />

@x4 Derive the analytic form of the bright solitary-wave solution and animate it.


304 CHAPTER 7. THE HUNT FOR SOLITONS<br />

7.2.2 Looking for a Kinky Solution<br />

Masterpieces are not single and solitary births; they are the outcome<br />

of ... thinking by the body of the people, so that the experience of the<br />

mass is behind the single voice.<br />

Virginia Woolf, British novelist, ARoomofOne'sOwn,1929<br />

In our second example, we seek a kink solitary-wave solution of the SGE,<br />

@2Ã @x2 ¡ @2Ã =sinÃ: (7.3)<br />

@t2 Recall that the moving kink has been used to model the motion of a magnetic<br />

domain wall separating two di®erent spin regions in a ferromagnet.<br />

To ¯nd a kink, the PDEtools package is loaded and the SGE entered.<br />

> restart: with(plots): with(PDEtools):<br />

> SGE:=diff(psi(x,t),x,x)-diff(psi(x,t),t,t)-sin(psi(x,t))=0;<br />

μ μ <br />

2<br />

2<br />

@ @<br />

SGE := Ã(x; t) ¡ Ã(x; t) ¡ sin(Ã(x; t)) = 0<br />

@x2 @t2 Then, SGE is reduced to a nonlinear ODE by assuming that Ã(x; t) =U(z)<br />

with x = z + c¿ and t = ¿, and applying the dchange command.<br />

> tr:=fx=z+c*tau,t=tau,psi(x,t)=U(z)g:<br />

> ode1:=dchange(tr,SGE,[z,tau,U(z)]);<br />

μ μ <br />

2<br />

2<br />

d d<br />

ode1 := U (z) ¡ U (z) c<br />

dz2 dz2 2 ¡ sin(U (z)) = 0<br />

The second derivative terms are collected in ode1 .<br />

> ode1:=collect(ode1,diff(U(z),z,z));<br />

ode1 := (1 ¡ c2 μ <br />

2 d<br />

) U (z) ¡ sin(U (z)) = 0<br />

dz2 For a nontrivial solution, it is necessary that the velocity satisfy c 6= 1. Although<br />

c could be left as a general parameter, the analytic form is substantially<br />

simpli¯ed if a speci¯c numerical value is chosen for c, e.g., c = 1<br />

4 .<br />

> c:=1/4:<br />

Paralleling the procedure in the KdV recipe, let's set V = dU=dz, so that<br />

d2U=dz2 = V (dV=dU), and substitute this result and U(z) =U into ode1 .<br />

> ode2:=subs(fdiff(U(z),z,z)=V(U)*diff(V(U),U),U(z)=Ug,ode1);<br />

ode2 := 15<br />

μ <br />

d<br />

V (U) V (U) ¡ sin(U) =0<br />

16 dU<br />

For the kink solitary wave, both U and V ´ dU=dz must go to zero as z !¡1.<br />

So ode2 is solved for V (U), subject to V (0) = 0.<br />

> sol:=dsolve(fode2,V(0)=0g,V(U));<br />

sol := V (U) = 4 p 4 p<br />

30 ¡ 30 cos(U); V (U) =¡ 30 ¡ 30 cos(U)<br />

15<br />

15


7.2. ANALYTIC SOLITON SOLUTIONS 305<br />

The positive square root is chosen (the negative square root yields an antikink)<br />

and the trig identity cos U =1¡ 2sin 2 (U=2) substituted,<br />

> sol1:=subs(cos(U)=1-2*sin(U/2)^2,sol[1]);<br />

sol1 := V (U) = 4<br />

s<br />

μ 2<br />

p U<br />

60 sin<br />

15<br />

2<br />

and the result simpli¯ed using the square root and symbolic options.<br />

> sol1:=simplify(sol1,sqrt,symbolic);<br />

sol1 := V (U) = 8<br />

μ <br />

p U<br />

15 sin<br />

15 2<br />

Since V = dU=dz, thenz ´ x ¡ ct is equal to the integral with respect to U of<br />

the reciprocal of the right-hand side of sol1 .<br />

> z:=x-c*t=int(1/rhs(sol1),U);<br />

z := x ¡ t<br />

μ μ μ <br />

1 p U U<br />

= 15 ln csc ¡ cot<br />

4 4<br />

2 2<br />

Then, solving for U and recalling that U(z) ´ Ã(x ¡ ct),<br />

> solwave:=psi(x,t)=solve(z,U);<br />

solwave := Ã(x; t) =<br />

0<br />

B<br />

2arctanB<br />

Ã<br />

B<br />

@<br />

1+<br />

2 e ( (4 x¡t) p 15<br />

15<br />

e ( (4 x¡t) p 15<br />

15<br />

Ã<br />

)<br />

! 2 ; ¡ Ã<br />

)<br />

1+<br />

e ( (4 x¡t) p 15<br />

15<br />

! 2<br />

)<br />

e ( (4 x¡t) p 15<br />

15<br />

1<br />

¡ 1 C<br />

! 2 C<br />

) A<br />

yields the analytic solitary-wave solution shown in solwave. The arctan function<br />

is expressed in terms of two arguments separated by a comma. The term to the<br />

left (right) of the comma is the numerator (denominator) of arctan.<br />

The common denominators in the arguments can be removed and the numerator<br />

of the second argument simpli¯ed with the following assumption:<br />

> solwave:=simplify(solwave,assume=real);<br />

solwave := Ã(x; t) =2arctan(2e ( (4 x¡t) p 15<br />

15<br />

)<br />

; ¡e<br />

( 2(4x¡t) p 15<br />

) 15 +1)<br />

If you can't instantly see that this still complicated-appearing result is a kink<br />

solitary-wave solution of the SGE, you can be excused. However, that it is a<br />

solution can be con¯rmed by applying the following pdetest command.<br />

> pdetest(solwave,SGE);<br />

0<br />

To see that it is a kink solitary wave, let's animate the rhs of solwave.<br />

> animate(plot,[rhs(solwave),x=-10..50],t=0..200,frames=50,<br />

thickness=2,axes=framed);<br />

On running the animation, we observe that a kink solitary wave travels to the


306 CHAPTER 7. THE HUNT FOR SOLITONS<br />

right, maintaining its initial shape throughout. The kink varies in amplitude<br />

from 0 at x = ¡1 to 2 ¼ at z =+1.<br />

PROBLEMS:<br />

Problem 7-12: Antikink solitary waves<br />

Show that the choice of the negative square root yields an antikink solution.<br />

Problem 7-13: Relation between amplitude and velocity<br />

Is there any relation between the maximum nonzero amplitude and the velocity?<br />

Is this the same sort of relationship as for the KdV solitary wave or is it<br />

di®erent?<br />

Problem 7-14: Burgers' equation<br />

Burgers' nonlinear di®usion equation is of the form<br />

@U @U<br />

+ U<br />

@t @x = ¾ @2U ;<br />

@x2 where ¾ is the positive di®usion coe±cient. Analytically derive an antikink<br />

solitary-wave solution to Burgers' equation and animate it. How do the width<br />

of the antikink region and the velocity depend on amplitude?<br />

Problem 7-15: Sine{Gordon breather<br />

The SGE permits a moving (velocity v) \breather"-mode solution, which is<br />

localized in space but oscillatory in time, of the form,<br />

à = 4 arctan<br />

μr m<br />

1 ¡ m<br />

sin(° p 1 ¡ m (t ¡ vx))<br />

cosh(° p m (x ¡ vt))<br />

with ° =1= p 1 ¡ v2 , ¡1


7.2. ANALYTIC SOLITON SOLUTIONS 307<br />

In 1971, Fred Tappert, of Bell Laboratories, found an exact two-soliton<br />

analytic solution for the KdV equation, this equation now being entered.<br />

> restart: with(plots):<br />

> KdVE:=diff(psi(x,t),t)+psi(x,t)*diff(psi(x,t),x)<br />

+diff(psi(x,t),x,x,x)=0;<br />

μ μ μ <br />

3<br />

@<br />

@<br />

@<br />

KdVE := Ã(x; t) + Ã(x; t) Ã(x; t) + Ã(x; t) =0<br />

@t @x @x3 Tappert's two-soliton solution Ã(x; t) isgiven.<br />

> psi(x,t):=72*(3+4*cosh(2*x-8*t)+cosh(4*x-64*t))<br />

/(3*cosh(x-28*t)+cosh(3*x-36*t))^2;<br />

72 (3 + 4 cosh(2 x ¡ 8 t)+cosh(4x ¡ 64 t))<br />

Ã(x; t) :=<br />

(3 cosh(x ¡ 28 t)+cosh(3x ¡ 36 t)) 2<br />

The lhs of KdVE is extracted and simpli¯ed, Ã(x; t) having been automatically<br />

substituted. A lengthy expression results, which is suppressed here in the text.<br />

> check1:=simplify(lhs(KdVE));<br />

The combine command, with the trig option, is applied to the numerator of<br />

check1 , the result being zero, con¯rming that Ã(x; t) is a solution of KdVE .<br />

> check2:=combine(numer(check1),trig);<br />

check2 := 0<br />

The two-soliton solution is now animated.<br />

> animate(plot,[psi(x,t),x=-20..20],t=-1..1,frames=60,<br />

numpoints=250,axes=frame,thickness=2);<br />

In the animation, one initially has a taller, narrower solitary wave to the left of<br />

a shorter, wider solitary wave. As the animation progresses, both pulses move<br />

to the right. Having a larger velocity, the taller pulse overtakes the shorter<br />

pulse and a collision occurs. During the collision, a nonlinear superposition<br />

takes place, the resultant amplitude being less than the linear sum of the two<br />

amplitudes. As time progresses, the taller, faster pulse passes through the<br />

shorter one and emerges unchanged in shape, as does the shorter pulse. The<br />

solitary waves are indeed solitons.<br />

Next, we con¯rm that the sine{Gordon equation,<br />

> SGE:=diff(U(x,t),x,x)-diff(U(x,t),t,t)-sin(U(x,t))=0;<br />

μ μ <br />

2<br />

2<br />

@ @<br />

SGE := U (x; t) ¡ U (x; t) ¡ sin(U (x; t)) = 0<br />

@x2 @t2 is satis¯ed by the following two-soliton kink{kink solution. [Jac90]<br />

> U(x,t):=4*arctan(c*sinh(x/sqrt(1-c^2))<br />

/cosh(c*t/sqrt(1-c^2)));<br />

0 μ 1<br />

x<br />

B<br />

c sinh p<br />

U (x; t) := 4 arctan B 1 ¡ c2 C<br />

@<br />

μ C<br />

ct A<br />

cosh p<br />

1 ¡ c2


308 CHAPTER 7. THE HUNT FOR SOLITONS<br />

The lhs of SGE is simpli¯ed,<br />

> check3:=simplify(lhs(SGE));<br />

and the numerator of check3 expanded and further simpli¯ed.<br />

> check4:=simplify(expand(numer(check3)));<br />

check4 := 0<br />

The result is zero, so U(x; t) satis¯es the sine{Gordon equation. This twosoliton<br />

kink{kink solution is now animated, with c = 1<br />

4 .<br />

> animate(plot,[eval(U(x,t),c=1/4),x=-50..50],t=-100..100,<br />

frames=50,thickness=2,axes=framed);<br />

On running the animation, you will observe that the two kinks travel in opposite<br />

directions, run into each other, and reverse directions after the collision, still<br />

maintaining their initial shapes.<br />

PROBLEMS:<br />

Problem 7-16: Kink{antikink collision<br />

In the two-soliton kink{kink solution, replace the ¯rst c by 1=c, x by ct,and<br />

ct by x. Animate the resulting solution and show that it represents a kink{<br />

antikink collision. Describe the observed behavior.<br />

7.3 Simulating Soliton Collisions<br />

Both authors of this text have spent an academic lifetime jousting with nonlinearities<br />

in all mathematical shapes and sizes. In this text, we have tried to<br />

provide a glimpse of the excitement and complexity involved in the study of<br />

nonlinear dynamics, yet still present the bread-and-butter recipes necessary to<br />

solve linear ODE and PDE problems, the staple of most undergraduate science<br />

curricula. Whether the balance of linear and nonlinear recipes is right in our<br />

computer algebra menu, you will have to be the judge, but we could not resist<br />

presenting two numerical recipes that simulate soliton collisions. The ¯rst is<br />

for the Korteweg{de Vries equation, the second for the sine{Gordon equation.<br />

7.3.1 To Be or Not to Be a Soliton<br />

There is no means of proving it is preferable to be than not to be.<br />

E. M. Cioran, French philosopher (1911{1995)<br />

To prove that solitary-wave solutions are solitons, i.e., whether they survive<br />

collisions with each other unchanged in shape, is an important area of research<br />

in nonlinear dynamics. One approach is to numerically collide the solitary<br />

waves using a ¯nite di®erence scheme to simulate the relevant nonlinear PDE.<br />

This was done by Norman Zabusky and Martin Kruskal [ZK65] for the KdV


7.3. SIMULATING SOLITON COLLISIONS 309<br />

equation (taking ® =1),<br />

@Ã<br />

@t<br />

@Ã<br />

+ Ã<br />

@x + @3Ã =0: (7.4)<br />

@x3 They used a CDA for each ¯rst derivative, approximated @ 3 Ã=@x 3 by<br />

μ 3 @ Ã<br />

@x3 <br />

=(Ãi+2;j ¡ 2 Ãi+1;j +2Ãi¡1;j ¡ Ãi¡2;j)=(2 h<br />

P<br />

3 ); (7.5)<br />

and averaged à in the nonlinear term equally over the three grid points (i+1;j),<br />

(i; j), and (i ¡ 1;j). Setting r = k=h3 , the Zabusky{Kruskal algorithm is<br />

Ãi;j+1 = Ãi;j¡1 ¡ rh 2 (Ãi+1;j + Ãi;j + Ãi¡1;j)(Ãi+1;j ¡ Ãi¡1;j)=3<br />

¡ r (Ãi+2;j ¡ 2 Ãi+1;j +2Ãi¡1;j ¡ Ãi¡2;j);<br />

(7.6)<br />

with j =1; 2;:::: This scheme is numerically stable for r


310 CHAPTER 7. THE HUNT FOR SOLITONS<br />

Using the operator F, we add the three time-dependent solitary waves in f, and<br />

take the time derivative of f in g.<br />

> f:= add(F(X[i],c[i]),i=1..3): g:=diff(f,t):<br />

Setting the time to zero, we plot the input pro¯le over the spatial range x =0<br />

to M, the resulting picture being shown in Figure 7.8.<br />

> t:=0: plot(f,x=0..M,thickness=2);<br />

2.5<br />

2<br />

1.5<br />

1<br />

0.5<br />

0 50 100 x 150 200 250<br />

Figure 7.8: Input pro¯le for the three-solitary-wave collision simulation.<br />

Note that there is a slight overlap of the solitary-wave tails. One could place<br />

them further apart initially, but this takes more computing time.<br />

To evaluate f and g at the spatial mesh points, we use the unapply command<br />

to turn them into operators in terms of the spatial coordinate x.<br />

> f2:=unapply(f,x): g2:=unapply(g,x):<br />

Using these two operators, we calculate the input amplitudes Ui;0 ´ f(i; t =0)<br />

and Ui;1 ´ f(i; t =0)+kg(i; t =0)fori =0toM in the ¯rst and second<br />

initial conditions, ic1 and ic2 .<br />

> ic1:=seq(U(i,0)=evalf(f2(i)),i=0..M):<br />

> ic2:=seq(U(i,1)=evalf(f2(i))+k*g2(i),i=0..M):<br />

To avoid any possible unknown U values creeping into the double do loop that<br />

will be used to iterate the numerical algorithm, we \initialize" all U values to<br />

zero for i =0toM and j =2toN, i.e., for all remaining grid points. These<br />

zeros will be overwritten as the loop is executed and new U values calculated.<br />

> init:=seq(seq(U(i,j)=0,i=0..M),j=2..N):<br />

The two initial conditions and the initialization are assigned.<br />

> assign(ic1,ic2,init):


7.3. SIMULATING SOLITON COLLISIONS 311<br />

An operator G is introduced to calculate the rhs of the Zabusky{Kruskal algorithm<br />

(7.6) (with à replaced with U) for a speci¯ed i and j.<br />

> G:=(i,j)->U(i,j-1)-r*h^2*(U(i+1,j)+U(i,j)+U(i-1,j))<br />

*(U(i+1,j)-U(i-1,j))/3<br />

-r*(U(i+2,j)-2*U(i+1,j)+2*U(i-1,j)-U(i-2,j)):<br />

The numerical algorithm is ¯rst iterated from i =2toM ¡ 2foragivenjvalue and then from j =1toN. The spatial index i isstartedat2andendedat<br />

M ¡ 2 to avoid unknown U values from the two edges of the grid entering into<br />

the double do loop calculation.<br />

> for j from 1 to N do;<br />

> for i from 2 to M-2 do<br />

> U(i,j+1):=G(i,j):<br />

> end do:<br />

> end do:<br />

A graphing operator is formed to plot the entire pro¯le on the jth time step.<br />

> gr:=j->plot([seq([i,U(i,j)],i=2..M-2)],thickness=2):<br />

Using every second graph, the sequence of pictures is now animated.<br />

> plots[display]([seq(gr(2*j),j=0..N/2)],insequence=true);<br />

You will have to execute the recipe, click on the resulting plot, and then on the<br />

start arrow to see the wonderful animation. Despite the initial overlap of the<br />

solitary-wave tails and the coarse spatial grid used (recall, h = 1), the solitary<br />

waves are remarkably stable, all three surviving the collision process apparently<br />

unchanged. After the collision the order of the waves is the reverse of the initial<br />

ordering, with the smallest pulse on the left and the largest on the right.<br />

> cpu:=time()-begin;<br />

cpu := 29:072<br />

The CPU time on a 3-GHz PC is about 29 seconds.<br />

Although we have concentrated on soliton collisions here, the recipe may<br />

be easily modi¯ed to investigate the behavior of other input pro¯les. For most<br />

cases, an analytic solution will not exist and the numerical simulation route is<br />

the only feasible one to take.<br />

PROBLEMS:<br />

Problem 7-17: Third derivative<br />

Using the Taylor expansion, derive the approximation (7.5) to @3Ã=@3x. Problem 7-18: A di®erent scheme<br />

In the Zabusky{Kruskal ¯nite di®erence scheme for the KdV equation, Ã in the<br />

nonlinear term à (@Ã=@x) was approximated by the average of three à terms<br />

at the grid points (i +1;j), (i; j), and (i ¡ 1;j). Compare the results obtained<br />

in the text recipe with those you would obtain if U ´ Ã were approximated by<br />

Ui;j alone. Discuss your result.


312 CHAPTER 7. THE HUNT FOR SOLITONS<br />

Problem 7-19: Ampli¯cation<br />

Multiply the smallest of the three solitary waves in the text recipe by a factor of<br />

3 and interpret the resulting behavior when the worksheet is executed. Explore<br />

the e®ect of multiplying one or more pulses by numerical factors.<br />

Problem 7-20: Radiative ripples<br />

In the text recipe, change the sech 2 terms in the input pulses to sech 4 terms,<br />

then execute the modi¯ed recipe, and discuss the results.<br />

7.3.2 Are Diamonds a Kink's Best Friend?<br />

I never hated a man enough to give him diamonds back.<br />

Zsa Zsa Gabor, Movie actress (1919{)<br />

Although the sine{Gordon equation,<br />

@2Ã @x2 ¡ @2Ã =sinÃ;<br />

@t2 (7.7)<br />

can be numerically solved with an explicit scheme based on a rectangular mesh,<br />

it lends itself more naturally to being tackled with a diamond-shaped mesh<br />

chosen to follow the characteristic directions of the equation. To see how this<br />

works, let's consider the general PDE<br />

a @2U @x2 + b @2U @x@y + c @2U + e =0;<br />

@y2 (7.8)<br />

where a, b, c, and e are functions of U, @U=@x, @U=@y, but not of higher<br />

derivatives. For the SGE, U = Ã, y = t, a =1,b =0,c = ¡1, and e = ¡ sin Ã.<br />

Equation (7.8) can be quite generally solved by the method of characteristics.<br />

Setting p ´ @U=@x and q ´ @U=@y, equation (7.8) can be written in the form<br />

a @p @p @q<br />

+ b + c + e =0:<br />

@x @y @y<br />

Since p = p(x; y) andq = q(x; y), then<br />

(7.9)<br />

dp @p @p dy<br />

= + ;<br />

dx @x @y dx<br />

dq @q dx @q<br />

= + :<br />

dy @x dy @y<br />

(7.10)<br />

Substituting @p=@x and @q=@y into (7.9), then multiplying through by dy=dx,<br />

noting that @q=@x = @p=@y, and rearranging yields<br />

" μ 2 μ # ·<br />

@p dy dy<br />

a ¡ b + c ¡ a<br />

@y dx dx<br />

dp<br />

¸<br />

dy dq dy<br />

+ c + e =0:<br />

dx dx dx dx<br />

(7.11)<br />

At this stage, the resulting equation looks like a mathematical mess! However,<br />

if we choose to work in the characteristic directions whose slopes are given by<br />

μ 2 μ <br />

dy dy<br />

a ¡ b + c =0; (7.12)<br />

dx dx


7.3. SIMULATING SOLITON COLLISIONS 313<br />

then equation (7.11) reduces to<br />

μ <br />

dy<br />

a dp + cdq+ edy =0: (7.13)<br />

dx<br />

For the SGE, a =1,b =0,andc = ¡1, so that (7.12) yields (dy=dx) 2 ¡ 1=0,<br />

or dy=dx = §1. The two characteristic directions have slopes of 45 ± and ¡45 ± ,<br />

respectively. Forming a diamond-shaped mesh with these slopes produces the<br />

grid illustrated in Figure 7.9. Given the new grid, how is U (or Ã) calculated?<br />

j=2<br />

y<br />

j=1<br />

P<br />

L R<br />

(0,2) (2,2) (4,2)<br />

(1,1) (3,1) (5,1)<br />

j=0<br />

(2,0) (4,0) (6,0)<br />

i=0 i=1 i=2<br />

Δx=h<br />

x x<br />

min max<br />

Δy=h<br />

Figure 7.9: Characteristic directions and labels for solving the SGE.<br />

Consider the mesh point P in Figure 7.9, where it is desired to calculate the<br />

unknown UP from the known values UL and UR on the previous time step. The<br />

subscripts L and R denote advancing \from the left" along the characteristic<br />

direction dy=dx = 1 and \from the right" along the characteristic direction<br />

dy=dx = ¡1, respectively. Taking dy=dx = §1 and replacing (7.13) with a<br />

¯nite di®erence approximation yields the following pair of equations,<br />

(pP ¡ pL) ¡ (qP ¡ qL) =¡eL (yP ¡ yL);<br />

¡(pP ¡ pR) ¡ (qP ¡ qR) =¡eR (yP ¡ yR);<br />

x<br />

(7.14)


314 CHAPTER 7. THE HUNT FOR SOLITONS<br />

which are easily solved for pP and qP ,<br />

pP = 1<br />

2 (pR + pL)+ 1<br />

2 (qR ¡ qL)+ 1<br />

2 (eR ¡ eL)¢y;<br />

qP = 1<br />

2 (pR ¡ pL)+ 1<br />

2 (qR + qL)+ 1<br />

2 (eR + eL)¢y;<br />

(7.15)<br />

with ¢y = yP ¡ yL = yP ¡ yR =¢x ´ h.<br />

To obtain UP from the values at L and R, wenotethatU =U(x; y), so that<br />

dU =(@U=@x) dx +(@U=@y) dy =pdx+ qdy. Replacing this result with a ¯nite<br />

di®erence approximation along the characteristic direction dy=dx=1 yields<br />

UP = UL + 1<br />

2 (pL + pP )(xP ¡ xL)+ 1<br />

2 (qL + qP )(yP ¡ yL)<br />

or UP = UL + 1<br />

2 h (pL + pP + qL + qP ); (7.16)<br />

where for improved accuracy, the \old" and \new" values of p and q have<br />

been averaged. Of course, we could also have calculated UP along the other<br />

characteristic direction dy=dx = ¡1, viz.,<br />

UP = UR + 1<br />

2 (pR + pP )(xP ¡ xR)+ 1<br />

2 (qR + qP )(yP ¡ yR);<br />

or UP = UR + 1<br />

2 h (¡pR ¡ pP + qR + qP ): (7.17)<br />

Since the two numerical values of UP will di®er slightly, an equally weighted<br />

average of the two results for UP is usually taken.<br />

This method of characteristics scheme is now applied to the collision of a<br />

sine{Gordon kink with an antikink solitary wave, the input pro¯le taken to be,<br />

U = 4 arctan<br />

³<br />

e (x ¡ x1 ¡ c1 t)=a ´ ³<br />

+ 4 arctan e ¡(x ¡ x2 ¡ c2 t)=b ´<br />

; (7.18)<br />

with a = p 1 ¡ c 2 1 , b = p 1 ¡ c 2 2 , x1 < 0, x2 > 0, c1 > 0, and c2 < 0, and<br />

the time t = 0. The ¯rst term in the input pro¯le is the kink, 2 the second<br />

the antikink. Nonzero values of x1 and x2 are used to spatially separate the<br />

kink and antikink initially. The choice of signs puts the kink to the left of the<br />

antikink. Since the velocities are of opposite sign, the kink and antikink will<br />

move toward each other and a collision will ultimately take place.<br />

So with this preamble behind us, let the ¯nal recipe of this chapter begin!<br />

Let's consider M =200spatialandN = 100 time steps.<br />

> restart: begin:=time(): M:=200: N:=100:<br />

We take x1 = ¡5, x2 =5,c1 =0:8, and c2 = ¡0:8, and calculate a and b.<br />

> x[1]:=-5: x[2]:=5: c[1]:=0.8: c[2]:=-0.8:<br />

> a:=sqrt(1-c[1]^2); b:=sqrt(1-c[2]^2);<br />

a := 0:6000000000 b := 0:6000000000<br />

2 A more general form than derived earlier.


7.3. SIMULATING SOLITON COLLISIONS 315<br />

The spatial range is taken from xmin =3x1 = ¡15 to xmax =3x2 = 15, and<br />

the step size h =(xmax ¡ xmin)=M calculated.<br />

> xmin:=3*x[1]: xmax:=3*x[2]: h:=evalf((xmax-xmin)/M);<br />

h := 0:1500000000<br />

The kink{antikink pro¯le at time t is entered.<br />

> U:=4*arctan(exp((x-x[1]-c[1]*t)/a))<br />

+4*arctan(exp(-(x-x[2]-c[2]*t)/b));<br />

³<br />

U := 4 arctan e (1:666666667 x +8:333333335 ¡ 1:333333334 t)´<br />

³<br />

+ 4 arctan e (¡1:666666667 x +8:333333335 ¡ 1:333333334 t)´<br />

The values of p(x; 0) ´ (@U=@x)jt=0 and q(x; 0) ´ (@U=@t)jt=0 are needed, so<br />

the relevant spatial and time derivatives are calculated and labeled P and Q.<br />

> P:=diff(U,x): Q:=diff(U,t): t:=0:<br />

Setting t = 0, the following loop evaluates U, p, andq at each spatial grid point<br />

on the zeroth time step. Note that the numerical value of U at the ith spatial<br />

grid point is labeled ui;0 and i is incremented in steps of 2 from 0 to M.<br />

> for i from 0 to M by 2 do #initial conditions<br />

> x:=xmin + i*h;<br />

> u[i,0]:=evalf(U); p[i,0]:=evalf(P); q[i,0]:=evalf(Q);<br />

> end do:<br />

The input pro¯le is now plotted and displayed in Figure 7.10.<br />

> plot([seq([xmin+2*i*h,u[2*i,0]],i=0..M/2)],view=<br />

[xmin..xmax,-1..15],tickmarks=[3,3],labels=["x","U"]);<br />

15<br />

10<br />

U<br />

5<br />

–10 0<br />

x 10<br />

Figure 7.10: Input pro¯le for the kink{antikink soliton collision simulation.


316 CHAPTER 7. THE HUNT FOR SOLITONS<br />

The kink is on the left, the antikink on the right, the two pro¯les being joined<br />

together in the middle. At the x boundaries, one has U ¼ 2 ¼ and @U=@x ¼ 0.<br />

Since the kink is traveling to the right and the antikink to the left, a collision will<br />

take place before each reaches the opposite boundary. Provided that we do not<br />

let the kink and antikink come close to those boundaries, the above boundary<br />

conditions will prevail for all times in the run. This implies that @U=@t ¼ 0at<br />

the x boundaries. In the following do loop, the x-boundary grid points (circled<br />

points in Figure 7.9) are initialized, setting U =2¼ and p = q =0.<br />

> for j from 2 to N by 2 do #boundary conditions<br />

> u[0,j]:=2*evalf(Pi): p[0,j]:=0: q[0,j]:=0;<br />

> u[M,j]:=2*evalf(Pi): p[M,j]:=0: q[M,j]:=0;<br />

> end do:<br />

The following double do loop calculates the values of u at the other grid points.<br />

> for j from 0 to (N-1) do:<br />

A conditional statement is inserted to start i at i0 =0forj =0; 2; 4; ::: and<br />

i0 =1forj =1; 3; 5; ::::<br />

> if j mod 2 = 0 then i0:=0: else i0:=1: end if;<br />

The following do loop runs over the spatial grid points i, incrementing them<br />

from i0 to M ¡ 2instepsof2.<br />

> for i from i0 to (M-2) by 2 do<br />

Using equation (7.15), we calculate the values of p and q.<br />

> p[i+1,j+1]:=0.5*(p[i+2,j]+p[i,j]+q[i+2,j]-q[i,j]<br />

+(-sin(u[i+2,j])+sin(u[i,j]))*h);<br />

> q[i+1,j+1]:=0.5*(p[i+2,j]-p[i,j]+q[i+2,j]+q[i,j]<br />

+(-sin(u[i+2,j])-sin(u[i,j]))*h);<br />

Then U is evaluated using equations (7.16) and (7.17), and the average taken.<br />

> uP1:=u[i,j]+0.5*h*(p[i,j]+p[i+1,j+1] +q[i,j]+q[i+1,j+1]);<br />

> uP2:=u[i+2,j]+0.5*h*(-p[i+2,j]-p[i+1,j+1]+q[i+2,j]<br />

+q[i+1,j+1]);<br />

> u[i+1,j+1]:=(uP1+uP2)/2;<br />

> end do: end do:<br />

The results are plotted,<br />

> for j from 0 to N by 2 do<br />

> pl(j):=plot([seq([xmin+2*i*h,u[2*i,j]],i=0..M/2)],<br />

thickness=3,labels=["x","U"]):<br />

> end do:<br />

andanimatedwiththeinsequence=true option.<br />

> plots[display]([seq(pl(2*j),j=0..N/2)],insequence=true);<br />

When the work sheet is executed, the kink{antikink hump °ips upside down<br />

but the shape of the moving pro¯le is identical to the input shape aside from a


7.3. SIMULATING SOLITON COLLISIONS 317<br />

phase factor e i¼ = ¡1, indicating that the kink and antikink solitary waves are<br />

indeed solitons. Finally, the CPU time is calculated.<br />

> cpu:=(time()-begin)*seconds;<br />

cpu := 3:024 seconds<br />

and is about 3 seconds on a 3-GHz PC.<br />

PROBLEMS:<br />

Problem 7-21: Ampli¯ed kink{antikink input<br />

In the text recipe, double the amplitudes of the input kink and antikink solitarywave<br />

pro¯les. Remembering to also double the value 2¼ in the initialization<br />

statement to avoid causing an end-e®ect problem, run the ¯le with the ampli¯ed<br />

input and interpret the outcome.<br />

Problem 7-22: Kink{kink collision<br />

Modify the recipe to simulate the collision of a kink solitary wave with another<br />

kink. Discuss the observed behavior.<br />

Problem 7-23: Antikink{antikink collision<br />

Modify the recipe to simulate the collision of an antikink solitary wave with<br />

another antikink. Discuss the observed behavior.<br />

Problem 7-24: Rectangular mesh<br />

Solve the problem of the text recipe using an explicit scheme based on a rectangular<br />

mesh.<br />

Problem 7-25: Interacting laser beams<br />

The interaction of two intense laser pulses of di®erent frequencies as they pass<br />

through each other in opposite directions in a certain resonant absorbing °uid<br />

can be described [RE76] by the following normalized PDEs for the laser intensities<br />

U and V ,<br />

@U @U<br />

+<br />

@x @y = ¡g1<br />

@V @V<br />

UV ¡ ®U; ¡<br />

@x @y = ¡g2 UV + ®V:<br />

Here x is the normalized distance inside the °uid medium of length one unit, y<br />

the normalized time, g1 > 0andg2 > 0arethe\gain"coe±cients,and® ¸ 0<br />

the absorption coe±cient. The U pulse travels in the positive x direction, while<br />

the V pulse moves in the negative x direction.<br />

(a) Find the characteristic directions along which the PDEs reduce to ODEs.<br />

(b) Devise an explicit numerical scheme that integrates the ODEs along the<br />

characteristic directions assuming that there are no pulses initially inside<br />

the °uid (U(x; 0) = V (x; 0) = 0 for 0 < x < 1) and identical ¯niteduration<br />

U and V pulses are fed in at opposite ends (U(0;y)=V (1;y)=<br />

f(y) for0· y · Y = 1 and zero for y>Y).<br />

2<br />

(c) Numerically solve the equations and animate the results, assuming that<br />

f(y) =1,g1 =0:4, g2 = 20, and (a) ® =0,(b)® =0:5.<br />

(d) Discuss the behavior of the two pulses as revealed in the animation.


318 CHAPTER 7. THE HUNT FOR SOLITONS<br />

(e) Repeat the calculation and animation for f(y) =sin(2¼y), the parameter<br />

values and all boundary and initial conditions remaining the same.<br />

Compare the results with those obtained for the rectangular pulses.


Chapter 8<br />

Nonlinear Diagnostic Tools<br />

In the Appetizers, the reader was introduced to the concept of phase-plane<br />

analysis of nonlinear ODE models. This involved the creation of phase-plane<br />

portraits and the location and identi¯cation of the relevant stationary points of<br />

the ODE system. This graphical approach was extended in the last chapter to<br />

¯nding solitary wave solutions of physically important nonlinear PDEs.<br />

Physicists and mathematicians have developed a wide variety of other graphical<br />

tools for exploring the frontiers of nonlinear dynamics and understanding<br />

what is observed. In this chapter, a few of the simpler diagnostic tools for<br />

nonlinear ODEs and nonlinear di®erence equations are presented for the reader<br />

who craves a ¯nal light but scrumptious intellectual dessert.<br />

8.1 The Poincare Section<br />

An important approach to studying the forced motion of nonlinear oscillator<br />

systems is to create a Poincare section. If the driving frequency is !, onetakesa<br />

\snapshot" of the phase plane after each period T0 =2¼=! of the driving force.<br />

After an initial transient time, the ODE system will settle down in steady state<br />

to either a periodic or a chaotic motion. For the periodic case, the system is said<br />

to display a period-n response if its period T equals nT0, wheren =1; 2; 3; ::::<br />

In other words, the frequency response of a period-n solution is !n = !=n.<br />

If the system evolves to a period-1 solution, with T = T0, the Poincare<br />

section will consist of a single plot point in the phase plane that is reproduced<br />

at each multiple of the driving period. On the other hand, if the system evolves<br />

to a period-2 solution, with T =2T0, thePoincaresectionwillhavetwopoints<br />

between which the system oscillates as multiples of T0 elapse. And so on.<br />

In contrast to the periodic situation, for chaotic motion a point is produced<br />

at a di®erent location at each multiple of T0, and the \sum" of the individual<br />

snapshots can produce strange, localized patterns (\strange attractors") of plot<br />

points with complex boundaries in the phase plane.<br />

In the following recipe, the \period-doubling route to chaos" is explored once<br />

again for the forced Du±ng oscillator, now from the Poincare section viewpoint.<br />

319


320 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

8.1.1 A Rattler Signals Chaos<br />

Humor is emotional chaos remembered in tranquility.<br />

James Thurber, American writer, humorist, and cartoonist (1894{1961)<br />

As an illustrative example of how a Poincare section is produced and how it<br />

changes character as a control parameter is varied, let's consider Du±ng's ODE<br />

describing the force oscillations of a nonlinear spring system,<br />

Äx +2g _x + ®x+ ¯x 3 = F cos(!t): (8.1)<br />

Here x is the displacement, g the damping coe±cient, ® and ¯ real parameters,<br />

F the force amplitude, and ! the driving frequency.<br />

The solutions of Du±ng's equation were examined in some detail in Section<br />

1.2.1 as the control parameter F was varied, all other parameters being<br />

held ¯xed. In this recipe, we shall use exactly the same coe±cient values and<br />

initial conditions as in the earlier treatment, including the same F values. This<br />

will allow us to compare the results of the Poincare treatmentwiththeconclusions<br />

reached previously on the response of the forced Du±ng oscillator.<br />

The number of F values is taken to be N1 = 4, and the maximum number<br />

of multiples of the driving period T0 =2¼=! considered is N2 =250.<br />

> restart: with(plots): N1:=4: N2:=250:<br />

The coe±cient values are entered and the driving period calculated.<br />

> g:=0.25: alpha:=-1: beta:=1: omega:=1: T[0]:=2*Pi/omega;<br />

T0 := 2 ¼<br />

The force amplitudes are F1 =0:325, F2 =0:35, F3 =0:356, and F4 =0:42.<br />

> F[1]:=0.325: F[2]:=0.35: F[3]:=0.356: F[4]:=0.42:<br />

Du±ng's equation can be rewritten as a coupled set of ¯rst-order ODEs,<br />

_x = y; _y = ¡2 gy¡ ®x¡ ¯x 3 + Fi cos(!t);<br />

which will be numerically solved with the initial conditions x(0)=0:09, y(0)=0.<br />

> ic:=x(0)=0.09,y(0)=0:<br />

The coupled ¯rst-order di®erential equations are entered, an operator being<br />

used for the second one, the subscript i of the force amplitude Fi to be given.<br />

> de1:=diff(x(t),t)=y(t):<br />

> de2:=i->diff(y(t),t)=-2*g*y(t)-alpha*x(t)-beta*x(t)^3<br />

+F[i]*cos(omega*t):<br />

An operator sol is introduced to numerically solve de1 and de2 (i), subject to<br />

the initial conditions, for a given value of i. The option maxfun=0 overrules any<br />

limit on the maximum number of function evaluations in Maple's numerical<br />

algorithm. The output is given as a listprocedure.<br />

> sol:=i->dsolve(fde1,de2(i),icg,fx(t),y(t)g,type=numeric,<br />

maxfun=0,output=listprocedure):<br />

Operators X and Y are formed to evaluate x(t) andy(t)<br />

> X:=i->eval(x(t),sol(i)): Y:=i->eval(y(t),sol(i)):


8.1. THE POINCAR ESECTION 321<br />

for the ith solution, the evaluations being carried out in the following do loop.<br />

> for i from 1 to N1 do xx[i]:=X(i); yy[i]:=Y(i); end do:<br />

An operator Gr is created to graph a phase-plane point, represented by a size-16<br />

blue cross, at time t = nT0 for the ith amplitude.<br />

> Gr:=(i,n)->pointplot(f[yy[i](n*T[0]),xx[i](n*T[0])]g<br />

color=blue,symbol=CROSS,symbolsize=16):<br />

Using this graphing operator in the following loop generates the Poincare section<br />

for each of the N1 = 4 amplitude values. To eliminate the transient part of the<br />

solution, a certain number of initial points must be removed in each plot. This<br />

number will vary for each numerical run and must usually be determined by<br />

trial and error. Here, the ¯rst 24 points have been removed. Since N2 =250,<br />

each plot still contains 225 points. A suitable viewing box is selected, which is<br />

the same for all four plots, and labels added and the minimum number of tick<br />

marks controlled.<br />

> for i from 1 to N1 do<br />

> display([seq(Gr(i,n),n=25..N2)],axes=boxed,view=<br />

[-0.4..0.8,-1.4..1.4],labels=["y","x"],tickmarks=[3,3]);<br />

> end do;<br />

1<br />

x<br />

–1<br />

0 y 0.5<br />

1<br />

x<br />

–1<br />

0 y 0.5<br />

Figure 8.1: Period-1 (left ¯gure) and period-2 (right) Poincare sections.<br />

The plot on the left of Figure 8.1 corresponds to F1 =0:325, the one on the right<br />

to F2 =0:35. Despite the fact that 225 points were plotted, we see only a single<br />

cross in the F1 =0:325 graph, indicating that the system has settled down to<br />

a period-1 solution. For F2 =0:35, the ODE system oscillates back and forth<br />

between the two crosses, the Poincare section being characteristic of a period-2<br />

solution. The observed periodicities agree with the results in Section 1.2.1.<br />

For F3 =0:356, Figure 8.2 indicates a period-4 solution, again agreeing<br />

with our earlier conclusion about the periodicity for this forcing amplitude.<br />

So it is clear that the Poincare section approach is a useful graphical tool for<br />

interpreting the periodicity of driven oscillator systems.


322 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

1<br />

x<br />

–1<br />

0 y 0.5<br />

Figure 8.2: Period-4 Poincare section.<br />

Finally, for F4 =0:42, we had previously observed a localized chaotic trajectory,<br />

characteristic of a strange attractor. The corresponding \strange"<br />

Poincare section is shown in Figure 8.3.<br />

x<br />

1<br />

0<br />

–1<br />

0 y 0.5<br />

Figure 8.3: Chaotic \rattler."<br />

Strange attractors are often given colorful or descriptive names. What name<br />

shallwegivetothechaoticPoincare section obtained above? This depends on<br />

the reader's experience and imagination. To coauthor Richard, it reminds him<br />

of an incident that occurred while he was hiking with his family in the Superstition<br />

Mountains of southern Arizona. While scrambling down a rocky scree<br />

slope, he had a feeling of impending chaos when his youngest daughter nearly<br />

stumbled into a coiled rattlesnake. To the author, this particular Poincare sec-


8.1. THE POINCAR ESECTION 323<br />

tion resembles that rattler poised to strike. Fortunately, the snake was just as<br />

frightened as the author's daughter and slithered away without striking. Some<br />

years later one could joke about the incident, but it was certainly not funny at<br />

the time.<br />

PROBLEMS:<br />

Problem 8-1: A di®erent ¯ value<br />

Holding all other parameter values as in the text recipe, use the Poincare section<br />

to determine the response of Du±ngs's ODE for each F value when ¯ =2.<br />

Problem 8-2: Varying the frequency<br />

For each of the four Fi,exploretheresponseoftheDu±ngODEasthefrequency<br />

! is varied, all other parameters being the same as in the text recipe.<br />

Problem 8-3: Interchanging signs<br />

Determine the response of the Du±ng ODE for each Fi when all numerical values<br />

are the same as in the text recipe, but the signs of ® and ¯ are interchanged.<br />

Problem 8-4: Periodicity?<br />

Using the Poincare section approach, determine the periodicity of the steadystate<br />

solution of the following forced oscillator equations:<br />

(a) Äx +0:7 _x + x3 =0:75 cos t; with x(0) = _x(0) = 0;<br />

(b) Äx +0:08 _x + x3 =0:2cost; with x(0) = 0:25; _x(0) = 0.<br />

Problem 8-5: Varying force amplitude<br />

Using the Poincare section approach, determine the periodicity of the steadystate<br />

solution of the following ODE for F =0:357 and F =0:35797:<br />

Äx +0:5 _x ¡ x + x 3 = F cos(t +1); with x(0) = 0:09; _x(0) = 0:<br />

8.1.2 Hamiltonian Chaos<br />

Progress everywhere today does seem to come so very heavily<br />

disguised as Chaos.<br />

Joyce Grenfell, British actor, writer, Stately as a Galleon, 1978<br />

In the Hamiltonian formulation of classical mechanics the motion of a single<br />

particle of unit mass, with coordinates qi and (generalized) momenta pi, moving<br />

in a conservative potential V (qi) can be described by the Hamiltonian,<br />

NX 1<br />

H =<br />

2<br />

i<br />

p2i + V (qi); (8.2)<br />

where the ¯rst term is the kinetic energy and N is the number of degrees of<br />

freedom. Hamilton's equations of motion then are given by<br />

_qi = @H<br />

; _pi = ¡<br />

@pi<br />

@H<br />

: (8.3)<br />

@qi


324 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

For N = 1, the motion can be described by a trajectory in the q1 vs. p1 phase<br />

plane. For N>1, the trajectory is in a 2N-dimensional phase space.<br />

Originally motivated to study the motion of a star inside a galaxy, Henon<br />

and Heiles [HH64] introduced a conservative Hamiltonian describing the motion<br />

of a unit mass in the two-dimensional potential<br />

V = 1<br />

2 q2 1 + 1<br />

2 q2 2 + q 2 1 q2 ¡ 1<br />

3 q3 2: (8.4)<br />

The ¯rst two terms in V would generate a paraboloid of revolution characteristic<br />

of a two-dimensional harmonic oscillator. The force ~ F = ¡rV in this case is<br />

just the two-dimensional form of Hooke's law. The inclusion of the two cubic<br />

terms in V distort the shape of the potential away from a paraboloid, add<br />

nonlinear terms to Hooke's law, and Hamilton's equations generate nonlinear<br />

ODEs in the 4-dimensional phase space.<br />

In this recipe, we shall use specialized commands found in the DEtools<br />

library package to generate these equations, numerically solve them to produce<br />

the trajectory for a speci¯ed energy and initial conditions, and produce a<br />

Poincare section.<br />

> restart: with(plots): with(DEtools):<br />

Entering the Henon{Heiles potential (8.4), a two-dimensional contour plot is<br />

generated, the contour lines given by V =0:04 i with i = 0 to 9. To obtain<br />

smooth curves, the number of plotting points is taken to be 5000.<br />

> V:=q1^2/2+q2^2/2+q1^2*q2-q2^3/3:<br />

> contourplot(V,q1=-2..2,q2=-2..2,contours=[seq(0.04*i,<br />

i=0..9)],numpoints=5000,color=black);<br />

q2<br />

2<br />

1<br />

–2 –1 0<br />

1 q1 2<br />

–1<br />

–2<br />

Figure 8.4: Contour plot of the Henon{Heiles potential.


8.1. THE POINCAR ESECTION 325<br />

To aid in interpreting the contour plot, let's ¯nd the stationary points where the<br />

force vanishes. Di®erentiating V with respect to each coordinate and solving<br />

for the coordinate values that make the force components equal to zero,<br />

> sol:=solve(fdiff(V,q1),diff(V,q2)g,fq1,q2g);<br />

sol := fq2 =0; q1 =0g; fq2 =1; q1 =0g;<br />

fq2 = ¡1 1<br />

; q1 =<br />

2 2 RootOf(¡3+ Z 2 ; label = L2 )g<br />

yields a stationary point at q1 = q2 =0andq1 =0; q2 = 1, as well as others<br />

at q2 = ¡ 1 and q1 given by the RootOf placeholder. These latter values may<br />

2<br />

be found by applying the allvalues command to the third entry in sol.<br />

> sol3:=allvalues(sol[3]);<br />

p p<br />

3 ¡1 ¡1 3<br />

sol3 := fq1 = ; q2 = g; fq2 = ; q1 = ¡<br />

2 2 2 2 g<br />

1 ; q2 = ¡ 2 2 and at q1 = ¡ p 3;<br />

q2 = 2<br />

. The four stationary points are now extracted separately and labeled,<br />

> s1:=sol[1]; s2:=sol[2]; s3:=sol3[1]; s4:=sol3[2];<br />

There are two more ¯xed points at q1 = p 3<br />

¡ 1<br />

2<br />

s1 := fq2 =0; q1 =0g s2 := fq2 =1; q1 =0g<br />

p p<br />

3 ¡1<br />

¡1 3<br />

s3 := fq1 = ; q2 = g s4 := fq2 = ; q1 = ¡<br />

2 2 2 2 g<br />

and the potential energy at each stationary point determined.<br />

> U:=v->eval(V,v): V1:=U(s1); V2:=U(s2); V3:=U(s3); V4:=U(s4);<br />

V1 := 0 V2 := 1 1 1<br />

V3 := V4 :=<br />

6 6 6<br />

The stationary point s1 at the origin is the minimum of what would be a<br />

parabolic potential well if the cubic terms were not present in V . Referring<br />

to the contour plot, the shape of the contour lines changes as one moves away<br />

from the origin, the contour lines near the other three stationary points being<br />

characteristic of saddle points. 1 If the particle has a total energy below the<br />

potential energy 1<br />

6 at the saddle point and starts inside the region bounded<br />

by the three saddle points, it will have a bounded orbit inside this region. If<br />

E> 1<br />

6 , the particle could escape through one of the saddle points to in¯nity.<br />

The Hamiltonian is entered, and the command hamilton eqs used to generate<br />

Hamilton's equations and a list of the four dependent variables.<br />

> H:=p1^2/2+p2^2/2+V;<br />

> hamilton_eqs(H);<br />

[ d<br />

d<br />

p1(t) =¡q1 (t) ¡ 2 q1(t) q2 (t);<br />

dt dt p2 (t) =¡q2 (t) ¡ q1 (t)2 + q2 (t) 2 ;<br />

d<br />

d<br />

q1 (t) =p1(t); q2 (t) =p2 (t)]; [p1(t); p2 (t); q1 (t); q2 (t)]<br />

dt dt<br />

1 You can con¯rm this by making a 3-dimensional contour plot using the plot3d command.


326 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

The result is a nonlinear system of four coupled ODEs, which must be solved<br />

numerically. Let's take as initial conditions q1(t =0)=q10 = ¡0:1, q2(0) =<br />

q20 = ¡0:2, p2 (0) = p20 = ¡0:05, and a total energy E0 =1=16. This will<br />

produce a bounded orbit inside the region bounded by the saddle points.<br />

> q10:=-0.1: q20:=-0.2: p20:=-0.05: E0:=1/16:<br />

Note that it is not necessary to specify the initial value of p1, since it will be<br />

determined by energy conservation. In fact, p1(0) can be obtained by entering<br />

the following generate ic command and asking for one solution.<br />

> ic:=generate_ic(H,ft=0,p2=p20,q2=q20,q1=q10,energy=E0g,1):<br />

ic := f[0:; 0:2667708130; ¡0:05; ¡0:1; ¡0:2]g<br />

The second entry in the output tells us that p1(0) ¼ 0:267. If desired, more initial<br />

conditions can be generated by stating, e.g., a range for q2(0) and specifying<br />

the number of p1 (0) values wanted.<br />

The following poincare command uses a fourth-order Runge{Kutta method<br />

with three iterations and a step size of 0:05 to produce a trajectory over the<br />

time interval t =0to300intheq2 vs. p2 vs. q1 phase space. The last number<br />

speci¯es that a 3-dimensional plot is to be produced.<br />

> poincare(H,t=0..300,ic,stepsize=.05,iterations=3,<br />

scene=[q2=-0.4..0.4,p2=-0.4..0.4,q1=-0.4..0.4],3);<br />

H = :62500000e ¡ 1 ; Initial conditions :; t=0:;<br />

p1 =0:2667708130; p2 = ¡0:05; q1 = ¡0:1; q2 = ¡0:2;<br />

Maximum H deviation : :1020000000e ¡ 5 %<br />

q1<br />

0.4<br />

0.2<br />

0<br />

–0.2<br />

–0.4<br />

–0.4<br />

Time consumed : 19 seconds<br />

0<br />

p2<br />

H = .6250000000e–1;<br />

0.4 0.2 0<br />

q2<br />

–0.2<br />

–0.4<br />

Figure 8.5: Quasiperiodic trajectory for E =1=16.


8.1. THE POINCAR ESECTION 327<br />

The output informs us of the input H (energy) value, the initial conditions,<br />

the maximum percentage deviation from the input H value, and the computer<br />

time taken to produce a plot of the trajectory, which is shown in Figure 8.5.<br />

The trajectory executes quasiperiodic motion on the surface of a twisted torus,<br />

referred to as the Kolmogorov{Moser{Arnold (KAM) torus.<br />

The Poincare section for the q1 = 0 plane shown in Figure 8.5 can be<br />

obtained with the following poincare command. In addition to the same information<br />

as before, the number of points (96 here) in the q2 -p2 plane where<br />

the trajectory crosses the plane is also given.<br />

> poincare(H,t=0..300,ic,stepsize=.05,iterations=3,<br />

scene=[q2,p2]);<br />

H = :62500000e ¡ 1 ; Initial conditions :; t=0:;<br />

p1 =0:2667708130; p2 = ¡0:05; q1 = ¡0:1; q2 = ¡0:2<br />

Number of points found crossing the (q2; p2) plane : 96<br />

Maximum H deviation : :9800000000e ¡ 6 %<br />

p2<br />

0.2<br />

0.1<br />

0<br />

–0.1<br />

–0.2<br />

Time consumed : 1 seconds<br />

H = .6250000000e–1;<br />

–0.3 –0.2 –0.1 0 0.1 0.2 0.3<br />

q2<br />

Figure 8.6: Poincare section for E =1=16.<br />

The Poincare section can be qualitatively understood. One can think of the<br />

KAM torus as a twisted \donut," with the trajectories con¯ned to the donut's<br />

surface. The con¯guration of points in the Poincare section resembles two<br />

distorted ellipses that one might expect from \slicing" the donut through its<br />

cross section with the q1 =0plane.<br />

If the total energy is increased to 1<br />

8 and the viewing box increased in size,<br />

the \chaotic" trajectory shown in Figure 8.7 results.


328 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

q1<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

–0.2<br />

–0.4<br />

–0.6<br />

–0.5<br />

0<br />

p2<br />

H = .1250000000;<br />

0.6 0.4 0.2 0 –0.2<br />

q2<br />

–0.4<br />

–0.6<br />

Figure 8.7: Chaotic trajectory for E = 1<br />

8 .<br />

A great deal of mathematics research has gone into understanding the onset<br />

of chaos for the nonlinear Henon{Heiles ODE system. The interested<br />

reader is referred to the nonlinear dynamics texts by Jackson [Jac90] and by<br />

Hilborn [Hil94].<br />

PROBLEMS:<br />

Problem 8-6: A di®erent potential<br />

Replace the potential in the text recipe with<br />

V = 1<br />

2 q2 1<br />

1 +<br />

2 q2 2 + q4 1 q2 ¡ 1<br />

4 q3 2 :<br />

(a) Execute the modi¯ed recipe with E =1=16 and initial conditions as in<br />

the text recipe. Discuss the resulting plots.<br />

(b) Explore other initial conditions for the same total energy as in part (a).<br />

Discuss the results.<br />

(c) Explore what happens as the energy is increased with the same initial<br />

conditions as in part (a). Discuss the results.<br />

(d) Explore other potential energy functions and discuss the results.<br />

Problem 8-7: Toda potential<br />

The Toda potential [Jac90] is given by<br />

V = 1<br />

μ<br />

e<br />

3<br />

(q2 + p 3 q1) (q2 + e<br />

¡ p <br />

3 q1) (¡2 q2)<br />

+ e ¡ 1:<br />

(a) Create two- and three-dimensional contour plots of V , choosing suitable<br />

potential energy contours and viewing ranges.


8.2. THE POWER SPECTRUM 329<br />

(b) Locate and identify the nature of the stationary points.<br />

(c) Generate the Hamiltonian equations.<br />

(d) For E =1:0, p2(0) = ¡0:05, q2(0) = ¡0:2, q1(0) = ¡0:2, determine p1(0).<br />

(e) Plot the system's trajectory in the q1-q2-p2 space and discuss the result.<br />

(f) Generate the Poincare section in the q2 vs. p2 plane. Interpret the result.<br />

(g) Explore the Toda Hamiltonian for other E values and discuss the results.<br />

8.2 The Power Spectrum<br />

Still another important diagnostic tool is the power spectrum, which, although<br />

perhaps better known for its use by engineers in digital signal processing [SK89],<br />

can be adapted to studying the frequency content of a solution x(t) of a forced<br />

linear or nonlinear oscillator equation.<br />

Suppose that in principle, a nonlinear ODE of physical interest has the timedependent<br />

solution x(t), valid for all t (¡1


330 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

evaluate the Fourier transform of x(t) andthenS(f), this procedure would lead<br />

to an inordinately long computation time. In practice, one tries to obtain an<br />

accurate power spectrum using a limited number of x points. How this is done<br />

is now explained in some detail.<br />

Assume that a sequence of N values of x, viz., xn ´ x(tn = nTs) with<br />

n =0; 1; 2; :::; N¡ 1 is recorded at evenly spaced time intervals Ts over some<br />

¯nite time range. As with the Poincare section analysis, one starts recording at<br />

a su±ciently large time t0, so as to ensure that all transients have died away.<br />

How large this time must be depends on the nature of the forced oscillator, the<br />

parameter values, initial conditions, etc., and is determined by trial and error.<br />

For any choice of the sampling time interval Ts, there is a very special corresponding<br />

frequency, fNyquist =1=(2 Ts), called the Nyquist frequency. Notethat<br />

the sampling frequency Fs =1=Ts is twice the Nyquist frequency. Why is the<br />

Nyquist frequency important? The answer lies in the sampling theorem, dueto<br />

Nyquist [Nyq28] and Shannon [Sha49], which states:<br />

If a continuous signal x(t), sampled at an interval Ts, issuchthatitsFourier<br />

transform X(f) is equal to 0 for all frequencies jfj >fNyquist, thenx(t) is completely<br />

determined by the sampled values xn.<br />

In this case, the Nyquist frequency is clearly greater than the maximum frequency<br />

f max in the signal's frequency spectrum. Thus, Fs > 2 f max.<br />

In signal processing, engineers ensure that the sampling theorem prevails by<br />

using a low-pass analog ¯lter on their signal to select f max(< f Nyquist), removing<br />

all higher frequencies by the process of attenuation. When X(f) is zero outside<br />

the range ¡f Nyquist to f Nyquist, theyrefertox(t) asbeingbandwidth limited to<br />

frequencies smaller in magnitude than f Nyquist.<br />

What happens if x(t) is not bandwidth limited to this frequency range,<br />

i.e., its Fourier transform X(f) does not vanish outside the range ¡f Nyquist to<br />

f Nyquist? It turns out that the power outside this frequency range gets \folded<br />

back" into the range giving an inaccurate power spectrum. This phenomenon is<br />

called aliasing. To avoid aliasing, one should attempt to make x(t) bandwidth<br />

limited by taking the sampling frequency Fs > 2 f max. Unfortunately, for forced<br />

oscillator problems it is usually not known a priori what the maximum frequency<br />

component is in the signal x(t). On the other hand, suppose that the chosen<br />

sampling frequency or sampling interval Ts =1=Fs is such that X(f) isnot<br />

zero at the Nyquist frequency. Then increase Fs to check for possible aliasing.<br />

Increasing Fs pushes the Nyquist frequency up, allowing us to see whether there<br />

are indeed higher-frequency components present.<br />

Keeping these important aspects in mind, let's continue with the formal<br />

derivation of the power spectrum from the N sampled values xn. It follows from<br />

elementary mathematics that given these N values, we can generate the Fourier<br />

transform at only N frequencies. Assuming that x(t) is bandwidth limited, we<br />

shall take these frequencies to be equally spaced between ¡f Nyquist and f Nyquist,<br />

viz., the frequencies fk ´ k=(N Ts) withk = ¡N=2; :::;0; :::; N=2. The<br />

extreme k values generate ¡f Nyquist and f Nyquist. It might seem on counting the


8.2. THE POWER SPECTRUM 331<br />

k values that we have N + 1 of them, but due to periodicity of the Fourier<br />

transform, the extreme k values are not independent, but in fact are equal.<br />

We now approximate the continuous Fourier transform as follows,<br />

Z 1<br />

X(fk) = x(t) e ¡2 ¼Ifk t dt ¼<br />

¡1<br />

N¡1 X<br />

n=0<br />

where Xk is the discrete Fourier transform,<br />

Xk ´<br />

N¡1 X<br />

xn e ¡2 ¼Ifk tn Ts = Ts Xk;<br />

xn e ¡2 ¼Ikn=N : (8.7)<br />

n=0<br />

We can change the k range from ¡N=2; :::; N=2to0;:::;N¡ 1, thus making<br />

it the same as the n range, by noting that Xk is periodic in k with period N.<br />

With this standard convention for the range of k, k =0correspondstozero<br />

frequency, k =1; 2; :::; N=2¡1 to positive frequencies, k = N=2+1; :::; N¡1<br />

to negative frequencies, and k = N=2 tobothfNyquist and ¡fNyquist. Because of<br />

symmetry of the power spectrum about k = N=2, it su±ces to plot only the<br />

positive frequency range, which is what we will do in our recipes.<br />

In a similar manner, the inverse discrete Fourier transform can be derived:<br />

xn = 1<br />

N¡1 X<br />

N<br />

k=0<br />

Xk e 2 ¼Ikn=N : (8.8)<br />

From the discrete Fourier transform pair, Parseval's theorem then becomes<br />

N¡1 X<br />

n=0<br />

jxnj 2 = 1<br />

N<br />

N¡1 X<br />

k=0<br />

jXkj 2 ´<br />

N¡1 X<br />

k=0<br />

SN (k); (8.9)<br />

where SN (k) =jXkj 2 =N is the power spectrum.<br />

In calculating the discrete Fourier transform Xk, we will make use of the fast<br />

Fourier transform (FFT), which is the default numerical algorithm [Bri74] in<br />

the FourierTransform command found in Maple's DiscreteTransforms library<br />

package. The FFT is based on the idea of splitting the data set in the discrete<br />

Fourier transform into even- and odd-labeled points and using the periodicity<br />

of the exponential function to eliminate redundant operations. A detailed discussion<br />

of this conversion may be found in standard numerical analysis texts,<br />

for example in Burden and Faires [BF89] and in Numerical <strong>Recipes</strong> [PFTV89].<br />

Why use this routine? As suggested by the process of eliminating redundant<br />

calculations, the FFT is signi¯cantly faster than the straightforward evaluation<br />

of the discrete Fourier transform.<br />

How much faster? A lot! If N is the number of data points, the discrete<br />

Fourier transform involves N 2 multiplications, while the FFT turns out<br />

to involve about N log 2(N) operations. If, for example, N = 10000 as in the<br />

following recipe, the \normal" discrete Fourier transform requires (10 4 ) 2 =10 8<br />

computations compared to about 10 4 £ log 2(10 4 ) ¼ 10 5 for the FFT. In this<br />

case the FFT is about 1000 times faster.


332 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

8.2.1 Frank N. Stein's Heartbeat<br />

The more powerful and original a mind, the more it will incline<br />

towards the religion of solitude.<br />

Aldous Huxley, British writer (1894{1963)<br />

Let's ¯rst illustrate how the power spectrum is calculated for a simple example.<br />

We are given Frank N. Stein's steady heartbeat described by<br />

2X<br />

x = Ai sin(2 ¼fit); i=1<br />

with fundamental frequency f1 = 1 beat per second (60 beats per minute) and<br />

a small second harmonic f2 = 2 beats per second. The suitably normalized<br />

amplitudes are A1 =1andA2 =0:4. Pretending that we do not know the<br />

frequencies, we will extract them from the power spectrum. (We could be<br />

dealing with experimental data, not a known analytic form.)<br />

To calculate the discrete Fourier transform, the DiscreteTransforms package<br />

must ¯rst be loaded. The number of sampling points is taken to be N = 1000.<br />

The numerical factor d = 10 will be used to determine the sampling time.<br />

> restart: with(DiscreteTransforms): N:=1000: d:=10:<br />

The parameter values are entered and the time T2 =1=f2 is calculated.<br />

> A[1]:=1: A[2]:=0.4: f[1]:=1: f[2]:=2.0: T[2]:=1/f[2];<br />

T2 := 0:5000000000<br />

An operator is formed to calculate x at a speci¯ed time t.<br />

> x:=t->add(A[i]*sin(2*Pi*f[i]*t),i=1..2):<br />

Then, x(t) is plotted over the time interval t =0todT2.<br />

> plot(x(t),t=0..d*T[2],labels=["t","x"]);<br />

x<br />

1<br />

0.5<br />

0<br />

–0.5<br />

–1<br />

1 2 3 4 5<br />

t<br />

Figure 8.8: Frank N. Stein's heartbeat.<br />

If one were given only the plot shown in Figure 8.8, it would not be obvious<br />

exactly what frequencies are contained in Frank's heartbeat. The power spec-


8.2. THE POWER SPECTRUM 333<br />

trum will now reveal what they are. The sampling time interval is taken to be<br />

Ts = T2=d and the sampling frequency Fs =1=Ts is calculated.<br />

> T[s]:=T[2]/d; F[s]:=1/T[s];<br />

Ts := 0:05000000000 Fs := 20:00000000<br />

The continuous function x(t) is sampled at times t = nTs with n =0toN ¡ 1.<br />

The sequence of sampled x values is then put into an array format.<br />

> x:=Array([seq(x(n*T[s]),n=0..N-1)]):<br />

The (discrete) Fourier transform of x is performed. Maple de¯nes this transform<br />

such that the kth item in FT is Xk= p N in our notation.<br />

> FT:=FourierTransform(x):<br />

The following operator will allow us to calculate S(k) foragivenk value.<br />

> S:=k->abs(FT[k])^2:<br />

A plotting point operator pt is introduced that gives the power spectrum S(k)<br />

at the frequency (k ¡ 1) Fs=N .<br />

> pt:=k->[F[s]*(k-1)/N,S(k)]:<br />

Taking the power spectrum to be zero at zero frequency, we produce the points<br />

in the power spectrum for k ranging up to N=2.<br />

> pts:=[[0,0],seq(pt(k),k=2..N/2)]:<br />

The complete power spectrum is plotted, and shown in Figure 8.9. There are<br />

clearly two frequencies present at 1 and 2 beats per second, as expected.<br />

> plot(pts,labels=["f","S"],view=[0..5,0..0.3]);<br />

300<br />

250<br />

S<br />

150<br />

100<br />

50<br />

0<br />

1 2 3 4 5<br />

f<br />

Figure 8.9: Frequencies in Frank N. Stein's heartbeat.<br />

PROBLEMS:<br />

Problem 8-8: Third Harmonic<br />

Suppose that Frank N. Stein's heartbeat also contains the term 0:1 sin(6¼t).<br />

Plotting p S, show that the presence of the third harmonic is revealed.


334 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

8.2.2 The Rattler Returns<br />

You cannot have power for good without having power for evil too.<br />

Even mother's milk nourishes murderers as well as heroes.<br />

George Bernard Shaw, Anglo-Irish playwright, Cusins, in Major Barbara, act3<br />

To illustrate how the power spectrum is calculated for a nonlinear ODE, let's<br />

consider the Du±ng oscillator of the previous section with exactly the same parameter<br />

values and initial conditions. We begin by loading the DiscreteTransforms<br />

package and taking the number of sample values of x to be N = 10000.<br />

> restart: with(DiscreteTransforms): N:=10000:<br />

The Du±ng oscillator ODE is entered,<br />

> ode:=diff(x(t),t,t)+ 2*g*diff(x(t),t) + alpha*x(t)<br />

+ beta*x(t)^3=F*cos(omega*t);<br />

μ μ 2 d d<br />

ode := x (t) +2g<br />

dt2 dt x(t)<br />

<br />

+ ® x(t)+¯ x (t) 3 = F cos(!t)<br />

along with the parameter values (taking F =0:325 here) and initial conditions.<br />

> g:=0.25: alpha:=-1: beta:=1: omega:=1; F:=0.325; #change F<br />

! := 1 F := 0:325<br />

> ic:=x(0)=0.09,D(x)(0)=0:<br />

The force amplitude F will be adjusted to the other values, F =0:35; 0:356; 0:42,<br />

used previously. The Du±ng oscillator equation is numerically solved,<br />

> sol:=dsolve(fode,icg,fx(t)g,numeric,maxfun=0,<br />

output=listprocedure):<br />

and the solution used to evaluate x(t) for arbitrary time t.<br />

> X:=eval(x(t),sol):<br />

The driving frequency is ! =1 rad/s, or f =!=(2 ¼)=1=(2 ¼) Hz. The sampling<br />

frequency fs is taken to be 4 f and the sampling time Ts =1=fs is calculated.<br />

> f:=omega/(2*Pi): f[s]:=4*f; T[s]:=1/f[s]; #frequencies in Hz<br />

fs := 2<br />

Ts :=<br />

¼<br />

¼<br />

2<br />

To eliminate the transient solution, the x values are recorded starting at t0 =<br />

50 ¼ seconds and sampled every Ts seconds up to time (N ¡ 1) Ts. Thesevalues<br />

are entered with the Array command.<br />

> x:=Array([seq(X(50*Pi+T[s]*i),i=0..N-1)]):<br />

The FourierTransform command is applied to the sampled x values. This<br />

command calculates the discrete Fourier transform (8.7), divided by p N,using<br />

the fast Fourier transform as the default algorithm.<br />

> FT:=FourierTransform(x):<br />

The following operator F enables us to extract the ith term in FT and, since<br />

the result is generally complex, take the absolute value. Because of Maple's<br />

de¯nition of the discrete Fourier transform, this is equivalent to taking the


8.2. THE POWER SPECTRUM 335<br />

square root of the power spectrum for the ith frequency point. We take the<br />

square root here because it helps to accentuate smaller peaks in the spectrum.<br />

> F:=i->abs(FT[i]): #sqrt of S<br />

An operator pt is introduced to form the ith plotting point for the power<br />

spectrum, the frequency being expressed in radians per second so a comparison<br />

can be easily made with the driving frequency ! =1 rad/s.<br />

> pt:=i->[2*Pi*f[s]*(i-1)/N,F(i)]:<br />

With the aid of the pt operator, the plotting points are formed into a list of<br />

lists, with the zero frequency value of the power spectrum taken as zero. Since<br />

the power spectrum is symmetric about N/2, only the points up to this number<br />

will be plotted. In the present case, 5000 points will be included. The point,<br />

e.g., i = 2501 corresponds to an angular frequency of 1 rad/s, for which S ¼ 29.<br />

> pts:=[[0,0],seq(pt(i),i=2..N/2)]: pts[2501];<br />

[1; 28:82963799]<br />

The points are plotted and labels are added,<br />

> plot(pts,tickmarks=[3,2],labels=["omega","S"]);<br />

S<br />

20<br />

0<br />

1 omega 2<br />

S<br />

20<br />

0<br />

1 omega 2<br />

Figure 8.10: Power spectrum for period-1 (left) and period-2 (right).<br />

the power spectrum for F =0:325 being shown in the left plot of Figure 8.10.<br />

This spectrum shows a single sharp spike located at a frequency of 1 rad/s, i.e.,<br />

exactly at the driving frequency. The period is T =2¼=! =2¼ seconds, so the<br />

response is period 1, in agreement with the conclusion reached earlier for the<br />

same Du±ng oscillator on the basis of a Poincare section analysis.<br />

The plot on the right of Figure 8.10 results on executing the work sheet<br />

with F =0:35. In addition to the tallest spike at the driving frequency, there<br />

is a second spike to the left, located at the frequency !=2=0:5 rad/s. This<br />

corresponds to a period T =2¼=(!=2) = 4 ¼ seconds, i.e., twice as long as<br />

for F =0:325. The spectrum is characteristic of a period-2 solution. Note<br />

that there is also a spike in the power spectrum to the right of the driving


336 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

frequency, occurring at 1:5 rad/s. This is the third harmonic of the period-2<br />

frequency. Harmonics are often present in power spectra, so remember that<br />

only those spikes lying to the left of the driving frequency spike should be<br />

used to determine the periodicity. It is because these harmonics are present<br />

that one must be sure to use a su±ciently high sampling frequency so that<br />

these harmonics do not get \folded" back (aliased) into the frequency range of<br />

interest.<br />

On increasing F to 0:356, one sees three spikes to the left of the driving<br />

frequency in the left plot of Figure 8.11. The spike furthest to the left is located<br />

at !=4 =0:25 rad/s, corresponding to a period of 8 ¼ seconds. The spectrum<br />

is characteristic of a period-4 response. Again, harmonics of these frequencies<br />

appear to the right of the driving frequency.<br />

S<br />

20<br />

0<br />

1 omega 2<br />

10<br />

S<br />

0<br />

1 omega 2<br />

Figure 8.11: Power spectrum for period-4 (left) and chaotic response (right).<br />

Finally, taking F =0:42 produces the power spectrum shown on the right of<br />

Figure 8.11. Although a sharp spike is still seen at the driving frequency, the<br />

spectrum is very chaotic, which is not surprising, since it corresponds to the<br />

chaotic \rattler" Poincare section seen earlier.<br />

Recalling Richard's fright when his daughter nearly stumbled and rolled<br />

over a real rattlesnake, one might fancifully interpret this power spectrum as<br />

representing the rattling of his teeth or the shaking of his knees at the time of<br />

the incident.<br />

PROBLEMS:<br />

Problem 8-9: A di®erent ¯ value<br />

Holding all other parameter values as in the text, use the power spectrum to<br />

determine the response of the forced Du±ng ODE for each F value when ¯ =2.<br />

Problem 8-10: Varying the frequency<br />

For each of the four F values, use the power spectrum to explore the response<br />

of the Du±ng oscillator as ! is varied, all other parameters being unchanged.


8.3. THE BIFURCATION DIAGRAM 337<br />

Problem 8-11: Interchanging signs<br />

Use the power spectrum to determine the response of the forced Du±ng oscillator<br />

for each F value when all numerical values are the same as in the text<br />

recipe, but the signs of ® and ¯ are interchanged.<br />

Problem 8-12: Steady-state solution?<br />

Using the power spectrum approach, determine the nature of the steady-state<br />

solution for the following forced oscillator equation:<br />

Äx +0:7 _x + x 3 =0:75 cos t; x(0) = _x(0) = 0:<br />

Problem 8-13: Solution?<br />

Using the power spectrum approach, determine the nature of the steady-state<br />

solution for the following forced Du±ng equation:<br />

Äx +0:08 _x + x 3 =0:2cost; x(0) = 0:25; _x(0) = 0:<br />

Problem 8-14: Solutions?<br />

Using the power spectrum approach, determine the nature of the steady-state<br />

solution for the following oscillator equation for F =0:357 and F =0:35797:<br />

Äx +0:5 _x ¡ x + x 3 =0:357 cos(t +1); x(0) = 0:09; _x(0) = 0:<br />

Problem 8-15: Forced glycolytic oscillator<br />

The equations describing forced oscillations of the glycolytic oscillator are<br />

_x = ¡x + ®y+ x 2 y; _y = ¯ ¡ ®y¡ x 2 y + A + F cos(!t):<br />

Taking ® = ¯ =0,A =0:999, F =0:42, x(0) = 2, and y(0) = 1, determine the<br />

periodicity of the response using the Poincare sectionapproachfor(a)! =2<br />

and (b) ! =1:75. Explore the frequency range in between and identify any<br />

interesting solutions.<br />

8.3 The Bifurcation Diagram<br />

Bifurcation diagrams can be generated for both nonlinear ODEs and nonlinear<br />

di®erence equations by plotting the system \response" versus a \control" parameter<br />

as the latter is varied. The word bifurcation is derived from the Latin<br />

word furca for fork. When period doubling occurs from period one to period<br />

two, the response curve resembles a two-pronged fork, the period-one portion<br />

being the \handle" and the period-two portion looking like two \prongs." In a<br />

typical period-doubling scenario, the two prongs then split into four and then<br />

into eight and so on as the control parmeter is further increased. Period doubling<br />

is not the only \route" to chaos, so bifurcation diagrams are useful in<br />

revealing the nature of the route.


338 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

8.3.1 Pitchforks and Other Bifurcations<br />

Though you drive away nature with a pitchfork, she always returns.<br />

Horace, Roman poet known for his odes (65{8 BC)<br />

Consider the following di®erence equation, known as the logistic map,<br />

xn+1 = axn (1 ¡ xn); (8.10)<br />

where n =0; 1; 2; :::;N and a is allowed to vary between 0 and 4. As a is<br />

increased over its range, a period-doubling sequence to chaos occurs that can<br />

be illustrated by plotting xn (at large N to eliminate the transient) versus a.<br />

The ¯rst part of the following recipe illustrates a period-2 solution of the<br />

logistic map for a =3:2, N = 119, and initial value x0 =0:1.<br />

> restart: a:=3.2: N:=119: x[0]:=0.1:<br />

An operator F is formed to calculate the rhs of the logistic map for a given x.<br />

> F:=x->a*x*(1-x):<br />

The logistic map is iterated from n =0toN,<br />

> for n from 0 to N do<br />

> x[n+1]:=F(x[n]);<br />

> end do:<br />

and the sequence of points [n; xn] plotted, each point being represented by a<br />

size-12 black circle. The resulting picture is shown in Figure 8.12.<br />

> plot([seq([n,x[n]],n=0..N)],style=point,symbol=circle,<br />

symbolsize=12,color=black,labels=["n","x"]);<br />

0.8<br />

0.7<br />

x<br />

0.5<br />

0.4<br />

0.3<br />

0.2<br />

0.1<br />

0 20 40 60 n 100 120<br />

Figure 8.12: Period-2 solution for the logistic map.


8.3. THE BIFURCATION DIAGRAM 339<br />

After a short transient interval, the logistic system oscillates back and forth<br />

between the two branches shown in the ¯gure. This is characteristic of a period-<br />

2 solution, there being only one branch in steady state for a period-1 solution.<br />

As a is increased, further bifurcations occur.<br />

To create a bifurcation diagram for the logistic map, a particular initial<br />

value of x0 is chosen, and the map iterated for a given a. A certain number of<br />

the initial points are thrown away to remove the transient part of the solution,<br />

and the subsequent steady-state points plotted. Then, one increments a by a<br />

small amount and repeats the process, and so on. The whole process is easily<br />

automated, as is now illustrated.<br />

> restart: with(plots):<br />

As you may con¯rm by running the ¯rst part of the recipe, a period-1 solution<br />

prevails until a =3:0, at which point period two begins. In the recipe, the range<br />

of a is taken from the starting value Sa =2:9 uptothe¯nalavalue Fa =4. If<br />

this a range is divided into, say, N = 200 equal intervals,<br />

> Sa:=2.9: Fa:=4: N:=200: stepsize:=(Fa-Sa)/N; x:=0.2;<br />

stepsize := 0:005500000000 x := 0:2<br />

the stepsize is ¢a =0:0055. The initial value of x has been taken to be x =0:2.<br />

A total of 500 iterations will be considered and the ¯rst 100 points ignored<br />

in order to remove any transients. This leaves 400 points to be plotted for each<br />

a value. The quantity c is a counter to keep track of the plots, a graph being<br />

produced for each a value. The counter is initially set equal to zero.<br />

> totalpts:=500: ignorepts:=100: pts:=totalpts-ignorepts; c:=0:<br />

pts := 400<br />

In the following double do loop, the ¯rst, or outer, loop increments a from the<br />

starting value Sa to the ¯nal a value Fa in incremental steps given by stepsize.<br />

> for a from Sa to Fa by stepsize do<br />

The second, or inner, do loop iterates the logistic equation from 1 to totalpts.<br />

> for n from 1 to totalpts do<br />

> x:=a*x*(1-x);<br />

The points for a given a value are formed into a list,<br />

> pts[n]:=[a,x];<br />

> end do;<br />

and the inner do loop completed. Then, the counter is advanced by one,<br />

> c:=c+1;<br />

and a list of lists is made using the ¯nal 400 (presumably) steady-state points.<br />

> points:=[seq(pts[k],k=ignorepts..totalpts)]:<br />

Aplotismadeforeachavalue using a point style,<br />

> Gr[c]:=pointplot(points,symbol=point,color=black):<br />

> end do:


340 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

and the outer do loop ended. The N = 200 plots are superimposed with the<br />

display command, yielding the bifurcation diagram shown in Figure 8.13.<br />

x<br />

> display([seq(Gr[m],m=1..N)],view=[Sa..Fa,0..1],<br />

1<br />

0<br />

labels=["a","x"]);<br />

3 4<br />

a<br />

Figure 8.13: Bifurcation diagram for the logistic map for a =2:9 to4.<br />

Starting at a =2:9, the reader can observe period 1 occurring up to a =3:0.<br />

Then the steady-state response undergoes a so-called pitchfork bifurcation to<br />

period 2, followed by clearly seen bifurcations to period four, period eight, and<br />

a barely observable period-sixteen solution. At higher a values, the response is<br />

generally chaotic, but narrow periodic windows also occur. The reader should<br />

be able to see, for example, a period-3 solution for a ¼ 3:83. In this case, the<br />

bifurcation to period 3 is an example of a tangent bifurcation.<br />

Since the periodic windows are often very narrow in terms of the range of a,<br />

one should really increase the number N, but this leads to a longer computing<br />

time. A better approach is to leave N unchanged and zoom in on a particular<br />

range of a by changing the values of Sa and Fa.<br />

Bifurcation diagrams are very useful diagnostic tools for studying the behavior<br />

of nonlinear maps as well as forced oscillator ODEs as one or more control<br />

parameters are varied.<br />

A complementary graphical approach is to calculate the Lyapunov exponent<br />

as a function of a as illustrated in the next recipe.


8.3. THE BIFURCATION DIAGRAM 341<br />

PROBLEMS:<br />

Problem 8-16: Finer structure<br />

For the logistic map, produce the bifurcation diagram for the region a =3:54 to<br />

a =3:6, taking x0 =0:2, and dividing the a interval into 100 steps. Summarize<br />

the various periodic solutions that you observe.<br />

Problem 8-17: More ¯ne structure<br />

Explore the periodic window in the vicinity of a =3:8and report on what<br />

periodicities you observe at each a value sampled.<br />

Problem 8-18: Cubic map<br />

Produce a bifurcation diagram for the cubic map<br />

xn+1 = axn ¡ x 3 n<br />

over a suitable range of the parameter a. Determine the values of a in the<br />

diagram at which the periodicity changes.<br />

Problem 8-19: Quartic map<br />

With x0 =0:2, produce the bifurcation diagram for the quartic map<br />

xn+1 = axn (1 ¡ x 3 n )<br />

over the range a =1:5 toa =2:0, taking as small an a step size as you can.<br />

Summarize the behavior of the map as a varies over the speci¯ed range.<br />

Problem 8-20: The tent map<br />

Produce the bifurcation diagram for the tent map<br />

xn+1 =2axn; 0


342 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

8.4 The Lyapunov Exponent<br />

Named after the Russian mathematician Aleksandr Mikhailovich Lyapunov<br />

(1857{1918), the Lyapunov exponent ¸ is a measure of the very sensitive dependence<br />

on initial conditions that is characteristic of chaotic behavior in nonlinear<br />

di®erence equations (maps) and ODEs. The discussion that follows is for maps,<br />

a similar analysis applying to ODEs.<br />

Consider a one-dimensional map<br />

xn+1 = f(xn); (8.11)<br />

with f some speci¯ed functional form, and let x0 and y0 be two initial values<br />

very close to each other. In phase space, they would be represented by two very<br />

close points. After n iterations, the values of xn and yn will be given by<br />

xn = f (n) (x0); yn = f (n) (y0); (8.12)<br />

where f (n) denotes the nth iteration of the map. Because the chaotic regime<br />

is typically characterized by an extreme sensitivity to initial conditions, for a<br />

chaotic situation nearby initial points will rapidly separate. On the other hand,<br />

periodic solutions are insensitive to initial conditions, and nearby initial points<br />

rapidly converge.<br />

This suggests that for su±ciently large n, one might assume an approximately<br />

exponential dependence on n of the separation distance, viz.,<br />

jxn ¡ ynj = jx0 ¡ y0je ¸n ; (8.13)<br />

with ¸>0 for the chaotic situation and ¸


8.4. THE LYAPUNOV EXPONENT 343<br />

and the Lyapunov exponent ¸ is given by<br />

n¡1 ¯ ¯<br />

1 X ¯<br />

¸ = lim ln ¯<br />

df (xk) ¯<br />

n!1 n ¯ dxk<br />

¯ : (8.18)<br />

k=0<br />

For periodic solutions, which starting point x0 is chosen doesn't matter, but<br />

for chaotic trajectories, the precise value of ¸ will depend on x0, i.e., in general<br />

¸ = ¸(x0). One can, if desired, de¯ne an average ¸, averaged over all starting<br />

points. Whether this is done or not, ¸>0 should correspond to chaos and<br />

¸ restart: with(plots): numpts:=300:<br />

The range of a is taken from the starting value Sa =2:8 to the ¯nal a value<br />

Fa = 4, with the range divided into N = 480 equal steps.<br />

> Sa:=2.8: Fa:=4: N:=480: x:=0.2: stepsize:=(Fa-Sa)/N; c:=0:<br />

stepsize := 0:002500000000<br />

The stepsize is 0:0025 and the initial value of x is taken to be 0:2. The plots<br />

counter c has been \initialized" to zero. The outer loop in the following double<br />

loop increments a in units of stepsize from Sa to Fa.<br />

> for a from Sa to Fa by stepsize do<br />

The sum in equation (8.18) is calculated for each value of a, and the sum is<br />

assigned the name total. Tostarto®,total is set to zero.<br />

> total:=0;<br />

The inner do loop runs over the total number of iterations, numpts =300.<br />

> for j from 1 to numpts do<br />

The logistic map is entered, and the absolute value of the derivative with respect<br />

to x formed and labeled d.<br />

> x:=a*x*(1-x);<br />

> d:=abs(a*(1-2*x));


344 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

If d is not equal to zero, then f =ln(d) iscalculated. Ifd = 0, we would obtain<br />

f = ¡1. This latter situation is avoided by setting f = 0 in this case.<br />

> if d0 then f:=ln(d) else f=0 end if;<br />

To perform the sum in equation (8.18), the total is incremented by the value of<br />

f, and the inner loop ended.<br />

> total:=total+f;<br />

> end do:<br />

The counter c is incremented by one,<br />

> c:=c+1;<br />

and a list of points formed with a as the horizontal coordinate and ¸ =<br />

total=numpts as the vertical coordinate. This completes the evaluation of ¸<br />

in equation (8.18) for a given a value.<br />

> pts[c]:=[a,total/numpts]:<br />

> end do:<br />

The sequence of N = 480 points is plotted, the points being joined using a line<br />

style. Figure 8.14 shows the Lyapunov exponent ¸ for a =2:8 toa =4.<br />

> plot([seq(pts[i],i=1..N)],style=line,view=[Sa..Fa,-1.5..1],<br />

tickmarks=[3,3]);<br />

1<br />

0<br />

-1<br />

3 3.5 4<br />

Figure 8.14: Lyapunov exponent (vertical axis) for a =2:8 toa =4.<br />

If one compares the periodic windows where the Lyapunov exponent goes negative,<br />

there is good agreement with the bifurcation diagram, Figure 8.13, for<br />

the logistic map. Because the Lyapunov spikes are sometimes quite narrow, the<br />

agreement can be improved by zooming in on a particular a region by altering<br />

the values of Sa and Fa.


8.5. RECONSTRUCTING AN ATTRACTOR 345<br />

PROBLEMS:<br />

Problem 8-23: Quartic map<br />

With x0 =0:2, calculate the Lyapunov exponent for the quartic map<br />

xn+1 = axn (1 ¡ x 3 n)<br />

over the range a =1:5 toa =2:0, keeping all other parameters as in the text<br />

recipe. Over what regions of a do periodic solutions occur?<br />

Problem 8-24: The tent map<br />

Plot the Lyapunov exponent ¸ versus a for the tent map<br />

xn+1 =2axn; 0


346 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

so that xn+1 depends only on the previous value xn. If this is the case, then a<br />

functional form f will exist such that xn+1 = f(xn).<br />

Assuming that this is the case, one plots pairs of numbers (xn; xn+1) from<br />

the time series to form the two-dimensional space xn+1 versus xn. Ifthepoints<br />

appear to lie on a de¯nite geometrical line, this implies that there is an underlying<br />

attractor and an associated functional form f. If the geometrical shape<br />

has more structure to it, this could imply that there is an underlying \twodimensional"<br />

map, namely,<br />

xn+1 = f(xn)+g(xn¡1); or xn+1 = f(xn)+yn; yn+1 = g(xn):<br />

If the dimensionality of the underlying map is higher than two, one must increase<br />

the dimensionality of the space accordingly. To \see" a three-dimensional<br />

map, for example, one must work in a three-dimensional space. The above procedure<br />

is then generalized by plotting triplets of numbers. For example, one<br />

might use (x0; x1; x2), (x1; x2; x3), etc.<br />

8.5.1 Putting Humpty Dumpty Together Again<br />

Humpty Dumpty sat on a wall, Humpty Dumpty had a great fall,<br />

All the king's horses, And all the king's men,<br />

Couldn't put Humpty Dumpty together again.<br />

Lewis Carroll, Alice's Adventures in Wonderland, 1865<br />

Suppose that we have been given the following lengthy data list x, whereeach<br />

entry x(n) corresponds to a time t = nts, withn =1; 2; :::;N.<br />

> restart: with(plots):<br />

> x:=[6.24, 9.15, 3.03, 8.24, 5.66, 9.58, 1.56, 5.14, 9.74, .980,<br />

3.45, 8.81, 4.09, 9.43, 2.10, 6.47, 8.91, 3.79, 9.18, 2.93, 8.07,<br />

6.07, 9.30, 2.53, 7.37, 7.56, 7.18, 7.89, 6.50, 8.88, 3.89, 9.27,<br />

2.65, 7.60, 7.12, 8.00, 6.24, 9.15, 3.03, 8.23, 8.23, 5.67, 9.57,<br />

1.60, 5.23, 9.73, 1.03, 3.59, 8.98, 3.58, 8.97, 3.61, 9.00, 3.51,<br />

3.86, 9.24, 2.74, 7.76, 6.77, 8.53, 4.89, 9.74, .969, 8.89, 3.41,<br />

8.77, 4.21, 9.51, 1.82, 5.81, 9.50, 1.87, 5.93, 9.41, 2.16, 6.61,<br />

8.74, 4.30, 9.56, 1.64, 5.33, 9.71, 1.11, 3.85, 9.23, 2.76, 7.80,<br />

6.70, 8.62, 4.65, 9.70, 1.13, 3.91, 9.28, 2.59, 7.48, 7.34, 7.61,<br />

7.10, 8.04, 6.16, 9.23, 2.78, 7.83, 6.62, 8.72, 4.34, 9.58, 1.56,<br />

5.13, 9.74, .977, 3.44, 8.80, 4.13, 9.45, 2.02, 6.29, 9.10, 3.18,<br />

8.46, 5.08, 9.75, .960, 3.39, 8.73, 4.31, 9.56, 1.62, 5.30, 9.72,<br />

1.08, 3.76, 9.15, 3.04, 8.25, 5.63, 9.60, 1.51, 5.00, 9.75, .951,<br />

3.36, 8.70, 4.43, 9.62, 1.42, 4.75, 9.73, 1.04, 3.63, 9.02, 3.45,<br />

8.81, 4.09, 9.43, 2.10, 6.47, 8.90, 3.81, 9.20, 2.88, 8.00, 6.23,<br />

9.16, 3.01, 8.21, 5.73, 9.54, 1.70, 5.49, 9.66, 1.30, 4.41, 9.61,<br />

1.45, 4.84, 9.74, .989, 3.48, 8.84, 3.98, 9.35, 2.38, 7.07, 8.07,<br />

6.07, 9.30, 2.52, 7.35, 7.59, 7.14, 7.97, 6.30, 9.09, 3.23, 8.53,<br />

4.88, 9.74, .972, 3.42]:


8.5. RECONSTRUCTING AN ATTRACTOR 347<br />

Although the data appears to be con¯ned to the approximate range 0 to 10, it<br />

is not clear at ¯rst glance whether it represents deterministic chaos or is simply<br />

a \noisy" set of data. Can we con¯rm that it is the former and identify the<br />

probable identity of the underlying map? Calling this the \Humpty Dumpty<br />

map," can we then reconstruct his or her mathematical \appearance"? Or, at<br />

the risk of sounding rather melodramatic, can we put Humpty Dumpty back<br />

together again?<br />

The number of operands command reveals that there are 200 entries in x.<br />

> N:=nops(x);<br />

N := 200<br />

First, let us plot x versus n and see whether that reveals any pattern that we<br />

might have missed. By default, the N points are joined by straight lines.<br />

> plot([seq([n,x[n]],n=1..N)],labels=["n","x[n]"]);<br />

x[n]<br />

8<br />

6<br />

4<br />

2<br />

0 50 100 150 200<br />

n<br />

Figure 8.15: Time series x versus n.<br />

Although there is a hint of some repetition, it certainly isn't conclusive that the<br />

series comes from a map producing deterministic chaos rather than just being<br />

noisy output. Following the procedure mentioned in the introduction, we will<br />

plot xn+1=10 versus xn=10, the factor of 10 being introduced to reduce both<br />

vertical and horizontal ranges to 0 to 1 in the graph. The points are represented<br />

by size-12 black circles. The graph is assigned a name, gr1, soitcan¯rstbe<br />

displayed and then used to reveal Humpty Dumpty's true identity.<br />

> gr1:=pointplot([seq([x[n]/10,x[n+1]/10],n=1..N-1)],<br />

symbol=circle,symbolsize=12,color=black,<br />

labels=["x[n]","x[n+1]"]):<br />

Entering gr1 with a command-line-ending semicolon,<br />

> gr1; #humpty dumpty?


348 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

0.8<br />

0.6<br />

x[n+1]<br />

0.4<br />

0.2<br />

0.2 0.4<br />

x[n]<br />

0.8<br />

Figure 8.16: xn+1 versus xn for time series.<br />

produces Figure 8.16. The data points appear to lie on an inverted parabola,<br />

suggesting that Humpty Dumpty might be a one-dimensional logistic map. Adjusting<br />

the parameter a by trial and error to provide the best ¯t, the logistic<br />

curve is now plotted for a =3:9 as a thick red line over the range X =0to1.<br />

> a:=3.9: #adjust<br />

> gr2:=plot(a*X*(1-X),X=0..1,color=red,thickness=2):<br />

The two graphs, gr1 and gr2, are plotted in the same picture, the result being<br />

showninFigure8.17.<br />

> display(fgr1,gr2g); #successful reconstruction<br />

0.8<br />

0.6<br />

x[n+1]<br />

0.4<br />

0.2<br />

0<br />

0.2 0.4<br />

x[n]<br />

0.8 1<br />

Figure 8.17: Best-¯tting logistic curve (solid) and xn+1 vs. xn points.


8.5. RECONSTRUCTING AN ATTRACTOR 349<br />

The points lie on the logistic curve, so we have been successful in identifying and<br />

reconstructing Humpty Dumpty. We can con¯rm from either of the previous<br />

two recipes that the logistic map produces deterministic chaos for a =3:9.<br />

PROBLEMS:<br />

Problem 8-27: Reconstructing the quartic map<br />

Taking a =1:97 and x0 =0:9, iterate the quartic map<br />

xn+1 = axn (1 ¡ x 3 n)<br />

to produce a time series with 200 points. Plot the time series with a line<br />

style. Attempt to reconstruct any possible underlying deterministic attractor<br />

by plotting xn+1 versus xn using a point style. Show that these points lie on<br />

the curve aX(1 ¡ X 3 )witha =1:97. (This problem is a bit like a dog chasing<br />

its tail!)<br />

8.5.2 Random Is Random<br />

We humans have purpose on the brain. We ¯nd it hard to look at<br />

anything without wondering what it is \for," what the motive for it<br />

is, or the purpose behind it. When the obsession with purpose becomes<br />

pathological it is called paranoia{reading malevolent purpose<br />

into what is actually random bad luck. But this is just an exaggerated<br />

form of a nearly universal delusion. Show us almost any object<br />

or process, and it is hard for us to resist the \Why" question|the<br />

\What is it for?" question.<br />

Richard Dawkins, British biologist, author, River Out of Eden, 1995<br />

In this recipe, we shall use Maple's random-number generator to produce a<br />

time series and attempt to reconstruct any underlying deterministic attractor.<br />

The time series will have N =200points.<br />

> restart: N:=200:<br />

The command randomize( ) sets the random-number seed to a di®erent value<br />

based on the computer system clock.<br />

> randomize():<br />

In the following do loop, N random decimal numbers lying between 0 and 1 are<br />

generated.<br />

> for n from 0 to N do<br />

The command rand( ) produces a random positive twelve-digit number. A<br />

fractional number between 0 and 1 results on dividing by 1012 .Thenumberis<br />

then put into decimal form by applying the °oating-point evaluation command.<br />

> x[n]:=evalf(rand()/10^12);<br />

> end do:


350 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

The randomly generated time series is plotted in Figure 8.18.<br />

> plot([seq([n,x[n]],n=1..N)],labels=["n","x[n]"]);<br />

1<br />

0.8<br />

0.6<br />

x[n]<br />

0.4<br />

0.2<br />

0<br />

50 100 n 150 200<br />

Figure 8.18: Time series for random data.<br />

If we didn't know how the series was produced, we would probably still<br />

conclude from the ¯gure that we are dealing with random noise. But one might<br />

have arrived at the same conclusion in the previous recipe from the time series<br />

plot. As in that recipe, let's plot xn+1 versus xn using a point style, thus<br />

producing Figure 8.19.<br />

> plot([seq([x[n],x[n+1]],n=1..N-1)],style=point,symbol=<br />

circle,symbolsize=16,labels=["x[n]","x[n+1]"]);<br />

1<br />

0.8<br />

0.6<br />

x[n+1]<br />

0.4<br />

0.2<br />

0<br />

0.2 0.4 x[n] 0.8 1<br />

Figure 8.19: xn+1 versus xn for time series.


8.5. RECONSTRUCTING AN ATTRACTOR 351<br />

There is no discernible pattern in the ¯gure, unlike the situation in the previous<br />

recipe. By plotting other pairs, or even triplets, of numbers, one can conclude<br />

(not surprisingly) that there is no underlying chaotic attractor here.<br />

PROBLEMS:<br />

Problem 8-28: Rolling a die<br />

Consulting Maple's Help, produce a random set of 500 numbers from the positive<br />

integers one to six inclusive. This might simulate the rolling of an honest<br />

die. Make a plot of the \time series" and xn+1 versus xn to show the randomness.<br />

Problem 8-29: Literature search<br />

Apply the techniques of attractor reconstruction to some time series data (e.g.,<br />

the Dow Jones index) extracted from newspapers, magazines, or whatever, and<br />

see whether a pattern emerges.<br />

8.5.3 Butter°y Reconstruction<br />

A people's literature is the great textbook for real knowledge of them.<br />

Thewritingsofthedayshowthequalityofthepeopleasnohistorical<br />

reconstruction can.<br />

Edith Hamilton, American classical scholar (1867{1963)<br />

Our ¯nal recipe will illustrate how Lorenz's butter°y attractor can be reconstructed<br />

from time series data extracted from the governing system of three<br />

coupled nonlinear ODEs. The Lorenz system (which was discussed in Section<br />

2.2.1) is entered, along with the initial condition x(0) = 2, y(0) = 5, z(0) = 5.<br />

> restart: with(plots):<br />

> sys:=diff(x(t),t)=sigma*(y(t)-x(t)),diff(y(t),t)=-x(t)*z(t)<br />

+r*x(t)-y(t),diff(z(t),t)=x(t)*y(t)-b*z(t);<br />

sys := d<br />

x (t) =¾ (y(t) ¡ x (t));<br />

dt<br />

d<br />

y(t) =¡x(t) z(t)+r x (t) ¡ y(t);<br />

dt<br />

d<br />

z(t) =x(t) y(t) ¡ b z(t)<br />

dt<br />

> ic:=(x(0)=2,y(0)=5,z(0)=5):<br />

The parameter values are taken to be r =28,b =8=3, and ¾ =10.<br />

> r:=28: b:=8/3: sigma:=10:<br />

The total number of entries in the time series will be taken to be N = 2000.<br />

The total time is T = 50, so the step size ¢ = T=N is 1=40.<br />

> N:=2000: T:=50: Delta:=T/N;


352 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

¢:= 1<br />

40<br />

The system of ODEs is solved numerically, the solution being given as a list<br />

procedure, so that we can create a time series.<br />

> sol:=dsolve(fsys,icg,fx(t),y(t),z(t)g,numeric,maxfun=0,<br />

output=listprocedure):<br />

The following line uses the numerical solution to evaluate x(t) atanarbitrary<br />

time, which must be speci¯ed.<br />

> S:=eval(x(t),sol):<br />

Then entering S(n*Delta) will yield x(t) att = n ¢. Using this result, the x<br />

values are obtained at times t = n ¢forn =0toN.<br />

> for n from 0 to N do X[n]:=S(n*Delta); end do:<br />

The time series is created and plotted, the default being to join the points with<br />

straight lines. The resulting picture is shown in Figure 8.20.<br />

> plot([seq([n*Delta,X[n]],n=0..N)],labels=["t","x"]);<br />

x<br />

15<br />

10<br />

5<br />

0<br />

–5<br />

–10<br />

–15<br />

10 20 30 40 50<br />

t<br />

Figure 8.20: x time series for the Lorenz system.<br />

To reconstruct the 3-dimensional Lorenz butter°y attractor, it is necessary to<br />

form triplets of numbers from the time series. By trial and error, we use the<br />

triplet combination involving n, n +3,andn + 6 to create the plotting points.<br />

> points:=[seq([X[n],X[n+3],X[n+6]],n=0..(N-6))]:<br />

Using the spacecurve command with shading=z to color the trajectory, the<br />

butter°y attractor is revealed.<br />

> spacecurve(points,style=line,shading=z,axes=framed,<br />

orientation=[-30,60],tickmarks=[3,3,3],<br />

labels=["X(n)","X(n+3)","X(n+6)"]);<br />

A black-and-white version is shown in Figure 8.21. If one compares the picture,<br />

which can be rotated on the computer screen, with the butter°y picture<br />

obtained in Chapter 2, the reconstruction of the butter°y is quite good.


8.5. RECONSTRUCTING AN ATTRACTOR 353<br />

X(n+6)<br />

10<br />

0<br />

–10<br />

–10<br />

X(n)<br />

0<br />

10<br />

–10<br />

0<br />

X(n+3)<br />

Figure 8.21: Butter°y attractor reconstructed from time series.<br />

In the preceding recipes, the reconstruction attempt has been tested on<br />

known examples. So the question is, does the method work for real experimental<br />

time series data, particularly when the answer is not known? The answer is<br />

yes! The method has been applied to the Belousov{Zhabotinski chemical oscillator<br />

reaction (Section 1.2.2) [RSS83] [SWS82], to Taylor{Couette °ow in hydrodynamics<br />

[AGS84], to ultrasonic cavitation in liquids [LH91], and to measles<br />

data for the cities of Baltimore and New York [SK86].<br />

PROBLEMS:<br />

Problem 8-30: Butter°y attractor<br />

Try reconstructing the butter°y attractor from the z(t) time series, and explain<br />

why you do not obtain two \wings."<br />

Problem 8-31: RÄossler attractor<br />

The RÄossler system is given by<br />

_x = ¡(y + z); _y = x + ay; _z = b + z (x ¡ c):<br />

Using the time series for x(t) witha =0:2, b =0:2, c =5:7, x(0) = y(0) =<br />

z(0) = 0:1, construct the RÄossler attractor. Hint: Your picture should resemble<br />

Figure 1.18.<br />

10


354 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

Epilogue<br />

Thus grew the tale of Wonderland.<br />

Thus slowly, one by one,<br />

Its quant events were hammered out|<br />

And now the tale is done,<br />

And home we steer, a merry crew,<br />

Beneath the setting sun.<br />

Lewis Carroll, Alice's Adventures in Wonderland, 1865<br />

The storybook characters who formed the \merry crew of our \Wonderland,"<br />

having earlier attended Mike and Vectoria's wedding ceremony in a sun-dappled<br />

alpine meadow, are beginning to slowly drift away from the banquet table to<br />

dance beneath the setting sun. Eavesdropping on their conversation, it appears<br />

that everyone was pleased with the entire menu, the appetizers, the entrees,<br />

and the desserts. The crew also chatted about the new friends that they have<br />

made. They hope that you the reader, having shared some of their experiences<br />

and recipes, will include yourself in this group.<br />

Now your CAS chefs must reluctantly end this tale of Wonderland and<br />

close this gourmet's guide to some of the advanced mathematical models of<br />

science. Our guiding principle throughout both volumes of <strong>Computer</strong> <strong>Algebra</strong><br />

<strong>Recipes</strong> has been to introduce the reader to what we believe is an important<br />

educational and scienti¯c innovation, the use of a computer algebra system<br />

to learn and explore science. This belief is supported by the fact that over<br />

a million physicists, engineers, mathematicians, chemists, and other groups of<br />

scientists, are already using one CAS or another to solve technological and<br />

scienti¯c problems of interest to them. If you have successfully applied the<br />

computer algebra recipes in our menu to the text problems in both volumes,<br />

youshouldbeingoodshapetojointheirranks.<br />

Richard and George, Your CAS chefs


Bibliography<br />

[AGS84] R. H. Abraham, J. P. Gollub, and H. L. Swinney. Testing nonlinear<br />

dynamics. Physica D, 11:252, 1984.<br />

[AJMS81] R. M. Anderson, H. C. Jackson, R. M. May, and A. M. Smith.<br />

Population dynamics of fox rabies in Europe. Nature, 289:765, 1981.<br />

[AS72] M. Abramowitz and I. A. Stegun. Handbook of Mathematical Functions<br />

with Formulas, Graphs, and Mathematical Tables. National<br />

Bureau of Standards, Washington, DC, 1972.<br />

[Bac69] J. Backus. The Acoustical Foundations of Music. W.W.Norton,<br />

New York, 1969.<br />

[Bel58] B. P. Belousov. Oscillation reaction and its mechanism. In Collection<br />

of Abstracts on Radiation Medicine. Medgiz, Moscow, 1958.<br />

[BEMS71] A. Barone, F. Esposito, C. J. Magee, and A. C. Scott. Theory<br />

and applications of the sine{gordon equation. Riv. Nuovo Cimento,<br />

1:227, 1971.<br />

[BEP71] I.P.Batra,R.H.Enns,andD.Pohl.Stimulatedthermalscattering<br />

of light. Physica Status Solidi, 48:11, 1971.<br />

[BF89] R. L. Burden and J. D. Faires. Numerical Analysis, 4th ed. PWS{<br />

KENT, Boston, MA, 1989.<br />

[Boa83] M. L. Boas. Mathematical Methods in the Physical Sciences, 2nd<br />

ed. John Wiley, New York, 1983.<br />

[Bri74] E. O. Brigham. The Fast Fourier Transform. Prentice-Hall Inc.,<br />

New Jersey, 1974.<br />

[Cha39] S. Chandrasekhar. An Introduction to the Study of Stellar Structure.<br />

Dover Reprint, Chicago, 1939.<br />

[Cho64] W. F. Chow. Principles of Tunnel Diode Circuits. Wiley, New York,<br />

1964.<br />

355


356 BIBLIOGRAPHY<br />

[Dav62] H. T. Davis. Introduction to Nonlinear Di®erential and Integral<br />

Equations. Dover, New York, 1962.<br />

[EJMR81] R. H. Enns, B. L. Jones, R. M. Miura, and S. S. Rangnekar. Nonlinear<br />

Phenomena in Physics and Biology. Plenum Press, New York,<br />

1981.<br />

[EK88] L. Edelstein-Keshet. Mathematical Models in Biology. BirkhÄauser,<br />

Boston, MA, 1988.<br />

[EM00] R. H. Enns and G. C. McGuire. Nonlinear Physics with Maple for<br />

Scientists and Engineers, 2nd ed. BirkhÄauser, Boston, MA, 2000.<br />

[EM01] R. H. Enns and G. M. McGuire. <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong>: A<br />

Gourmet's Guide to the Mathematical Models of Science. Springer-<br />

Verlag, New York, 2001.<br />

[EM06] R.H.EnnsandG.M.McGuire.<strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong>: An Introductory<br />

Guide to the Mathematical Models of Science. Springer-<br />

Verlag, New York, 2006.<br />

[Enn05] R. H. Enns. <strong>Computer</strong> <strong>Algebra</strong> <strong>Recipes</strong> for Mathematical Physics.<br />

BirkhÄauser, Boston, MA, 2005.<br />

[ER79] R. H. Enns and S. S. Rangnekar. The 3-wave interaction in nonlinear<br />

optics. Phys. Status Solidi, 94:9, 1979.<br />

[Erl83] H. Erlichson. Maximum projectile range with drag and lift, with<br />

particular application to golf. Amer.J.Phys., 51:357, 1983.<br />

[FC99] G. R. Fowles and G. L Cassiday. Analytic Mechanics. Saunders<br />

College, Orlando, FL, 1999.<br />

[FKN72] R. J. Field, E. K}orÄos, and R. M. Noyes. Oscillations in chemical<br />

systems, Part 2. Thorough analysis of temporal oscillations in<br />

the bromate{cerium{malonic acid system. Journal of the American<br />

Chemical Society, 94:8649, 1972.<br />

[FN74] R. J. Field and R. M. Noyes. Oscillations in chemical systems, IV.<br />

Limit cycle behavior in a model of a real chemical reaction. Journal<br />

of Chemical Physics, 60:1877, 1974.<br />

[Gau69] G.F.Gause.The Struggle for Existence. Hafner, New York, 1969.<br />

[Gri95] D.J.Gri±ths.Introduction to Quantum Mechanics. Prentice Hall,<br />

Englewood Cli®s, N. J., 1995.<br />

[Has90] A. Hasegawa. Optical Solitons in Fibers. Springer-Verlag, New<br />

York, 1990.


BIBLIOGRAPHY 357<br />

[Hay64] C. Hayashi. Nonlinear Oscillations in Physical Systems. McGraw<br />

Hill, New York, 1964.<br />

[HH64] M. Henon and C. Heiles. The applicability of the third integral of<br />

motion: some numerical experiments. Astrophys. J., 69:73, 1964.<br />

[Hil94] R. C. Hilborn. Chaos and Nonlinear Dynamics. OxfordUniversity<br />

Press, Oxford, 1994.<br />

[Jac90] E.A.Jackson. Perspectives of Nonlinear Dynamics, Vol. 1 and 2.<br />

Cambridge University Press, Cambridge, 1990.<br />

[Kau76] D. J. Kaup. The three-wave interaction. Studies Appl. Math., 55:9,<br />

1976.<br />

[KRB79] D. J. Kaup, A. Rieman, and A. Bers. Space{time evolution of<br />

nonlinear three-wave interactions. Rev. Modern Phys., 51:275, 1979.<br />

[LH91] W. Lauterborn and J. Holzfuss. Acoustic chaos. International Journal<br />

of Bifurcation and Chaos, 1:13, 1991.<br />

[Lor63] E. N. Lorenz. Deterministic nonperiodic °ow. J. Atmospheric Sci.,<br />

20:130, 1963.<br />

[MA88] J. J. McPhee and G. C. Andrews. E®ect of sidespin and wind on<br />

projectile trajectory, with particular application to golf. Amer. J.<br />

Phys., 56:933, 1988.<br />

[Map05] Maplesoft. Maple 10 User Manual. Waterloo Maple, Waterloo,<br />

Canada, 2005.<br />

[May80] R. M. May. Nonlinear phenomena in ecology and epidemiology.<br />

Ann. New York Acad. Sci., 357:267, 1980.<br />

[MGH + 05] M. B. Monagan, K. O. Geddes, K. M. Heal, G. Labahn, S. M.<br />

Vorkoetter, J. McCarron, and P. DeMarco. Maple 10 Introductory<br />

(Advanced) Programming Guide. Waterloo Maple, Waterloo,<br />

Canada, 2005.<br />

[MH91] W. M. MacDonald and S. Hanzely. The physics of the drive in golf.<br />

Amer.J.Phys., 59:213, 1991.<br />

[Mor48] P. M. Morse. Vibration and Sound. McGraw-Hill, New York, 1948.<br />

[Mur89] J.D.Murray. Mathematical Biology. Springer-Verlag, New York,<br />

1989.<br />

[MW71] J. Mathews and R. L. Walker. Mathematical Methods of Physics,<br />

2nd ed. Addison-Wesley, New York, 1971.


358 BIBLIOGRAPHY<br />

[Nyq28] H. Nyquist. Certain topics in telegraph transmission theory. Trans.<br />

AIEE, 47:617, 1928.<br />

[Oha85] H. C. Ohanian. Physics. W.W.Norton,NewYork,1985.<br />

[PFTV89] W. H. Press, B. P. Flannery, S. A. Teukolsky, and W. T. Vetterling.<br />

Numerical <strong>Recipes</strong>. Cambridge University Press, Cambridge, 1989.<br />

[PLA92] M. Peastrel, R. Lynch, and A. Armenti. Terminal velocity of a<br />

shuttlecock in vertical fall. In Jr. Angelo Armenti, editor, The<br />

Physics of Sports. American Institute of Physics, New York, 1992.<br />

[RÄ76] O.E.RÄossler. An equation for continous chaos. Phys. Lett. A,<br />

57:397, 1976.<br />

[Rap60] A. Rapoport. Fights, Games and Debates. University of Michigan<br />

Press, 1960.<br />

[RE76] S. S. Rangnekar and R. H. Enns. Numerical solution of the transient<br />

gain equations for stimulated backward scattering in absorbing<br />

°uids. Canadian Journal of Physics, 54:1564, 1976.<br />

[RSS83] J.C.Roux,R.H.Simoyi,andH.L.Swinney. Observationofa<br />

strange attractor. Physica D, 8:257,1983.<br />

[Rus44] J. S. Russell. Report on waves. British Assoc. Adv. Sci., 14th<br />

Meeting, 1844.<br />

[SCM73] A.C.Scott,F.Y.F.Chu,andD.W.McLaughlin.Thesoliton:A<br />

new concept in applied science. Proc. IEEE, 61:1443, 1973.<br />

[Sco87] D.E.Scott. An Introduction to Circuit Analysis. McGraw-Hill,<br />

New York, 1987.<br />

[Sel68] E. E. Sel'kov. Self-oscillations in glycolysis. European J. Biochem.,<br />

4:79, 1968.<br />

[Sha49] C. E. Shannon. Communication in the presence of noise. Proc. IRE,<br />

37:10, 1949.<br />

[SK86] W. M. Scha®er and M. Kot. Di®erential systems in ecology and<br />

epidemiology. In Chaos. Princeton University Press, Princeton, N.<br />

J., 1986.<br />

[SK89] R. D. Strum and D. E. Kirk. Discrete Systems and Digital Signal<br />

Processing. Addison-Wesley, Reading, MA, 1989.<br />

[Str88] S. H. Strogatz. Love a®airs and di®erential equations. Math. Mag.,<br />

61:35, 1988.


BIBLIOGRAPHY 359<br />

[Str94] S. H. Strogatz. Nonlinear Dynamics and Chaos. Addison-Wesley,<br />

Reading, MA, 1994.<br />

[SWS82] R. H. Simoyi, A. Wolf, and H. L. Swinney. One-dimensional dynamics<br />

in a multi-component chemical reaction. Physical Review<br />

Letters, 49:245, 1982.<br />

[Tys76] J. J. Tyson. The Belousov{Zhabotinskii reaction. In Lecture Notes<br />

in Biomathematics, Vol. 10. Springer-Verlag, New York, 1976.<br />

[ZK65] N. J. Zabusky and M. D. Kruskal. Interaction of \solitons" in a<br />

collisionless plasma and the recurrence of initial states. Phys. Rev.<br />

Lett., 15:240, 1965.


Index<br />

acoustical waveguide, 261<br />

adenosine diphosphate, 98<br />

aliasing, 330<br />

Andromeda Strain, 152<br />

anharmonic force, 34<br />

annulus, 231<br />

aorta, 110<br />

arms race, 105<br />

arrhythmias, 28<br />

arrow notation, 52<br />

arrowheads<br />

full, 19<br />

half, 19<br />

attractor<br />

butter°y, 83, 351<br />

chaotic, 345<br />

Lorenz, 83<br />

normal, 45<br />

RÄossler, 353<br />

reconstruction, 345<br />

strange, 44<br />

autonomous system, 32<br />

baleen whale, 95<br />

band matrix, 276<br />

bandwidth limited, 330<br />

bandwidth theorem, 273<br />

basketball, falling, 152<br />

Belousov{Zhabotinski, 40<br />

Bernoulli equation, 155<br />

Bernoulli, Daniel, 138<br />

Bessel functions, 132, 254<br />

Bessel recurrence relations, 136<br />

Bessel zeros, 133<br />

bifurcation, 337<br />

diagram, 337<br />

361<br />

pitchfork, 340<br />

tangent, 340<br />

Bloch wall, 292<br />

blood pressure<br />

diastolic, 110<br />

systolic, 110<br />

blue whale, 160<br />

boundary condition, 228<br />

bounded orbit, 325<br />

Boussinesq's equation, 296, 303<br />

brachistochrone, 190<br />

bungee cord, 138<br />

Burgers' equation, 296, 306<br />

butter°y reconstruction, 351<br />

butter°y, Lorenz's, 83<br />

candle °ame, 287<br />

capacitor, 29<br />

Casablanca, 211<br />

catenary, 194<br />

Cauchy{Riemann conditions, 220<br />

CDA, 274<br />

center, 17<br />

central di®erence approximation, 90<br />

chain reaction, 236<br />

Chandrasekhar, S., 95<br />

chaos, 33, 38, 336<br />

characteristic directions, 312<br />

chemical oscillator, 40<br />

chemical reaction, 100<br />

empirical rule, 41<br />

Oregonator, 41<br />

classic Maple, 1<br />

coalescence of roots, 68<br />

column vector, 85, 277<br />

competition


362 INDEX<br />

for food, 27<br />

warring armies, 57<br />

complex conjugate, 217<br />

complex function, 220<br />

compliance, 110<br />

computational mesh, 274<br />

computer algebra system(CAS), 1<br />

concentration, 41<br />

conditional statement, 80<br />

conducting plates, 223<br />

contour plot, 221<br />

control parameter, 34, 320<br />

control rods, 236<br />

convolution theorem, 269<br />

coordinates<br />

bipolar, 235<br />

bispherical, 235<br />

Cartesian, 243<br />

cylindrical, 235, 258<br />

elliptic, 235<br />

paraboloidal, 235<br />

polar, 232, 254<br />

prolate spheroidal, 235<br />

spherical, 235<br />

CPU time, 91<br />

Crichton,Michael,152<br />

critical condition, 236<br />

critical damping, 26, 27<br />

critical mass, 239<br />

cross product, 176<br />

cross section, variable, 269<br />

crossed ¯elds, 179<br />

crystal dislocation, 288<br />

cubic map, 341<br />

cuto® frequency, 261<br />

cylinder<br />

quarter, 240<br />

temperature distribution, 241<br />

da Vinci, Leonardo, 58<br />

damping<br />

critical, 27<br />

negative, 29<br />

over, 26<br />

under, 26<br />

Dawkins, Richard, 349<br />

de Vries, Gustav, 301<br />

degenerate root, 69<br />

degrees of freedom, 324<br />

derivative<br />

BDA, 90<br />

CDA, 90<br />

FDA, 90<br />

derivative boundary condition, 259<br />

determinant, 85<br />

deterministic chaos, 28<br />

di®erence approximation<br />

backward, 90<br />

central, 90<br />

forward, 90<br />

fourth derivative, 91<br />

di®usion coe±cient, 209, 224<br />

dimensional analysis, 208<br />

dimensionless variable, 60<br />

Dirac delta function, 264<br />

dispersion, 273, 288<br />

dispersion relation, 301<br />

do loop, 24<br />

dot notation, 13<br />

dot product, 180<br />

double-well potential, 34<br />

drag force<br />

Newton, 161<br />

Stokes, 24<br />

driving period, 320<br />

drumhead, 254<br />

drumhead, circular, 257<br />

Du±ng's equation, 34, 149, 320<br />

hard spring, 33<br />

inverted, 33<br />

nonharmonic, 33<br />

soft spring, 33<br />

E. coli, 153<br />

eardrum, 168<br />

eardrum equation, 66<br />

Eddington, Arthur, 150<br />

Edelstein-Keshet, Leah, 152<br />

eigenfrequency, 257<br />

eigenfunction, 130


INDEX 363<br />

eigenvalue, 130<br />

Eiram Eiruc, 74<br />

electric ¯eld lines, 222<br />

elliptic cosine function, 174<br />

elliptic integral, 8<br />

complete, 172<br />

incomplete, 172<br />

elliptic sine function, 173<br />

EllipticF, 8<br />

EllipticK, 172<br />

energy transmission, 215<br />

entrainment, 28<br />

enzyme reaction, 161<br />

epidemiology, 66<br />

equipotentials, 222<br />

Erehwon, 187<br />

erf, 263<br />

erfc, 268<br />

Erlenmeyer °ask, 152<br />

error function, 263<br />

error function, complementary, 268<br />

Euler algorithm, 92<br />

Euler's constant, 34<br />

Euler{Lagrange equation, 185<br />

Euler{Mascheroni constant, 133<br />

explicit scheme, 91, 275, 279<br />

falling raindrop, 120<br />

fast Fourier transform (FFT), 331<br />

FDA, 274<br />

Fermat's principle, 190<br />

ferromagnet, 288<br />

ferromagnetic domain, 292<br />

Fick's law, 266, 267<br />

Field, R. J., 40<br />

¯nite di®erence approximation, 89<br />

¯sh harvesting, 100<br />

¯xed edges, 251<br />

¯xed point, 15<br />

°u epidemic, 160<br />

°uid °ow, 223<br />

focal/spiral point, 16<br />

forced sti® ODE, 106<br />

forward Euler method, 94<br />

forward-di®erence approximation, 274<br />

Fourier cosine transform, 264<br />

Fourier series, 212<br />

Fourier sine transform, 261<br />

Fourier transform, 271, 329<br />

inverse, 271<br />

fractal dimension, 45<br />

free body diagram, 181<br />

free edges, 253<br />

Frobenius series, 133<br />

fructose-6-phosphate, 98<br />

fudge factor, 44<br />

functional operator, 52<br />

fur catches, 57<br />

gamma function, 145<br />

Gause, 155<br />

generalized momentum, 324<br />

geodesic, 191<br />

glycolysis, 97<br />

gnus and sung, 73<br />

golf, 179<br />

Gompertz's law, 160<br />

gradient, 222<br />

great circle, 191<br />

Greg Arious Nerd, 115<br />

Henon{Heiles Hamiltonian, 324<br />

Henon{Heiles potential, 324<br />

Hamilton's equations, 324<br />

Hamiltonian chaos, 324<br />

hard spring, 66, 174<br />

harmonics, 335<br />

harvesting, 114<br />

heat capacity, 209<br />

heat di®usion, 208<br />

Helmholtz, 168<br />

Hermite functions, 145<br />

higher-order ¯xed point, 49<br />

hole in one, 184<br />

Hooke's law, 24<br />

Hudson's Bay Company, 57<br />

human °y, 195<br />

Humpty Dumpty map, 346<br />

hyperlink, 8<br />

implicit scheme, 91


364 INDEX<br />

implicit solution, 169<br />

incompressible °uid, 241<br />

inductor, 30<br />

infectious disease, 66<br />

in¯nite domain, 261<br />

initial conditions, 20<br />

initialization, 310<br />

Internet, 260<br />

inverted spring, 34<br />

ion acoustic soliton, 303<br />

iron core inductor, 57<br />

iron sphere temperature, 245<br />

irreversible reaction, 150<br />

isoperimetric problem, 191<br />

Jacobi elliptic function, 173<br />

Josephson junction, 288<br />

K}orÄos, E., 40<br />

KAM torus, 327<br />

Kaup, David, 299<br />

KdV equation, 287, 300<br />

KdV soliton collision, 308<br />

Kerr medium, 288<br />

kink, 304<br />

Kirchho®'s current rule, 29<br />

Kirchho®'s potential rule, 57<br />

Klein{Gordon equation, 278<br />

Korteweg, Diederik, 301<br />

Kruskal, Martin, 309<br />

Lagrange's equations, 202<br />

laminar °ow, 161<br />

Laplace transform, 121, 267<br />

Laplace's equation, 220<br />

Laplace, Pierre-Simon, 121<br />

laser beam competition, 159<br />

laser beams, 318<br />

learning curve, 114<br />

Legendre polynomials, 243<br />

limit cycle, 28<br />

logistic equation, 154<br />

logistic map, 338<br />

Lorentz force, 175<br />

Lorenz equations, 83<br />

Lorenz's butter°y, 351<br />

love a®air, 18<br />

low-pass ¯lter, 330<br />

Lyapunov exponent, 342, 343<br />

Lyapunov, Aleksandr M., 342<br />

magnetic bottle, 175<br />

magnetic spin, 288, 292<br />

magnetohydrodynamic waves, 288<br />

Malthus's equation, 153<br />

Malthus's law, 152<br />

Malthus, Thomas, 153<br />

map<br />

cubic, 341<br />

Humpty Dumpty, 346<br />

logistic, 338<br />

one-dimensional, 346<br />

quartic, 341, 345<br />

sine,341,345<br />

tent, 341, 345<br />

Maple<br />

active derivative, 19<br />

addition, 4<br />

aliasing symbols, 122<br />

animation, 7<br />

arrow operator, 52<br />

assignment operator, 4<br />

assume vs. assuming, 112<br />

automatic substitution, 19<br />

classic interface, 1<br />

clearing internal memory, 4<br />

colon, 4<br />

command information, 110<br />

comment, 5<br />

conditional statement, 80<br />

constrained scaling, 6<br />

copying examples, 8<br />

CPU time, 91<br />

curly brackets, 15<br />

default accuracy, 4<br />

di®erential operator, 26<br />

digits control, 103<br />

ditto operator, 30<br />

division, 4<br />

functional operator, 52


INDEX 365<br />

Help, Full Text Search, 8<br />

Help, Topic Search, 8<br />

Help, using, 8<br />

inert derivative, 19<br />

inserting comments, 5<br />

library packages, 7<br />

list, 6<br />

list of lists, 6<br />

list procedure, 127<br />

menu index ¯le, 2<br />

multiplication, 4<br />

placeholder, 280<br />

plot options, 6<br />

powers, 4<br />

prime notation, 126<br />

procedure, 52<br />

prompt symbol, 4<br />

recipe, 1<br />

rotating viewing box, 31<br />

semicolon, 4<br />

set, 15<br />

square brackets, 6<br />

standard interface, 1<br />

string, 6<br />

superimposing ¯gures, 53<br />

suppressing output, 4<br />

text on plot, 42<br />

toolbar, 6<br />

type match, 226<br />

unassignment, 54<br />

unprotect Maple symbol, 59<br />

user manuals, 1<br />

variable change, 29<br />

warnings, 7<br />

worksheet, 2<br />

Maple Command<br />

^, 4<br />

¡ >, 52<br />

*, 4<br />

+, 4<br />

-, 4<br />

., 180<br />

/, 4<br />

::, 226<br />

:=, 4<br />

:, 4<br />

;, 4<br />

>, 277<br />

< >,176<br />

?coords, 231<br />

?inifcns, 132<br />

?, 8<br />

Array, 333<br />

BandMatrix, 276,280<br />

BesselJZeros, 133, 255<br />

BesselJ, 132<br />

BesselY, 133, 237<br />

CrossProduct, 176<br />

DEplot3d, 31,45<br />

DEplot, 24<br />

DEtools[expsols], 267<br />

Determinant, 85<br />

Diff, 19<br />

Digits, 98<br />

Dirac, 264<br />

DotProduct, 180<br />

D, 26<br />

Eigenvalues, 85<br />

EulerLagrange, 188<br />

FourierTransform, 333<br />

Gamma, 59<br />

GenerateMatrix, 85<br />

Gradient, 222<br />

HINT, 225<br />

Hamilton eqs, 325<br />

INTEGRATE, 225<br />

Int, 34<br />

I, 216<br />

Laplacian('cylindrical'), 258<br />

Laplacian, 232<br />

LegendreP, 134<br />

LegendreQ, 134,242<br />

Omega, 203<br />

Order, 128<br />

Phi, 5<br />

Pi, 209<br />

Sum, 226<br />

SurfaceOfRevolution, 189<br />

Tangent, 167<br />

Theta, 60, 203


366 INDEX<br />

#, 5<br />

&x, 176<br />

EnvAllSolutions, 61<br />

EnvLegendreCut, 135<br />

abs, 128<br />

add, 213<br />

algsubs, 203<br />

alias, 123<br />

allvalues, 79, 325<br />

alpha, 34<br />

animate, 7<br />

array, 36<br />

arrows=MEDIUM, 19<br />

arrows=THICK, 177<br />

assign, 22,52<br />

assume=real, 305<br />

assume, 172<br />

assuming, 116<br />

axes=frame, 42<br />

axes=none, 140<br />

axes=normal, 72<br />

background, 7<br />

bernoullisol, 155<br />

beta, 24, 26, 34<br />

build, 225<br />

coeff, 233<br />

collect, 30,68<br />

color, 20<br />

combine(trig), 217<br />

combine, 197<br />

conjugate, 217<br />

contourplot, 221, 324<br />

contours, 221<br />

convert(exp), 272<br />

convert(polynom), 89<br />

convert(radians), 182<br />

convert(sincos), 163<br />

convert(units), 5,200<br />

coordplot3d, 235<br />

coordplot, 232<br />

cosh, 177, 228<br />

cos, 4<br />

dchange, 30, 60, 290<br />

declare, 126<br />

dfieldplot, 19<br />

diff, 18,59<br />

dirgrid, 19<br />

display, 42<br />

dsolve('series'), 128<br />

dsolve(classical[foreuler]),<br />

94<br />

dsolve(classical[rk4]), 99<br />

dsolve(method=laplace), 122<br />

dsolve(numeric), 42,127<br />

dsolve, 22, 27<br />

epsilon, 30<br />

evalc, 124<br />

evalf, 5<br />

eval, 5<br />

expand, 30, 54, 59, 60<br />

exp, 19<br />

factor, 30, 238<br />

fieldplot, 177<br />

firint, 116<br />

for...while...do, 24<br />

fouriercos, 264<br />

fouriersin, 262<br />

fourier, 271<br />

frames, 7<br />

fsolve, 75, 199<br />

gamma, 34, 59<br />

generate ic, 326<br />

grid, 75<br />

has, 225<br />

if...elif... end if, 80<br />

implicitplot, 75, 234<br />

infinity, 152<br />

infolevel[dsolve], 110<br />

insequence=true, 167<br />

integer, 229<br />

interface(imaginaryunit), 66<br />

intfactor, 116<br />

int, 34<br />

invfourier, 272<br />

invlaplace, 121,268<br />

isolate, 203<br />

iterations, 327<br />

labelling=true, 232<br />

labels, 34<br />

lambda, 85


INDEX 367<br />

laplace, 121,267,268<br />

lhs, 22<br />

limit(right), 198<br />

limit, 152<br />

linecolor, 20<br />

linestyle=[DASH,SOLID], 69<br />

ln, 19<br />

maxfun=0, 320<br />

mu, 237<br />

nops, 78<br />

numer, 188<br />

numpoints, 42<br />

nu, 237<br />

odeadvisor, 115,131<br />

odeplot, 42,204<br />

omega, 24, 31, 34<br />

op, 140<br />

orientation, 31, 45<br />

output=plot, 167<br />

pdetest, 212,305<br />

pdsolve, 225<br />

phaseportrait, 20,35<br />

phi, 5<br />

piecewise, 111, 213<br />

plot3d, 229<br />

plots[display], 277<br />

plot, 6<br />

poincare, 326<br />

pointplot3d, 93, 178<br />

pointplot, 7,53<br />

polar, 232<br />

psi, 139<br />

rand( ), 350<br />

randomize( ), 349<br />

remove, 84,124<br />

restart, 4<br />

rho, 209<br />

rhs, 19, 22<br />

riccatisol, 162<br />

rotate, 140<br />

round, 151<br />

rtablesize=infinity, 276<br />

scaling=constrained, 6<br />

scene, 21, 31<br />

select, 124<br />

seq, 80<br />

series, 133<br />

shading=zhue, 45<br />

showtangent, 167<br />

sign, 167<br />

simplify(exp), 239<br />

simplify(power), 165<br />

simplify(symbolic), 225<br />

simplify(trig), 197<br />

simplify, 22,60<br />

sin, 4,19<br />

solve, 5,15<br />

spacecurve, 98, 104, 352<br />

sphereplot, 204<br />

sqrt, 8, 19, 59<br />

stepsize, 20<br />

style=line, 53<br />

style=patchcontour, 229<br />

style=patchnogrid, 240<br />

style=point, 62<br />

subs, 24,30,35<br />

sum, 226<br />

symbol=box, 53<br />

symbol=circle, 7,62<br />

symbol=cross, 93<br />

symbolsize, 7<br />

tau, 30,60<br />

taylor, 89, 168<br />

textplot3d, 42<br />

textplot, 53<br />

theta, 5,59<br />

thickness, 42<br />

tickmarks, 34<br />

time( ), 98, 276<br />

title, 42<br />

unapply, 151<br />

unassign, 54,63<br />

unprotect, 34, 59, 297<br />

with(DEtools), 18, 23, 51<br />

with(DiscreteTransforms), 332<br />

with(Linear<strong>Algebra</strong>), 83, 276<br />

with(PDEtools), 29, 59, 126<br />

with(Student[Calculus1]), 166<br />

with(VectorCalculus), 175<br />

with(inttrans), 121,262


368 INDEX<br />

with(plots), 7,59<br />

with(plottools, 138<br />

Mathieu equation, 143<br />

Mathieu functions, 142<br />

Mathieu, Emile, 142<br />

MathieuC, 143<br />

MathieuS, 143<br />

matrix, 85<br />

band, 276<br />

multiplication, 276<br />

square, 276<br />

tridiagonal, 276<br />

May, Robert, 149<br />

mean daily temperature, 209<br />

measles, 353<br />

membrane<br />

circular, 254<br />

free edges, 253<br />

rectangular, 251<br />

square, 253<br />

mesh<br />

diamond-shaped, 312<br />

point, 274<br />

rectangular, 275<br />

method of characteristics, 312<br />

Michaelis{Menton equation, 161<br />

microbiology, 152<br />

Mike, 23<br />

mirage, 190<br />

model<br />

KdV soliton, 300<br />

modi¯ed Euler algorithm, 96<br />

modi¯ed KdV equation, 303<br />

Mona Lisa, 58<br />

multiplication factor, 236<br />

musical notes, 257<br />

myxamatosis, 160<br />

National Bureau of Standards, 131<br />

negative damping, 29<br />

neutron density, 236<br />

neutron di®usion, 236<br />

Newton's drag law, 161<br />

Newton's second law, 59, 115<br />

nodal lines, 256<br />

nodal point, 16<br />

nonlinear diode, 159<br />

nonlinear drag, 164<br />

nonlinear rate equations, 41<br />

nonlinear SchrÄodinger equation, 287<br />

nonlinear spring, 72<br />

normal modes, 257, 259<br />

Noyes, R. M., 40<br />

nuclear explosion, 240<br />

nuclear ¯ssion, 236<br />

numerical instability, 96, 277<br />

numerical mesh, 274<br />

Nyquist frequency, 330<br />

Nyquist, H., 330<br />

ODE<br />

nth-order, 110<br />

Airy, 23<br />

analytic solution, 22<br />

arms race, 105<br />

autonomous, 13<br />

baleen whale, 95<br />

Bernoulli, 155<br />

Bertalan®y, 161<br />

Bessel, 131<br />

blood pressure model, 110<br />

blue whale, 160<br />

brachistochrone, 190<br />

bungee cord, 138<br />

catenary, 194<br />

chemical oscillator, 44<br />

chemical reaction, 100<br />

competing armies, 57<br />

con°uent hypergeometric, 23<br />

dimensionless, 30<br />

dot notation, 13<br />

Du±ng, 149, 320<br />

eardrum, 168<br />

Euler algorithm, 92<br />

Euler{Lagrange, 185<br />

falling basketball, 152<br />

falling raindrop, 120<br />

¯nite di®erence approximation,<br />

89<br />

¯rst integral, 116


INDEX 369<br />

¯sh harvesting, 100<br />

¯xed points, 14<br />

°u epidemic, 160<br />

forced sti®, 106<br />

fox rabies, 102<br />

Frobenius series, 132<br />

geodesic, 191<br />

glycolytic, 96<br />

gnus and sung, 74<br />

golf ball, 182<br />

Gompertz, 160<br />

growing pendulum, 141<br />

hard spring, 174<br />

Hermite, 23<br />

homogeneous, 110<br />

inhomogeneous, 110<br />

integrating factor, 115<br />

Lagrange, 202<br />

Laplace transform method, 121<br />

laser beam, 159<br />

learning curve, 114<br />

Legendre, 134<br />

light ray path, 191<br />

linear, 14, 110<br />

logistic, 154<br />

Lorenz, 83<br />

Malthus, 153<br />

Maple odeadvisor, 115<br />

Mathieu, 142<br />

Michaelis{Menton, 161<br />

modi¯ed Euler algorithm, 96<br />

nonautonomous, 13<br />

nonlinear, 14<br />

nonlinear diode, 159<br />

numerical instability, 96<br />

numerical solution, 42<br />

onset of bending, 141<br />

Oregonator, 40<br />

oscillating pivot, 206<br />

p-q diagram, 50<br />

parametric excitation, 206<br />

pendulum, 23<br />

phase-plane analysis, 47<br />

phase-plane portrait, 13<br />

piecewise, 111<br />

plotting numerical solution, 42<br />

population growth, 114<br />

prime notation, 13<br />

pursuit, 164<br />

RÄossler, 45, 88<br />

rabbits and foxes, 14, 51<br />

Rayleigh, 23<br />

Riccati, 162<br />

RK4 algorithm, 96<br />

rkf45 method, 42<br />

RL circuit, 114<br />

Romeo and Juliet, 18<br />

rotating circular loop, 206<br />

SchrÄodinger, 219<br />

second-order, 14, 118<br />

Sel'kov, 97<br />

semi-implicit algorithm, 102<br />

separable, 150<br />

series solution, 126<br />

simple harmonic oscillator, 14<br />

SIR model, 66<br />

soft spring, 23<br />

spherical pendulum, 203<br />

squid and herring, 82<br />

standard form, 14<br />

stationary points, 14<br />

steady-state solution, 124<br />

sti®, 105<br />

sti®ening spring, 141<br />

Sturm{Liouville, 130<br />

trajectory, 14<br />

transient solution, 124<br />

Van der Pol, 28<br />

Verhulst, 72<br />

white dwarf, 95<br />

yeast model, 154<br />

optical pulse, 288<br />

ordinary functions, 130<br />

ordinary point, 15, 47<br />

Oregonator, 40<br />

orthogonality, 136, 226<br />

oscillator<br />

forced glycolytic, 337<br />

glycolytic, 96<br />

tunnel diode, 28


370 INDEX<br />

overdamping, 26<br />

p-q diagram, 50<br />

pacemaker, 28<br />

Palace of the Governors, 207<br />

parametric excitation, 206<br />

parametric plot, 6<br />

Parseval's theorem, 329<br />

PDE<br />

Boussinesq, 296<br />

Burgers, 296<br />

cosine{Gordon, 293<br />

embedded string, 278<br />

Hamilton, 324<br />

heat di®usion, 208<br />

interacting laser beam, 318<br />

KdV, 287<br />

Klein{Gordon,278,281<br />

Laplace, 220<br />

modi¯ed di®usion, 267<br />

modi¯ed KdV, 303<br />

nonlinear, 287<br />

nonlinear di®usion, 296<br />

nonlinear Klein{Gordon, 281<br />

nonlinear SchrÄodinger, 287<br />

numerical Laplace, 284<br />

numerical simulation, 274<br />

Poisson, 282<br />

scalar Helmholtz, 257<br />

sine{Gordon, 287<br />

sound waves, 257<br />

three-wave, 296<br />

variable separation, 224<br />

vibrating bar, 270<br />

vibrating membrane, 251<br />

vibrating string, 248<br />

vibrating wire, 270<br />

wave, 212, 247<br />

general solution, 248<br />

pendulum, growing, 141<br />

pendulum, rotating, 205<br />

period doubling, 34, 38<br />

period eight, 39<br />

periodfour,38,321,336<br />

period one, 37<br />

period two, 38, 319, 335<br />

period-n response, 319<br />

periodic windows, 344<br />

phase plane, 14<br />

portrait, 14<br />

trajectory, 14<br />

phenomenological model, 51<br />

piano string, 250<br />

piecewise function, 111<br />

pitchfork bifurcation, 337<br />

plane wave, 215<br />

plate, semicircular, 240<br />

Poincare section, 319<br />

Poincare's theorem, 51<br />

point<br />

¯xed, 15<br />

focal/spiral, 16, 49<br />

higher-order ¯xed, 49<br />

nodal, 16, 49<br />

ordinary, 15, 47<br />

saddle, 16, 17, 50<br />

saddle-vortex, 71<br />

simple stationary, 15, 48<br />

stable equilibrium, 16<br />

stable focal, 17<br />

stable nodal, 17, 49<br />

stationary or ¯xed, 47<br />

unstable focal, 17<br />

unstable nodal, 17<br />

vortex, 16, 17, 67<br />

Poisson's equation, 282<br />

polar coordinates, 231<br />

polynomial force law, 67<br />

population growth, 153<br />

potential<br />

alternating surface, 235<br />

split, 245<br />

power spectrum, 329<br />

chaotic, 336<br />

predator{prey interaction, 51<br />

prime notation, 13<br />

pulsating sphere, 210<br />

pursuit problem, 164<br />

quantum tunneling, 219


INDEX 371<br />

quartic map, 345<br />

Queen Dido, 191<br />

RÄossler system, 88<br />

radian, 59<br />

radiation, 312<br />

radioactive contamination, 266<br />

Rainbow County, 51<br />

random time series, 350<br />

random-number generator, 349<br />

random-number seed, 349<br />

rectangular barrier, 219<br />

recurrence formula, 136<br />

re°ection coe±cient, 215<br />

resistor, 29<br />

Riccati equation, 162<br />

rigid boundary, 241<br />

rk4 method, 97<br />

rkf45 algorithm, 42<br />

RL circuit, 114<br />

Rocky Mountain, 184<br />

Romeo and Juliet, 18<br />

rotational symmetry, 242<br />

round-o® error, 95<br />

route to chaos, 34<br />

Russell, John Scott, 300<br />

Saccharomyces cerevisiae, 155<br />

saddle point, 16, 17, 35<br />

saddle{vortex point, 71<br />

Sagan, Carl, 343<br />

sampling frequency, 330, 333, 334<br />

sampling theorem, 330<br />

saturable refractive index, 296<br />

saturation, 155<br />

scalar Helmholtz equation, 257<br />

Schizosaccharomyces kephir, 155<br />

SchrÄodinger equation, 219<br />

Sel'kov model, 97<br />

semi-implicit method, 102<br />

semi-in¯nite domain, 261<br />

separable ODE, 151<br />

separation constant, 228<br />

separation of variables, 224<br />

separatrix, 17, 289<br />

Shannon, C. E., 330<br />

SHE, 257<br />

shear force, 270<br />

SHO, 16<br />

shock wave, 301<br />

sifting property, 264<br />

signal processing, 330<br />

simple ¯xed point<br />

condition for, 48<br />

simple harmonic oscillator, 14<br />

simple pendulum, 58<br />

simple stationary point, 15, 48<br />

sine map, 341, 345<br />

sine{Gordon breather, 306<br />

sine{Gordon equation, 287<br />

single-valued, 259<br />

SIR model, 66<br />

snowshoe hare, 160<br />

solitary wave, 287<br />

antikink, 289<br />

black, 289<br />

bright, 289<br />

kink, 289<br />

nontopological, 289<br />

three-wave, 296<br />

topological, 289<br />

soliton, 287<br />

black, 296<br />

bright, 295<br />

ion acoustic, 303<br />

stationary, 295<br />

sound speed, 257<br />

special functions, 130<br />

speci¯c heat, 208<br />

squid and herring, 81<br />

stability, collisonal, 287<br />

stable focal point, 17<br />

stable limit cycle, 29<br />

stable nodal point, 17<br />

static potential, 231<br />

stationary point, 15<br />

stationary points<br />

classi¯cation of, 49<br />

steady state, 124, 284<br />

sti® ODE, 105


372 INDEX<br />

sti®ness,248,270<br />

Stokes's drag law, 118<br />

storybook character, 2<br />

strange attractor, 44, 319<br />

streamlines, 223<br />

string<br />

plucked, 214<br />

struck, 215<br />

Strogatz, Steven, 18<br />

supercritical condition, 236<br />

superposition<br />

linear, 238<br />

surface of revolution, 189<br />

systemic resistance, 111<br />

tangent ¯eld, 14<br />

Tappert, Fred, 307<br />

Taylor expansion, 48, 89<br />

Taylor{Couette °ow, 353<br />

tent map, 341, 345<br />

terminal velocity, 120<br />

thermal conductivity, 208<br />

thermonuclear fusion, 175<br />

third harmonic, 333<br />

three-wave problem, 296<br />

Toda Hamiltonian, 329<br />

trading records, 57<br />

transcendental equation, 5<br />

transcendental function, 61<br />

transform<br />

discrete Fourier, 331<br />

discrete inverse Fourier, 331<br />

Fourier, 271<br />

Fourier cosine, 264<br />

Fourier sine, 261<br />

inverse Fourier, 271<br />

Laplace, 267<br />

transient, 124<br />

transmission coe±cient, 215<br />

transverse velocity, 249<br />

tridiagonal matrix, 276<br />

tunnel diode, 28<br />

turbulence, 161<br />

turning point, 171<br />

two-soliton solution, 307<br />

tympanic membrane, 168<br />

ultrasonic cavitation, 353<br />

uncertainty principle, 273<br />

underdamping, 26<br />

unstable focal point, 17<br />

unstable nodal point, 17<br />

Van der Pol equation, 29<br />

Van der Pol, Balthasar, 28<br />

variable endpoint, 198<br />

variable transformation, 290<br />

variational calculus, 185<br />

vector<br />

column, 277<br />

Vectoria, 23<br />

velocity potential, 241<br />

Verhulst, 154<br />

Verhulst equations, 72<br />

vibrating cylinder, 261<br />

vibrating wire, 270<br />

von Bertalan®y equation, 161<br />

vortex point, 16, 17, 35, 51, 67<br />

wave equation, 212<br />

wave number, 215<br />

waves<br />

elastic, 247<br />

electromagnetic, 247<br />

longitudinal dispersive, 288<br />

magnetohydrodynamic, 288<br />

membrane, 247<br />

pressure, 288<br />

shallow water, 288<br />

sound, 247<br />

string, 247<br />

tidal, 247<br />

weather forecasting, 83<br />

white dwarf stars, 95<br />

Whittaker functions, 145<br />

Woods, Tiger, 183<br />

yeast, 152<br />

Zabusky, Norman, 309<br />

Zabusky{Kruskal algorithm, 309

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!