Mathematica by Example This page intentionally left blank Mathematica by Example Fourth Edition Martha L. Abell and James P. Braselton Department of Mathematical Sciences Georgia Southern University Statesboro, Georgia AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO Academic Press is an imprint of Elsevier Academic Press is an imprint of Elsevier 30 Corporate Drive, Suite 400, Burlington, MA 01803, USA 525 B Street, Suite 1900, San Diego, California 92101-4495, USA 84 Theobald’s Road, London WC1X 8RR, UK This book is printed on acid-free paper.(cid:2)∞ © Copyright 2009 by Elsevier Inc. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopy, recording, or any information storage and retrieval system, without permission in writing from the publisher. Permissions may be sought directly from Elsevier’s Science & Technology Rights Department in Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333, E-mail: [email protected]. You may also complete your request on-line via the Elsevier homepage (http://elsevier.com), by selecting “Support & Contact” then “Copyright and Permission” and then “Obtaining Permissions.” Library of Congress Cataloging-in-Publication Data APPLICATION SUBMITTED British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library. ISBN: 978-0-12-374318-3 For information on all Academic Press publications visit our Web site at www.books.elsevier.com Printed in the United States of America 09 10 11 12 9 8 7 6 5 4 3 2 1 Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix CHAPTER 1 Getting Started 1 1.1 Introduction to Mathematica . . . . . . . . . . . . . . . . . . . . . 1 A Note Regarding Different Versions of Mathematica . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.1 Getting Started with Mathematica . . . . . . . . . . . . . . 3 Preview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Five Basic Rules of Mathematica Syntax . . . . . . . . . . . . . . 13 1.2 Loading Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.2.1 Packages Included with Older Versions of Mathematica . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2.2 Loading New Packages . . . . . . . . . . . . . . . . . . . . 15 1.3 Getting Help from Mathematica . . . . . . . . . . . . . . . . . . . 17 Mathematica Help . . . . . . . . . . . . . . . . . . . . . . 24 1.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 CHAPTER 2 Basic Operations on Numbers, Expressions, and Functions 31 2.1 Numerical Calculations and Built-in Functions . . . . . . . . . . . 31 2.1.1 Numerical Calculations . . . . . . . . . . . . . . . . . . . . 31 2.1.2 Built-in Constants . . . . . . . . . . . . . . . . . . . . . . . 34 2.1.3 Built-in Functions . . . . . . . . . . . . . . . . . . . . . . . 35 A Word of Caution . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 2.2 Expressions and Functions: Elementary Algebra . . . . . . . . . . 39 2.2.1 Basic Algebraic Operations on Expressions . . . . . . . . 39 2.2.2 Naming and Evaluating Expressions . . . . . . . . . . . . . 44 2.2.3 Defining and Evaluating Functions . . . . . . . . . . . . . 47 2.3 Graphing Functions, Expressions, and Equations . . . . . . . . . 52 2.3.1 Functions of a Single Variable . . . . . . . . . . . . . . . . 52 2.3.2 Parametric and Polar Plots in Two Dimensions . . . . . . 65 2.3.3 Three-Dimensional and Contour Plots: Graphing Equations . . . . . . . . . . . . . . . . . . . . . . 71 2.3.4 Parametric Curves and Surfaces in Space . . . . . . . . . . 82 2.3.5 Miscellaneous Comments . . . . . . . . . . . . . . . . . . . 94 2.4 Solving Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 2.4.1 Exact Solutions of Equations . . . . . . . . . . . . . . . . . 100 2.4.2 Approximate Solutions of Equations . . . . . . . . . . . . 110 2.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 v vi Contents CHAPTER 3 Calculus 117 3.1 Limits and Continuity . . . . . . . . . . . . . . . . . . . . . . . . . 117 3.1.1 Using Graphs and Tables to Predict Limits . . . . . . . . . 117 3.1.2 Computing Limits . . . . . . . . . . . . . . . . . . . . . . . 121 3.1.3 One-Sided Limits . . . . . . . . . . . . . . . . . . . . . . . . 123 3.1.4 Continuity. . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 3.2 Differential Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . 128 3.2.1 Definition of the Derivative . . . . . . . . . . . . . . . . . 128 3.2.2 Calculating Derivatives . . . . . . . . . . . . . . . . . . . . 135 3.2.3 Implicit Differentiation . . . . . . . . . . . . . . . . . . . . 138 3.2.4 Tangent Lines. . . . . . . . . . . . . . . . . . . . . . . . . . 139 3.2.5 The First Derivative Test and Second Derivative Test . . . . . . . . . . . . . . . . . . . . . . . . . 148 3.2.6 Applied Max/Min Problems. . . . . . . . . . . . . . . . . . 156 3.2.7 Antidifferentiation . . . . . . . . . . . . . . . . . . . . . . . 164 3.3 Integral Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 3.3.1 Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 3.3.2 The Definite Integral . . . . . . . . . . . . . . . . . . . . . 174 3.3.3 Approximating Definite Integrals . . . . . . . . . . . . . . 179 3.3.4 Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 3.3.5 Arc Length . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 3.3.6 Solids of Revolution . . . . . . . . . . . . . . . . . . . . . . 190 3.4 Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 3.4.1 Introduction to Sequences and Series. . . . . . . . . . . . 201 3.4.2 Convergence Tests . . . . . . . . . . . . . . . . . . . . . . . 205 3.4.3 Alternating Series . . . . . . . . . . . . . . . . . . . . . . . 209 3.4.4 Power Series . . . . . . . . . . . . . . . . . . . . . . . . . . 210 3.4.5 Taylor and Maclaurin Series . . . . . . . . . . . . . . . . . 213 3.4.6 Taylor’s Theorem . . . . . . . . . . . . . . . . . . . . . . . 217 3.4.7 Other Series . . . . . . . . . . . . . . . . . . . . . . . . . . 220 3.5 Multivariable Calculus . . . . . . . . . . . . . . . . . . . . . . . . . 221 3.5.1 Limits of Functions of Two Variables . . . . . . . . . . . . 222 3.5.2 Partial and Directional Derivatives . . . . . . . . . . . . . . 224 3.5.3 Iterated Integrals . . . . . . . . . . . . . . . . . . . . . . . . 238 3.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 CHAPTER 4 Introduction to Lists and Tables 251 4.1 Lists and List Operations . . . . . . . . . . . . . . . . . . . . . . . 251 4.1.1 Defining Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 251 4.1.2 Plotting Lists of Points . . . . . . . . . . . . . . . . . . . . 258 4.2 Manipulating Lists: More on Part and Map . . . . . . . . . . . . . 269 4.2.1 More on Graphing Lists: Graphing Lists of Points Using Graphics Primitives . . . . . . . . . . . . . . . . . . 277 4.2.2 Miscellaneous List Operations . . . . . . . . . . . . . . . . 283 Contents vii 4.3 Other Applications . . . . . . . . . . . . . . . . . . . . . . . . . . 283 4.3.1 Approximating Lists with Functions. . . . . . . . . . . . . 283 4.3.2 Introduction to Fourier Series . . . . . . . . . . . . . . . . 287 4.3.3 The Mandelbrot Set and Julia Sets . . . . . . . . . . . . . . 299 4.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 CHAPTER 5 Matrices and Vectors: Topics from Linear Algebra and Vector Calculus 317 5.1 Nested Lists: Introduction to Matrices, Vectors, and Matrix Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 5.1.1 Defining Nested Lists, Matrices, and Vectors. . . . . . . . 317 5.1.2 Extracting Elements of Matrices . . . . . . . . . . . . . . . 322 5.1.3 Basic Computations with Matrices . . . . . . . . . . . . . 325 5.1.4 Basic Computations with Vectors . . . . . . . . . . . . . . 329 5.2 Linear Systems of Equations . . . . . . . . . . . . . . . . . . . . . 337 5.2.1 Calculating Solutions of Linear Systems of Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 5.2.2 Gauss–Jordan Elimination . . . . . . . . . . . . . . . . . . . 342 5.3 Selected Topics from Linear Algebra . . . . . . . . . . . . . . . . 349 5.3.1 Fundamental Subspaces Associated with Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 5.3.2 The Gram–Schmidt Process . . . . . . . . . . . . . . . . . 351 5.3.3 Linear Transformations . . . . . . . . . . . . . . . . . . . . 355 5.3.4 Eigenvalues and Eigenvectors . . . . . . . . . . . . . . . . 358 5.3.5 Jordan Canonical Form . . . . . . . . . . . . . . . . . . . . 361 5.3.6 The QR Method . . . . . . . . . . . . . . . . . . . . . . . . 364 5.4 Maxima and Minima Using Linear Programming. . . . . . . . . . 366 5.4.1 The Standard Form of a Linear Programming Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 5.4.2 The Dual Problem . . . . . . . . . . . . . . . . . . . . . . . 368 5.5 Selected Topics from Vector Calculus. . . . . . . . . . . . . . . . 374 5.5.1 Vector-Valued Functions . . . . . . . . . . . . . . . . . . . 374 5.5.2 Line Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . 384 5.5.3 Surface Integrals . . . . . . . . . . . . . . . . . . . . . . . . 387 5.5.4 A Note on Nonorientability . . . . . . . . . . . . . . . . . 391 5.5.5 More on Tangents, Normals, and Curvature in R3 . . . . 404 5.6 Matrices and Graphics . . . . . . . . . . . . . . . . . . . . . . . . 415 5.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 CHAPTER 6 Applications Related to Ordinary and Partial Differential Equations 435 6.1 First-Order Differential Equations . . . . . . . . . . . . . . . . . . 435 6.1.1 Separable Equations . . . . . . . . . . . . . . . . . . . . . . 435 6.1.2 Linear Equations . . . . . . . . . . . . . . . . . . . . . . . . 442 viii Contents 6.1.3 Nonlinear Equations . . . . . . . . . . . . . . . . . . . . . . 450 6.1.4 Numerical Methods . . . . . . . . . . . . . . . . . . . . . . 453 6.2 Second-Order Linear Equations . . . . . . . . . . . . . . . . . . . 457 6.2.1 Basic Theory . . . . . . . . . . . . . . . . . . . . . . . . . . 457 6.2.2 Constant Coefficients . . . . . . . . . . . . . . . . . . . . . 458 6.2.3 Undetermined Coefficients . . . . . . . . . . . . . . . . . . 464 6.2.4 Variation of Parameters . . . . . . . . . . . . . . . . . . . . 470 6.3 Higher-Order Linear Equations . . . . . . . . . . . . . . . . . . . . 472 6.3.1 Basic Theory . . . . . . . . . . . . . . . . . . . . . . . . . . 472 6.3.2 Constant Coefficients . . . . . . . . . . . . . . . . . . . . . 473 6.3.3 Undetermined Coefficients . . . . . . . . . . . . . . . . . . 475 6.3.4 Laplace Transform Methods . . . . . . . . . . . . . . . . . 481 6.3.5 Nonlinear Higher-Order Equations. . . . . . . . . . . . . . 492 6.4 Systems of Equations . . . . . . . . . . . . . . . . . . . . . . . . . 492 6.4.1 Linear Systems . . . . . . . . . . . . . . . . . . . . . . . . . 492 6.4.2 Nonhomogeneous Linear Systems . . . . . . . . . . . . . . 505 6.4.3 Nonlinear Systems . . . . . . . . . . . . . . . . . . . . . . . 511 6.5 Some Partial Differential Equations . . . . . . . . . . . . . . . . . 532 6.5.1 The One-Dimensional Wave Equation . . . . . . . . . . . . 532 6.5.2 The Two-Dimensional Wave Equation . . . . . . . . . . . . 537 6.5.3 Other Partial Differential Equations . . . . . . . . . . . . . 547 6.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 References 557 Index 559 Preface Mathematica by Example bridges the gap that exists between the very elementaryhandbooksavailableonMathematicaandthosereferencebooks writtenfortheadvancedMathematicausers.Thisbookisanappropriateref- erence for all users of Mathematica and, in particular, for beginning users such as students, instructors, engineers, businesspeople, and other profes- sionals first learning to use Mathematica. This book introduces the very basiccommandsandincludestypicalexamplesofapplicationsofthesecom- mands.Inaddition,thetextalsoincludescommandsusefulinareassuchas calculus,linearalgebra,businessmathematics,ordinaryandpartialdifferen- tialequations,andgraphics.Inallcases,however,examplesfollowtheintro- duction of new commands. Readers from the most elementary to advanced levelswillfindthattherangeoftopicscoveredaddressestheirneeds. Taking advantage of Version 6 of Mathematica, Mathematica by Exam- ple, Fourth Edition, introduces the fundamental concepts of Mathematica to solve typical problems of interest to students, instructors, and scientists. The fourth edition is an extensive revision of the text. Features that make this edition easy to use as a reference and as useful as possible for the beginner include the following: 1. Version 6 compatibility. All examples illustrated in this book were completed using Version 6 of Mathematica. Although many com- putations can continue to be carried out with earlier versions of Mathematica,wehavetakenadvantageofthenewfeaturesinVersion 6 as much as possible. 2. Applications. New applications, many of which are documented by references from a variety of fields, especially biology, physics, and engineering, are included throughout the text. 3. Detailed table of contents. The table of contents includes all chap- ter, section, and subsection headings. Along with the comprehensive index, we hope that users will be able to locate information quickly and easily. 4. Additional examples. We have considerably expanded the topics throughout the book. The results should be more useful to instruc- tors, students, businesspeople, engineers, and other professionals using Mathematica on a variety of platforms. In addition, several sections have been added to make it easier for the user to locate information. ix
Description: