100% found this document useful (1 vote)
10 views

Numerical Methods in Engineering with MATLAB Jaan Kiusalaas download

The document is about 'Numerical Methods in Engineering with MATLAB' by Jaan Kiusalaas, which serves as a textbook for engineering students and a reference for professionals. It covers various numerical methods relevant to engineering problems, supported by MATLAB programming examples. The second edition includes updates such as new MATLAB features and additional methods for optimization and interpolation.

Uploaded by

somjitigaryq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
10 views

Numerical Methods in Engineering with MATLAB Jaan Kiusalaas download

The document is about 'Numerical Methods in Engineering with MATLAB' by Jaan Kiusalaas, which serves as a textbook for engineering students and a reference for professionals. It covers various numerical methods relevant to engineering problems, supported by MATLAB programming examples. The second edition includes updates such as new MATLAB features and additional methods for optimization and interpolation.

Uploaded by

somjitigaryq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Numerical Methods in Engineering with MATLAB

Jaan Kiusalaas download

https://ebookname.com/product/numerical-methods-in-engineering-
with-matlab-jaan-kiusalaas/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Numerical Methods in Engineering With Python First


Edition Jaan Kiusalaas

https://ebookname.com/product/numerical-methods-in-engineering-
with-python-first-edition-jaan-kiusalaas/

Numerical Methods for Chemical Engineering Applications


in MATLAB 1st Edition Kenneth J. Beers

https://ebookname.com/product/numerical-methods-for-chemical-
engineering-applications-in-matlab-1st-edition-kenneth-j-beers/

Numerical and Analytical Methods with MATLAB 1st


Edition William Bober

https://ebookname.com/product/numerical-and-analytical-methods-
with-matlab-1st-edition-william-bober/

Exploring Animal Social Networks 1st Edition Darren P.


Croft

https://ebookname.com/product/exploring-animal-social-
networks-1st-edition-darren-p-croft/
Keats The Myth of the Hero Dorothy Bendon Van Ghent
(Editor)

https://ebookname.com/product/keats-the-myth-of-the-hero-dorothy-
bendon-van-ghent-editor/

The Politics of Denial Israel and the Palestinian


Refugee Problem 1st Edition Nur Masalha

https://ebookname.com/product/the-politics-of-denial-israel-and-
the-palestinian-refugee-problem-1st-edition-nur-masalha/

Stigmata Escaping Texts Routledge Classics 2nd Edition


Hélène Cixous

https://ebookname.com/product/stigmata-escaping-texts-routledge-
classics-2nd-edition-helene-cixous/

Voice over LTE EPS and IMS Networks 1st Edition André
Pérez

https://ebookname.com/product/voice-over-lte-eps-and-ims-
networks-1st-edition-andre-perez/

Inclusion and Diversity Meeting the Needs of All


Students 1st Edition Sue Grace

https://ebookname.com/product/inclusion-and-diversity-meeting-
the-needs-of-all-students-1st-edition-sue-grace/
Hacking Leadership The 11 Gaps Every Business Needs to
Close and the Secrets to Closing Them Quickly 1st
Edition Mike Myatt

https://ebookname.com/product/hacking-leadership-the-11-gaps-
every-business-needs-to-close-and-the-secrets-to-closing-them-
quickly-1st-edition-mike-myatt/
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

This page intentionally left blank

ii
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

Numerical Methods in Engineering with MATLABR

Second Edition


R
Numerical Methods in Engineering with MATLAB is a text for engi-
neering students and a reference for practicing engineers. The choice of
numerical methods was based on their relevance to engineering prob-
lems. Every method is discussed thoroughly and illustrated with prob-
lems involving both hand computation and programming. MATLAB
M-files accompany each method and are available on the book Web
site. This code is made simple and easy to understand by avoiding com-
plex bookkeeping schemes while maintaining the essential features of
the method. MATLAB was chosen as the example language because of
its ubiquitous use in engineering studies and practice. This new edi-
tion includes the new MATLAB anonymous functions, which allow the
programmer to embed functions into the program rather than storing
them as separate files. Other changes include the addition of rational
function interpolation in Chapter 3, the addition of Ridder’s method in
place of Brent’s method in Chapter 4, and the addition of the downhill
simplex method in place of the Fletcher–Reeves method of optimization
in Chapter 10.

Jaan Kiusalaas is a Professor Emeritus in the Department of Engineer-


ing Science and Mechanics at the Pennsylvania State University. He has
taught numerical methods, including finite element and boundary ele-
ment methods, for more than 30 years. He is also the co-author of four
other books – Engineering Mechanics: Statics, Engineering Mechanics:
Dynamics, Mechanics of Materials, and Numerical Methods in Engineer-
ing with Python, Second Edition.

i
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

ii
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

NUMERICAL
METHODS IN
ENGINEERING

R
WITH MATLAB

Second Edition

Jaan Kiusalaas
Pennsylvania State University

iii
CAMBRIDGE UNIVERSITY PRESS
Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore,
São Paulo, Delhi, Dubai, Tokyo

Cambridge University Press


The Edinburgh Building, Cambridge CB2 8RU, UK

Published in the United States of America by Cambridge University Press, New York

www.cambridge.org
Information on this title: www.cambridge.org/9780521191333
© Jaan Kiusalaas 2010

This publication is in copyright. Subject to statutory exception and to the


provision of relevant collective licensing agreements, no reproduction of any part
may take place without the written permission of Cambridge University Press.
First published in print format 2009

ISBN-13 978-0-511-64033-9 eBook (EBL)

ISBN-13 978-0-521-19133-3 Hardback

Cambridge University Press has no responsibility for the persistence or accuracy


of urls for external or third-party internet websites referred to in this publication,
and does not guarantee that any content on such websites is, or will remain,
accurate or appropriate.
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

