20
Gander 'Hfebicek Solving Problems in Scientific Computing Using Maple and MATLAB®

Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

Gander 'Hfebicek Solving Problems in Scientific Computing Using Maple and MATLAB®

Page 2: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

Springer-Verlag Ber l in Heidelberg G m b H

Page 3: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

Walter Gander • Jiri Hrebicek

Solving Problems in Scientific Computing Using Maple

and MÄTLAB*

Fourth, Expanded and Revised Edition 2004

With 161 Figures and 12 Tables

Springer

Page 4: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

Walter Gander

Institute for Computational Science

E T H Zentrum, HRS G 29

CH-8092 Zürich, Switzerland

e-mail: [email protected]

Jiff H f ebicek

Department of Information Technology

Faculty of Informatics

Masaryk University of Brno

Botanickä 68a

CZ-60200 Brno, Czech Republic

e-mail: [email protected]

Library of Congress Control Number:2004i04245

The cover picture shows a plane fitted by least squares to given points (see Chapter 6)

Mathematics Subject Classification (2000): 00A35,08-04,65Y99,68Q40 68N15

ISBN 978-3-540-21127-3 ISBN 978-3-642-18873-2 (eBook) DOI 10.1007/978-3-642-18873-2

This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilm or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer-Verlag. Violations are liable to prosecution under the German Copyright Law.

MATLAB* is a registered trademark of The MathWorks Inc. The trademark is being used with the written permission of The MathWorks Inc.

springeronline.com

© Springer-Verlag Berlin Heidelberg 1993,1995,1997,2004 Ursprünglich erschienen bei Springer-Verlag Berlin Heidelberg GmbH 2004 The use of general descriptive names, registered names, trademarks etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.

Typesetting: Camera-ready copy from the authors Printed on acid-free paper 46/3142db-5 4 3210

Page 5: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

Preface

Modern computing tools like MAPLE(a symbolic computation pack­age) and MATLAB®(a numeric and symbolic computation and visu­alization program) make it possible to use the techniques of scien­tific computing to solve realistic nontrivial problems in a classroomsetting. These problems have been traditionally avoided , since theamount of work required to obtain a solution exceeded the class­room time available and the capabilities of the students. Therefore,simplified and linearized models are often used. This situation haschanged, and students can be taught with real-life problems whichcan be solved by the powerful software tools available. This bookis a collection of interesting problems which illustrate some solu­tion techniques in Scientific Computing. The solution techniquefor each problem is discussed and demonstrated through the use ofeither MAPLE or MATLAB. The problems are presented in a waysuch that a reader can easily extend the techniques to even moredifficult problems.

This book is int ended for students of engineering and scient ificcomputing. It is not an introduction to MAPLE and MATLAB.Instead, it teaches problem solving techniques through the use ofexamples, which are difficult real-life problems. Please review theMAPLE and MATLAB documentation for questions on how to usethe software.

All figures in the book were created either by using graphic com­mands of MAPLE and MATLAB or by direct use of xfig on a SUNworkstation. Occasionally changes were made by Dr . S. Bartonin the postscript files to improve the visual quality of the figures.These changes include different font sizes, line types, line thick­nesses, as well as additional comments and labels.

This book was written as a collaboration between three insti­tutes:

• the Department of Th eoretical Physics and Astrophysics ofMasaryk University, Brno, Czech Republic ,

• the Institute of Physics of the University of Agriculture andForestry, Brno , Czech Republic, and

Page 6: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

vi

• the Institute of Scientific Computing ETH , Zurich, Switzer­land.

The authors are indebted to the Swiss National Science Founda­tion which stimulated this collaboration through a grant from the"Oststaaten-Soforthilfeprogramm" . An additional grant from theETH "Sonderprogramm Ostkontakte" and support from the Com­puter Science Department of ETH Zurich made it possible for Dr. S.Barton to spend a year in Zurich . He was the communication linkbetween the two groups of authors and without him , the book wouldnot have been produced on time. We would also like to thank Dr .L. Badoux, Austauschdienst ETH , and Prof. C.A. Zehnder, chair­man of the Computer Science Department, for their interest andsupport.

