Table Of Content(cid:2)
Fundamentals of Numerical Mathematics
for Physicists and Engineers
(cid:2) (cid:2)
(cid:2)
(cid:2)
Fundamentals of Numerical
Mathematics for Physicists and
Engineers
Alvaro Meseguer
Department of Physics
(cid:2) Universitat Polit`ecnica de Catalunya--UPC BarcelonaTech (cid:2)
(cid:2)
(cid:2)
Thiseditionfirstpublished2020
(cid:2)c 2020JohnWiley&Sons,Inc.Allrightsreserved.
Allrightsreserved.Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,or
transmitted,inanyformorbyanymeans,electronic,mechanical,photocopying,recordingor
otherwise,exceptaspermittedbylaw.Adviceonhowtoobtainpermissiontoreusematerialfrom
thistitleisavailableathttp://www.wiley.com/go/permissions.
TherightofAlvaroMeseguertobeidentifiedastheauthorofthisworkhasbeenassertedin
accordancewithlaw.
RegisteredOffice
JohnWiley&Sons,Inc.,111RiverStreet,Hoboken,NJ07030,USA
EditorialOffice
111RiverStreet,Hoboken,NJ07030,USA
Fordetailsofourglobaleditorialoffices,customerservices,andmoreinformationaboutWiley
productsvisitusatwww.wiley.com.
Wileyalsopublishesitsbooksinavarietyofelectronicformatsandbyprint-on-demand.Some
contentthatappearsinstandardprintversionsofthisbookmaynotbeavailableinotherformats.
LimitofLiability/DisclaimerofWarranty
Whilethepublisherandauthorshaveusedtheirbesteffortsinpreparingthiswork,theymakeno
representationsorwarrantieswithrespecttotheaccuracyorcompletenessofthecontentsofthis
workandspecificallydisclaimallwarranties,includingwithoutlimitationanyimpliedwarranties
ofmerchantabilityorfitnessforaparticularpurpose.Nowarrantymaybecreatedorextendedby
salesrepresentatives,writtensalesmaterialsorpromotionalstatementsforthiswork.Thefact
thatanorganization,website,orproductisreferredtointhisworkasacitationand/orpotential
sourceoffurtherinformationdoesnotmeanthatthepublisherandauthorsendorsethe
(cid:2) informationorservicestheorganization,website,orproductmayprovideorrecommendationsit (cid:2)
maymake.Thisworkissoldwiththeunderstandingthatthepublisherisnotengagedin
renderingprofessionalservices.Theadviceandstrategiescontainedhereinmaynotbesuitablefor
yoursituation.Youshouldconsultwithaspecialistwhereappropriate.Further,readersshouldbe
awarethatwebsiteslistedinthisworkmayhavechangedordisappearedbetweenwhenthiswork
waswrittenandwhenitisread.Neitherthepublishernorauthorsshallbeliableforanylossof
profitoranyothercommercialdamages,includingbutnotlimitedtospecial,incidental,
consequential,orotherdamages.
LibraryofCongressCataloging-in-PublicationData
Names:Meseguer,Alvaro(AlvaroMeseguer),author.
Title:Fundamentalsofnumericalmathematicsforphysicistsandengineers/
AlvaroMeseguer.
Description:Hoboken,NJ:Wiley,2020.|Includesbibliographical
referencesandindex.
Identifiers:LCCN2019057703(print)|LCCN2019057704(ebook)|ISBN
9781119425670(hardback)|ISBN9781119425717(adobepdf)|ISBN
9781119425755(epub)
Subjects:LCSH:Numericalanalysis.|Mathematicalphysics.|Engineering
mathematics.
Classification:LCCQA297.M4572020(print)|LCCQA297(ebook)|DDC
518–dc23
LCrecordavailableathttps://lccn.loc.gov/2019057703
LCebookrecordavailableathttps://lccn.loc.gov/2019057704
CoverDesign:Wiley
CoverImage:CourtesyofAlvaroMeseguer,(background)(cid:2)c HNK/Shutterstock
Setin9.5/12.5ptCMR10bySPiGlobal,Chennai,India
PrintedintheUnitedStatesofAmerica
10 9 8 7 6 5 4 3 2 1
(cid:2)
(cid:2)
v
Contents
About the Author ix
Preface xi
Acknowledgments xv
Part I 1
1 Solution Methods for Scalar Nonlinear Equations 3
(cid:2) (cid:2)
1.1 Nonlinear Equations in Physics 3
1.2 Approximate Roots: Tolerance 5
1.2.1 The Bisection Method 6
1.3 Newton’s Method 10
1.4 Order of a Root-Finding Method 13
1.5 Chord and Secant Methods 16
1.6 Conditioning 18
1.7 Local and Global Convergence 20
Problems and Exercises 24
2 Polynomial Interpolation 29
2.1 Function Approximation 29
2.2 Polynomial Interpolation 30
2.3 Lagrange’s Interpolation 33
2.3.1 Equispaced Grids 37
2.4 Barycentric Interpolation 39
2.5 Convergence of the Interpolation Method 43
2.5.1 Runge’s Counterexample 46
2.6 Conditioning of an Interpolation 49
2.7 Chebyshev’s Interpolation 54
Problems and Exercises 60
(cid:2)
(cid:2)
vi Contents
3 Numerical Differentiation 63
3.1 Introduction 63
3.2 Differentiation Matrices 66
3.3 Local Equispaced Differentiation 72
3.4 Accuracy of Finite Differences 75
3.5 Chebyshev Differentiation 80
Problems and Exercises 84
4 Numerical Integration 87
4.1 Introduction 87
4.2 Interpolatory Quadratures 88
4.2.1 Newton–Cotes Quadratures 92
4.2.2 Composite Quadrature Rules 95
4.3 Accuracy of Quadrature Formulas 98
4.4 Clenshaw–Curtis Quadrature 104
4.5 Integration of Periodic Functions 112
4.6 Improper Integrals 115
4.6.1 Improper Integrals of the First Kind 116
4.6.2 Improper Integrals of the Second Kind 119
Problems and Exercises 125
(cid:2) (cid:2)
Part II 129
5 Numerical Linear Algebra 131
5.1 Introduction 131
5.2 Direct Linear Solvers 132
5.2.1 Diagonal and Triangular Systems 133
5.2.2 The Gaussian Elimination Method 135
5.3 LU Factorization of a Matrix 140
5.3.1 Solving Systems with LU 145
5.3.2 Accuracy of LU 147
5.4 LU with Partial Pivoting 150
5.5 The Least Squares Problem 160
5.5.1 QR Factorization 162
5.5.2 Linear Data Fitting 173
5.6 Matrix Norms and Conditioning 178
5.7 Gram–Schmidt Orthonormalization 183
5.7.1 Instability of CGS: Reorthogonalization 187
5.8 Matrix-Free Krylov Solvers 193
Problems and Exercises 204
(cid:2)
(cid:2)
Contents vii
6 Systems of Nonlinear Equations 209
6.1 Newton’s Method for Nonlinear Systems 210
6.2 Nonlinear Systems with Parameters 220
6.3 Numerical Continuation (Homotopy) 224
Problems and Exercises 232
7 Numerical Fourier Analysis 235
7.1 The Discrete Fourier Transform 235
7.1.1 Time–Frequency Windows 243
7.1.2 Aliasing 246
7.2 Fourier Differentiation 251
Problems and Exercises 258
8 Ordinary Differential Equations 261
8.1 Boundary Value Problems 262
8.1.1 Bounded Domains 262
8.1.2 Periodic Domains 275
8.1.3 Unbounded Domains 277
8.2 The Initial Value Problem 279
8.2.1 Runge–Kutta One-Step Formulas 281
(cid:2) (cid:2)
8.2.2 Linear Multistep Formulas 287
8.2.3 Convergence of Time-Steppers 297
8.2.4 A-Stability 301
8.2.5 A-Stability in Nonlinear Systems: Stiffness 315
Problems and Exercises 330
Solutions to Problems and Exercises 335
Glossary of Mathematical Symbols 367
Bibliography 369
Index 373
(cid:2)
(cid:2)
ix
About the Author
AlvaroMeseguer,PhD,isAssociateProfessorattheDepartmentofPhysicsat
Polytechnic University of Catalonia (UPC BarcelonaTech), Barcelona, Spain,
where he teaches Numerical Methods, Fluid Dynamics and Mathematical
PhysicstoadvancedundergraduatesinEngineeringPhysicsandMathematics.
He has published more than 30 articles in peer-reviewed journals within the
fields of computational fluid dynamics, and nonlinear physics.
(cid:2) (cid:2)
(cid:2)
(cid:2)
xi
Preface
Much of the material in this book is derived from lecture notes for two
courses on numerical methods taught over many years to undergraduate
students in Engineering Physics at the Universitat Polit`ecnica de Catalunya
(UPC) BarcelonaTech. Its volume is scaled to a one-year course, that is, a
two-semester course. Accordingly, the book has two parts. Part I is addressed
to first or second year undergraduate students who have a solid foundation in
differential and integral calculus in one real variable (including Taylor series,
O(h) notation, and improper integrals), along with elementary linear algebra
(cid:2) (cid:2)
(including polynomials and systems of linear equations). Part II is addressed
to slightly more advanced undergraduate or first-year graduate students with
a broader mathematical background, including multivariate calculus, ordinary
differential equations, functions of a complex variable, and Fourier series. In
both cases, it is assumed that the students are familiar with basic Matlab
commands and functions.
The book has been written thinking not only of the student but also of
the instructor (or instructors) that is supposed to teach the material follow-
ing an academic calendar. Each chapter contains mathematical topics to be
addressed in the lectures, along with Matlab codes and computer hands-on
practicals. These practicals are problem-solving tutorials where the students,
alwayssupervisedandguidedbyaninstructor,useMatlabonalocalcomputer
tosolveagivenexercisethatisfocusedonthetopicpreviouslyseeninthelec-
tures. From my point of view, teaching numerical methods should encompass
notonlytheoreticallectures,addressingtheunderlyingmathematicsonablack-
board, but also practical computations, where the student learns the actual
implementation of those mathematical concepts. There are certain aspects of
numericalmathematics,suchasconditioning ororder of convergence,thatcan
onlybeproperlyillustratedbyexperimentationonacomputer.Thesehands-on
practicals may also help the instructor to efficiently assess the performance of
a student. This can be easily carried out by using Matlab’s publish function,
(cid:2)
(cid:2)
xii Preface
forexample.Theendofeachchapteralsoincludesashortlistofproblemsand
exercisesoftheoretical(labeledwithanA)and/orcomputational(labeledwith
an N) nature. The solutions to many of the exercises (and practicals) can be
found atthe end ofthe book. Finally, eachchapter includes aComplementary
Reading section, where the student may find suitable bibliography to broaden
his or her knowledge on different aspects of numerical mathematics. Comple-
mentary lists of exercises can also be found in many of these recommended
references.
This book is mainly written for mathematically inclined scientists and engi-
neers, although applied mathematicians may also find many of the topics
addressed in this book interesting. My intention is not simply to give a set
of recipes for solving problems, but rather to present the underlying mathe-
matical concepts involved in every numerical method. Throughout the eight
chapters, I have tried to write a readable book, always looking for an equilib-
riumbetweenpracticalityandmathematicalrigor.Clarityinpresentingmajor
points often requires the supression of minor ones. A trained mathematician
may find certain statements incomplete. In those passages where I think this
may be the case, I always refer the rigorous reader to suitable bibliography
where the key theorem and its corresponding proof can be found.
Whenever it has been possible, I have tried to illustrate how to apply cer-
(cid:2) (cid:2)
tainnumericalmethodologiestosolveproblemsarisinginthephysicalsciences
or in engineering. For example, Part I includes some practicals involving very
basicNewtonianmechanics.PartIIincludespracticalsandexamplesthatillus-
trate how to solve problems in electrical networks (Kirchhof’s laws), classical
thermodynamics (van der Waals equation of state), or quantum mechanics
(Schro¨dinger equation for univariate potentials). In all the previous examples,
the mathematical equations have already been derived, so that those readers
who are not necessarily familiar with any of those areas of physics should be
able to address the problem without any difficulty.
Many of the topics covered throughout the eight chapters are fairly stan-
dard and can easily be found in many other textbooks, although probably in
a different order. For example, Chapter 1 introduces topics such as nonlin-
ear scalar equations, root-finding method, convergence, or conditioning. This
chapter also shows how to measure in practice the order of convergence of a
root-findingmethod,andhowill-conditioningmayaffectthatorder.Chapter2
is devoted to one of the most important methods to approximate functions:
interpolation. I have addressed three different interpolatory formulas, namely,
monomial, Lagrange, and barycentric, the last one being the most computa-
tionallyefficient.IdevoteafewpagestointroducetheconceptofLebesguecon-
stant orconditionnumberofasetofinterpolatorynodes.Thischapterclearly
illustrates that global interpolation, performed on a suitable set of nodes,
(cid:2)