Contents

Preface to the First Edition . . . . . . . . . . . . . ix

Preface to the Second Edition. . . . . . . . . .xi

1 Introduction to MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Quick Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Data Types and Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4 Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.6 Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.7 Array Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.8 Writing and Running Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.9 Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

2 Systems of Linear Algebraic Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27


2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2 Gauss Elimination Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
2.3 LU Decomposition Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Problem Set 2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.4 Symmetric and Banded Coefficient Matrices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
2.5 Pivoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Problem Set 2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

2.6 Matrix Inversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

2.7 Iterative Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82
Problem Set 2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

3 Interpolation and Curve Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100


3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
3.2 Polynomial Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
3.3 Interpolation with Cubic Spline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Problem Set 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
3.4 Least-Squares Fit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
Problem Set 3.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

v
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

vi Contents

4 Roots of Equations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142


4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
4.2 Incremental Search Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
4.3 Method of Bisection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
4.4 Methods Based on Linear Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
4.5 Newton–Raphson Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
4.6 Systems of Equations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159
Problem Set 4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

4.7 Zeros of Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Problem Set 4.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

5 Numerical Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181


5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5.2 Finite Difference Approximations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5.3 Richardson Extrapolation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186
5.4 Derivatives by Interpolation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
Problem Set 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

6 Numerical Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198


6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
6.2 Newton–Cotes Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
6.3 Romberg Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Problem Set 6.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.4 Gaussian Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Problem Set 6.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

6.5 Multiple Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Problem Set 6.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

7 Initial Value Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248


7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
7.2 Taylor Series Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249
7.3 Runge–Kutta Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Problem Set 7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
7.4 Stability and Stiffness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
7.5 Adaptive Runge–Kutta Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
7.6 Bulirsch–Stoer Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
Problem Set 7.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

8 Two-Point Boundary Value Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295


8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
8.2 Shooting Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Problem Set 8.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
8.3 Finite Difference Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310
Problem Set 8.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319

9 Symmetric Matrix Eigenvalue Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325


9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
9.2 Jacobi Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
9.3 Inverse Power and Power Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .343
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

vii Contents

Problem Set 9.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350


9.4 Householder Reduction to Tridiagonal Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
9.5 Eigenvalues of Symmetric Tridiagonal Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Problem Set 9.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

10 Introduction to Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380


10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
10.2 Minimization Along a Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
10.3 Powell’s Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .389
10.4 Downhill Simplex Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .399
Problem Set 10.1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406

Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
A1 Taylor Series. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415
A2 Matrix Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418

List of Computer Programs . . . . . . . . . . . 423


Chapter 2. . . . . . . . . . . . . . . . . . . . 423
Chapter 3 . . . . . . . . . . . . . . . . . . . .423
Chapter 4 . . . . . . . . . . . . . . . . . . . .424
Chapter 6 . . . . . . . . . . . . . . . . . . . . 424
Chapter 7 . . . . . . . . . . . . . . . . . . . . 424
Chapter 8 . . . . . . . . . . . . . . . . . . . . 424
Chapter 9 . . . . . . . . . . . . . . . . . . . . 425
Chapter 10 . . . . . . . . . . . . . . . . . . . .425

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .427
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

viii
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

Preface to the First Edition

This book is targeted primarily toward engineers and engineering students of ad-
vanced standing (sophomores, seniors, and graduate students). Familiarity with a
computer language is required; knowledge of engineering mechanics (statics, dy-
namics, and mechanics of materials) is useful, but not essential.
The text places emphasis on numerical methods, not programming. Most engi-
neers are not programmers, but problem solvers. They want to know what methods
can be applied to a given problem, what their strengths and pitfalls are, and how to
implement them. Engineers are not expected to write computer code for basic tasks
from scratch; they are more likely to utilize functions and subroutines that have been
already written and tested. Thus programming by engineers is largely confined to
assembling existing bits of code into a coherent package that solves the problem at
hand.
The “bit” of code is usually a function that implements a specific task. For the
user the details of the code are of secondary importance. What matters is the inter-
face (what goes in and what comes out) and an understanding of the method on
which the algorithm is based. Since no numerical algorithm is infallible, the impor-
tance of understanding the underlying method cannot be overemphasized; it is, in
fact, the rationale behind learning numerical methods.
This book attempts to conform to the views outlined above. Each numerical
method is explained in detail and its shortcomings are pointed out. The examples
that follow individual topics fall into two categories: hand computations that illus-
trate the inner workings of the method, and small programs that show how the com-
puter code is utilized in solving a problem. Problems that require programming are
marked with .
The material consists of the usual topics covered in an engineering course on nu-
merical methods: solution of equations, interpolation and data fitting, numerical dif-
ferentiation and integration, solution of ordinary differential equations, and eigen-
value problems. The choice of methods within each topic is tilted toward relevance
to engineering problems. For example, there is an extensive discussion of symmetric,
sparsely populated coefficient matrices in the solution of simultaneous equations.

ix
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

x Preface to the First Edition

In the same vein, the solution of eigenvalue problems concentrates on methods that
efficiently extract specific eigenvalues from banded matrices.
An important criterion used in the selection of methods was clarity. Algorithms
requiring overly complex bookkeeping were rejected regardless of their efficiency and
robustness. This decision, which was taken with great reluctance, is in keeping with
the intent to avoid emphasis on programming.
The selection of algorithms was also influenced by current practice. This disqual-
ified several well-known historical methods that have been overtaken by more recent
developments. For example, the secant method for finding roots of equations was
omitted as having no advantages over Ridder’s method. For the same reason, the mul-
tistep methods used to solve differential equations (e.g., Milne and Adams methods)
were left out in favor of the adaptive Runge–Kutta and Bulirsch–Stoer methods.
Notably absent is a chapter on partial differential equations. It was felt that
this topic is best treated by finite element or boundary element methods, which
are outside the scope of this book. The finite difference model, which is commonly
introduced in numerical methods texts, is just too impractical in handling curved
boundaries.
As usual, the book contains more material than can be covered in a three-credit
course. The topics that can be skipped without loss of continuity are tagged with an
asterisk (*).
R
The programs listed in this book were tested with MATLAB R2008b under
R
Windows XP.
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