Making our Swiss- and Czech-English understandable and cor­rect was a major problem in producing this book. This was ac­complished through an internal refereeing and proofreading processwhich greatly improved the quality of all articles. We had greathelp from Dr. Kevin Gates, Martha Gonnet, Michael Oettli, Prof.S. Leon, Prof. T. Casavant and Prof. B. Gragg during this process .We thank them all for their efforts to improve our language.

Dr . U. von Matt wrote the 1}'IEX style file to generate the layoutof our book in order to meet the requirements of the publisher. Weare all very thankful for his excellent work.

D. Gruntz, our MAPLE expert, gave valuable comments to allthe authors and greatly improved the quality of the programs. Wewish to thank him for his assistance.

The programs were written using MAPLE V Release 2 and MAT­

LAB 4.1. For MAPLE output we used the ASCII interface insteadof the nicer XMAPLE environment. This way it was easier to in­corporate MAPLE output in the book . The programs are availablein machine readable form . We are thankful to The MathWorks forhelping us to distribute the software .

Zurich, September 13, 1993

Preface to the second edition

Walter Gander, Jiff Hrebfcek

The first edition of this book has been very well received by thecommunity, and this has made it necessary to write a second edi­tion within one year. We add ed the new chapters 20 and 21 andwe expanded chapters 15 and 17. Some typographical errors werecorrected, and we also rephrased some text . By doing so we hopeto have improved our English language.

Page 7: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

VII

All programs were adapted to the newest versions of the softwarei.e. to MAPLE V Release 3 and to MATLAB Version v4. In order tosimplify the production of the book we again chose the pretty printoutput mode for the MAPLE output.

We dedicate the second edition to our late colleague FraniisekKluaiia . We all mourn for our friend, a lovely, friendly, modestperson and a great scientist.

Druhe vydani je uenoudno panuitce naseho zestiuleho kolegy Fran­tiska Kluaiii . Vsichni uzpomituime na tuiseho draheho pfitele, mile­ho a skrommeho cloueka a velkeho uedce.

Zurich, October 7, 1994

Preface to the third edition

Walter Gander, Jiff Hrebicek

In the present edition the book has been enlarged by six new chap­ters (Chapters 22-27) . Some of the previous chapters were revised :a new way to solve a system of differential equations was added toChapter 1. Chapter 17 on free metal compression was completelyrewritten. With the new approach, the compression of more generalbodies can be simulated.

The index has been considerably enlarged and split into threeparts, two of them containing all MAPLE and MATLAB commandsused in this book . We are indebted to Rolf Strebel for this work.

All chapters have been adapted to the newest versions of MAPLE

(Version 5 Release 4) and MATLAB 5. The calculations for MAPLE

were done on Unix workstations by Standa Barton and Rolf Strebel,who also produced the worksheets. Notice that the order of theterms in sums and products and the order of the elements in setsis unspecified and may change from session to session. When theMAPLE commands are re-executed, one may get results in a differ­ent representation than those printed in the book. For example, thesolution of a set of equations may depend on different free parame­ters. Commands which depend on the order of previous results (likeaccesses to sets and expression sequences) may have to be adjustedaccordingly. Since we have re-executed the MAPLE examples withRelease 4, some statements have changed compared to the previouseditions of this book .

All MATLAB computations were performed on a PC , equippedwith an Intel Pentium Pro Processor running under Windows NT4.0 at 200 Mhz using MATLAB 5.0. We are indebted to LeonhardJaschke for taking care of these test runs. MATLAB 5 offers new M­files for the integration of differential equations. While in the older

Page 8: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

viii

versions one had to specify an interval for the indep endent variable,th ere are now new possibilities to stop the integration process. Wehave made use of this new feature and simplified our codes .

A criticism by some reviewers that th e ASCII output of MAPLE

does not look nice has been taken into considerat ion. We havetransformed all the formulas using the MAPLE latex-commandinto J5.TEX. We th ank Erwin Achermann who checked and adaptedthe layout .

The two syst ems MAPLE and MATLAB seem to come closerto each other. Th ere is th e Symbolic Math Toolbox for MATLAB

