Numerical Methods 4th Edition George Lindfield download
Numerical Methods 4th Edition George Lindfield download
pdf download
https://ebookfinal.com/download/numerical-methods-4th-edition-
george-lindfield/
https://ebookfinal.com/download/numerical-methods-third-edition-using-
matlab-george-lindfield/
https://ebookfinal.com/download/numerical-methods-using-matlab-4th-
edition-john-h-mathews/
https://ebookfinal.com/download/numerical-methods-using-matlab-gupta/
https://ebookfinal.com/download/numerical-methods-1st-edition-s-r-k-
iyengar-r-k-jain/
Numerical methods of statistics 2ed Edition Monahan J.F.
https://ebookfinal.com/download/numerical-methods-of-statistics-2ed-
edition-monahan-j-f/
https://ebookfinal.com/download/operator-theory-and-numerical-
methods-1st-edition-hiroshi-fujita/
https://ebookfinal.com/download/numerical-methods-for-evolutionary-
differential-equations-uri-m-ascher/
https://ebookfinal.com/download/analytical-and-numerical-methods-for-
vibration-analyses-1st-edition-wu/
https://ebookfinal.com/download/numerical-calculation-of-lubrication-
methods-and-programs-1st-edition-ping-huang/
Numerical Methods 4th Edition George Lindfield Digital
Instant Download
Author(s): George Lindfield, John Penny
ISBN(s): 9780128122563, 0128122560
Edition: 4
File Details: PDF, 7.45 MB
Year: 2018
Language: english
Numerical Methods
Using M ATLAB®
Numerical Methods
Using M ATLAB®
Fourth Edition
George Lindfield
Aston University, School of Engineering and Applied Science,
Birmingham, England, United Kingdom
John Penny
Aston University, School of Engineering and Applied Science,
Birmingham, England, United Kingdom
Academic Press is an imprint of Elsevier
125 London Wall, London EC2Y 5AS, United Kingdom
525 B Street, Suite 1650, San Diego, CA 92101, United States
50 Hampshire Street, 5th Floor, Cambridge, MA 02139, United States
The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, United Kingdom
Copyright © 2019 Elsevier Inc. All rights reserved.
M ATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does not warrant the accuracy of the
text or exercises in this book. This book’s use or discussion of M ATLAB® software or related products does not constitute endorsement
or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the M ATLAB® software.
No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including
photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher. Details on
how to seek permission, further information about the Publisher’s permissions policies and our arrangements with organizations such as
the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions.
This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted
herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes
in research methods, professional practices, or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information,
methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety
and the safety of others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any injury and/or
damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods,
products, instructions, or ideas contained in the material herein.
ISBN: 978-0-12-812256-3
This book is for my wife Wendy, for her patience, support and
encouragement, and for our grown up children, Debra, Mark and Joanne.
Also to our cat Jeremy who provided me with company
whilst I worked on this book.
John Penny
List of Figures
Fig. 1.1 Superimposed graphs obtained using plot(x,y) and hold statements. 30
Fig. 1.2 Plot of y = sin(x 3 ) using 51 equispaced plotting points. 31
Fig. 1.3 Plot of y = sin(x 3 ) using the function fplot to choose plotting points adaptively. 31
Fig. 1.4 Function plotted over the range from −4 to 4. It has a maximum value of 4 × 106 . 32
Fig. 1.5 The same function as plotted in Fig. 1.4 but with a limit on the range of the y-axis. 32
Fig. 1.6 An example of the use of the subplot function. 33
Fig. 1.7 polar and compass plots showing the roots of x 5 − 1 = 0. 34
Fig. 1.8 Polar scatter plots. Left diagram with default size circle markers. Right diagram with larger
filled black circles. 35
Fig. 1.9 Polar scatter histogram. 35
Fig. 1.10 Three-dimensional surface using default view. 37
Fig. 1.11 Three-dimensional contour plot. 37
Fig. 1.12 Filled contour plot. 37
Fig. 1.13 Implicit quadrafolium and folium of Descartes. 38
Fig. 1.14 Plots illustrating aspects of handle graphics. 41
Fig. 1.15 Plot of functions shown in Fig. 1.14 illustrating further handle graphs features. 42
Fig. 1.16 Plot of cos(2x). The axes of the right-hand plot are enhanced using handle graphics. 43
Fig. 1.17 Plot of (ω2 + x)2 α cos(ω1 x). 44
Fig. 2.1 Electrical network. 74
Fig. 2.2 Three intersecting planes representing three equations in three variables. (A) Three plane
surfaces intersecting in a point. (B) Three plane surfaces intersecting in a line. (C) Three plane
surfaces, two of which do not intersect. (D) Three plane surfaces intersecting in three lines. 77
Fig. 2.3 Planes representing an under-determined system of equations. (A) Two plane surfaces
intersecting in a line. (B) Two plane surfaces which do not intersect. 80
Fig. 2.4 Planes representing an over-determined system of equations. (A) Four plane surfaces
intersecting in a point. (B) Four plane surfaces intersecting in a line. (C) Four plane surfaces not
intersecting at a single point. Point of intersection of (S1, S2, S3) and (S1, S2, S4) are visible.
(D) Four plane surfaces representing inconsistent equations. 81
Fig. 2.5 Plot of an inconsistent equation system (2.30). 110
Fig. 2.6 Plot of inconsistent equation system (2.30) showing the region of intersection of the equations,
where + indicates “best” solution. 112
Fig. 2.7 Effect of minimum degree ordering on LU decomposition. The spy function shows the matrix,
the ordered matrix, and LU decomposition with and without preordering. 125
Fig. 2.8 Mass-spring system with three degrees of freedom. 128
Fig. 2.9 Connections of different strengths between five pages of the internet. 150
Fig. 3.1 Solution of x = exp(−x/c). Results from the function fzero are indicated by o and those from
the Armstrong and Kulesza formula by +. 158
Fig. 3.2 Plot of the function f (x) = (x − 1)3 (x + 2)2 (x − 3). 159
Fig. 3.3 Plot of f (x) = exp(−x/10) sin(10x). 159
xiii
xiv List of Figures
Fig. 3.4 Iterates in the solution of (x − 1)(x − 2)(x − 3) = 0 from close but different starting points. 163
Fig. 3.5 Geometric interpretation of Newton’s method. 165
Fig. 3.6 Plot of x 3 − 10x 2 + 29x − 20 = 0 with the iterates of Newton’s method shown by o. 167
Fig. 3.7 Plot showing the complex roots of cos(x) − x = 0. 168
Fig. 3.8 Plot of the iterates for five complex initial approximations for the solution of cos(x) − x = 0
using Newton’s method. Each iterate is shown by ◦. 168
Fig. 3.9 The cursor is shown close to the position of the root. 172
Fig. 3.10 Plot of graph f (x) = sin(1/x). This plot is spurious in the range ±0.2. 172
Fig. 3.11 Plot of system (3.30). Intersections show roots. 182
Fig. 4.1 A log–log plot showing the error in a simple derivative approximation. 192
Fig. 4.2 Simpson’s rule, using a quadratic approximation over two intervals. 197
Fig. 4.3 Plots of functions defined by (4.41), (4.42), and (4.43). 221
Fig. 4.4 Function sin(1/x) in the range x = 2 × 10−4 to 2.05 × 10−4 . Nineteen cycles of the function
are displayed. 224
Fig. 4.5 Graph of z = y 2 sin x. 227
Fig. 5.1 Exact o and approximate + solution for dy/dt = −0.1(y − 10). 240
Fig. 5.2 Geometric interpretation of Euler’s method. 241
Fig. 5.3 Points from the Euler solution of dy/dt = y − 20 given that y = 100 when t = 0. Approximate
solutions for h = 0.2, 0.4, and 0.6 are plotted using o, +, and ∗ respectively. The exact solution
is given by the solid line. 242
Fig. 5.4 Absolute errors in the solution of dy/dt = y where y = 1 when t = 0, using Euler’s method
with h = 0.1. 244
Fig. 5.5 Relative errors in the solution of dy/dt = y where y = 1 when t = 0, using Euler’s method with
h = 0.1. 244
Fig. 5.6 Solution of dy/dt = y using Euler (∗) and trapezoidal method, o. Step h = 0.1 and y0 = 1 at
t = 0. 246
Fig. 5.7 Solution of dy/dt = −y. The ∗ represents Butcher’s method, + Merson’s method, and o the
classical method. 251
Fig. 5.8 Absolute error in solution of dy/dt = −2y using the Adams–Bashforth–Moulton method. The
solid line plots the errors with a step size of 0.5. The dot-dashed line plots the errors with step
size 0.7. 253
Fig. 5.9 Relative error in the solution of dy/dt = y where y = 1 when t = 0, using Hamming’s method
with a step size of 0.5. 255
Fig. 5.10 Solution of Zeeman’s model with p = 1 and accuracy 0.005. The solid line represents s and the
dashed line represents x. 261
Fig. 5.11 Solution of Zeeman’s model with p = 20 and accuracy 0.005. The solid line represents s and
the dashed line represents x. 261
Fig. 5.12 Sections of the cusp catastrophe curve in Zeeman’s model for p = 0 : 10 : 40. 262
Fig. 5.13 Variation in the population of lynxes (dashed line) and hares (solid line) against time, beginning
with 5000 hares and 100 lynxes. Accuracy 0.005. 263
Fig. 5.14 Graph showing the three coordinate responses of a mass-spring-damper system, shown by full
lines, when excited by a half sine pulse, shown by a dotted line. 270
Fig. 5.15 Plot showing the difference between the Newmark and 4th-order Runge–Kutta method
solutions for the three coordinates. 270
List of Figures xv
Fig. 5.16 Solution of Lorenz equations for r = 126.52, s = 10, and b = 8/3 using an accuracy of
0.000005 and terminating at t = 8. 272
Fig. 5.17 Solution of Lorenz equations where each variable is plotted against time. Conditions are the
same as those used to generate Fig. 5.16. Note the unpredictable nature of the solutions. 272
Fig. 5.18 Solution of Lorenz equations for r = 28, s = 10, and b = 8/3. Initial conditions x = [5 5 5]
shown by the full line, and x = [5.0091 4.9997 5.0060] shown by the dashed line. Note the
sudden divergence of the two solutions from each other and unpredictable nature of the
solutions. 273
Fig. 5.19 Solution of Lorenz equations for r = 28, s = 10, and b = 8/3. The full line shows the solution
using the default accuracy of the M ATLAB Runge–Kutta 4/5 function. The dashed line shows a
higher accuracy solution. Note the sudden divergence of the two solutions from each other and
unpredictable nature of the solutions. 273
Fig. 5.20 Case 1: The full line is the output from Duffing oscillator. ω = 100 rad/s (15.92 Hz). Zero initial
conditions. The dashed line is the input force, arbitrarily scaled in amplitude. 275
Fig. 5.21 Output from Duffing oscillator. ω = 120 rad/s. Full line gives output with zero initial conditions.
Dashed line give output with an initial displacement of 1 mm and an initial velocity of 1 m/s. 275
Fig. 5.22 Output from Duffing oscillator. ω = 120 rad/s. Solution with zero initial velocity and initial
displacements of 1, 1.001, and 1.002 mm. (Shown by full, dashed and dot-dashed lines
respectively.) 276
Fig. 5.23 Output from Duffing oscillator. Phase plane plot. ω = 120 rad/s. 276
Fig. 5.24 Poincaré map showing output from Duffing oscillator. ω = 120 rad/s. 277
Fig. 5.25 Output from Duffing oscillator showing where points from two solutions lie on a Poincaré map.
+ and o indicate points generated from two different initial conditions with ω = 120 rad/s. 277
Fig. 5.26 Plot of sigmoid function V = (1 + tanh u)/2. 278
Fig. 5.27 Neural network finds the binary equivalent of 5 using 3 neurons and an accuracy of 0.005. The
three curves show the convergence to the binary digits 1, 0, and 1. 280
Fig. 5.28 Relative error in the solution of dy/dt = y using Hermite’s method. Initial condition y = 1
when t = 0 and a step of 0.5. 284
Fig. 5.29 Model of a second-order differential equation, (5.62). 289
Fig. 5.30 Model of a second-order differential equation with Coulomb damping. 290
Fig. 5.31 A second-order system modeled by a transfer function. 290
Fig. 5.32 Model of Van der Pol’s equation. 291
Fig. 5.33 Model of a pair of simultaneous ordinary differential equations. 292
Fig. 5.34 Two simultaneous ordinary differential equations modeled in state space form. 293
Fig. 5.35 Model to determine the root of a cubic equation. 294
Fig. 5.36 The Simulink model of Fig. 5.35 replaced by a single mask. 295
Fig. 6.1 Second-order differential equations with one or two independent variables and their solutions. 302
Fig. 6.2 Solutions of x 2 (d 2 y/dx 2 ) − 6y = 0 with initial conditions y = 1 and dy/dx = s when x = 1,
for trial values of s. 303
Fig. 6.3 Equispaced nodal points. 305
Fig. 6.4 Grid mesh in rectangular coordinates. 306
Fig. 6.5 Node numbering used in the solution of (6.15). 307
Fig. 6.6 Finite difference solution of (1 + x 2 )(d 2 z/dx 2 ) + xdz/dx − z = x 2 . The ◦ indicates the finite
difference estimate; the continuous line is the exact solution. 310
xvi List of Figures
Fig. 8.2 Graph shows the relationship between a signal frequency and its component in the DFT. Thus,
for example, a signal frequency of twice Nyquist frequency, 2fmax , will give a component of
zero frequency in the DFT. 386
Fig. 8.3 Stages in the FFT algorithm. 390
Fig. 8.4 Plots of the real and imaginary part of the DFT. 392
Fig. 8.5 Frequency spectra. 393
Fig. 8.6 The top graph shows the data in the time domain and the bottom graph shows the corresponding
frequency spectrum. Note frequency components at 20, 50, and 70 Hz. 394
Fig. 8.7 The top graph shows the data in the time domain and the bottom graph shows the corresponding
frequency spectrum. Note that due to aliasing, frequency components are at 20, approximately
32.4 and 50 Hz. 395
Fig. 8.8 Spectrum of a sequence of data. 398
Fig. 8.9 Plot of data y against time, in seconds. The dashed line is the envelope derived from the
absolute value of the analytic data. 404
Fig. 8.10 A three-dimensional plot of the real and imaginary parts of the analytic data against time, in
seconds, showing an exponentially decaying spiral. 404
Fig. 8.11 Plot of frequency, in Hz, derived from the Hilbert transform, against time, in seconds. The
dashed line is the exact frequency. 404
Fig. 8.12 Fourier transform of the data, showing a spectrum between 0.5 Hz and 1.5 Hz, but the transform
gives no information about the variation of frequency with time. 404
Fig. 8.13 Original data is shown in the first plot in the left column. The remaining plots are of the first 5
intrinsic mode functions derived from it. 406
Fig. 8.14 Plot of the original data over the interval from t = 14.5 s to 16.5 s and data points reconstructed
from the first and second intrinsic mode functions indicated by ◦. Note the very close agreement. 406
Fig. 8.15 Plot showing the variation with time of the frequency components. The full lines are data from
the intrinsic mode functions. The dashed lines are the actual frequency components. 406
Fig. 8.16 Plot showing the variation with time of the amplitude of the frequency components. The full
lines are data from the intrinsic mode functions The dashed lines are the actual amplitudes of
the frequency components. 406
Fig. 8.17 Fourier transform of the data of Example 8.5. Note that this plot gives no information about the
variation of frequency with time. 407
Fig. 8.18 Walsh functions in the range t = 0 to 1, in ascending sequency order from WAL(0, t), with no
zero crossings to WAL(7, t) with seven zero crossings. 408
Fig. 8.19 Upper figure shows plot of time series. Lower figure shows power sequency spectrum of the
time series. 413
Fig. 8.20 Plots show the coefficients of CAL and SAL sequency spectrum for the time series shown in
Fig. 8.19. 413
Fig. 8.21 Diagram showing the partitioning of the time–frequency plane in the DWT. 417
Fig. 8.22 The Haar wavelets in ascending order from ψ(0, t) to ψ(7, t) over the range 0 < t < 1. 417
Fig. 8.23 Flow diagram for the fast Haar transform. Data carried by a dashed line entering a node is
negated and added to the data carried by the full line entering a node. 418
Fig. 8.24 Decomposition of x(t) into a constant term and 6 levels of Haar wavelets. 420
Fig. 8.25 Reconstruction of x(t) from its Haar wavelet components. Adding the constant term (Level −1)
and all the Haar wavelets from Level 0 to Level 5 together provides and exact reconstruction
x(t). 420
xviii List of Figures
Fig. 8.26 Contour plot of DWT of signal defined by (8.66), a composition of square waves. Responses
can be clearly seen at levels 5, 3, and 8. 422
Fig. 8.27 Contour plot of DWT of signal defined by (8.67), a composition of sine waves. Responses can
be observed at levels 5, 3, and 8. 423
Fig. 8.28 Contour plot of DWT of signal comprising bursts of exponentially decaying components,
(8.68). Response at levels 5 (at t = 3.2), 8 (at t = 6.4), 7 (at t = 11.2), 9 (at t = 17.6), and 3 (at
t = 19.2) can be observed. 424
Fig. 8.29 Plots of the wavelets db2, db4, db8, and db16. 424
Fig. 8.30 Plots of the real and imaginary parts of the Morlet wavelet. The mother wavelet in the middle of
the plot with a = 1 and b = 0, that is, the wavelet is neither dilated nor shifted. The wavelet at
the right of the plot is the wavelet shifted by b = 7 but it is not dilated. The wavelet at the left of
the plot is both shifted by b = −7 and dilated by a = 1/4. 426
Fig. 8.31 Ricker wavelet. 427
Fig. 8.32 Contour plot of the CWT of the signal defined by (8.72). Note that the frequency (Hz) = 2L
where L is the level. The burst of energy can be seen at levels −2, 0, 2, 4, and 5, thus
corresponding to frequencies of 0.25, 1, 4, 16, and 32 Hz, respectively. 428
Fig. 8.33 Contour plot of the CWT for Eq. (8.73). Note that the frequency (Hz) = 2L where L is the level.
It is seen that one component of the signal clearly increases smoothly over the sampling time. 428
Fig. 9.1 Graphical representation of an optimization problem. The dashed line represents the objective
function and the solid lines represent the constraints. 436
Fig. 9.2 Graph of a function with a minimum in the range [xa xb ]. 441
Fig. 9.3 A plot of the Bessel function of the second kind showing three minima. 443
Fig. 9.4 Three-dimensional plot of the Styblinski and Tang function. 448
Fig. 9.5 Contour plot of the Styblinski and Tang function, showing the location of four local minima.
The conjugate gradient algorithm has found the one in the lower left corner. The search path
taken by the algorithm is also shown. 448
Fig. 9.6 Graph showing the Styblinski–Tang function value for the final 40 iterations of the simulated
annealing algorithm. 461
Fig. 9.7 Contour plot of the Styblinski–Tang function. The final stages in the simulated annealing
process are shown. Note how these values are concentrated in the lower left corner, close to the
global minimum. 461
Fig. 9.8 Genetic algorithm. Each member of the population is represented by o. Successive generations
of the population concentrate toward the value 4 approximately. 464
Fig. 9.9 Contour plot of the Alpine 2 function showing the rapid convergence to the global maximum
using Differential Evolution. The bottom right contour plot is greatly expanded. 471
Fig. 9.10 Graph showing the minimization of the negative of the Alpine 2 function in 4 variables. The
plots show the maximum, mean, and minimum values of the population for 200 generations of
the DE algorithm. The continuous line denotes the mean values and the dashed lines denote the
maximum and minimum values. Convergence is to the exact solution, shown by the horizontal
line. 472
Fig. 9.11 Graph showing the objective function and constraints for Example 9.1. The four solutions are
also indicated. 476
Fig. 9.12 Graph of loge (x). 477
List of Figures xix
Fig. 10.1 Plot of the Fresnel sine integral in the range x = 1 to x = 3. 500
Fig. 10.2 Symbolic solution and numerical solution indicated by +. 513
Fig. 10.3 The Fourier transform of a cosine function. 518
Fig. 10.4 The Fourier transforms of a “top-hat” function. 518
About the Authors
George Lindfield is a former lecturer in the Department of Computer Science at Aston University and
is now retired. He taught courses in computer science and in optimization at bachelor- and master’s-
level. He has coauthored books on numerical methods and published many papers in various fields
including optimization. He is a member of the Institute of Mathematics, a Chartered Mathematician,
and a Fellow of the Royal Astronomical Society.
John Penny is an Emeritus Professor in the School of Engineering and Applied Science at Aston
University, Birmingham. England. He is a former head of the Mechanical Engineering Department. He
taught bachelor- and master’s-level students in structural and rotor dynamics and related topics such as
numerical analysis, instrumentation, and digital signal processing. His research interests were in topics
in dynamics such as damage detection in static and rotating structures. He has published over 40 peer
reviewed papers. He is a Fellow of the Institute of Mathematics and its Applications and is a coauthor
of four text books.
xxi
Preface
Our primary aim in this text is unchanged from previous editions; it is to introduce the reader to a wide
range of numerical algorithms, explain their fundamental principles and illustrate their application. The
algorithms are implemented in the software package M ATLAB which is constantly being enhanced and
provides a powerful tool to help with these studies.
Many important theoretical results are discussed but it is not intended to provide a detailed and
rigorous theoretical development in every area. Rather, we wish to show how numerical procedures
can be applied to solve problems from many fields of application, and that the numerical procedures
give the expected theoretical performance when used to solve specific problems.
When used with care M ATLAB provides a natural and succinct way of describing numerical algo-
rithms and a powerful means of experimenting with them. However, no tool, irrespective of its power,
should be used carelessly or uncritically.
This text allows the reader to study numerical methods by encouraging systematic experimentation
with some of the many fascinating problems of numerical analysis. Although M ATLAB provides many
useful functions this text also introduces the reader to numerous useful and important algorithms and
develops M ATLAB functions to implement them. The reader is encouraged to use these functions to
produce results in numerical and graphical form. M ATLAB provides powerful and varied graphics facil-
ities to give a clearer understanding of the nature of the results produced by the numerical procedures.
Particular examples are given throughout the text to illustrate how numerical methods are used to
study problems which include applications in the biosciences, chaos, neural networks, engineering,
and science.
It should be noted that the introduction to M ATLAB is relatively brief and is meant as an aid to the
reader. It can in no way be expected to replace the standard M ATLAB manual or text books devoted to
M ATLAB software. We provide a broad introduction to the topics, develop algorithms in the form of
M ATLAB functions and encourage the reader to experiment with these functions which have been kept
as simple as possible for reasons of clarity. These functions can be improved and we urge readers to
develop the ones that are of particular interest to them.
In addition to a general introduction to M ATLAB, the text covers the solution of linear equations and
eigenvalue problems; methods for solving non-linear equations; numerical integration and differenti-
ation; the solution of initial value and boundary value problems; curve fitting including splines, least
squares, and Fourier analysis, topics in optimization such as interior point methods, non-linear pro-
gramming, and heuristic algorithms and, finally, we show how symbolic computing can be integrated
with numeric algorithms. Specifically in this 4th edition, descriptions and examples of some functions
recently added to M ATLAB such as implicit functions and the Live Editor are given in Chapter 1.
Chapter 4 now includes a section on adaptive integration. Chapter 5 now includes a brief introduction
to Simulink; a toolbox which provides a visual interface to help the user simulating the process of
solving differential equations. The old Chapter 7 has been split into two chapters and we have added
the Kalman filter and principal component analysis, and the Hilbert, Walsh, and wavelet transforms.
The old Chapter 8 has had the emphasis on the genetic algorithm reduced and replaced by the more
modern and efficient differential evolution algorithm.
xxiii
xxiv Preface
The text contains many worked examples, practice problems (some of which are new to this edition)
and solutions and we hope we have provided an interesting range of problems.
For readers of this book, additional materials, including all .m file scripts and functions listed in
the text, are available on the book’s companion site: https://www.elsevier.com/books-and-journals/
book-companion/9780128122563. For instructors using this book as a text for their courses, a solutions
manual is available by registering at the textbook site: www.textbooks.elsevier.com.
The text is suitable for undergraduate and postgraduate students and for those working in industry
and education. We hope readers will share our enthusiasm for this area of study. For those who do
not currently have access to M ATLAB, this text still provides a general introduction to a wide range of
numerical algorithms and many useful and interesting examples and problems.
We would like to thank the many readers from all over the world for their helpful comments which
have enhanced this edition and we would be pleased to hear from readers who note errors or have
suggestions for improvements.
George Lindfield
John Penny
Aston University, Birmingham
March 2018
Acknowledgment
We thank Peter Jardim for his encouragement and support, Joe Hayton, the Publishing Director and the
production team members.
xxv
CHAPTER
AN INTRODUCTION TO M ATLAB®
Abstract
1
M ATLAB® is a software package produced by The MathWorks, Inc. (http://www.mathworks.com) and
is available on systems ranging from personal computers to super-computers and including parallel
computing. In this chapter we aim to provide a useful introduction to M ATLAB, giving sufficient back-
ground for the numerical methods we consider. The reader is referred to the M ATLAB manual for a full
description of the package.
values stored in B and C. In M ATLAB the variables B and C may represent arrays so that each element
of the array A will become the sum of the values of corresponding elements of B and C; that is the
addition will follow the laws of matrix algebra.
There are several languages or software packages that have some similarities to M ATLAB. These
packages include:
Mathematica and Maple. These packages are known for their ability to carry out complicated sym-
bolic mathematical manipulation but they are also able to undertake high precision numerical
computation. In contrast M ATLAB is known for its powerful numerical computational and ma-
trix manipulation facilities. However, M ATLAB also provides an optional symbolic toolbox. This
is discussed in Chapter 10.
Other Matlab-style languages. Languages such as Scilab,1 Octave,2 and Freemat3 are somewhat
similar to M ATLAB in that they implement a wide range of numerical methods, and, in some
cases, use similar syntax to M ATLAB.
It should noted that the languages do not necessarily have a range of toolboxes like M ATLAB.
Julia. Julia4 is a new high-level, high-performance dynamic programming language. The develop-
ers of Julia wanted, amongst other attributes, the speed of C, the general programming easy
of Python, and the powerful linear algebra functions and familiar mathematical notation of
M ATLAB.
General purpose languages. General purpose languages such as Python and C. These languages
don’t have any significant numerical analysis capability in themselves but can load libraries of
routines. For example Python+Numpy, Python+Scipy, C+GSL.
The current M ATLAB release, version 9.4 (R2018a), is available on a wide variety of platforms.
Generally MathWorks releases an upgraded version of M ATLAB every six months.
When M ATLAB is invoked it opens a command window. Graphics, editing, and help windows
may also be opened if required. Users can design their M ATLAB working environment as they see fit.
M ATLAB scripts and function are generally platform independent and they can be readily ported from
one system to another. To install and start M ATLAB, readers should consult the manual appropriate to
their particular working environment.
The scripts and functions given in this book have been tested under M ATLAB release, version
9.3.0.713579 (R2017b). However, most of them will work directly using earlier versions of M ATLAB
but some may require modification.
The remainder of this chapter is devoted to introducing some of the statements and syntax of
M ATLAB. The intention is to give the reader a sound but brief introduction to the power of M ATLAB.
Some details of structure and syntax are omitted and must be obtained from the M ATLAB manual. A de-
tailed description of M ATLAB is given by Higham and Higham (2017). Other sources of information
are the MathWorks website and Wikipedia. Wikipedia should be used with some care.
Before we begin a detailed discussion of the features of M ATLAB, the meaning some terminology
needs clarification. Consider the terms M ATLAB statements, commands, functions, and keywords. If
1 http://www.scilab.org.
2 http://www.gnu.org/software/octave.
3 http://freemat.sourceforge.net.
4 https://julialang.org/.
1.2 MATRICES IN M ATLAB 3
we take a very simple M ATLAB expression, like y = sqrt(x) then, if this is used in the command
window for immediate execution, it is a command for M ATLAB to determine the square root of the
variable x and assign it to y. If it is used in a script, and is not for immediate execution, then it is
usually called a statement. The expression sqrt is a M ATLAB function, but it can also be called a
keyword. The vast majority of M ATLAB keywords are functions, but a few are not: for example all,
long, and pi. The last of these is a reserved keyword to denote the mathematical constant π. Thus, the
use of the four word discussed are often interchangeable.
after the prompt >>. Notice that the elements of the matrix are placed in square brackets, each row
element separated by at least one space or comma. A semicolon (;) indicates the end of a row and the
beginning of another. When the return key is pressed the matrix will be displayed thus:
A =
1 3 5
1 0 1
5 0 9
Discovering Diverse Content Through
Random Scribd Documents
[334] The constable of the Tower, fearing that they would speak upon
the scaffold, reminded them that the honor due to the king would
not permit them to doubt the justice of their sentence. When they
reached the place of punishment, Lord Rocheford, no longer able to
keep silence, turned towards the spectators and said: 'My friends, I
am going to die, as such is his majesty's pleasure. I do not complain
of my death, for I have committed many sins during my life, but I
have never injured the king. May God grant him a long and happy
life!' Then, according to the chronicler, he presented his head
Au dur tranchant qui d'un coup l'emporta.[335]
Norris, Weston, and Brereton were beheaded after him.
The king, before putting his wife to death, desired to perform an
act not less cruel: he was determined to annul his marriage with
Anne, notwithstanding Northumberland's denials. Did he wish to
avoid the reproach of causing his wife to perish by the hands of the
executioner? or, in a fit of anger, did he desire to strike the queen on
all sides at once? We cannot tell. Be that as it may, the king in his
wrath did not see that he was contradicting himself; that if there
was no marriage between him and Anne, there could be no adultery,
and that the sentence, based on this crime, was ex facto null.
Cranmer, the most unfortunate, but perhaps not the least guilty of all
the lords who lent themselves servilely to the despotic wishes of the
prince—Cranmer believed (as it appears) that the position of the
queen would thus become better; that her life would be saved, if she
could no longer be regarded as having been Henry's wife. This
excuses, although slightly, his great weakness. He told the unhappy
lady that he was commissioned to find the means of declaring null
and void the ties which united her to the king. Anne, stunned by the
sentence pronounced upon her, was also of opinion that it was an
expedient invented by some relics of Henry's regard, to rescue her
from the bitterness of death. Her heart opened to hope, and
imagining that she would only be sent into banishment, she formed
a plan of returning to the continent. 'I will go to Antwerp,' she said
at dinner, with an almost happy look.[336] She knew that she would
meet with protestants in that city, who would receive her with joy.
But vain hope! In the very letter wherein the governor of the Tower
reports this ingenuous remark of the queen, he asks for the king's
orders as to the construction of the scaffold.[337] Henry desired
personally to order the arrangement of those planks which he was
about to stain with innocent blood.
About nine o'clock in the forenoon of the 17th of May the lord-
chancellor, the duke of Suffolk, the earl of Essex (Cromwell), the earl
of Sussex, with several doctors and archdeacons entered the chapel
at Lambeth.[338] The archbishop having taken his seat, and the
objections made against the marriage of Henry VIII. and Anne
Boleyn having been read, the proctors of the king and of the queen
admitted them, and the primate declared the marriage to be null
and void. The queen was not present, as some historians have
thought.
=DELIGHT OF THE POPE.=
On the very day of Anne Boleyn's divorce, Da Casale, the English
envoy at Rome, having heard of the queen's imprisonment, hurried
to the pontifical palace to inform Paul III. of the good news.[339] 'I
have never ceased praying to heaven for this favor,' said the pope
with delight, 'and I have always hoped for it. Now his majesty may
accomplish an admirable work for the good of Christendom. Let the
king become reconciled with Rome, and he will obtain from the king
of France all that he can wish for. Let us be friends. I will send him a
nuncio for that purpose. When the news of cardinal Fisher's death
reached Rome,' he continued, recollecting that terrible bull, 'it is true
I found myself driven to a measure somewhat severe ... but I never
intended to follow up my words by deeds.' Thus, according to the
pope and his adherents, the imprisonment of Anne Boleyn was to
reconcile England and Rome. This fact points to one of the causes
which made Norfolk and other catholics enter into the conspiracy
against her.
On the same day also (17th of May), towards evening, the queen
learnt that the sentence would assuredly be carried out. Although it
was declared that she had never been the king's wife, the doom
pronounced upon her for adultery must nevertheless be
accomplished. This is what Henry VIII. called administering justice.
=ANNE ASKS MARY'S PARDON.=
Anne desired to take the Lord's Supper, and asked to be left alone.
About two hours after midnight the chaplain arrived; but, before
partaking of the holy rite, there was one thing she wished to do.
One fault weighed heavily on her heart. She felt that she had sinned
against queen Catherine by consenting to marry the king. Her
conscience reproached her with having injured the princess Mary. It
filled her with the deepest sorrow, and she was eager, before she
died, to make reparation to the daughter of the woman whose place
she had taken. Anne would have liked to see Mary, to fall a queen at
her feet, and implore her pardon; but alas! she could not: she was
only to leave the prison for the scaffold. Resolved, however, to
confess her fault, she did so in a striking manner, which showed all
the sincerity of her repentance and her firm determination to humble
herself before Catherine's daughter. She begged Lady Kingston, the
wife of the constable of the Tower, who had little regard for her, to
take her seat in the chair of state. When the latter objected, Anne
compelled her, and kneeling before her, she said, all the while crying
bitterly: 'I charge you—as you would answer before God—to go in
my name to the princess Mary, to fall down before her as I do now
before you, and ask her forgiveness for all the wrongs I have done
her. Until that is done,' she added, 'my conscience will have no
rest.'[340] At the moment when she was about to appear before the
throne of God, she wished to make reparation for a fault that
weighed heavily upon her heart. 'In that,' she said, 'I wish to do
what a Christian ought.' This touching incident leads us to hope that
if, during life, Anne was simply an honest protestant, trusting too
much to her own works, the trial had borne fruit and had made her
a true Christian. But of this she was to give a still more striking
proof.
As she rose from her knees, Anne felt more calm and prepared to
receive the sacrament. Before taking it, she once more declared her
innocence of the crime imputed to her. The governor was present,
and he did not fail to inform Cromwell of this declaration, made as it
were in the presence of God. Anne had found in Christ's death new
strength to endure her own: she sighed after the moment that
would put an end to her sorrows. Contrary to her expectation, she
was told that the execution was put off until the afternoon. 'Mr.
Kingston,' she said, 'I hear that I am not to die this afternoon, and I
am very sorry for it; for I thought by this time to be dead and past
my pain.'—'Madam,' replied the governor, 'you will feel no pain, the
blow will be so sharp and swift.'—'Yes,' resumed Anne, 'I have heard
say that the headsman is very clever,' and then she added: 'and I
have but a little neck,' putting her hand about it and smiling.[341]
Kingston left the room.
Meanwhile the devout adherents of the Roman primacy were full
of exultation, and allowed the hopes to appear which Anne's death
raised in their bosoms. 'Sire,' they told the king, 'the tapers placed
round the tomb of queen Catherine suddenly burst into flame of
their own accord.'[342] They concluded, from this prodigy, that
Roman-catholicism was once more about to shed its light on
England. The priests were eager to chant their Deo gratias, and a
report was circulated that this new victory over the Reformation was
going to be inaugurated by hanging a group of heretics along with
Anne.[343] Neither friends nor enemies drew any real distinction
between the cause of Anne and the cause of protestantism; and
many evangelical Christians, imagining that when Anne was dead
there would be no one to protect them any longer, prepared to quit
the kingdom.
Henry, however, keenly desiring to have if it were but one word
from Anne that would exculpate him, sent some one to her with a
commission to sound her, and to discover whether the hope of
escaping death would not induce her to satisfy him. Anne replied,
and they were the last words she addressed to the king: 'Commend
me to his majesty, and tell him that he has ever been constant in his
career of advancing me. From a private gentlewoman he made me a
marchioness, from a marchioness a queen; and now that he has no
higher degree of honor left, he gives my innocence the crown of
martyrdom.'[344] The gentleman went and reported this noble
farewell to his master. Even the jailer bore testimony to the peace
and joy which filled Anne Boleyn's heart at this solemn moment. 'I
have seen men and also women executed,' wrote Kingston to
Cromwell, 'and they have been in great sorrow; but to my
knowledge this lady has much joy and pleasure in death.'[345]
=ANNE'S EXECUTION.=
Everything was arranged so that the murder should be
perpetrated without publicity and without disturbance. Kingston
received orders to turn all strangers out of the Tower, and readily
obeyed. About eleven in the forenoon of the 19th of May, the dukes
of Suffolk and Richmond, the lord-chancellor, Cromwell, the lord-
mayor with the sheriffs and aldermen, entered the Tower, and took
their stations on the green, where the instrument of punishment had
been erected. The executioner, whom Henry had summoned from
Calais, was there with his axe and his attendants. A cannon,
mounted on the walls, was to announce both to king and people that
all was over. A little past noon Anne appeared, dressed in a robe of
black damask, and attended by four of her maids of honor. She
walked up to the block on which she was to lay her head. Her step
was firm, her looks calm; all indicated the most complete
resignation. She was then thirty years old, and 'never had she
looked so beautiful before,'[346] says a French contemporary, then in
London. Her eyes expressed a meek submission; a pleasing smile
accompanied the look she turned on the spectators of this tragic
scene.[347] But just when the executioners had made the last
preparations, her emotion was so keen that she nearly fainted.
Gradually she recovered her strength, and her faith in the Saviour
filled her with courage and hope.
It is important to know what, in this last and solemn moment,
were her sentiments towards the king. She had desired that Mary
should be asked to forgive her wrongs: it was her duty, if she died a
Christian, also to pardon Henry's faults. She must obey her Saviour,
who said: 'Love your enemies, bless them that curse you.' She had
pardoned everything; but it was her duty to declare it before she
died, and if she was humble, she would do so without affectation.
Addressing those who had been her subjects and were then
standing round her, she said: 'Good Christian people, I am not come
here to justify myself; I leave my justification entirely to Christ, in
whom I put my trust. I will accuse no man, nor speak anything of
that whereof I am accused, as I know full well that aught that I
could say in my defence doth not appertain unto you, and that I
could draw no hope of life from the same. I come here only to die,
according as I have been condemned. I commend my judges to the
Lord's mercy. I pray God (and I beg you to do the same) to save the
king and send him long to reign over you, for a gentler or more
merciful prince there never was. To me he was ever a good, gentle,
and sovereign lord. And thus I take my leave of the world and of
you, and I heartily desire you all to pray for me. O Lord, have mercy
upon me! To God I commit my soul!'[348]
Such are the simple words in which Anne gave utterance to the
feelings of peace with which her heart was filled towards her
husband, at the moment when he was robbing her of life. Had she
said that she forgave him, she would have called up the memory of
the king's crime, and would thus have appeared to claim the merit of
her generous pardon. She did nothing of the sort. During one part of
their wedded life, Henry had been a 'good lord' to her. She desired
to recall the good only, and buried the evil in oblivion. She did so
without any thought of self; for she knew that before the gracious
words could reach the king's ears, the axe would have already fallen
upon her, and it would be impossible for Henry to arrest the fatal
blow.
This Christian discourse could not fail to make a deep impression
on all who heard her. As they looked at the unfortunate queen, they
felt the tenderest compassion and the sharpest pain.[349] The firmer
her heart became, the weaker grew the spectators of the tragedy.
Ere long they were unable to check the tears which the sufferer had
the strength to restrain.[350] One of the ladies of the royal victim
approached her to cover her eyes; but Anne refused, saying that she
was not afraid of death, and gave her as a memorial of that hour, a
little manuscript prayer-book that she had brought with her.
The queen then removed her white collar and took off her hood,
that the action of the axe might not be impeded;[351] this head-dress
formed a queue and hung down behind. Then falling on her knees,
she remained a few moments silent and motionless, praying
inwardly. On rising up, she approached the fatal block, and laid her
head on it: 'O Christ, into thy hands I commit my soul!' she
exclaimed. The headsman, disturbed by the mild expression of her
face, hesitated a few seconds, but his courage returned. Anne cried
out again: 'O Jesus, receive my soul!' At this instant the axe of the
executioner flashed in the air and her head fell. A cry escaped from
the lips of the spectators, 'as if they had received the blow upon
their own necks.'[352] This is honorable to Anne's enemies, so that we
may well believe the evidence. But immediately another sound was
heard: the gunner, placed as a signal-man on the wall, had watched
the different phases of the scene, holding a lighted match in his
hand; scarcely had the head fallen, when he fired the gun, and the
report, which was heard at a distance, bore to Henry the news of
the crime which gave him Jane Seymour.[353] The ladies of queen
Anne, though almost lifeless with terror, would not permit the noble
remains of the mistress, whom they had loved so much, to be
touched by rude hands; they gathered round the body, wrapped it in
a white sheet, and carried it (almost fainting as they were) to an old
elm chest, which had been brought out of the arsenal and had been
used for storing arrows. This rough box was the last home assigned
to her who had inhabited costly palaces: not so much as a coffin had
been provided for her. The ladies placed in it Anne's head and body;
'the eyes and lips were observed to move,' says a document, as if
her mouth was repeating the last words it had uttered. She was
immediately buried in the Tower chapel.[354]
Thus died Anne Boleyn. If the violent passions of a prince and the
meanness of his courtiers brought her to an untimely death, hatred
and credulity have killed her a second time. But an infamous
calumny, forged by dishonest individuals, ought to be sternly
rejected by all sensible men. Not in vain did Anne, at the hour of
death, place her cause in the hands of God, and we willingly believe
that all enlightened men, without prejudice or partiality, among
Roman-catholics as among others, turn with disgust from the vile
falsehoods of malicious courtiers and the deceitful fables of the
papist Sanders and his followers.
=HENRY'S INHUMANITY.=
On the morning of this day, Henry VIII. had dressed himself in
white, as for a festival, and ordered a hunting-party. There was a
great stir round the palace; huntsmen hurrying to and fro, dogs
baying, horns sounding, nobles arriving. The troop was formed and
they all set off for Epping Forest, where the sport began. At noon
the hunters met to repose themselves under an oak which still bears
the name of the King's Oak. Henry had taken his seat beneath it,
surrounded by his suite and the dogs; he listened and seemed to be
agitated. Suddenly a cannon shot resounded through the forest—it
was the concerted signal—the queen's head had fallen. 'Ha, ha!'
exclaimed the king, rising, 'the deed is done! uncouple the hounds
and away.'[355] Horns and trumpets were sounded, and dogs and
horses were soon in pursuit. The wretched prince, led away by his
passions, forgot that there is a God to whom he would have to
render an account not only of the execution in the Tower, but of the
chase in the forest; and by these cruel acts, which should have
shocked the hearts even of his courtiers, he branded himself with his
own hands as a great criminal. The king and his court returned to
the palace before nightfall.
At last Henry was free. He had desired Jane Seymour, and
everything had been invented—adultery, incest—to break the bonds
that united him to the queen. The proofs of Anne's crimes failing,
the ferocious acts of the king were to supply their place. Could those
who witnessed the cruelty of the husband venture to doubt the guilt
of the wife? Henry had become inhuman that he might not appear
faithless. Now that the object was obtained, it only remained to
profit by his crime. His impatience to gratify his passions made him
brave all propriety. The mournful death of his queen; the Christian
words that she had uttered, kissing as it were the cruel hand that
struck her—nothing softened that man's heart, and the very next
day he married the youthful maid of honor. It would have been
difficult to say in a more striking manner: 'This is why Anne Boleyn is
no more!' When we see side by side the blood-stained block on
which Anne had received her death-blow, and the brilliant altar
before which Henry and Jane were united, we all understand the
story.[356] The prince, at once voluptuous and cruel, liked to combine
the most contrary objects in the same picture—crime and festivities,
marriage and death, sensuality and hatred. He showed himself the
most magnificent and most civilized monarch of Europe; but also the
rival of those barbarous kings of savage hordes who take delight in
cutting off the heads of those who have been their favorites and
even the objects of their most passionate love. We must employ
different standards in judging of the same person, when we regard
him as a private and as a public individual. The Tudor prince, so
guilty as a husband, father, and friend, did much good as a ruler for
England. Louis XIV., as well as Henry VIII., had some of the
characteristics of a great king; and his moral life was certainly not
better than that of his prototype in England. He had as many, and
even more mistresses than the predecessor of the Stuarts had
wives; but the only advantage which the French monarch had over
the English one, is that he knew how to get rid of them without
cutting off their heads.
The death of Anne Boleyn caused a great sensation in Europe, as
that of Fisher and More had done before it. Her innocence, which
Henry (it is said) acknowledged on his death-bed,[357] was denied by
some and maintained by others; but all men of principle expressed a
feeling of horror when they heard of her punishment. The protestant
princes and divines of Germany had not a doubt that this cruel act
was the pledge of reconciliation offered to the pope by Henry VIII.,
and renounced the alliance they were on the point of concluding
with England. 'At last I am free from that journey,' said Melanchthon,
whom Anne Boleyn's death, added to that of Sir Thomas More, had
rendered even less desirous of approaching the prince who had
struck them. 'The queen,' he continued, 'accused, rather than
convicted, of adultery, has suffered the penalty of death, and that
catastrophe has wrought great changes in our plans.'[358]
Somewhat later the protestants ascribed Anne's death especially
to the pope: 'That blow came from Rome,' they cried; 'in Rome all
these tricks and plots are contrived. Even Petrarch had long since
called that city
Nido di tradimenti, in cui si cuova
Quanto mal per lo mondo hoggi si spande.'[359]
In this I suspect there is a mistake. The plots of the Roman court
against Elizabeth have caused it to be accused of similar designs
against the mother of the great protestant queen. The friends of
that court in England were probably no strangers to the crime, but
the great criminal was Henry.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com