Preface to the Second Edition

The second edition was largely precipitated by the introduction of anonymous func-
tions into MATLAB. This feature, which allows us to embed functions in a program,
rather than storing them in separate files, helps to alleviate the scourge of MATLAB
programmers – proliferation of small files. In this edition, we have recoded all the
example programs that could benefit from anonymous functions.
We also took the opportunity to make a few changes in the material covered:

• Rational function interpolation was added to Chapter 3.


• Brent’s method of root finding in Chapter 4 was replaced by Ridder’s method.
The full-blown algorithm of Brent is a complicated procedure involving elaborate
bookkeeping (a simplified version was presented in the first edition). Ridder’s
method is as robust and almost as efficient as Brent’s method, but much easier
to understand.
• The Fletcher–Reeves method of optimization was dropped in favor of the down-
hill simplex method in Chapter 10. Fletcher–Reeves is a first-order method that
requires the knowledge of gradients of the merit function. Since there are few
practical problems where the gradients are available, the method is of limited
utility. The downhill simplex algorithm is a very robust (but slow) zero-order
method that often works where faster methods fail.

xi
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

xii
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

1 Introduction to MATLAB

1.1 Quick Overview



R
This chapter is not intended to be a comprehensive manual of MATLAB . Our sole
aim is to provide sufficient information to give you a good start. If you are familiar
with another computer language, and we assume that you are, it is not difficult to
pick up the rest as you go.
MATLAB is a high-level computer language for scientific computing and
data visualization built around an interactive programming environment. It is
becoming the premier platform for scientific computing at educational institu-
tions and research establishments. The great advantage of an interactive system is
that programs can be tested and debugged quickly, allowing the user to concen-
trate more on the principles behind the program and less on programming itself.
Since there is no need to compile, link, and execute after each correction,
MATLAB programs can be developed in a much shorter time than equivalent
FORTRAN or C programs. On the negative side, MATLAB does not produce stand-
alone applications – the programs can be run only on computers that have MATLAB
installed.
MATLAB has other advantages over mainstream languages that contribute to
rapid program development:

• MATLAB contains a large number of functions that access proven numerical li-
braries, such as LINPACK and EISPACK. This means that many common tasks
(e.g., solution of simultaneous equations) can be accomplished with a single
function call.
• There is extensive graphics support that allows the results of computations to be
plotted with a few statements.
• All numerical objects are treated as double-precision arrays. Thus there is no
need to declare data types and carry out type conversions.
• MATLAB programs are clean and easy to read; they lack the syntactic clutter of
some mainstream languages (e.g., C).

1
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

2 Introduction to MATLAB

The syntax of MATLAB resembles that of FORTRAN. To get an idea of the simi-
larities, let us compare the codes written in the two languages for solution of simul-
taneous equations Ax = b by Gauss elimination (do not worry about understanding
the inner workings of the programs). Here is the subroutine in FORTRAN 90:

subroutine gauss(A,b,n)
use prec_mod
implicit none
real(DP), dimension(:,:), intent(in out) :: A
real(DP), dimension(:), intent(in out) :: b
integer, intent(in) :: n
real(DP) :: lambda
integer :: i,k
! --------------Elimination phase--------------
do k = 1,n-1
do i = k+1,n
if(A(i,k) /= 0) then
lambda = A(i,k)/A(k,k)
A(i,k+1:n) = A(i,k+1:n) - lambda*A(k,k+1:n)
b(i) = b(i) - lambda*b(k)
end if
end do
end do
! ------------Back substitution phase----------
do k = n,1,-1
b(k) = (b(k) - sum(A(k,k+1:n)*b(k+1:n)))/A(k,k)
end do
return
end subroutine gauss

The statement use prec mod tells the compiler to load the module prec mod
(not shown here), which defines the word length DP for floating-point numbers. Also
note the use of array sections, such as a(k,k+1:n), a very useful feature that was not
available in previous versions of FORTRAN.
The equivalent MATLAB function is (MATLAB does not have subroutines):

function b = gauss(A,b)
n = length(b);
%-----------------Elimination phase-------------
for k = 1:n-1
for i = k+1:n
if A(i,k) ˜= 0
lambda = A(i,k)/A(k,k);
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

3 1.1 Quick Overview

A(i,k+1:n) = A(i,k+1:n) - lambda*A(k,k+1:n);


b(i)= b(i) - lambda*b(k);
end
end
end
%--------------Back substitution phase-----------
for k = n:-1:1
b(k) = (b(k) - A(k,k+1:n)*b(k+1:n))/A(k,k);
end

Simultaneous equations can also be solved in MATLAB with the simple com-
mand A\b (see below).
MATLAB can be operated in the interactive mode through its command window,
where each command is executed immediately upon its entry. In this mode MATLAB
acts like an electronic calculator. Here is an example of an interactive session for the
solution of simultaneous equations:

>> A = [2 1 0; -1 2 2; 0 1 4]; % Input 3 x 3 matrix.


>> b = [1; 2; 3]; % Input column vector
>> soln = A\b % Solve A*x = b by ’left division’
soln =
0.2500
0.5000
0.6250

The symbol >> is MATLAB’s prompt for input. The percent sign (%) marks the
beginning of a comment. A semicolon (;) has two functions: it suppresses printout
of intermediate results and separates the rows of a matrix. Without a terminating
semicolon, the result of a command would be displayed. For example, omission of
the last semicolon in the line defining the matrix A would result in