which can be used to call MAPLE from a MATLAB program . Also,there are plans that in the near future a similar mechanism will beavailable on th e other side. We have not made use of th e SymbolicMath Toolbox , mainly because we do want to use both systemsequivalently and complementarily.

The MATLAB and MAPLE programs (and worksheets) are avail­able via anonymous ftp from ftp. inf .ethz . ChI

We dedicate this edition to one of our co-authors-the one withthe highest seniority-Professor Heinz Schilt, the expert in Switz er­land for computing and constructing sun dials with typical Swissprecision .

Zurich, March 18, 1997 Walter Gander, Jiff Hfebfcek

Preface to the second printing of the third edition

After the third edit ion was sold out the authors decided to havea second printing of the third edition with updated programs. Allprograms have been adapted to the newest versions : MAPLE 7 andMATLAB Version 6.1.0.450 Release 12.1. The computations wereperformed by Stanislav Barton with th e help of Dominik Gruntzand Rolf Strebel on SUN workstations at ETH. Stanislav discovereda bug in th e fsolve-function of MAPLE 7. The following commandis necessary in order to overcome the bug

> ' f sol ve/ Eval At x ' := subs( subs=«x,y)->eval(y,x)),> eval('fsolve/EvalAtx'));

We th ank Maplesoft for providing this workaround to that problem(see Chapter 7). This saved us from having to add a home madezerofinder to solve th e equation in Section 7.4.4. Waterloo Maplehas assured us th at th is bug will be fixed in an upcoming release ofMAPLE.

1 VRL: ftp://ftp .inf . ethz . ch/pub/software/SolvingProblerns/ed3/

Page 9: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

ix

Stanislav Barton would like to thank Petr Byron, director ofHUMUSOFT, Prague (www.humusoft .cz) . for providing him free ac­cess to the newest release of MATLAB.

Zurich, September 3, 2001, Walter Gander, Jirf Hfebicek

Preface to the forth edition

This is now the forth edition and we are happy to celebrate the 10thanniversary of this book! It has been enlarged by four new chapters(Chapters 28-31). Some of the previous chapters were revised usingnew possibilities offered by MAPLE and MATLAB. We would liketo thank Stanislav Barton and Jan Pesl for testing and adapting allthe programs to the newest versions of the software: MAPLE 9 andMATLAB 6.5 Release 13. Stanislav Barton would like to thank PetrByron for again providing him free access to the newest release ofMATLAB. No bugs were found in the new versions - the functionfsolve of MAPLE has been fixed and makes no troubles anymorein Chapter 7.

We have decided to create a web page for the book. The addressis

www .SolvingProblems .inf .ethz .ch

All MAPLE and MATLAB programs are available through this webpage. The web has become a overwhelming source of informationfor each one of us. We felt that it would be useful to list someimportant and interesting web pages related to MAPLE and MAT­

LAB . This information can be found in the appendix. When westarted this book 10 years ago, there was not much similar materialaround. The world has definitely changed and one can find manyinteresting solved problems in scientific computing in cyber space .We are glad to have participated as pioneers in this development .

Zurich , December 17, 2003, Walter Gander, Jirf Hfebicek

Page 10: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

List of Authors

Stanislav Barton Department of Automobile Transportand Principles of Technology

Mendel Univ. of Agricult ure and Forestry BrnoZemedelska 1CZ-613 00 Brno , Czech [email protected]

Jaroslav Buchar Department of Automobile Transportand Principles of Technology

Mendel Univ. of Agricult ure and Forestry BrnoZernedelska 1CZ-613 00 Brno, Czech [email protected]

Ivan Daler AutoCont-CZKounicova 67aCZ-602 00 Brno , Czech Republicivan .daler@autocont .cz

Walter Gander Institu te of Computationa l ScienceETH ZurichCH-8092 Zurich, Switzerlandgander@inf .ethz .ch

Walter Gautschi Departm ent of Comp uter SciencesPurdue UniversityWest Lafayette, IN 47907-1398, [email protected]

Gaston Gonnet Institute of Computational ScienceETH ZurichCH-8092 Zurich, Switzerlandgonnet@inf .ethz .ch

