Nothing Special   »   [go: up one dir, main page]

Full Scientific Computing With MATLAB Second Edition Dingyu Xue Ebook All Chapters

Download as pdf or txt
Download as pdf or txt
You are on page 1of 54

Full download text book at textbookfull.

com

Scientific Computing with MATLAB Second


Edition Dingyu Xue

DOWLOAD HERE

https://textbookfull.com/product/scientific-
computing-with-matlab-second-edition-dingyu-xue/

DOWLOAD NOW

Download more textbook from textbookfull.com


More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Differential Equation Solutions With MATLAB


Fundamentals and Numerical Implementations De Gruyter
STEM Dingyu Xue

https://textbookfull.com/product/differential-equation-solutions-
with-matlab-fundamentals-and-numerical-implementations-de-
gruyter-stem-dingyu-xue/

Calculus Problem Solutions With MATLAB 1st Edition


Dingyü Xue

https://textbookfull.com/product/calculus-problem-solutions-with-
matlab-1st-edition-dingyu-xue/

Linear Algebra and Matrix Computations With MATLAB 1st


Edition Dingyü Xue

https://textbookfull.com/product/linear-algebra-and-matrix-
computations-with-matlab-1st-edition-dingyu-xue/

MATLAB Programming Mathematical Problem Solutions De


Gruyter STEM 1st Edition Dingyü Xue

https://textbookfull.com/product/matlab-programming-mathematical-
problem-solutions-de-gruyter-stem-1st-edition-dingyu-xue/
Solving applied mathematical problems with MATLAB
Second Edition Chen

https://textbookfull.com/product/solving-applied-mathematical-
problems-with-matlab-second-edition-chen/

Learning SciPy for Numerical and Scientific Computing


Second Edition Sergio J. Rojas G.

https://textbookfull.com/product/learning-scipy-for-numerical-
and-scientific-computing-second-edition-sergio-j-rojas-g/

Planar multibody dynamics formulation programming with


MATLAB and applications Second Edition Nikravesh

https://textbookfull.com/product/planar-multibody-dynamics-
formulation-programming-with-matlab-and-applications-second-
edition-nikravesh/

MATLAB Parallel Computing Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-parallel-computing-
toolbox-user-s-guide-the-mathworks/

Scientific computing an introductory survey 2nd Edition


Heath M.T

https://textbookfull.com/product/scientific-computing-an-
introductory-survey-2nd-edition-heath-m-t/
Scientific Computing
with MATLAB®
Second Edition
Scientific Computing
with MATLAB®
Second Edition

Dingyü Xue
Northeastern University
Shenyang, China

YangQuan Chen
University of California
Merced, USA
MATLAB® 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 MATLAB® software or related products
does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular
use of the MATLAB® software.

CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
© 2016 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works


Version Date: 20160113

International Standard Book Number-13: 978-1-4987-5778-2 (eBook - PDF)

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been
made to publish reliable data and information, but the author and publisher cannot assume responsibility for the valid-
ity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright
holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this
form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may
rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or uti-
lized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopy-
ing, microfilming, and recording, or in any information storage or retrieval system, without written permission from the
publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://
www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923,
978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For
organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation without intent to infringe.
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
Contents

Preface xiii

Preface of the First Edition xv

1 Computer Mathematics Languages — An Overview 1

1.1 Computer Solutions to Mathematics Problems . . . . . . . . . . . . . . . . 1


1.1.1 Why should we study computer mathematics language? . . . . . . . 1
1.1.2 Analytical solutions versus numerical solutions . . . . . . . . . . . . 5
1.1.3 Mathematics software packages: an overview . . . . . . . . . . . . . 5
1.1.4 Limitations of conventional computer languages . . . . . . . . . . . . 6
1.2 Summary of Computer Mathematics Languages . . . . . . . . . . . . . . . 8
1.2.1 A brief historic review of MATLAB . . . . . . . . . . . . . . . . . . 8
1.2.2 Three widely used computer mathematics languages . . . . . . . . . 8
1.2.3 Introduction to free scientific open-source softwares . . . . . . . . . . 9
1.3 Outline of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.1 The organization of the book . . . . . . . . . . . . . . . . . . . . . . 9
1.3.2 How to learn and use MATLAB . . . . . . . . . . . . . . . . . . . . 11
1.3.3 The three-phase solution methodology . . . . . . . . . . . . . . . . . 11
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2 Fundamentals of MATLAB Programming and Scientific Visualization 15

2.1 Essentials in MATLAB Programming . . . . . . . . . . . . . . . . . . . . . 16


2.1.1 Variables and constants in MATLAB . . . . . . . . . . . . . . . . . . 16
2.1.2 Data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.3 Basic statement structures of MATLAB . . . . . . . . . . . . . . . . 18
2.1.4 Colon expressions and sub-matrices extraction . . . . . . . . . . . . 19
2.2 Fundamental Mathematical Calculations . . . . . . . . . . . . . . . . . . . 20
2.2.1 Algebraic operations of matrices . . . . . . . . . . . . . . . . . . . . 20
2.2.2 Logic operations of matrices . . . . . . . . . . . . . . . . . . . . . . . 22
2.2.3 Relationship operations of matrices . . . . . . . . . . . . . . . . . . . 22
2.2.4 Simplifications and presentations of analytical results . . . . . . . . 22
2.2.5 Basic number theory computations . . . . . . . . . . . . . . . . . . . 24
2.3 Flow Control Structures of MATLAB Language . . . . . . . . . . . . . . . 25
2.3.1 Loop control structures . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.2 Conditional control structures . . . . . . . . . . . . . . . . . . . . . . 27
2.3.3 Switch structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3.4 Trial structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.4 Writing and Debugging MATLAB Functions . . . . . . . . . . . . . . . . . 30

v
vi Contents

2.4.1 Basic structure of MATLAB functions . . . . . . . . . . . . . . . . . 30


2.4.2 Programming of functions with variable numbers of arguments in
inputs and outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.4.3 Inline functions and anonymous functions . . . . . . . . . . . . . . . 34
2.4.4 Pseudo code and source code protection . . . . . . . . . . . . . . . . 34
2.5 Two-dimensional Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.5.1 Basic statements of two-dimensional plotting . . . . . . . . . . . . . 35
2.5.2 Plotting with multiple horizontal or vertical axes . . . . . . . . . . . 37
2.5.3 Other two-dimensional plotting functions . . . . . . . . . . . . . . . 38
2.5.4 Plots of implicit functions . . . . . . . . . . . . . . . . . . . . . . . . 39
2.5.5 Graphics decorations . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.5.6 Data file access with MATLAB . . . . . . . . . . . . . . . . . . . . . 42
2.6 Three-dimensional Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.6.1 Plotting of three-dimensional curves . . . . . . . . . . . . . . . . . . 44
2.6.2 Plotting of three-dimensional surfaces . . . . . . . . . . . . . . . . . 45
2.6.3 Viewpoint settings in 3D graphs . . . . . . . . . . . . . . . . . . . . 48
2.6.4 Surface plots of parametric equations . . . . . . . . . . . . . . . . . . 49
2.6.5 Spheres and cylinders . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.6.6 Drawing 2D and 3D contours . . . . . . . . . . . . . . . . . . . . . . 51
2.6.7 Drawing 3D implicit functions . . . . . . . . . . . . . . . . . . . . . 52
2.7 Four-dimensional Visualization . . . . . . . . . . . . . . . . . . . . . . . . . 53
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

3 Calculus Problems 61

3.1 Analytical Solutions to Limit Problems . . . . . . . . . . . . . . . . . . . . 61


