ebook img

Numerical Methods for Engineers and Scientists Using MATLAB®, Second Edition. PDF

495 Pages·2017·19.747 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Numerical Methods for Engineers and Scientists Using MATLAB®, Second Edition.

Mechanical Esfandiari SECOND EDITION Numerical Methods aN SECOND EDITION nu for Engineers dm Numerical Methods S e cr and Scientists ieic for Engineers Using MATLAB® na tl iM s Ramin S. Esfandiari aanndd SScciieennttiissttss t e s This book provides a pragmatic, methodical and easy-to-follow presentation of t numerical methods and their effective implementation using MATLAB®, which Uh ®® o UUssiinngg MMAATTLLAABB is introduced at the outset. The author introduces techniques for solving equa- s id tions of a single variable and systems of equations, followed by curve fitting n s and interpolation of data. The book also provides detailed coverage of numeri- g cal differentiation and integration, as well as numerical solutions of initial-value f Mo and boundary-value problems. The author then presents the numerical solution r of the matrix eigenvalue problem, which entails approximation of a few or all A E eigenvalues of a matrix. The last chapter is devoted to numerical solutions of T n L partial differential equations that arise in engineering and science. Each meth- g A od is accompanied by at least one fully worked-out example showing essential i Bn details involved in preliminary hand calculations, as well as computations in ®e MATLAB. This thoroughly researched resource: e • Demonstrates effective applications of MATLAB user-defined functions r or script files, and built-in functions when available, for all methods s discussed • Employs a direct, pragmatic and easy-to-follow approach in presenting numerical methods and their applications in engineering and science • Shows readers meticulously worked-out examples using hand calcula- tions and verification of results by executing user-defined functions, and when applicable, the built-in MATLAB functions SECOND • Provides exercises of various degrees of difficulty for each topic EDITION K29770 Ramin S. Esfandiari 6000 Broken Sound Parkway, NW Suite 300, Boca Raton, FL 33487 711 Third Avenue New York, NY 10017 2 Park Square, Milton Park Abingdon, Oxon OX14 4RN, UK Numerical Methods for Engineers and Scientists Using MATLAB® Second Edition Numerical Methods for Engineers and Scientists Using MATLAB® Second Edition Ramin S. Esfandiari, PhD 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 particu- lar use of the MATLAB® software. CRC Press Taylor & Francis Group, 6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742 © 2017 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 Printed on acid-free paper International Standard Book Number-13: 978-1-4987-7742-1 (Hardback) 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 validity 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 utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including pho- tocopying, 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. Library of Congress Cataloging–in–Publication Data Names: Esfandiari, Ramin S., author. Title: Numerical methods for engineers and scientists using MATLAB / Ramin S. Esfandiari. Description: Second edition. | Boca Raton : a CRC title, part of the Taylor & Francis imprint, a member of the Taylor & Francis Group, the academic division of T&F Informa, plc, [2017] Identifiers: LCCN 2016039623 | ISBN 9781498777421 (hardback : alk. paper) Subjects: LCSH: Engineering mathematics. | Numerical analysis. Classification: LCC TA335 .E843 2017 | DDC 620.00285/53--dc23 LC record available at https://lccn.loc.gov/2016039623 Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com To My wife Haleh, my sisters Mandana and Roxana, and my parents to whom I owe everything Contents Preface .............................................................................................................................................xv Acknowledgments ......................................................................................................................xix Author ...........................................................................................................................................xxi 1. Background and Introduction ..............................................................................................1 Part 1: Background ..................................................................................................................1 1.1 Differential Equations ..................................................................................................1 1.1.1 Linear, First-Order ODEs ................................................................................1 1.1.2 Second-Order ODEs with Constant Coefficients ........................................2 1.1.2.1 Homogeneous Solution ...................................................................2 1.1.2.2 Particular Solution ...........................................................................3 1.1.3 Method of Undetermined Coefficients .........................................................3 1.2 Matrix Analysis .............................................................................................................4 1.2.1 Matrix Operations............................................................................................5 1.2.2 Matrix Transpose .............................................................................................5 1.2.3 Special Matrices ...............................................................................................6 1.2.4 Determinant of a Matrix .................................................................................6 1.2.5 Properties of Determinant ..............................................................................6 1.2.5.1 Cramer’s Rule ....................................................................................7 1.2.6 Inverse of a Matrix ...........................................................................................8 1.2.7 Properties of Inverse ........................................................................................9 1.2.8 Solving a Linear System of Equations ..........................................................9 1.3 Matrix Eigenvalue Problem .........................................................................................9 1.3.1 Solving the Eigenvalue Problem ..................................................................10 1.3.2 Similarity Transformation ............................................................................11 1.3.3 Matrix Diagonalization .................................................................................11 1.3.4 Eigenvalue Properties of Matrices ...............................................................12 Part 2: Introduction to Numerical Methods .......................................................................12 1.4 Errors and Approximations .......................................................................................12 1.4.1 Sources of Computational Error ..................................................................12 1.4.2 Binary and Hexadecimal Numbers ............................................................13 1.4.3 Floating Point and Rounding Errors ...........................................................13 1.4.4 Round-Off: Chopping and Rounding .........................................................14 1.4.5 Absolute and Relative Errors .......................................................................15 1.4.6 Error Bound ....................................................................................................16 1.4.7 Transmission of Error from a Source to the Final Result .........................16 1.4.8 Subtraction of Nearly Equal Numbers .......................................................17 1.5 Iterative Methods ........................................................................................................19 1.5.1 Fundamental Iterative Method ....................................................................20 1.5.2 Rate of Convergence of an Iterative Method ..............................................21 Problem Set (Chapter 1) ........................................................................................................22 2. Introduction to MATLAB® .................................................................................................27 2.1 MATLAB Built-In Functions .....................................................................................27 vii viii Contents 2.1.1 Rounding Commands ...................................................................................27 2.1.2 Relational Operators ......................................................................................28 2.1.3 Format Options ..............................................................................................28 2.2 Vectors and Matrices ..................................................................................................29 2.2.1 Linspace...........................................................................................................30 2.2.2 Matrices ...........................................................................................................30 2.2.3 Determinant, Transpose, and Inverse .........................................................32 2.2.4 Slash Operators ..............................................................................................33 2.2.5 Element-by-Element Operations ..................................................................33 2.2.6 Diagonal Matrices and Diagonals of a Matrix ...........................................34 2.3 Symbolic Math Toolbox ..............................................................................................36 2.3.1 Anonymous Functions ..................................................................................38 2.3.2 MATLAB Function ........................................................................................38 2.3.3 Differentiation ................................................................................................39 2.3.4 Partial Derivatives .........................................................................................40 2.3.5 Integration .......................................................................................................40 2.4 Program Flow Control ................................................................................................41 2.4.1 for Loop .........................................................................................................41 2.4.2 The if Command ..........................................................................................42 2.4.3 while Loop ....................................................................................................43 2.5 Displaying Formatted Data .......................................................................................43 2.5.1 Differential Equations ...................................................................................44 2.6 Plotting .........................................................................................................................45 2.6.1 subplot ..........................................................................................................45 2.6.2 Plotting Analytical Expressions ..................................................................46 2.6.3 Multiple Plots ..................................................................................................46 2.7 User-Defined Functions and Script Files .................................................................47 2.7.1 Setting Default Values for Input Variables .................................................49 2.7.2 Creating Script Files ......................................................................................50 Problem Set (Chapter 2) ........................................................................................................51 3. Numerical Solution of Equations of a Single Variable .................................................55 3.1 Numerical Solution of Equations ..............................................................................55 3.2 Bisection Method ........................................................................................................55 3.2.1 MATLAB Built-In Function fzero .............................................................60 3.3 Regula Falsi Method (Method of False Position) ....................................................61 3.3.1 Modified Regula Falsi Method ....................................................................64 3.4 Fixed-Point Method ....................................................................................................65 3.4.1 Selection of a Suitable Iteration Function ...................................................66 3.4.2 A Note on Convergence ................................................................................67 3.4.3 Rate of Convergence of the Fixed-Point Iteration ......................................71 3.5 Newton’s Method (Newton–Raphson Method) .....................................................72 3.5.1 Rate of Convergence of Newton’s Method .................................................76 3.5.2 A Few Notes on Newton’s Method .............................................................77 3.5.3 Modified Newton’s Method for Roots with Multiplicity 2 or Higher ......................................................................................................78 3.6 Secant Method .............................................................................................................81 3.6.1 Rate of Convergence of Secant Method ......................................................83 3.6.2 A Few Notes on Secant Method ..................................................................83 Contents ix 3.7 Equations with Several Roots ....................................................................................83 3.7.1 Finding Roots to the Right of a Specified Point .........................................83 3.7.2 Finding Several Roots in an Interval Using fzero ..................................84 Problem Set (Chapter 3) ........................................................................................................88 4. Numerical Solution of Systems of Equations .................................................................95 4.1 Linear Systems of Equations .....................................................................................95 4.2 Numerical Solution of Linear Systems.....................................................................96 4.3 Gauss Elimination Method ........................................................................................96 4.3.1 Choosing the Pivot Row: Partial Pivoting with Row Scaling .................98 4.3.2 Permutation Matrices ....................................................................................99 4.3.3 Counting the Number of Operations ........................................................102 4.3.3.1 Elimination ....................................................................................102 4.3.3.2 Back Substitution ..........................................................................103 4.3.4 Tridiagonal Systems ....................................................................................103 4.3.4.1 Thomas Method ...........................................................................104 4.3.4.2 MATLAB Built-In Function "\" .................................................106 4.4 LU Factorization Methods .......................................................................................107 4.4.1 Doolittle Factorization .................................................................................107 4.4.2 Finding L and U Using Steps of Gauss Elimination ...............................108 4.4.3 Finding L and U Directly............................................................................108 4.4.3.1 Doolittle’s Method to Solve a Linear System ............................110 4.4.3.2 Operations Count .........................................................................112 4.4.4 Cholesky Factorization ................................................................................112 4.4.4.1 Cholesky’s Method to Solve a Linear System ...........................113 4.4.4.2 Operations Count .........................................................................115 4.4.4.3 MATLAB Built-In Functions lu and chol ...............................115 4.5 Iterative Solution of Linear Systems .......................................................................116 4.5.1 Vector Norms ................................................................................................116 4.5.2 Matrix Norms ...............................................................................................118 4.5.2.1 Compatibility of Vector and Matrix Norms .............................119 4.5.3 General Iterative Method ............................................................................120 4.5.3.1 Convergence of the General Iterative Method .........................120 4.5.4 Jacobi Iteration Method ...............................................................................121 4.5.4.1 Convergence of the Jacobi Iteration Method ............................122 4.5.5 Gauss–Seidel Iteration Method ..................................................................125 4.5.5.1 Convergence of the Gauss–Seidel Iteration Method ...............127 4.5.6 Indirect Methods versus Direct Methods for Large Systems ................130 4.6 Ill-Conditioning and Error Analysis ......................................................................131 4.6.1 Condition Number.......................................................................................131 4.6.2 Ill-Conditioning ...........................................................................................132 4.6.2.1 Indicators of Ill-Conditioning .....................................................133 4.6.3 Computational Error ...................................................................................133 4.6.3.1 Consequences of Ill-Conditioning .............................................135 4.6.4 Effects of Parameter Changes on the Solution ........................................136 4.7 Systems of Nonlinear Equations .............................................................................138 4.7.1 Newton’s Method for a System of Nonlinear Equations ........................138 4.7.1.1 Newton’s Method for Solving a System of Two Nonlinear Equations ...........................................................138

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.