>> A = [2 1 0; -1 2 2; 0 1 4]
A =
2 1 0
-1 2 2
0 1 4

Functions and programs can be created with the MATLAB editor/debugger and
saved with the .m extension (MATLAB calls them M-files). The file name of a saved
function should be identical to the name of the function. For example, if the function
for Gauss elimination listed above is saved as gauss.m, it can be called just like any
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

4 Introduction to MATLAB

MATLAB function:
>> A = [2 1 0; -1 2 2; 0 1 4];
>> b = [1; 2; 3];
>> soln = gauss(A,b)
soln =
0.2500
0.5000
0.6250

1.2 Data Types and Variables


Data Types
The most commonly used MATLAB data types, or classes, are double, char, and log-
ical, all of which are considered by MATLAB as arrays. Numerical objects belong to
the class double, which represent double-precision arrays; a scalar is treated as a
1 × 1 array. The elements of a char type array are strings (sequences of characters),
whereas a logical type array element may contain only 1 (true) or 0 (false).
Another important class is function handle, which is unique to MATLAB. It
contains information required to find and execute a function. The name of a function
handle consists of the character @, followed by the name of the function; for example,
@sin. Function handles are used as input arguments in function calls. For example,
suppose that we have a MATLAB function plot(func,x1,x2) that plots any user-
specified function func from x1 to x2. The function call to plot sin x from 0 to π
would be plot(@sin,0,pi).
There are other data types, such as sparse (sparse matrices), inline (inline ob-
jects), and struct (structured arrays), but we seldom come across them in this text.
Additional classes can be defined by the user. The class of an object can be displayed
with the class command. For example,

>> x = 1 + 3i % Complex number


>> class(x)
ans =
double

Variables
Variable names, which must start with a letter, are case sensitive. Hence xstart and
XStart represent two different variables. The length of the name is unlimited, but
only the first N characters are significant. To find N for your installation of MATLAB,
use the command namelengthmax:
>> namelengthmax
ans =
63
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

5 1.2 Data Types and Variables

Variables that are defined within a MATLAB function are local in their scope.
They are not available to other parts of the program and do not remain in memory
after exiting the function (this applies to most programming languages). However,
variables can be shared between a function and the calling program if they are de-
clared global. For example, by placing the statement global X Y in a function as
well as the calling program, the variables X and Y are shared between the two program
units. The recommended practice is to use capital letters for global variables.
MATLAB contains several built-in constants and special variables, most impor-
tant of which are

ans Default name for results


eps Smallest number for which 1 + eps > 1
inf Infinity
NaN Not a number

i or j −1
pi π
realmin Smallest usable positive number
realmax Largest usable positive number

Here are a few examples:

>> warning off % Suppresses print of warning messages


>> 5/0
ans =
Inf

>> 0/0
ans =
NaN

>> 5*NaN % Most operations with NaN result in NaN


ans =
NaN

>> NaN == NaN % Different NaN’s are not equal!


ans =
0

>> eps
ans =
2.2204e-016
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

6 Introduction to MATLAB

Arrays
Arrays can be created in several ways. One of them is to type the elements of the array
between brackets. The elements in each row must be separated by blanks or commas.
Here is an example of generating a 3 × 3 matrix:

>> A = [ 2 -1 0
-1 2 -1
0 -1 1]
A =
2 -1 0
-1 2 -1
0 -1 1

The elements can also be typed on a single line, separating the rows with colons:

>> A = [2 -1 0; -1 2 -1; 0 -1 1]
A =
2 -1 0
-1 2 -1
0 -1 1

Unlike most computer languages, MATLAB differentiates between row and col-
umn vectors (this peculiarity is a frequent source of programming and input errors).
For example,

>> b = [1 2 3] % Row vector


b =
1 2 3

>> b = [1; 2; 3] % Column vector


b =
1
2
3

>> b = [1 2 3]’ % Transpose of row vector


b =
1
2
3
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

7 1.2 Data Types and Variables

The single quote (’) is the transpose operator in MATLAB; thus, b’ is the trans-
pose of b.
The elements of a matrix, such as
 
A 11 A 12 A 13
 
A = A 21 A 22 A 23 
A 31 A 32 A 33

can be accessed with the statement A(i,j), where i and j are the row and column
numbers, respectively. A section of an array can be extracted by the use of colon no-
tation. Here is an illustration:

>> A = [8 1 6; 3 5 7; 4 9 2]
A =
8 1 6
3 5 7
4 9 2

>> A(2,3) % Element in row 2, column 3


ans =
7

>> A(:,2) % Second column


ans =
1
5
9

>> A(2:3,2:3) % The 2 x 2 submatrix in lower right corner


ans =
5 7
9 2

Array elements can also be accessed with a single index. Thus A(i) extracts the
ithelement of A, counting the elements down the columns. For example, A(7) and
A(1,3) would extract the same element from a 3 × 3 matrix.

Cells
A cell array is a sequence of arbitrary objects. Cell arrays can be created by enclosing
its contents between braces {}. For example, a cell array c consisting of three cells
can be created by

>> c = {[1 2 3], ’one two three’, 6 + 7i}


P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

8 Introduction to MATLAB

c =
[1x3 double] ’one two three’ [6.0000+ 7.0000i]

As seen above, the contents of some cells are not printed in order to save space.
If all contents are to be displayed, use the celldisp command:

>> celldisp(c)
c{1} =
1 2 3
c{2} =
one two three
c{3} =
6.0000 + 7.0000i

Braces are also used to extract the contents of the cells:

>> c{1} % First cell


ans =
1 2 3
>> c{1}(2) % Second element of first cell
ans =
2
>> c{2} % Second cell
ans =
one two three

Strings
A string is a sequence of characters; it is treated by MATLAB as a character array.
Strings are created by enclosing the characters between single quotes. They are con-
catenated with the function strcat, whereas colon operator (:) is used to extract a
portion of the string. For example,

>> s1 = ’Press return to exit’; % Create a string


>> s2 = ’ the program’; % Create another string
>> s3 = strcat(s1,s2) % Concatenate s1 and s2
s3 =
Press return to exit the program
>> s4 = s1(1:12) % Extract chars. 1-12 of s1
s4 =
Press return
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

9 1.3 Operators

1.3 Operators
Arithmetic Operators
MATLAB supports the usual arithmetic operators

+ Addition
− Subtraction
∗ Multiplication
ˆ Exponentiation

When applied to matrices, they perform the familiar matrix operations, as illus-
trated below.

>> A = [1 2 3; 4 5 6]; B = [7 8 9; 0 1 2];

>> A + B % Matrix addition


ans =
8 10 12
4 6 8

>> A*B’ % Matrix multiplication


ans =
50 8
122 17

>> A*B % Matrix multiplication fails


??? Error using ==> * % due to incompatible dimensions
Inner matrix dimensions must agree.

There are two division operators in MATLAB:

/ Right division
\ Left division

If a and b are scalars, the right division a/b results in a divided by b, whereas the left
division is equivalent to b/a. In the case where A and B are matrices, A/B returns the
solution of X*A = B and A\B yields the solution of A*X = B.
Often we need to apply the *, /, and ˆ operations to matrices in an element-
by-element fashion. This can be done by preceding the operator with a period (.) as
follows:

.* Element-wise multiplication
./ Element-wise division
.ˆ Element-wise exponentiation

For example, the computation Cij = A ij Bij can be accomplished with


P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

10 Introduction to MATLAB

>> A = [1 2 3; 4 5 6]; B = [7 8 9; 0 1 2];


>> C = A.*B
C =
7 16 27
0 5 12

Comparison Operators
The comparison (relational) operators return 1 for true and 0 for false. These opera-
tors are

< Less than


> Greater than
<= Less than or equal to
>= Greater than or equal to
== Equal to
˜= Not equal to

The comparison operators always act element-wise on matrices; hence, they result
in a matrix of logical type. For example,

>> A = [1 2 3; 4 5 6]; B = [7 8 9; 0 1 2];


>> A > B
ans =
0 0 0
1 1 1

Logical Operators
The logical operators in MATLAB are

& AND
| OR
˜ NOT

They are used to build compound relational expressions, an example of which is


shown below.

>> A = [1 2 3; 4 5 6]; B = [7 8 9; 0 1 2];


>> (A > B) | (B > 5)
ans =
1 1 1
1 1 1
P1: PHB
cuus734 CUUS734/Kiusalaas 0 521 19133 3 August 29, 2009 12:17

11 1.4 Flow Control

1.4 Flow Control


Conditionals
if, else, elseif
The if construct

if condition
block
end

executes the block of statements if the condition is true. If the condition is false,
the block skipped. The if conditional can be followed by any number of elseif
constructs:

if condition
block
elseif condition
block
..
.
end

which work in the same manner. The else clause


..
.
else
block
end

can be used to define the block of statements which are to be executed if none of the
if–elseif clauses are true. The function signum, which determines the sign of a
variable, illustrates the use of the conditionals:
function sgn = signum(a)
if a > 0
sgn = 1;
elseif a < 0
sgn = -1;
else
sgn = 0;
end

>> signum (-1.5)


ans =
-1
Discovering Diverse Content Through
Random Scribd Documents
around and saw the scalp of my dear little boy, fresh bleeding from
his head, in the hand of one of the savages, and sank down to the
earth again upon my infant child. The first thing I remember, after
witnessing this spectacle of woe, was the severe blows I was
receiving from the hands of the savages, though at that time I was
unconscious of the injury I was sustaining. After a severe
castigation, they assisted me in getting up, and supported me when
up. The scalp of my little boy was hid from my view, and in order to
bring me to my senses again they took me back to the river and led
me in knee-deep; this had its intended effect. But, "the tender
mercies of the wicked are cruel."

We now proceeded on our journey by crossing the island, and


coming to a shallow place where we could wade out, and so arrive
at the Indian side of the country. Here they pushed me in the river
before them, and had to conduct me through it. The water was up
to my breast, but I suspended my child above the water, and, with
the assistance of the savages, got safely out. Thence we rapidly
proceeded forward, and came to Big Buffalo; here the stream was
very rapid and the Indians had again to assist me. When we had
crossed this creek, we made a straight course to the
Connoquenessing Creek, the very place where Butler, Pa., now
stands; and thence we travelled five or six miles to Little Buffalo,
which we crossed.

I now felt weary of my life, and had a full determination to make the
savages kill me, thinking that death would be exceedingly welcome
when compared to the fatigue, cruelties, and miseries I had the
prospect of enduring. To have my purpose effected I stood still, one
of the savages being before me, and the other walking behind me,
and I took from off my shoulder a large powder-horn they made me
carry, in addition to my child, who was one year and four days old. I
threw the horn on the ground, closed my eyes, and expected every
moment to feel the deadly tomahawk. But to my surprise the Indian
took it up, cursed me bitterly, and put it on my shoulder again. I
took it off the second time, and threw it on the ground, and again
closed my eyes, with the assurance I should meet death; but instead
of this, the Indian again took up the horn, and with an indignant,
frightful countenance, came and placed it on again. I took it off the
third time, and was determined to effect it, and, therefore, threw it
as far as I was able from me, over the rocks. The savage
immediately went after it, while the one who had claimed me as his
squaw, and who had stood and witnessed the transaction, came up
to me and said: "Well done; you did right and are a good squaw,
and the other is a lazy son-of-a-gun; he may carry it himself."

The savages now changed their position, and the one who claimed
me as his squaw went behind. This movement, I believe, was to
prevent the other from doing me any injury; and we went on till we
struck the Connoquenessing at the Salt Lick, about two miles above
Butler, where was an Indian camp, where we arrived a little before
dark, having no refreshment during the day. The camp was made of
stakes driven into the ground, sloping, and covered with chestnut
bark, and appeared sufficiently long for fifty men. The camp
appeared to have been occupied for some time; it was very much
trodden, and large beaten paths went out from it in different
directions.

That night they took me about three hundred yards from the camp,
up a run, into a large, dark bottom, where they cut the brush in a
thicket and placed a blanket on the ground and permitted me to sit
down with my child. They then pinioned my arms back, only with a
little liberty, so that it was with difficulty that I managed my child.
Here, in this dreary situation, without fire or refreshment, having an
infant to take care of, and my arms bound behind me, and having a
savage on each side of me who had killed two of my dear children
that day, I had to pass the first night of my captivity.

But the trials and tribulations of the day I had passed had so
completely exhausted nature that, notwithstanding my unpleasant
situation, and my determination to escape, if possible, I insensibly
fell asleep, and repeatedly dreamed of my escape and safe arrival in
Pittsburgh, and several things relating to the town, of which I knew
nothing at the time, but found to be true when I arrived there. The
first night passed away and I found no means of escape, for the
savages kept watch the whole of the night without any sleep.

In the morning one of them left us to watch the trail we had come,
to see if any white people were pursuing us. During the absence of
the Indian, the one that claimed and remained with me, and who
was the murderer of my last boy, took from his bosom his scalp, and
prepared a hoop and stretched the scalp upon it. Those mothers
who have not seen the like done to one of the scalps of their own
children will be able to form but faint ideas of the feelings which
then harrowed up my soul. I meditated revenge! While he was in the
very act I attempted to take his tomahawk, which hung by his side
and rested on the ground, and had nearly succeeded, and was, as I
thought, about to give the fatal blow, when, alas! I was detected.

The savage felt at his tomahawk handle, turned upon me, cursed me
and told me I was a Yankee; thus insinuating he understood my
intention, and to prevent me from doing so again, faced me. My
excuse to him for handling his tomahawk was, that my child wanted
to play with the handle of it. The savage who went upon the lookout
in the morning came back about twelve o'clock, and had discovered
no pursuers. Then the one who had been guarding me went out on
the same errand. The savage who was now my guard began to
examine me about the white people, the strength of the armies
going against the Indians, etc., and boasted largely of their
achievements in the preceding fall, at the defeat of General St. Clair.

He then examined the plunder which he had brought from our house
the day before. He found my pocket-book and money among his
plunder. There were ten dollars in silver and a half-guinea in gold in
the book. During this day they gave me a piece of dried venison,
about the bulk of an egg, and a piece about the same size the day
we were marching, for my support and that of my child; but, owing
to the blows I had received from them on the jaws, I was unable to
eat a bit of it. I broke it up and gave it to the child.
The savage on the lookout returned about dark. This evening
(Monday, the 23d) they moved me to another station in the same
valley, and secured me as they did the preceding night. Thus I found
myself the second night between two Indians, without fire and
refreshment. During this night I was frequently asleep,
notwithstanding my unpleasant situation, and as often dreamed of
my arrival in Pittsburgh.

Early on the morning of the 24th a flock of mocking-birds and robins


hovered over us as we lay in our uncomfortable bed; and sang and
said, at least to my imagination, that I was to get up and go off. As
soon as day broke, one of the Indians went off again to watch the
trail, as on the preceding day, and he who was left to take care of
me appeared to be sleeping. When I perceived this I lay still and
began to snore, as though asleep, and he also fell asleep. Then I
concluded it was time to escape. I found it impossible to injure him
for my child at the breast, as I could not effect anything without
putting the child down, and then it would cry and give the alarm; so
I contented myself with taking, from a pillow-case of plunder stolen
from our house, a short gown, handkerchief, and child's frock, and
so made my escape; the sun then being about half an hour high.

I struck the Connoquenessing, and went down stream until about


two o'clock in the afternoon, over rocks, precipices, thorns, briers,
etc., with my bare feet and legs. I then discovered I was on the
wrong course, and waited till the North Star appeared. Marking out
the direction for the next day, I collected a bed of leaves, laid down
and slept, though my feet, being full of thorns, began to be
exceedingly painful, and I had nothing for self or babe to eat. The
next morning I started early, nothing material occurring. Towards
evening a gentle rain came on, and I began to prepare my leaf bed,
setting the child down the while, who began to cry. Fearful of the
consequences, I put him to the breast and he became quiet. I then
listened and distinctly heard footsteps. The ground over which I had
travelled was soft and my foot traces had been followed.
Greatly alarmed, I looked about for a place of safety, and
providentially discovered a large tree which had fallen, into the top
of which I crept. The darkness greatly assisted me and prevented
detection. The savage who followed me had heard the cry of the
child and came to the very spot where it had cried, and there he
halted, put down his gun, and was at this time so near that I heard
the wiping stick strike against his gun distinctly. My getting in under
the tree and sheltering myself from the rain, and pressing my boy to
my bosom, got him warm, and, most providentially, he fell asleep,
and lay very still during that time of extreme danger. All was still and
quiet; the savage was listening to hear again the cry. My own heart
was the only thing I feared, and that beat so loud that I was
apprehensive it would betray me. It is almost impossible to conceive
the wonderful effect my situation produced upon my whole system.

After the savage had stood and listened with nearly the stillness of
death for two hours, the sound of a bell and a cry like that of a night
owl, signals which were given to him by his companions, induced
him to answer, and after he had given a most horrid yell, which was
calculated to harrow up my soul, he started and went off to join
them. After his retreat, I concluded it unsafe to remain there till
morning.

But by this time nature was so nearly exhausted that I found some
difficulty in moving; yet, compelled by necessity, I threw my coat
about my child and placed the end between my teeth, and with one
arm and my teeth I carried him, and with the other groped my way
between the trees and travelled on, as I supposed, a mile or two,
and there sat down at the root of a tree till morning. The night was
cold and wet, and thus terminated the fourth day-and-night's
difficulties, trials, and dangers!

The fifth day, wet, exhausted, hungry, and wretched, I started from
my resting-place as soon as I could see my way, and on that
morning struck the head-waters of Pine Creek, which falls into the
Alleghany about four miles above Pittsburgh; though I knew not
then what waters they were; I crossed them, and on the opposite
bank I found a path, and on it two moccason tracks, fresh indented.
This alarmed me; but as they were before me, and travelling in the
same direction as I was, I concluded I could see them as soon as
they could see me, and, therefore, I pressed on in that path for
about three miles, when I came to where another branch emptied
into the creek, where was a hunter's camp, where the two men,
whose tracks I had before discovered and followed, had breakfasted
and left the fire burning.
I became more alarmed, and determined to leave the path. I then
crossed a ridge towards Squaw Run, and came upon a trail. Here I
stopped and meditated what to do; and while I was thus musing I
saw three deer coming towards me at full speed; they turned to look
at their pursuers; I looked too, with all attention, and saw the flash
and heard the report of a gun. I saw some dogs start after them,
and began to look about for shelter, and immediately made for a
large log to hide myself. Providentially I did not go clear to the log;
for as I put my hand to the ground, to raise myself so that I might
see who and where the hunters were, I saw a large heap of
rattlesnakes, the top one being very large, and coiled up very near
my face, and quite ready to bite me.

I again left my course, bearing to the left, and came upon the head-
waters of Squaw Run, and kept down the run the remainder of that
day. It rained, and I was in a very deplorable situation; so cold and
shivering were my limbs, that frequently, in opposition to all my
struggles, I gave an involuntary groan. I suffered intensely from
hunger, though my jaws were so far recovered that, wherever I
could, I procured grape-vines, and chewed them for a little
sustenance. In the evening I came within one mile of the Alleghany
River, though I was ignorant of it at the time; and there, at the root
of a tree, through a most tremendous rain, I took up my fifth night's
lodgings. In order to shelter my infant as much as possible, I placed
him in my lap, and then leaned my head against the tree, and thus
let the rain fall upon me.
On the sixth (that was the Sabbath) morning from my captivity, I
found myself unable, for a very considerable time, to raise myself
from the ground; and when I had once more, by hard struggling, got
myself upon my feet and started, nature was so nearly exhausted
and my spirits were so completely depressed that my progress was
amazingly slow and discouraging. In this almost helpless condition I
had not gone far before I came to a path where there had been
cattle travelling; I took it, under the impression that it would lead me
to the abode of some white people, and in about a mile I came to an
uninhabited cabin, and though I was in a river bottom, yet I knew
not where I was nor yet on what river bank I had come.

Here I was seized with feelings of despair, went to the threshold of


the cabin and concluded that I would enter and lie down and die,
since death would have been an angel of mercy to me in such a
miserable situation. Had it not been for the sufferings which my
infant, who would survive me some time, must endure, I would have
carried my determination into execution. Here I heard the sound of a
cow-bell, which imparted a gleam of hope to my desponding mind. I
followed the sound till I came opposite the fort at the Six Mile
Island, where I saw three men on the opposite bank of the river.
My feelings then can be better imagined than described. I called to
them, but they seemed unwilling to risk the danger of coming after
me, and asked who I was. I told them, and they requested me to
walk up the bank awhile that they might see if Indians were making
a decoy of me; but I replied my feet were so sore I could not walk.
Then one of them, James Closier, got into a canoe to fetch me over,
while the other two stood with cocked rifles ready to fire on the
Indians, provided they were using me as a decoy. When Mr. Closier
came near and saw my haggard and dejected appearance, he
exclaimed, "Who in the name of God are you?" This man was one of
my nearest neighbors, yet in six days I was so much altered that he
did not know me, either by my voice or countenance.
When I landed on the inhabited side of the river the people from the
fort came running out to see me. They took the child from me, and
now that I felt safe from all danger, I found myself unable to move
or to assist myself in any degree, whereupon the people took me
and carried me out of the boat to the house of Mr. Cortus.

Now that I felt secure from the cruelties of the barbarians, for the
first time since my captivity, my feelings returned in all their
poignancy and the tears flowed freely, imparting a happiness beyond
what I ever experienced. When I was taken into the house the heat
of the fire and the smell of victuals, of both of which I had so long
been deprived, caused me to faint. Some of the people attempted to
restore me and some to put clothes on me, but their kindness would
have killed me had it not been for the arrival of Major McCully, who
then commanded along the river. When he understood my situation,
and saw the provisions they were preparing for me, he was greatly
alarmed; ordered me out of the house, away from the heat and
smell; prohibited me from taking anything but a very little whey of
buttermilk, which he administered with his own hands. Through this
judicious management I was mercifully restored to my senses and
gradually to health and strength.
Two of the females, Sarah Carter and Mary Ann Crozier, then began
to take out the thorns from my feet and legs, which Mr. Felix Negley
stood by and counted to the number of one hundred and fifty,
though they were not all extracted at that time, for the next
evening, at Pittsburgh, there were many more taken out. The flesh
was mangled dreadfully, and the skin and flesh were hanging in
pieces on my feet and legs. The wounds were not healed for a
considerable time. Some of the thorns went through my feet and
came out at the top. For two weeks I was unable to put my feet to
the ground to walk. The next morning a young man employed by
the magistrates of Pittsburgh came for me to go immediately to
town to give in my deposition, that it might be published to the
American people. Some of the men carried me into a canoe, and
when I arrived I gave my deposition. As the intelligence spread,
Pittsburgh, and the country for twenty miles around, was all in a
state of commotion. The same evening my husband came to see
me, and soon after I was taken back to Coe's Station. In the evening
I gave an account of the murder of my boy on the island, and the
next morning a scout went out and found the body and buried it,
nine days after the murder.

THE END

OUTING
ADVENTURE
LIBRARY
Edited by Horace Kephart
¶ Here are brought together for the first time the great stories of
adventure of all ages and countries. These are the personal records
of the men who climbed the mountains and penetrated the jungles;
who explored the seas and crossed the deserts; who knew the
chances and took them, and lived to write their own tales of
hardship and endurance and achievement. The series will consist of
an indeterminate number of volumes—for the stories are myriad.
The whole will be edited by Horace Kephart. Each volume answers
the test of these two questions: Is it true? Is it interesting?
¶ The entire series is uniform in style and binding. Among the titles
now ready or in preparation are those described on the following
pages.

PRICE $1.00 EACH, NET. POSTAGE 10 CENTS EXTRA

THE NUMBERS MAKE ORDERING CONVENIENT


1. IN THE OLD WEST, by George Frederick Ruxton. The men who
blazed the trail across the Rockies to the Pacific were the
independent trappers and hunters in the days before the Mexican
war. They left no records of their adventures and most of them
linger now only as shadowy names. But a young Englishman lived
among them for a time, saw life from their point of view, trapped
with them and fought with them against the Indians. That was
George Frederick Ruxton. His story is our only complete picture of
the Old West in the days of the real Pioneers, of Kit Carson, Jim
Bridger, Bill Williams, the Sublettes, and all the rest of that glorious
company of the forgotten who opened the West.

2. CASTAWAYS AND CRUSOES. Since the beginnings of navigation


men have faced the dangers of shipwreck and starvation. Scattered
through the annals of the sea are the stories of those to whom
disaster came and the personal records of the way they met it.
Some of them are given in this volume, narratives of men who lived
by their hands among savages and on forlorn coasts, or drifted
helpless in open boats. They range from the South Seas to the Gulf
of St. Lawrence, from the iron coast of Patagonia to the shores of
Cuba. They are echoes from the days when the best that could be
hoped by the man who went to sea was hardship and man's-sized
work.

3. CAPTIVES AMONG THE INDIANS. First of all is the story of


Captain James Smith, who was captured by the Delawares at the
time of Braddock's defeat, was adopted into the tribe, and for four
years lived as an Indian, hunting with them, studying their habits,
and learning their point of view. Then there is the story of Father
Bressani who felt the tortures of the Iroquois, of Mary Rowlandson
who was among the human spoils of King Philip's war, and of Mercy
Harbison who suffered in the red flood that followed St. Clair's
defeat. All are personal records made by the actors themselves in
those days when the Indian was constantly at our forefathers's
doors.

4. FIRST THROUGH THE GRAND CANYON, by Major John Wesley


Powell. Major Powell was an officer in the Union Army who lost an
arm at Shiloh. In spite of this four years after the war he organized
an expedition which explored the Grand Canyon of the Colorado in
boats—the first to make this journey. His story has been lost for
years in the oblivion of a scientific report. It is here rescued and
presented as a record of one of the great personal exploring feats,
fitted to rank with the exploits of Pike, Lewis and Clark, and
Mackenzie.

5. ADRIFT IN THE ARCTIC ICE-PACK, By Elisha Kent Kane, M.D. Out


of the many expeditions that went north in search of Sir John
Franklin over fifty years ago, it fell to the lot of one, financed by a
New York merchant, to spend an Arctic winter drifting aimlessly in
the grip of the Polar ice in Lancaster Sound. The surgeon of the
expedition kept a careful diary and out of that record told the first
complete story of a Far Northern winter. That story is here
presented, shorn of the purely scientific data and stripped to the
personal exploits and adventures of the author and the other
members of the crew.
Footnotes

[1]
Pittsburgh.

[2]
Peel.

[3]
The Dutch he called Skoharehaugo, which took its
derivation from a Dutch settlement called Skoharey.

[4]
The Miami of the Lakes, now called Maumee.

[5]
This is the name of God, in their tongue, and signifies
the owner and ruler of all things.

[6]
Fifteen hundred Wamponoags, led by King Philip, and
accompanied by the Narragansetts, his allies, and by
the Nipmucks and Nashaways.

[7]
Thomas Rowlandson, brother to the clergyman.

[8]
Boston.

[9]
Seventeen of her family were put to death or captured.

[10]
Convert to Christianity.

[11]
Or Squakeag, now Northfield.

[12]
Apios tuberosa. The Pilgrims, during their first winter,
lived chiefly on these roots. The tubers vary from the
size of a cherry to that of a hen's egg, and grow in
strings of perhaps forty together.

[13]
Northampton was attacked March 14, 1676.

[14]
Princeton. The mountain in this town still retains the
name of Wachusett.

[15]
Sudbury was attacked 21st April.

[16]
Wicked.

Transcriber's Note:
Minor typographical errors have been corrected without note.
Irregularities and inconsistencies in the text have been
retained as printed.

The cover of this ebook was created by the transcriber and is


hereby placed in the public domain.
*** END OF THE PROJECT GUTENBERG EBOOK CAPTIVES AMONG
THE INDIANS ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like