3.1.1 Limits of univariate functions . . . . . . . . . . . . . . . . . . . . . . 62
3.1.2 Limits of interval functions . . . . . . . . . . . . . . . . . . . . . . . 64
3.1.3 Limits of multivariate functions . . . . . . . . . . . . . . . . . . . . . 66
3.2 Analytical Solutions to Derivative Problems . . . . . . . . . . . . . . . . . 67
3.2.1 Derivatives and high-order derivatives . . . . . . . . . . . . . . . . . 67
3.2.2 Partial derivatives of multivariate functions . . . . . . . . . . . . . . 69
3.2.3 Jacobian matrix of multivariate functions . . . . . . . . . . . . . . . 71
3.2.4 Hessian partial derivative matrix . . . . . . . . . . . . . . . . . . . . 72
3.2.5 Partial derivatives of implicit functions . . . . . . . . . . . . . . . . . 72
3.2.6 Derivatives of parametric equations . . . . . . . . . . . . . . . . . . . 74
3.2.7 Gradients, divergences and curls of fields . . . . . . . . . . . . . . . . 74
3.3 Analytical Solutions to Integral Problems . . . . . . . . . . . . . . . . . . . 75
3.3.1 Indefinite integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.3.2 Computing definite, infinite and improper integrals . . . . . . . . . . 77
3.3.3 Computing multiple integrals . . . . . . . . . . . . . . . . . . . . . . 79
3.4 Series Expansions and Finite-term Series Approximations . . . . . . . . . . 80
3.4.1 Taylor series expansion . . . . . . . . . . . . . . . . . . . . . . . . . 80
3.4.2 Fourier series expansion . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.5 Infinite Series and Products . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
3.5.1 Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
3.5.2 Product of sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.5.3 Convergence test of infinite series . . . . . . . . . . . . . . . . . . . . 89
Contents vii

3.6 Path Integrals and Line Integrals . . . . . . . . . . . . . . . . . . . . . . . . 91


3.6.1 Path integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
3.6.2 Line integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.7 Surface Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
3.7.1 Scalar surface integrals . . . . . . . . . . . . . . . . . . . . . . . . . . 94
3.7.2 Vector surface integrals . . . . . . . . . . . . . . . . . . . . . . . . . 96
3.8 Numerical Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
3.8.1 Numerical differentiation algorithms . . . . . . . . . . . . . . . . . . 97
3.8.2 Central-point difference algorithm with MATLAB implementation . 98
3.8.3 Gradient computations of functions with two variables . . . . . . . . 100
3.9 Numerical Integration Problems . . . . . . . . . . . . . . . . . . . . . . . . 101
3.9.1 Numerical integration from given data using trapezoidal method . . 102
3.9.2 Numerical integration of univariate functions . . . . . . . . . . . . . 103
3.9.3 Numerical infinite integrals . . . . . . . . . . . . . . . . . . . . . . . 106
3.9.4 Evaluating integral functions . . . . . . . . . . . . . . . . . . . . . . 107
3.9.5 Numerical solutions to double integrals . . . . . . . . . . . . . . . . 108
3.9.6 Numerical solutions to triple integrals . . . . . . . . . . . . . . . . . 111
3.9.7 Multiple integral evaluations . . . . . . . . . . . . . . . . . . . . . . 112
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

4 Linear Algebra Problems 121

4.1 Inputting Special Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . 122


4.1.1 Numerical matrix input . . . . . . . . . . . . . . . . . . . . . . . . . 122
4.1.2 Defining symbolic matrices . . . . . . . . . . . . . . . . . . . . . . . 126
4.1.3 Sparse matrix input . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
4.2 Fundamental Matrix Operations . . . . . . . . . . . . . . . . . . . . . . . . 128
4.2.1 Basic concepts and properties of matrices . . . . . . . . . . . . . . . 128
4.2.2 Matrix inversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
4.2.3 Generalized matrix inverse . . . . . . . . . . . . . . . . . . . . . . . 138
4.2.4 Matrix eigenvalue problems . . . . . . . . . . . . . . . . . . . . . . . 140
4.3 Fundamental Matrix Transformations . . . . . . . . . . . . . . . . . . . . . 142
4.3.1 Similarity transformations and orthogonal matrices . . . . . . . . . . 142
4.3.2 Triangular and Cholesky factorizations . . . . . . . . . . . . . . . . . 144
4.3.3 Companion, diagonal and Jordan transformations . . . . . . . . . . 149
4.3.4 Singular value decompositions . . . . . . . . . . . . . . . . . . . . . . 152
4.4 Solving Matrix Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
4.4.1 Solutions to linear algebraic equations . . . . . . . . . . . . . . . . . 155
4.4.2 Solutions to Lyapunov equations . . . . . . . . . . . . . . . . . . . . 158
4.4.3 Solutions to Sylvester equations . . . . . . . . . . . . . . . . . . . . . 161
4.4.4 Solutions of Diophantine equations . . . . . . . . . . . . . . . . . . . 163
4.4.5 Solutions to Riccati equations . . . . . . . . . . . . . . . . . . . . . . 165
4.5 Nonlinear Functions and Matrix Function Evaluations . . . . . . . . . . . . 166
4.5.1 Element-by-element computations . . . . . . . . . . . . . . . . . . . 166
4.5.2 Computations of matrix exponentials . . . . . . . . . . . . . . . . . . 166
4.5.3 Trigonometric functions of matrices . . . . . . . . . . . . . . . . . . 168
4.5.4 General matrix functions . . . . . . . . . . . . . . . . . . . . . . . . 171
4.5.5 Power of a matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
viii Contents

Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

5 Integral Transforms and Complex-valued Functions 183

5.1 Laplace Transforms and Their Inverses . . . . . . . . . . . . . . . . . . . . 184


5.1.1 Definitions and properties . . . . . . . . . . . . . . . . . . . . . . . . 184
5.1.2 Computer solution to Laplace transform problems . . . . . . . . . . 185
5.1.3 Numerical solutions of Laplace transforms . . . . . . . . . . . . . . . 187
5.2 Fourier Transforms and Their Inverses . . . . . . . . . . . . . . . . . . . . . 190
5.2.1 Definitions and properties . . . . . . . . . . . . . . . . . . . . . . . . 190
5.2.2 Solving Fourier transform problems . . . . . . . . . . . . . . . . . . . 191
5.2.3 Fourier sinusoidal and cosine transforms . . . . . . . . . . . . . . . . 193
5.2.4 Discrete Fourier sine, cosine transforms . . . . . . . . . . . . . . . . 194
5.2.5 Fast Fourier transforms . . . . . . . . . . . . . . . . . . . . . . . . . 195
5.3 Other Integral Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.3.1 Mellin transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.3.2 Hankel transform solutions . . . . . . . . . . . . . . . . . . . . . . . 198
5.4 z Transforms and Their Inverses . . . . . . . . . . . . . . . . . . . . . . . . 200
5.4.1 Definitions and properties of z transforms and inverses . . . . . . . . 200
5.4.2 Computations of z transform . . . . . . . . . . . . . . . . . . . . . . 201
5.4.3 Bilateral z transforms . . . . . . . . . . . . . . . . . . . . . . . . . . 202
5.4.4 Numerical inverse z transform of rational functions . . . . . . . . . . 203
5.5 Essentials of Complex-valued Functions . . . . . . . . . . . . . . . . . . . . 203
5.5.1 Complex matrices and their manipulations . . . . . . . . . . . . . . 204
5.5.2 Mapping of complex-valued functions . . . . . . . . . . . . . . . . . 204
5.5.3 Riemann surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
5.6 Solving Complex-valued Function Problems . . . . . . . . . . . . . . . . . . 207
5.6.1 Concept and computation of poles and residues . . . . . . . . . . . . 207
5.6.2 Partial fraction expansion for rational functions . . . . . . . . . . . . 210
5.6.3 Inverse Laplace transform using PFEs . . . . . . . . . . . . . . . . . 214
5.6.4 Laurent series expansions . . . . . . . . . . . . . . . . . . . . . . . . 215
5.6.5 Computing closed-path integrals . . . . . . . . . . . . . . . . . . . . 219
5.7 Solutions of Difference Equations . . . . . . . . . . . . . . . . . . . . . . . 221
5.7.1 Analytical solutions of linear difference equations . . . . . . . . . . . 221
5.7.2 Numerical solutions of linear time varying difference equations . . . 222
5.7.3 Solutions of linear time-invariant difference equations . . . . . . . . 224
5.7.4 Numerical solutions of nonlinear difference equations . . . . . . . . . 225
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

6 Nonlinear Equations and Numerical Optimization Problems 231

6.1 Nonlinear Algebraic Equations . . . . . . . . . . . . . . . . . . . . . . . . . 232


6.1.1 Graphical method for solving nonlinear equations . . . . . . . . . . . 232
6.1.2 Quasi-analytic solutions to polynomial-type equations . . . . . . . . 234
6.1.3 Numerical solutions to general nonlinear equations . . . . . . . . . . 238
6.2 Nonlinear Equations with Multiple Solutions . . . . . . . . . . . . . . . . . 240
6.2.1 Numerical solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
6.2.2 Finding high-precision solutions . . . . . . . . . . . . . . . . . . . . . 245
Contents ix

6.2.3 Solutions of underdetermined equations . . . . . . . . . . . . . . . . 247