Dominik Gruntz University of Applied Sciences AargauSteinackerstr. 5CH-5210 Brugg-Windisch, Switzerlandgruntz@fh-aargau .ch

Page 11: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

xii

Zdenek Hakl Department of Automobile Transportand Principles of Technology

Mendel Univ. of Agriculture and Forestry BrnoZemedelska 1CZ-613 00 Brno , Czech [email protected]

Jiirgen Halin Institute of Energy TechnologyETH ZurichCH-8092 Zurich, Switzerlandhalin@iet .mavt.ethz .ch

JiN Hiebicek Faculty of InformaticsMasaryk University BrnoBotanicka 68aCZ-602 00 Brno, Czech [email protected] .cz

Leonhard Jaschke Stampfenbachstrasse 67CH-8006 Zurich, [email protected]

Franiisek Klvaiia t

Urs Oswald Nordstrasse 292CH-8037 [email protected]

Urs von Matt ISE Integrated Systems Engineering Inc.III N. Market StreetSuit e 800San Jose , CA 95113, USAvonmatt@ise .ch

Michael H. Oettli Mathematik KollektivversicherungRentenanstaltjSwiss LifeGeneral Guisan-Quai 40CH-8022 Zurich, [email protected]

Jan Pesl Faculty of InformaticsMasaryk University BrnoBotanicka 68aCZ-602 00 Brno , Czech Republicxpesl@informatics .muni .cz

Page 12: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

Tomas Pitner

Heinz Schilt t

Rolf Stre bel

Jorg Waldvogel

Faculty of Informat icsMasaryk University BrnoBotanicka 68aCZ-602 00 Brno, Czech Republictomp@informatics .muni. cz

Schiitzenweg 3CH-7074 Malix, Switzerlandt wo. cent s@gmx. ch

Seminar of Applied Mat hematicsETH ZiirichCH-8092 Ziirich, Switzerlandjoerg .waldvogel@sam .math .ethz .ch

xiii

Page 13: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

Contents

Chapter 1. The Tractrix and Similar Curves 11.1 Introduction . . .. . . 11.2 The Classical Tractrix . 11.3 The Child and the Toy . 31.4 The Jogger and the Dog 61.5 Showing the Motions with MATLAB . 121.6 Jogger with Constant Velocity . . . . 151.7 Using a Moving Coordinate System . 16

1.7.1 Transformation for Jogger/Dog 181.7.2 Transformation for Child/Toy 20

1.8 Examples 22References . . . . . . . . . . . . . . . . . . 25

Chapter 2. Trajectory of a Spinning Tennis Ball . 272.1 Introduction . . . . 272.2 MAPLE Solution 292.3 MATLAB Solution . . . . . . . . 322.4 Simpler Solution for MATLAB 5 35References . . . . . . . . . . . . . . . 37

Chapter 3. The Illumination Problem 393.1 Introduction. . .. . . . . . . .. . 393.2 Finding the Minimal Illumination Point on a Road 403.3 Varying h2 to Maximize the Illumination 423.4 Optimal Illumination 453.5 Conclusion. 49References . . . . . . . . . 49

Chapter 4. Orbits in the Planar Three-Body Problem 514.1 Introduction . . . . .. . . .. ... . . . . . . 514.2 Equations of Motion in Physical Coordinates. 524.3 Global Regularization . . . . . . . . . . 564.4 Th e Pythagorean Three-Body Problem 624.5 Conclusions 70References . . . . . . . . . . . . . . . . . . . 72

Page 14: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

xvi CONTENTS

Chapter 5. The Internal Field in Semiconductors .. 735.1 Introduction ... . .. . . .. . . .. . . . . . . . . 735.2 Solving a Nonlinear Poisson Equation Using MAPLE 745.3 MATLAB Solut ion . 75References . . . . . . . . . . . . . . . . . . . 79

Chapter 6. Some Least Squares Problems 816.1 Introduction . . . . . . .. . . . . . . . 816.2 Fitting Lines, Rectangles and Squares in the Plane 816.3 Fitting Hyperpl anes. 93References . . . . . . . . . . . . . . . . . . . . . . 99

Chapter 7. The Generalized Billiard Problem 1017.1 Introduction . . .. . . .. .. . . . 1017.2 Th e Generalized Reflect ion Method 101

7.2.1 Line and Curve Reflection 1027.2.2 Math ematical Descrip tion 1037.2.3 M APLE Solution . . . .. 104

7.3 Th e Shortest Tra jectory Method . 1057.3.1 MAPLE Solut ion 106

7.4 Examples 1067.4.1 The Circular Billia rd Table 1067.4.2 The Elliptical Billiard Table 1107.4.3 The Snail Billiard Table 1147.4.4 The Star Billiard Table . 114

7.5 Conclusions 117References . . . . . . . . . 119

Chapter 8. Mirror Curves 1218.1 The Interesting Wast e 1218.2 Th e Mirror Curves Creat ed by MAPLE 1218.3 The Inverse Problem . . . . . . . . . . 123

8.3.1 Outflanking Manoeuvre ... . 1238.3.2 Geometrical Const ruction of a Point on th e

Pa ttern Curve. . 1248.3.3 MAPLE Solution 1258.3.4 Analytic Solution 126

8.4 Exa mples 1268.4.1 The Circle as th e Mirror Curve 1268.4.2 Th e Line as the Mirror Curve 128

8.5 Conclusions 129References . . . . . . . . . . . . . . . . . . 132

Page 15: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

CONTENTS xvii

Chapter 9. Smoothing Filters . 1339.1 Introduction ... .. . . 1339.2 Savitzky-Golay Filter . . 133

9.2.1 Filter Coefficients 1349.2.2 Results . . .. .. 137

9.3 Least Squares Filter .. 1389.3.1 Lagrange Equations . 1399.3.2 Zero Finder . . . . . 1419.3.3 Evaluation of th e Secular Function 1429.3.4 MEX-Fil es . 1449.3.5 Results . 148

References . . . . . . 150

Chapter 10. The Radar Problem . 15310.1 Introduction . . . . . . . . . . 15310.2 Converting Degrees into Radians 15410.3 Transformation into Geocentric Coordinates 15510.4 The Transformations 15810.5 Final Algorithm . . 16010.6 Practical Example 160References . . . . . . . . 162

Chapter 11. Conformal Mapping of a Circle 16311.1 Introduction . . . 16311.2 Problem Outline . 16311.3 MAPLE Solution . 16411.4 MATLAB Solution . 168References . . . . . . . . 170

Chapter 12. The Spinning Top 17112.1 Introduction . . . . . . . . 17112.2 Formulation and Basic Analysis of the Solut ion 17312.3 The Numerical Solution 178References . . . . . . . . . . . . . . . . . 180

Chapter 13. The Calibration Problem 18113.1 Introduction . . . . . . . . . . . . . 18113.2 The Physical Model Description . . 18113.3 Approximation by Splitting the Solution 18413.4 Conclusions 189References . . . . . . . . . . . . . . 190

Chapter 14. Heat Flow Problems 19114.1 Introduction. . . . . . . . . . 19114.2 Heat Flow through a Spherical Wall. 191

14.2.1 A Steady Stat e Heat Flow Model 192

Page 16: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

XVlll CONTENTS

14.2.2 Fourier Model for Steady State 19314.2.3 MAPLE Plots . . . . . . . . 194

14.3 Non Stationary Heat Flow throughan Agriculture Field 19514.3.1 MAPLE Plots 199

References. . . . . . . . . 199

Chapter 15. Modeling Penetration Phenomena 20115.1 Introduction . . . . . . . . . . . . . . . . . 20115.2 Short description of the penetration theory 20115.3 The Tate-Alekseevskii model. . 203

15.3.1 Special case Rt = Y; . . . . 20515.3.2 Special case PP = Pt = P .. 205

15.4 The eroding rod pene tration model 20715.5 Numerical Example. 21315.6 Conclusions 216References. . . . . . . . . 216

Chapter 16. Heat Capacity of Systemof Bose Particles . 219

16.1 Introduction. . . 21916.2 MAPLE Solution 221References . . . . . . . 225

Chapter 17. Free Metal Compression . 22717.1 Introduction . . . . . . . . . . . . . 22717.2 The Base Expansion .. . . . . . . 22917.3 Base Described by One and Several Functions 23117.4 The Lateral Side Distortion . . . . . . . . . . 23317.5 Non-centered Bases . . . . . . . . . . . . . . . 23717.6 Three Dimensional Graphical Representation

of the Distorted Body 24017.6.1 Centered base . . . . . . . . . . 24017.6.2 Non-centered, Segmented Base . 24417.6.3 Convex Polygon Base . 246

17.7 Three Dimensional Animation 24717.8 Limitations and Conclusions 248References . . . . . . . . . . . . . 250

Chapter 18. Gauss Quadrature . 25118.1 Introduction . . . . . . . 25118.2 Orthogonal Polynomials 25218.3 Quadrature Rule .. . . 26618.4 Gauss Quadrature Rule. 26718.5 Gauss-Radau Quadrature Rule 268

Page 17: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

CONTENTS xix

18.6 Gauss-Lobatto Quadrature Rule . 27118.7 Weight s . . . . . 27418.8 Quadrature Error 275References . . . . . . . 278

Chapter 19. Symbolic Computationof Explicit Runge-Kutta Formulas 281

19.1 Introduction . . . . . . . . . . . . . . . . . . . 28119.2 Derivation of the Equations for the Parameters 28319.3 Solving the Syst em of Equations. 285

19.3.1 Grabner Bases . . . 28719.3.2 Resultants . . . . . 290

19.4 The Compl ete Algorithm . 29219.4.1 Example 1: 29219.4.2 Example 2: 293

19.5 Conclusions 296References . . . . . . . . 297

Chapter 20. Transient Response of aTwo-Phase Half-Wave Rectifier 299

20.1 Introduction . . . . . . . . . . . . . . . . . 29920.2 Problem Outline 29920.3 Difficulties in Applying Conventional Codes

and Software Packages . . . . 30220.4 Solution by Means of MAPLE 304References . . . . . . . . . . . . . . 310

Chapter 21. Circuits in Power Electronics. 31121.1 Introduction . . . . . . . . . . . . . . 31121.2 Linear Differenti al Equations

with Piecewise Constant Coefficients 31321.3 Periodic Solutions . . . . . . 31621.4 A MATLAB Implementation 31721.5 Conclusions 322References . . . . . . . . . . . . . 322

Chapter 22 . Newton's and Kepler's laws . 32322.1 Introduction . . . . . . . . . 32322.2 Equilibrium of Two Forces . . . . . . . 32322.3 Equilibrium of Three Forces . . . . . . 32422.4 Equilibrium of Three Forces, Computed from

the Potential Energy . . . . . . . . . . . 32622.5 Gravitation of th e Massive Line Segment 328

22.5.1 Potential and Intensity . 32822.5.2 The Part icle Traj ectory 331

Page 18: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

xx

22.6 The Earth Satellite . . . . . . .22.7 Earth Satellite , Second Solution22.8 The Lost Screw22.9 ConclusionsReferences . . . . . .

CONTENTS

333334336337337

Chapter 23. Least Squares Fit of Point Clouds . 33923.1 Introduction . . . . . . . . . . . . . 33923.2 Computing the Translation . . . . . 33923.3 Computing the Orthogonal Matrix 34023.4 Solut ion of the Procrustes Problem 34123.5 Algorithm . . . . . . . . . . . . . . 34223.6 Decomposing the Orthogonal Matrix 34323.7 Numerical Examples . 345

23.7.1 First example . 34523.7.2 Second example 348

References . . . . . . . . . . 349

Chapter 24. Modeling Social Processes . 35124.1 Int roduct ion . . . . . . . . . . . . . . 35124.2 Modeling Population Migration . . . 351

24.2.1 Cyclic Migration without Regulation 35324.2.2 Cyclic Migration with Regulation 354

24.3 Modeling Strategic Investm ent . 356References . . . . . . . . . . . . . . . . . . . . 358

Chapter 25 . Contour Plots of Analytic Functions 35925.1 Introduction . . . . . . . . . . . . . . . . . 35925.2 Contour P lots by the contour Command . 35925.3 Differential Equations . . . . . . . 362

25.3.1 Contour Lines r = const . . . 36225.3.2 Contour Lines sp = const . . 364

25.4 The Contour Lines r = 1 of f = en 36625.5 The Contour Lines cp = const of f = en 370References . . . . . . . . . . . . . . . . . . . 371

Chapter 26. Non Linear Least Squares : Finding themost accurate lo cation of an aircraft 373

26.1 Introduction . . . . . . . . . . . . . . . 37326.2 Building the Least Squares Equations . 37426.3 Solving the Non-linear System . 37626.4 Confidence/Sensitivity Analysis . . . . 379

Page 19: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

CONTENTS XXI

Chapter 27. Computing Plane Sundials 38327.1 Introduction. . . . . . . . . 38327.2 Astronomical Fundamentals . . . 383

27.2.1 Coordinate Systems . . . . 38427.2.2 The Gnomonic Projection 386

27.3 Time Marks . . . . . . . 38827.3.1 Local Real Time . .. . . 38827.3.2 Mean Time . . . . . . . . 38927.3.3 Babylonic and Italic Hours . 394

27.4 Sundials on General Planes 39527.5 A Concluding Example . 396References . . . . . . . . . . . . . 398

Chapter 28. Agriculture Kinematics 39928.1 Introduction . . . . . . . . . . . . 39928.2 Modeling of the chain - Trajectory of the point G 40028.3 Trajectory of point H - The lead end . . . . . . . 40128.4 Computing and Plotting Trajectory, Velocity and

Acceleration of Scrapers . . . . . . . 40428.5 Plotting of the results 40528.6 Rail Described by an Implicit Function 40828.7 Hyperbola Rail (Implicit Function) . . 41028.8 Rail Describ ed by a Parametric Function 41528.9 Hyperbola Rail (Parametric Function) 41828.lOConclusions 420References . . . . . . . . . . . . . . 421

Chapter 29. The Catenary Curve 42329.1 The Catenary Function . 42329.2 Scaling of the Problem 42529.3 Eliminating Unknowns 42629.4 Solution . . . . . . . . 42729.5 Speed of Convergence . 429References . . . . . . . . . . 431

Chapter 30. Least Squares Fit with Piecewise Functions43330.1 Introduction. . . . . . . . . . . . . . . . 43330.2 The Constrained Least Squares Problem 43430.3 Gauss-Newton Solution . . . . . . . . 43530.4 Structure of th e Lineariz ed Problem . 43630.5 The Main Program 43830.6 Examples .. . 44130.7 Growth of Pigs 443References . . . . . . 449

Page 20: Gander 'Hfebicek Solving Problems in Scientific Computing ...3A978-3-642-18873-2%2F1.pdf · tion techniques in Scientific Computing. The solution technique for each problem is discussed

xxii CONTENTS

Chapter 31. Portfolio Problems - Solved Online 45131.1 The modified Markowitz model . . . . . 45131.2 Online solving . . . . . . . . . . . . . . . . . . . 453

31.2.1 Downloading the Recorded Data .. . . 45431.2.2 Computation of the Expected Returns and

Volatilities of the Stocks . . . . . . . . . . . 45531.2.3 Defining the Mathematical Model . . . . . . 45631.2.4 Solving the model with the Nonlinear Pro-

gramming package 457References . . . . . . . . . . . . . . . . . . . . . . . . . . 459

Appendix A. Shared knowledge of M aple and Matlab 461A.l Int roduct ion . . . . . . . . . . . . . 461A.2 Application Centers . . . . . . . . . 462

A.2.1 MAPLE App lications Cente r 462A.2.2 MAPLE Student Center . 462A.2.3 MATLAB Student Center 463A.2.4 MATLAB Facu lty Center 463A.2.5 M AT LAB Central . 463

A.3 Conclus ions 464

Index . . . . . . . . 465

Index of used MAPLE Commands . 471

Index of used MATLAB Commands 475