6.3 Unconstrained Optimization Problems . . . . . . . . . . . . . . . . . . . . . 248
6.3.1 Analytical solutions and graphical solution methods . . . . . . . . . 249
6.3.2 Solution of unconstrained optimization using MATLAB . . . . . . . 250
6.3.3 Global minimum and local minima . . . . . . . . . . . . . . . . . . . 252
6.3.4 Solving optimization problems with gradient information . . . . . . 255
6.4 Constrained Optimization Problems . . . . . . . . . . . . . . . . . . . . . . 257
6.4.1 Constraints and feasibility regions . . . . . . . . . . . . . . . . . . . 257
6.4.2 Solving linear programming problems . . . . . . . . . . . . . . . . . 258
6.4.3 Solving quadratic programming problems . . . . . . . . . . . . . . . 263
6.4.4 Solving general nonlinear programming problems . . . . . . . . . . . 264
6.5 Mixed Integer Programming Problems . . . . . . . . . . . . . . . . . . . . . 268
6.5.1 Enumerate method in integer programming problems . . . . . . . . 268
6.5.2 Solutions of linear integer programming problems . . . . . . . . . . . 270
6.5.3 Solutions of nonlinear integer programming problems . . . . . . . . . 271
6.5.4 Solving binary programming problems . . . . . . . . . . . . . . . . . 273
6.5.5 Assignment problems . . . . . . . . . . . . . . . . . . . . . . . . . . 275
6.6 Linear Matrix Inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
6.6.1 A general introduction to LMIs . . . . . . . . . . . . . . . . . . . . . 276
6.6.2 Lyapunov inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . 277
6.6.3 Classification of LMI problems . . . . . . . . . . . . . . . . . . . . . 279
6.6.4 LMI problem solutions with MATLAB . . . . . . . . . . . . . . . . . 279
6.6.5 Optimization of LMI problems by YALMIP Toolbox . . . . . . . . . 281
6.7 Solutions of Multi-objective Programming Problems . . . . . . . . . . . . . 283
6.7.1 Multi-objective optimization model . . . . . . . . . . . . . . . . . . . 283
6.7.2 Least squares solutions of unconstrained multi-objective program-
ming problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
6.7.3 Converting multi-objective problems into single-objective ones . . . 284
6.7.4 Pareto front of multi-objective programming problems . . . . . . . . 287
6.7.5 Solutions of minimax problems . . . . . . . . . . . . . . . . . . . . . 289
6.7.6 Solutions of multi-objective goal attainment problems . . . . . . . . 290
6.8 Dynamic Programming and Shortest Path Planning . . . . . . . . . . . . . 291
6.8.1 Matrix representation of graphs . . . . . . . . . . . . . . . . . . . . . 292
6.8.2 Optimal path planning of oriented graphs . . . . . . . . . . . . . . . 292
6.8.3 Optimal path planning of undigraphs . . . . . . . . . . . . . . . . . 296
6.8.4 Optimal path planning for graphs described by coordinates . . . . . 296
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

7 Differential Equation Problems 305

7.1 Analytical Solution Methods for Some Ordinary Differential Equations . . 306
7.1.1 Linear time-invariant ordinary differential equations . . . . . . . . . 306
7.1.2 Analytical solution with MATLAB . . . . . . . . . . . . . . . . . . . 307
7.1.3 Analytical solutions of linear state space equations . . . . . . . . . . 310
7.1.4 Analytical solutions to special nonlinear differential equations . . . . 311
7.2 Numerical Solutions to Ordinary Differential Equations . . . . . . . . . . . 312
7.2.1 Overview of numerical solution algorithms . . . . . . . . . . . . . . . 312
7.2.2 Fixed-step Runge–Kutta algorithm and its MATLAB implementation 314
x Contents

7.2.3 Numerical solution to first-order vector ODEs . . . . . . . . . . . . . 315


7.3 Transforms to Standard Differential Equations . . . . . . . . . . . . . . . . 320
7.3.1 Manipulating a single high-order ODE . . . . . . . . . . . . . . . . . 320
7.3.2 Manipulating multiple high-order ODEs . . . . . . . . . . . . . . . . 321
7.3.3 Validation of numerical solutions to ODEs . . . . . . . . . . . . . . . 325
7.3.4 Transformation of differential matrix equations . . . . . . . . . . . . 326
7.4 Solutions to Special Ordinary Differential Equations . . . . . . . . . . . . . 328
7.4.1 Solutions of stiff ordinary differential equations . . . . . . . . . . . . 329
7.4.2 Solutions of implicit differential equations . . . . . . . . . . . . . . . 332
7.4.3 Solutions to differential algebraic equations . . . . . . . . . . . . . . 335
7.4.4 Solutions of switching differential equations . . . . . . . . . . . . . . 337
7.4.5 Solutions to linear stochastic differential equations . . . . . . . . . . 338
7.5 Solutions to Delay Differential Equations . . . . . . . . . . . . . . . . . . . 342
7.5.1 Solutions of typical delay differential equations . . . . . . . . . . . . 342
7.5.2 Solutions of differential equations with variable delays . . . . . . . . 344
7.5.3 Solutions of neutral-type delay differential equations . . . . . . . . . 347
7.6 Solving Boundary Value Problems . . . . . . . . . . . . . . . . . . . . . . . 348
7.6.1 Shooting algorithm for linear equations . . . . . . . . . . . . . . . . 348
7.6.2 Boundary value problems of nonlinear equations . . . . . . . . . . . 350
7.6.3 Solutions to general boundary value problems . . . . . . . . . . . . . 352
7.7 Introduction to Partial Differential Equations . . . . . . . . . . . . . . . . . 355
7.7.1 Solving a set of one-dimensional partial differential equations . . . . 355
7.7.2 Mathematical description to two-dimensional PDEs . . . . . . . . . 357
7.7.3 The GUI for the PDE Toolbox — an introduction . . . . . . . . . . 358
7.8 Solving ODEs with Block Diagrams in Simulink . . . . . . . . . . . . . . . 365
7.8.1 A brief introduction to Simulink . . . . . . . . . . . . . . . . . . . . 365
7.8.2 Simulink — relevant blocks . . . . . . . . . . . . . . . . . . . . . . . 365
7.8.3 Using Simulink for modeling and simulation of ODEs . . . . . . . . 367
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379

8 Data Interpolation and Functional Approximation Problems 381

8.1 Interpolation and Data Fitting . . . . . . . . . . . . . . . . . . . . . . . . . 382


8.1.1 One-dimensional data interpolation . . . . . . . . . . . . . . . . . . . 382
8.1.2 Definite integral evaluation from given samples . . . . . . . . . . . . 385
8.1.3 Two-dimensional grid data interpolation . . . . . . . . . . . . . . . . 387
8.1.4 Two-dimensional scattered data interpolation . . . . . . . . . . . . . 389
8.1.5 Optimization problems based on scattered sample data . . . . . . . 392
8.1.6 High-dimensional data interpolations . . . . . . . . . . . . . . . . . . 393
8.2 Spline Interpolation and Numerical Calculus . . . . . . . . . . . . . . . . . 394
8.2.1 Spline interpolation in MATLAB . . . . . . . . . . . . . . . . . . . . 395
8.2.2 Numerical differentiation and integration with splines . . . . . . . . 398
8.3 Fitting Mathematical Models from Data . . . . . . . . . . . . . . . . . . . 401
8.3.1 Polynomial fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
8.3.2 Curve fitting by linear combination of basis functions . . . . . . . . 403
8.3.3 Least squares curve fitting . . . . . . . . . . . . . . . . . . . . . . . . 405
8.3.4 Least squares fitting of multivariate functions . . . . . . . . . . . . . 407
8.4 Rational Function Approximations . . . . . . . . . . . . . . . . . . . . . . . 408
Contents xi

8.4.1 Approximation by continued fraction expansions . . . . . . . . . . . 408


8.4.2 Padé rational approximations . . . . . . . . . . . . . . . . . . . . . . 412
8.4.3 Special approximation polynomials . . . . . . . . . . . . . . . . . . . 414
8.5 Special Functions and Their Plots . . . . . . . . . . . . . . . . . . . . . . . 416
8.5.1 Gamma functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
8.5.2 Beta functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
8.5.3 Legendre functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
8.5.4 Bessel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
8.5.5 Mittag–Leffler functions . . . . . . . . . . . . . . . . . . . . . . . . . 421
8.6 Signal Analysis and Digital Signal Processing . . . . . . . . . . . . . . . . . 425
8.6.1 Correlation analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
8.6.2 Power spectral analysis . . . . . . . . . . . . . . . . . . . . . . . . . 427
8.6.3 Filtering techniques and filter design . . . . . . . . . . . . . . . . . . 429
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436

9 Probability and Mathematical Statistics Problems 437

9.1 Probability Distributions and Pseudorandom Numbers . . . . . . . . . . . 438


9.1.1 Introduction to probability density functions and cumulative distribu-
tion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
9.1.2 Probability density functions and cumulative distribution functions
of commonly used distributions . . . . . . . . . . . . . . . . . . . . . 439
9.1.3 Random numbers and pseudorandom numbers . . . . . . . . . . . . 447
9.2 Solving Probability Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 448
9.2.1 Histogram and pie representation of discrete numbers . . . . . . . . 448
9.2.2 Probability computation of continuous functions . . . . . . . . . . . 450
9.2.3 Monte Carlo solutions to mathematical problems . . . . . . . . . . . 451
9.2.4 Simulation of random walk processes . . . . . . . . . . . . . . . . . . 453
9.3 Fundamental Statistical Analysis . . . . . . . . . . . . . . . . . . . . . . . . 454
9.3.1 Mean and variance of stochastic variables . . . . . . . . . . . . . . . 454
9.3.2 Moments of stochastic variables . . . . . . . . . . . . . . . . . . . . . 456
9.3.3 Covariance analysis of multivariate stochastic variables . . . . . . . . 457
9.3.4 Joint PDFs and CDFs of multivariate normal distributions . . . . . 458
9.3.5 Outliers, quartiles and box plots . . . . . . . . . . . . . . . . . . . . 459
9.4 Statistical Estimations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
9.4.1 Parametric estimation and interval estimation . . . . . . . . . . . . . 462
9.4.2 Multivariate linear regression and interval estimation . . . . . . . . . 463
9.4.3 Nonlinear least squares parametric and interval estimations . . . . . 466
9.4.4 Maximum likelihood estimations . . . . . . . . . . . . . . . . . . . . 468
9.5 Statistical Hypothesis Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
9.5.1 Concept and procedures for statistic hypothesis test . . . . . . . . . 469
9.5.2 Hypothesis tests for distributions . . . . . . . . . . . . . . . . . . . . 471
9.6 Analysis of Variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
9.6.1 One-way ANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
9.6.2 Two-way ANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
9.6.3 n-way ANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
9.7 Principal Component Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 478
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
xii Contents

Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483

10 Topics on Nontraditional Mathematical Branches 485

10.1 Fuzzy Logic and Fuzzy Inference . . . . . . . . . . . . . . . . . . . . . . . . 485


10.1.1 MATLAB solutions to classical set problems . . . . . . . . . . . . . 485
10.1.2 Fuzzy sets and membership functions . . . . . . . . . . . . . . . . . 488
10.1.3 Fuzzy rules and fuzzy inference . . . . . . . . . . . . . . . . . . . . . 494
10.2 Rough Set Theory and Its Applications . . . . . . . . . . . . . . . . . . . . 496
10.2.1 Introduction to rough set theory . . . . . . . . . . . . . . . . . . . . 496
10.2.2 Data processing problem solutions using rough sets . . . . . . . . . . 499
10.3 Neural Network and Applications in Data Fitting Problems . . . . . . . . . 502
10.3.1 Fundamentals of neural networks . . . . . . . . . . . . . . . . . . . . 503
10.3.2 Feedforward neural network . . . . . . . . . . . . . . . . . . . . . . . 504
10.3.3 Radial basis neural networks and applications . . . . . . . . . . . . . 511
10.3.4 Graphical user interface for neural networks . . . . . . . . . . . . . . 514
10.4 Evolutionary Computing and Global Optimization Problem Solutions . . . 516
10.4.1 Basic idea of genetic algorithms . . . . . . . . . . . . . . . . . . . . . 517
10.4.2 Solutions to optimization problems with genetic algorithms . . . . . 518
10.4.3 Solving constrained problems . . . . . . . . . . . . . . . . . . . . . . 522
10.4.4 Solving optimization problems with Global Optimization Toolbox . 522
10.4.5 Towards accurate global minimum solutions . . . . . . . . . . . . . . 528
10.5 Wavelet Transform and Its Applications in Data Processing . . . . . . . . . 529
10.5.1 Wavelet transform and waveforms of wavelet bases . . . . . . . . . . 530
10.5.2 Wavelet transform in signal processing problems . . . . . . . . . . . 534
10.5.3 Graphical user interface in wavelets . . . . . . . . . . . . . . . . . . 538
10.6 Fractional-order Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
10.6.1 Definitions of fractional-order calculus . . . . . . . . . . . . . . . . . 539
10.6.2 Properties and relationship of various fractional-order differentiation
definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
10.6.3 Evaluating fractional-order differentiation . . . . . . . . . . . . . . . 541
10.6.4 Solving fractional-order differential equations . . . . . . . . . . . . . 547
10.6.5 Block diagram based solutions of nonlinear fractional-order ordinary
differential equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
10.6.6 Object-oriented modeling and analysis of linear fractional-order
systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
Preface

Since the first edition of this book published in 2008, computing landscape changed radically,
from cloud computing to big data science, from wearable computing to internet of things,
from deep learning to driverless cars... yet in more general sense, computing happens in all
walks of life, from falling rocks to withering leaves, from climate change to extreme weather,
from gene editing to digital matter... But one thing not changed is the scientific computing
fundamentals that cover all college mathematics. Busy students, engineers and scientists
need “fast-food” ways to compute and get problems solved reliably.
Oliver Heaviside once said “Mathematics is of two kinds, Rigorous and Physical. The
former is Narrow: the latter Bold and Broad. To have to stop to formulate rigorous
demonstrations would put a stop to most physico-mathematical inquiries. Am I to refuse
to eat because I do not fully understand the mechanism of digestion?”1 Today, we can
ask a similar question: Am I to refuse to compute because I do not fully understand the
mechanism of numerics? As we discussed in the Preface of the first edition, we need a new
way of learning scientific computing so that we can focus more on “computational thinking.”
With these goals in mind, this edition includes the following new features:
(1) A significant amount of new material is introduced, specifically: four-dimensional
volume visualization, interval limit, infinite series convergence, numerical multiple integral,
arbitrary matrix analysis, matrix power, difference equations, numerical integral trans-
forms, Laurent series, matrix equation solutions, multi-objective optimizations, dynamic
programming and shortest path problems, matrix differential equations, switching ODEs,
delay ODEs, special functions, principal component analysis, Monte Carlo algorithm, outlier
detection, radial basis network, particle swarm optimization, and a completely new section
on fractional calculus.
(2) The three-phase solution procedure proposed by the authors has been followed
throughout the book. Namely, to solve a problem, the physical explanation of the
mathematical problem to be solved is given first, followed by the methodology of how
to formulate the problem in MATLAB -compatible framework, and finally, the third phase
is to call MATLAB functions to solve the problem. The guideline is useful in real world
problem solving with lots of illustrative examples.
(3) Mathematical branches are arranged more systematically. Using the traditional styles
in mathematical presentation (as in typical mathematics courses), however, concentrations
are made on how the problems are solved. If there are existing MATLAB functions, or third-
party products, suggestions are made to use them directly. If there are not, or if existing
ones are problematic, new MATLAB functions are written and easy-to-use calling syntaxes
are designed and explained.
(4) Soon after the publication of the first edition, MATLAB R2008b was released,
from which the symbolic engine is replaced, and some of the commands, especially those
1 Edge A. Oliver Heaviside (1850–1927) - Physical mathematician. Teaching Mathematics and Its

Applications 2: 55-61, 1983.

xiii
xiv Preface

involving overload functions and Maple internal functions, cannot be used for the symbolic
computation problems. In the new edition, compatibility with the new versions of MATLAB
are supported.
(5) Enhanced examples and exercises are included to support the materials throughout
the new edition. A complete set of teaching materials, composed of about 1500 PPT slides
and a solutions manual, is provided with the book. The relevant materials can be downloaded
from the authors-maintained web-site at
https://mechatronics.ucmerced.edu/Scientific-Computing-with-MATLAB-2ndEd
Financial support from the National Natural Science Foundation of China under Grant
61174145 is acknowledged. Thanks also go to Drs. Yanliang Zhang and Lynn Crisanti
for arranging the first author’s visit to MathWorks, Natick, MA for discussing a possible
MOOC project for the book. A MOOC in Chinese is just made ready and will be released
soon, thanks to the support from Liaoning Provincial Education Bureau and Northeastern
University, China. Classroom videos in English are scheduled. New information and links
on the MOOC progress will be anounced in the above web-site.
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. For product
information, please contact:
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA, 01760-2098, USA
Tel: 508-647-7000
Fax: 508-647-7101
E-mail: info@mathworks.com
Web: http://www.mathworks.com
This new edition was suggested and supported by Sunil Nair, Publisher, CRC Press,
Taylor and Francis Group. We are thankful for Sunil’s patience and constructive comments.
We wish to specially thank Michael Davidson, Project Editor, Taylor and Francis Group,
LLC for helping us with an excellent copy-editing service. We would like to extend our
appreciation to Professor Jian-Qiao Sun of University of California, Merced for adopting the
first edition of the book for his ME021 “Engineering Computing” course and for motivating
a new edition with a bigger format size. The new materials of the book have been used in
a course entitled “MATLAB and Scientific Computing” for two semesters in Northeastern
University, China. All the students of Lang Shijun Automation Experimental Classes 1309
and 1410, especially Mr. Weiming Mi and Mr. Huaijia Lin, are acknowledged for some new
insights and the hard work of modifications of the PPT slides and solutions manual.
Last but not least, Dingyü Xue would like to thank his wife Jun Yang and his daughter
Yang Xue; YangQuan Chen would like to thank his wife Huifang Dou and his sons Duyun,
David and Daniel, for their patience, understanding and complete support throughout this
book project.

Dingyü Xue, Shenyang, Liaoning, China


YangQuan Chen, Merced, California, USA
Preface of the First Edition

Computational Thinking2 , coined and promoted by Jeannette Wing of Carnegie Mellon


University, is getting more and more attention. “It represents a universally applicable
attitude and skill set everyone, not just computer scientists, would be eager to learn and use”
as acknowledged by Dr. Wing, “Computational Thinking draws on math as its foundations.”
The present book responds to “Computational Thinking” by offering the readers enhanced
math problem solving ability and therefore, the readers can focus more on “Computational
Thinking” instead of “Computational Doing.”
The breadth and depth of one’s mathematical knowledge might not match his or her
ability to solve mathematical problems. In today’s applied science and applied engineering,
one usually needs to get the mathematical problems at hand solved efficiently in a timely
manner without complete understanding of the numerical techniques involved in the solution
process. Therefore, today, arguably, it is a trend to focus more on how to formulate the
problem in a form suitable for computer solution and on the interpretation of the results
generated from the computer. We further argue that, even without a complete preparation of
mathematics, it is possible to solve some advanced mathematical problems using a computer.
We hope this book is useful for those who frequently feel that their level of math preparation
is not high enough because they still can get their math problems at hand solved with the
encouragement gained from reading this book.
Using computers to solve mathematical problems today is ubiquitous.
MATLAB /Simulink is considered as the dominant software platform for applied math
related topics. Sometimes, one simply does not know one’s problem could be solved in a
much simpler way in MATLAB or Simulink. From what Confucius wrote, “The craftsman
who wishes to work well has first to sharpen his implements,”3 it is clear that MATLAB
is the right, already sharpened “implement.” However, a bothering practical problem is
this: MATLAB documentation only shows “this function performs this,” and what a user
with a mathematical problem at hand wants is, “Given this math problem, through what
reformulation, and then, use of what functions will get the problem solved.” Frequently, it
is very easy for one to get lost in thousands of functions offered in MATLAB plus the same
amount, if not more, of functions contributed by the MATLAB users community. Therefore,
the major contribution of this book is to bridge the gap between “problems” and “solutions”
through well grouped topics and tightly yet smoothly glued MATLAB example scripts and
reproducible MATLAB-generated plots.
A distinguishing feature of the book is the organization and presentation of the material.
Based on our teaching, research and industrial experience, we have chosen to present the
course materials following the sequence
• Computer Mathematics Languages — An Overview
• Fundamentals of MATLAB Programming
• Calculus Problems
2 http://www.cs.cmu.edu/afs/cs/usr/wing/www/Computational Thinking.pdf
3 Confucius. http://www.confucius.org/lunyu/ed1509.htm.

xv
xvi Preface of the First Edition

• Linear Algebra Problems


• Integral Transforms and Complex Variable Functions
• Nonlinear Equations and Optimization Problems
• Differential Equations Problems
• Data Interpolation and Functional Approximation Problems
• Probability and Statistics Problems
• Nontraditional Methods
In particular, in the nontraditional mathematical problem solution methods, we choose
to cover some interesting and practically important topics such as set theory and fuzzy
inference system, neural networks, wavelet transform, evolutionary optimization methods
including genetic algorithms and particle swarm optimization methods, rough set based
data analysis problems, fractional-order calculus (derivative or integral of non-integer order)
problems, etc., all with extensive problem solution examples. A dedicated CAI (computer
aided instruction) kit including more than 1,300 interactive PowerPoint slides has been
developed for this book for both instruction and self-learning purposes.
We hope that readers will enjoy playing with the scripts and changing them as they
wish for a better understanding and deeper exploration with reduced efforts. Additionally,
each chapter comes with a set of problems to strengthen the understanding of the chapter
contents. It appears that the book is presenting in certain depth some mathematical
problems. However, the ultimate objective of this book is to help the readers, after
understanding roughly the mathematical background, to avoid the tedious and complex
technical details of mathematics and find the reliable and accurate solutions to the interested
mathematical problems with the use of MATLAB computer mathematics language. There
is no doubt that the readers’ ability to tackle mathematical problems can be significantly
enhanced after reading this book.
This book can be used as a reference text for almost all college students, both
undergraduates and graduates, in almost all disciplines which require certain levels of
applied mathematics. The coverage of topics is practically broad yet with a balanced depth.
The authors also believe that this book will be a good desktop reference for many who have
graduated from college and are still involved in solving mathematical problems in their jobs.
Apart from the standard MATLAB, some of the commercial toolboxes may be
needed. For instance, the Symbolic Math Toolbox is used throughout the book to
provide alternative analytical solutions to certain problems. Optimization Toolbox, Partial
Differential Equation Toolbox, Spline Toolbox, Statistics Toolbox, Fuzzy Logic Toolbox,
Neural Network Toolbox, Wavelet Toolbox, and Genetic Algorithm and Direct Search
Toolbox may be required in corresponding chapters or sections. A lot of MATLAB functions
designed by the authors, plus some third-party free toolboxes, are also presented in the book.
For more information on MATLAB and related products, please contact
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA, 01760-2098, USA
Tel: 508-647-7000
Fax: 508-647-7101
E-mail: info@mathworks.com
Web: http://www.mathworks.com
The writing of this book started more than 5 years ago, when a Chinese version4 was
4 Xue Dingyü and Chen YangQuan, Advanced applied mathematical problem solutions using MATLAB,

Beijing: Tsinghua University Press, 2004


Preface of the First Edition xvii

published in 2004. Many researchers, professors and students have provided useful feedback
comments and input for the newly extended English version. In particular, we thank the
following professors: Xinhe Xu, Fuli Wang of Northeastern University; Hengjun Zhu of
Beijing Jiaotong University; Igor Podlubny of Technical University of Kosice, Slovakia;
Shuzhi Sam Ge of National University of Singapore, Wen Chen of Hohai University, China.
The writing of some parts of this book has been helped by Drs. Feng Pan, Daoxiang Gao,
Chunna Zhao and Dali Chen, and some of the materials are motivated by the talks with
colleagues at Northeastern University, especially Drs. Xuefeng Zhang and Haibin Shi. The
computer aided instruction kit and solution manual were developed by our graduate students
Wenbin Dong, Jun Peng, Yingying Liu, Dazhi E, Lingmin Zhang and Ying Luo.
Moreover, we are grateful to the Editors, LiMing Leong and Marsha Hecht, CRC
Press, Taylor & Francis Group, for their creative suggestions and professional help. The
“Book Program” from The MathWorks Inc., in particular, Hong Yang, MathWorks, Beijing,
Courtney Esposito, Meg Vuliez and Dee Savageau, are acknowledged for the latest MATLAB
software and technical problem support.
The authors are grateful to the following free toolbox authors, to allow the inclusion of
their contributions in the companion CD:
Dr. Brian K Birge, for particle swarm optimization toolbox (PSOt)
John D’Errico, for fminsearchbnd Toolbox
Mr. Koert Kuipers for his BNB Toolbox
Dr. Johan Löfberg, University of Linköping, Sweden for YALMIP
Mr. Xuefeng Zhang, Northeastern University, China for RSDA Toolbox
Last but not least, Dingyü Xue would like to thank his wife Jun Yang and his daughter
Yang Xue; YangQuan Chen would like to thank his wife Huifang Dou and his sons Duyun,
David and Daniel, for their patience, understanding and complete support throughout this
work.

Dingyü Xue
Northeastern University
Shenyang, China
xuedingyu@mail.neu.edu.cn

YangQuan Chen
Utah State University
Logan, Utah, USA
yqchen@ieee.org
Another random document with
no related content on Scribd:
The Race.
Here are two boys running a race. They seem to be striving to see
which can run the swiftest; which can outstrip the other.
It is pleasant to run a race, if one is young and has a good pair of
legs. I should make a bad business of it,—old and decrepit as I am,
—and having a timber toe beside. Still, I can well recollect how I
used to delight in trying my speed with my youthful companions,
when I was a boy.
I remember very well, that, when I was young, there was a boy
at school by the name of Rufus, and it chanced that he and myself
were rivals in almost everything. We were always striving to see
which should run the swiftest; which should hop the farthest; which
should excel in writing, arithmetic, &c.
Now all this was very well, except one thing. Our rivalry at last
went so far, that we desired victory more than anything else. We did
not wish so much to do things well, as to triumph over our
competitors. Nor was this all: we began at length to dislike each
other, and a very bad feeling was therefore begotten by our strife, in
our bosoms.
This was certainly wrong, and young people as well as old people
should be careful never to indulge in any strife which leads to
hatred. We should love all around us, for love is the chief source of
happiness. Anything which interferes with this is wrong.
The Swing.
Here are children indulging themselves in swinging. ’Tis a very
pleasant amusement, and is as near to flying as anything we can do.
What a thrill passes through the heart, half pleasant and half painful,
when we go up, up, up—and then down, down, down!
In the western country, the children do not have to make swings
of ropes, for they are provided by nature. The grape vines climb up
the trees, often to the height of twenty feet, and then afford good
swings for the children. If you ever visit Kentucky, or Ohio, or
Missouri, or any of those great states in the west, you will probably
see children amusing themselves in grape vine swings.
A Strange Bird.
Not long since, a man in Connecticut shot an eagle of the largest
kind. The creature fell to the ground, and being only wounded, the
man carried him home, alive.
He now gave him to another man, who took good care of the
wounded bird, and pretty soon he got quite well. The eagle became
attached to the place where he was thus taken care of, and though
he was permitted to go at large, and often flew away to a
considerable distance, he would always come back again.
He used to take his station in the door-yard, in front of the house:
if any well-dressed person came through this yard, to the house, the
eagle would sit still and make no objections; but if a ragged person
came into the yard, he would fly at him, seize his clothes with one
claw, and hold on to the grass with the other, and thus make him a
prisoner.
Often was the proprietor of the house called upon to release
persons that had been thus seized by the eagle. It is a curious fact
that the bird never attacked ragged people going to the house the
back way: it was only when they attempted to enter through the
front door, that he assailed them. What renders this story very
curious is, that the bird had never been trained to act in this manner.
This eagle had some other curious habits. He did not go out every
day to get a breakfast, dinner and supper: his custom was, about
once a week, to make a hearty meal, and that was sufficient for six
days. His most common food was the king-bird, of which he would
sometimes catch ten in the course of a few hours—and these would
suffice for his weekly repast.
This bird at last made such havoc with the poultry of the
neighbors, that the proprietor was obliged to kill him.
It seems that the aversion of this eagle to ragged people, was not
altogether singular; for a person who writes to the editor of the New
York American, says that he once knew a Baltimore Oriole, that
would always manifest the greatest anger if a shabby person came
into the room. This bird also disliked colored people, and if he could
get at them, he would fly in their faces, and peck at them very
spitefully—while he did no such thing to white people.

The following letter has been some time in hand. Will our little
friend, the writer, forgive us for not inserting it sooner? Our
correspondents must remember that we have many things to attend
to, and if some of their favors seem to be overlooked, we hope they
will not scold.
My dear Mr. Merry:
I have been long wanting to write to you, so many of your
subscribers have been writing to you. I could not write to you
sooner, because I did not know my letter would go by the
mail.
Many of the stories in the Museum are quite interesting. I
have often tried to read your history of your own life,
through. I should have begun when your Museum first came
out, but it happened that I did not. “Philip Brusque” I began
too, but, as my brother was going up the river in a
steamboat, he wanted to take the number, so that I had to
leave off reading it.
In your number before the last I liked the “Two Friends.”
Many of the children like “The Siberian Sable-hunter,” but I do
not fancy it much, as there are so many hard names in it.
I am one of your little black-eyed subscribers: my brother
Benjamin is one of your blue-eyed subscribers. He does not
read as many of your Museums as I do, for he is away from
home a great part of the time, and when he gets home he
hardly ever thinks of reading them. I am always glad when I
hear that your Museum is come, and yet, the last time, they
kept it from me for a day and a night. Was not that very
hard?
My little sister, Lydia, is yet too young to read, and does
not even know her A, B, C; but I know them well enough. I
like your plain, simple stories best. I believe my brother likes
the ones that are not simple. In your number, a great while
ago, is a song by the name of “Jack Frost,” which I like very
much, and many other pieces of your poetry. “Discontented
Betty” I like too. I have been hurrying off with my lessons, so
that I could write to you; but, pray, do not think that I write
this myself, for I do not even know how to make a letter. My
sister writes for me.
I am in constant fear that we shall have to give up your
Museum, but I hope we shall not. I thought that I would have
to send my letter by the man that brought the Museum, but
my father told me that I need not, but that I should send it
by the mail. I hope your Museum will not end very soon, but
will keep on a long while. I have found out three of your
names, Parley, Merry and Goodrich. I want to see you very
much. My sister Mary is collecting autographs, and has got
one of yours, which I think to be quite a decent hand for such
an old man. I hope this letter will reach you safely. I wonder
if the one my brother William wrote to you, a long time ago,
ever reached you.
I have read some of your other books, as we have got
some others. I consider myself a very poor reader, if others
do not. I had a beautiful book given to me on New Year’s day,
by the name of “Flower People.” But I cannot think of
anything more to say, and so, Mr. Merry, good-bye.
E. O. B.
P.S. I have thought of one other thing to say, Mr. Merry,
and it is that I wish you would answer this letter.
MERRY’S MUSEUM.

Vol. VI. SEPTEMBER, 1843. No. 3.

September.
We have now reached the ninth month in the year—the first
month of autumn—September—the pleasantest month of all the
twelve. It is true the leaves of the trees are beginning to turn yellow;
many of the birds are departing for more southern climes; the
evenings are getting chilly; the summer flowers are gone; and all
around there is an air of soberness, almost of sadness. Yet there is
something in all this, that makes the heart content, tranquil and
happy.
The earth is now abounding with fruit. The peaches, the plums,
the pears, the apples, the grapes, are ripe, and seem to invite us to
taste them. How pleasant it is to be in the country now! Say, my
little friends, is not September the finest of all the months?
Jumping Rabbit’s Story.
chapter iii.

The return of our party.—Sports and festivities.


After I had been about a month in the village, a swift Indian,
despatched by the warriors who had been absent on an expedition
against some distant tribes, came in, and announced that the whole
party were near at hand, and would enter the village the following
morning. Preparations were therefore made to receive them.
All was bustle and activity, though this seemed to consist more in
running about, and chattering like a set of magpies, than anything
else. The children leaped, frolicked, shouted, and fought mimic
battles as well as real ones, in which they bit, scratched, kicked and
pulled hair, in honor of the coming celebration. The women went
about from tent to tent, talking with great animation and keeping up
the hum, which might be heard at the farther extremity of the
village.
Evening at last came, but there was no cessation of the
excitement. The greater part of the night was spent in talking,
squabbling, dancing, jumping, leaping and yelling. At length the
morning came, and just as the sun was rising, an Indian, painted
blue and red, carrying on his head the skin taken from the pate of a
grizzly bear, was seen creeping along in the edge of the adjacent
wood. He was soon followed by another, painted in a similar manner,
with the horns and pate of a buffalo upon his head. Others
succeeded, all of them painted and dressed in the most wild and
fantastic manner, until about a hundred warriors had gathered in the
thickets of the forest, close to the village.
A pause of at least half an hour ensued. All within the wood was
silent, and not a trace of the savages that lurked in its bosom, could
be discovered. The women, children and old men of the village had
gathered in the open space encircled by the tents, where they
awaited the coming spectacle in breathless expectation.
At last, a wild yell, as if a thousand demons filled the air, broke
from the forest. In an instant after, the warriors started from their
cover and ran toward the village with the greatest swiftness.
Approaching the group of women and children, they formed
themselves in a circle and began to dance in a most violent manner.
They leaped, jumped, ran, brandished their weapons, screamed,
chattered, and appeared more like infernal spirits than human
creatures. They were all on foot except about a dozen, who were on
horseback, and attired in the most fantastic manner. These rode
round the circle with great swiftness, flourishing their long spears,
and performing a sort of wild mimic battle.
Nothing could be more fierce and frightful than the whole scene,
yet the women and children were greatly delighted, and evinced
their ecstasy by uproarious acclamations. The warriors were excited
by this applause to greater feats, and for about an hour they kept up
their savage revel. They seemed to be as proud of their greasy paint
and their savage foppery, as a well-dressed company of militia
marching on a muster-day through one of our villages. A bear’s or
buffalo’s pate was fully equal to a cocked hat; a raccoon’s or
oppossum’s hide was equivalent to a pair of epaulettes; the bow and
arrow were an offset to the sword.
But the Indian warriors had one advantage over our training-day
soldiers. They had been in actual service, and carried with them
evidences of their victory. Several of them bore in their hands large
bundles of bloody scalps, which they had taken from their enemies,
and these they flourished in the faces of the admiring spectators. It
is obvious that the same vanity and foppery which are found in the
fair-weather soldiers of towns and cities, belong to the savage
warrior of the wilderness.
At length, the ceremony was over, and the savages dispersed
themselves to their several wigwams. The next day, however, they
had a great exhibition, which was a kind of war-dance, in which the
warriors attempted to exhibit their several battles and exploits. It
was in fact a sort of pantomime, in which several of the Indians
displayed great powers of mimicry. Though I was not much
accustomed to these things, I understood a good deal of what the
Indians meant by their performances.
One of these fellows amused me very much. He seemed to be
fond of fun, and, like the clown in a circus, appeared to think more
of making a laugh than anything else. It seemed from his
representation, that, on one occasion, he was sent to spy out the
situation of a party of Indians, whom they intended to attack. It was
night, and as he was proceeding along a deer path in the forest, he
chanced to see a skunk immediately before him. The creature stood
still, and positively refused to stir a step.
The Indian hesitated for some time what to do, but at last he put
an arrow to the bowstring, and shot the impertinent animal to the
heart. The air was, however, immediately filled with the creature’s
effluvia, and the Indians, whom the spy was seeking, being ever on
the watch, were startled by the circumstance, and the spy himself
was obliged to retreat for safety. This whole story was easily
comprehended from the admirable mimicry of the actor. Nothing
could exceed his drollery, except the applause of the spectators. He
seemed to have the reputation of an established wag, and, like
Andrews at the late Tremont Theatre, he could hardly turn his eye,
or crook his finger, but the action was followed with bursts of
applause.
There was one thing that characterized all the warriors, and that
was a love of boasting and self-glorification. Every one represented
himself as a hero and as performing the most wonderful feats of
strength and valor. Boasting, I suspect, is a thing that naturally
belongs to those who have little refinement, and modesty is
doubtless the fruit of those finer sentiments which belong to
civilization.
For several days there were sports and festivities, and every one
seemed to give himself up to amusement. The warriors had brought
home with them a young Indian prisoner, who was about eighteen
years old. He was a fine, proud-looking fellow, and when he was
brought out and encircled by all the Indians, he seemed to survey
them with a kind of scorn. He was tied to a stake, and the young
Indians, stationed at a certain distance, were allowed to shoot their
arrows at him. Several of them hit him, and the blood trickled freely
down his body. He stood unmoved, however, and seemed not to
notice the wounds. The women then surrounded him, and jeered at
him, making mouths, and pinching his flesh, and punching him with
sharp sticks.
At last, it was determined by the warriors, to let him loose upon
the prairie and give him a chance of escape. The warriors were to
pursue him. If he was retaken, he was to die; if he outran his
pursuers, he was to have his liberty.
The prisoner was unbound and placed at the distance of about six
rods in advance of those who were to pursue him; the signal was
given, and he departed. He seemed fleet as the mountain deer, and
life was the wager for which he ran. He was, however, pursued by
more than a dozen Indians, scarcely less lightfooted than himself. He
struck across the prairie, which lay stretched out for several miles,
almost as level as the sea, and in the distance, was skirted by the
forest.
He kept in advance of his pursuers, who strained every nerve to
overtake him. On he flew, casting an occasional glance backward.
The yells broke often from his pursuers, but he was silent. It was for
life that he fled, and he would not waste a breath. On he sped, and
as he and his followers seemed to grow less and less in the distance,
my eyes grew weary of the scene. But such was the interest that I
felt for the poor fugitive that I kept my gaze bent upon the chase for
almost an hour.
The Indians seemed at last in the remote distance to be dwindled
to the size of insects; they still strained every limb, though they
seemed scarcely to move; they still yelled with all their might, but
only an occasional faint echo reached our ears. At last, the fugitive
plunged into the forest; his pursuers followed, and they were lost to
the view. After the lapse of several hours, the pursuing party
returned, without their prisoner. He was at liberty in the unbounded
forest.
The Smuggler.
Who would imagine that a dog had been made serviceable as a
clerk, and thus made for his master upwards of a hundred thousand
crowns? And yet an incident like this happened upwards of forty
years since. One of those industrious beings who know how to live
by skinning flints, determined, in extreme poverty, to engage in
trade. He preferred that species of merchandise which occupied the
least space, and was calculated to yield the greatest profit. He
borrowed a small sum of money from a friend, and repairing to
Flanders, he there bought pieces of lace, which he smuggled into
France in the following manner.
He trained an active spaniel to his purpose. He caused him to be
shaved, and procured for him the skin of another dog, of the same
hair and the same shape. He then rolled his lace round the body of
his dog, and put over it the garment of the stranger so adroitly, that
it was impossible to discover the trick. The lace being thus arranged,
he would say to his docile messenger, “Forward, my friend.” At the
words, the dog would start, and pass boldly through the gates of
Malines or Valenciennes, in the face of the vigilant officer placed
there to prevent smuggling. Having thus passed the bounds, he
would wait his master at a little distance in the open country. There
they mutually caressed and feasted, and the merchant placed his
rich packages in a place of security, renewing his occupation as
occasion required. Such was the success of this smuggler that in less
than five or six years he amassed a handsome fortune and kept his
coach.
Envy pursues the prosperous. A mischievous neighbor at length
betrayed the lace merchant; notwithstanding all his efforts to
disguise the dog, he was suspected, watched, and discovered.
But the cunning of the dog was equal to the emergency. Did the
spies of the custom-house expect him at one gate,—he saw them at
a distance, and instantly ran to another. Were all the gates shut
against him,—he overcame every obstacle; sometimes he leaped
over the wall; at others, passing secretly behind a carriage or
running between the legs of travellers, he would thus accomplish his
aim. One day, however, while swimming a stream near Malines, he
was shot, and died in the water. There was then about him five
thousand crowns’ worth of lace—the loss of which did not afflict his
master, but he was inconsolable for the loss of his faithful dog.
The Poet’s Dog.
The manner in which Pope, the great English poet, was preserved
by the sagacity of his dog, is truly remarkable. This animal, who was
called Marquis, could never agree with a favorite servant of his
master’s; he constantly growled when near him, and would even
show his teeth whenever this servant approached. Although the poet
was singularly attached to this dog,—who was a spaniel of the
largest species,—yet, on account of his extreme neatness, which he
pushed almost to excess, he would never allow him to remain in his
chamber. Nevertheless, in spite of positive orders, the spaniel would
frequently sneak, towards evening, into the apartment of his master,
and would not be driven from it without the greatest difficulty.
One evening, having slipped very softly in without being
perceived, the animal placed himself under the bed of his master,
and remained there. Towards morning, the servant rushed hastily
into the chamber of Pope. At this moment, the dog suddenly left his
post and leaped on the villain, who was armed with a pistol. The
poet started from his sleep; he threw open the window to call for
assistance, and beheld three highwaymen, who had been introduced
by his servant into the garden of his villa, for the purpose of robbing
him. Disconcerted by this unforeseen accident, the robbers hesitated
a moment, and then took flight. The servant, thus betrayed by the
watchful dog, was sentenced to forfeit his life.
The same dog, shortly after this singular event, exhibited another
proof of his remarkable instinct. Pope, reposing one afternoon in a
little wood about twelve miles distant from his house, lost a watch of
great value. On returning home, the poet wished to know the hour,
and found his watch was not in his fob. Two or three hours had
elapsed, and a violent storm was just commencing.
The poet called his dog, and making a sign, which Marquis very
well understood, he said, “I have lost my watch—go look for it.” At
these words Marquis departed, and repaired, no doubt, to every spot
at which his master stopped. It happened that the poor animal was
so long occupied in the search as to create great anxiety, for
midnight had arrived, and he had not returned. What was the
astonishment of Pope, when, on rising in the morning, he opened his
chamber door, and there beheld his faithful messenger lying quietly
and holding in his mouth the splendid jewel, with which he had
returned perfectly uninjured, and which was the more highly valued
by the poet, as it had been presented to him by the queen of
England.
A Shark Story.
Some years ago, while sitting on the quarter-deck of a West
Indiaman, borne rapidly along before the trade wind, the captain
and passengers were amusing themselves by telling stories and
cracking jokes to beguile the sameness of the voyage. It came at
last to the turn of a gentleman remarkable for his love of cigars and
taciturnity; one who enjoyed a good anecdote, but abhorred the
trouble of relating it himself. He was, however, so strongly
importuned on this occasion, that with much reluctance he related
the following, by fits and starts, filling up each pause by vigorous
whiffs of his favorite weed:—
In the year 1820, the good ship Rambler sailed from Greenock,
with goods and passengers, towards Jamaica. She had crossed the
tropic. One day, when nearly becalmed, the steward, who had the
care of the captain’s plate, had occasion, after dinner, to wash some
spoons and other articles in a bucket, and thinking he had taken all
out of the water, he chucked it over the gangway, when, to his
vexation, he found he had thrown out with it a valuable silver table
spoon. He saw it shining through the clear blue ocean, and wavering
from side to side as it sank from his view. Several sharks had been
observed near the ship, and it is known they generally dart upon
anything white, a piece of rag often serving for a bait. He did not,
however, observe any of them near the spot at the time; and the
captain being a testy man, he kept the secret of the loss to himself,
and the matter was soon forgotten.
The ship in due time reached Jamaica, and when the
circumstance became known, the value of the spoon was deducted
from the wages of the steward. The vessel lay some time at
Kingston, received on board a cargo of sugar, and proceeded on her
homeward voyage. When crossing nearly the same spot on the
aqueous world where the spoon was lost, a number of sharks again
showed their tail fins above the water as they cut along the ship’s
side, or in her wake; and a shark hook being baited with a piece of
salt pork, was lowered over the stern. Presently one of the largest of
these devouring monsters, or, as the sailors call them, “Sea
Lawyers,” half turning on its side, took the huge bait into his pig-like
but tremendous jaws, and was securely hooked.
The fish was with difficulty hauled alongside and hoisted on deck,
where it flapped about and showed prodigious strength and tenacity
of life. When its struggles were ended by a blow on the head with a
mallet, one of the men proceeded to open it. His jack-knife soon
came in contact with something in its belly, and—said the narrator,
with earnestness, “what do you think was really found?” “Why, the
spoon, of course!” exclaimed the listeners simultaneously. “The
spoon!” he rejoined, with a smile, “No! no!” “What then?” they
hastily inquired. “Why, nothing but the entrails, to be sure!”
The taciturnity of the waggish messmate was not again disturbed
for another story during the voyage.

Joyful Meeting.—A few days since, at Buffalo, a boat load of


Germans landed from the canal, evidently direct from Germany.
Among them was an old lady and some three or four children, quite
grown up. Several tavern-keepers were around the boat, as is
customary, to solicit patronage from the emigrants, and one of these
approached the old lady, who, immediately upon seeing him, threw
herself upon his neck and wept. The children also embraced him,
and tears and smiles alternately bore their sway.
The explanation of the scene given was, that the old lady was on
her way to Detroit in search of her husband, who had emigrated
some years previous, and she had thus unexpectedly fallen upon
him at this place. What a meeting!

Mirage.—Brig. Wm. Ash, 6th July, 1843, 8-1/4 P. M.—Being at


anchor off the Pilgrims, river St. Lawrence, to wait the tide—fine
weather and light wind, I was called to by our pilot, Wm. Russell,
saying there was a ship sailing in the air. When, looking in the air, in
the direction pointed out, I distinctly saw the appearance of a full-
rigged ship, under full sail, passing very swiftly over the land, in a S.
S. W. direction. I watched it with the spyglass, until, to my view, it
vanished into smoke. It was witnessed also by the pilot’s apprentice,
Dennis Glen.
Wm. Morrish, Master.

“Our Father”—said a bishop, who was benevolently teaching the


Lord’s prayer to a poor beggar boy, to whom he had just given a
hard crust of bread. “What,—not our Father,” said the boy. “Yes,”
said the bishop, “our Father.” “Then we are brothers; and an’t you
ashamed to offer your brother such a crust as this?”
Eccentric Characters

old boots, of ripon

Among the infinite variety of human countenances, none was ever


better calculated to excite laughter, than that of the person whose
portrait we have given above. He was servant of an inn at Ripon, in
Yorkshire, England, where it was part of his duty to wait upon
travellers and take charge of boots and shoes. Hence, he went under
the title of Old Boots.
It was his custom to introduce himself into the room, with a pair
of slippers in one hand and a boot-jack in the other. His features at
once amazed and diverted every visitor; for nature had given him
such length of nose and chin, and brought them so near together,
that he could hold a piece of money between them, like a thumb
and finger, or a pair of nippers. This feat he was always ready to
perform, and he became, in fact, the great curiosity of the place.
captain snarly.

There is nothing more easy than to find fault, particularly after a


little practice; for the thing grows upon us as we get used to it. Of
all countries, there is none that furnishes such inveterate fault-
finders, as England. Many of them are very much addicted to
grumbling, even in their own country; but when out of it, everything
goes wrong. The other day I saw a boy with a snapping turtle, which
he had just taken out of a muddy pond. The creature was very
savage—and if you pointed your finger at him, he would snap at you
in the most spiteful manner. Nothing could move around him, but he
would snap at it. I must confess that when I looked at the creature,
he put me in mind of Captain Hall, Mrs. Trollope, Major Hamilton,
and other English travellers, who have visited our country, and gone
home and reviled everything they saw.
But we must now turn to the subject of the present article,
Joseph Cappur, whose portrait is placed at the head of this article,
and whom we call Captain Snarly. He lived at a place near London,
called Kensington, and though he was rich, his habits were
exceedingly stingy. He was chiefly famous for his love of finding
fault; and he loved nothing so well as a snarling companion. One
day, as he was walking about the place, he came to a small tavern.
He entered, and asked the landlord if he could furnish him lodgings.
“No!” said the landlord, fiercely—and then ordered him out of the
house. This pleased old Snarly so much, that he immediately took up
his abode at the place, and there he lived for twenty-five years. His
greatest sport was to poke fun at the landlord and make him mad
with fury.
Old Snarly was a great politician and a champion of the king. He
would let nobody speak ill of either. He hated the French, and one of
his chief occupations was to kill flies, which he called Frenchmen. He
died at the age of seventy-two, and left one hundred and fifty
thousand dollars to his relatives, whom he would not see while he
was living.

john baker.
This man was wonderful for the power he had over the muscles of
his face. Though he had not a long nose, yet he could move it in
such a manner as to take a piece of money up from a table between
his nose and chin, and hold it there firmly. Nay more, he could draw
his nose down in such a manner as to take it into his mouth, and
then his under lip appeared even with his eyes and forehead! He
could also put the stem of a tobacco pipe through his nose, and then
take up a wine glass and hold it between his nose and chin, as
shown in the portrait.
The performances of this man astonished all who saw him, and
several eminent medical men expressed great wonder at his feats.
He was both a sailor and a soldier, in the British service, and served
in the revolutionary war, in America. He was twice married, and had
a family of thirteen children. His life was one of great vicissitude,
and when an old man, he was famous at Wapping, for his stories
about what he had seen and done. He had a good opinion of
himself, and used generally to wind off his long tales with the
declaration that his equal was not to be found in the whole world!

You might also like