ebook img

The MAPLE book PDF

467 Pages·2002·2.615 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 The MAPLE book

T he MAPLE BOOK © 2002 by Chapman & Hall/CRC T he MAPLE BOOK F R A N K G A R V A N CHAPMAN & HALL/CRC A CRC Press Company Boca Raton London New York Washington, D.C. © 2002 by Chapman & Hall/CRC Library of Congress Cataloging-in-Publication Data Garvan, Frank (Frank G.), 1955- The Maple book / by Frank Garvan. p. cm. Rev. ed. of: Maple V primer. c1997. Includes bibliographical references and index. ISBN 1-58488-232-8 (alk. paper) 1. Maple (Computer file) 2. Algebra—Data processing. I. Garvan, Frank (Frank G.), 1955- Maple V primer. II. Title. QA155.7.E4 G36 2001 510′.285′53042—dc21 2001043596 This book contains information obtained from authentic and highly regarded sources. Reprinted material is quoted with permission, and sources are indicated. A wide variety of references are listed. Reasonable efforts have been made to publish reliable data and information, but the author and the publisher cannot assume responsibility for the validity of all materials or for the consequences of their use. Neither this book nor any part may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, microfilming, and recording, or by any information storage or retrieval system, without prior permission in writing from the publisher. The consent of CRC Press LLC does not extend to copying for general distribution, for promotion, for creating new works, or for resale. Specific permission must be obtained in writing from CRC Press LLC for such copying. Direct all inquiries to CRC Press LLC, 2000 N.W. Corporate Blvd., Boca Raton, Florida 33431. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation, without intent to infringe. Visit the CRC Press Web site at www.crcpress.com © 2002 by Chapman & Hall/CRC No claim to original U.S. Government works International Standard Book Number 1-58488-232-8 Library of Congress Card Number 2001043596 Printed in the United States of America 1 2 3 4 5 6 7 8 9 0 Printed on acid-free paper © 2002 by Chapman & Hall/CRC To my parents, Kevin and Clare © 2002 by Chapman & Hall/CRC PREFACE maple(cid:2) is a very powerful interactive computer algebra system. It is used by students, educators, mathematicians, statisticians, scientists, and engineers fordoingnumericalandsymboliccomputation. maple hasmanystrengths: (1) itcandoexactintegercomputation,(2)itcandonumericalcomputationtoany (well, almost) number of specified digits, (3) it can do symbolic computation, (4) it comes with many built-in functions and packages for doing a wide variety of mathematical tasks, (5) it has facilities for doing two- and three-dimensional plotting and animation, (6) it has a worksheet-based interface, (7) it has facil- ities for making technical documents, and (8) maple is a simple programming language,whichmeansthatuserscaneasilywritetheirownfunctionsandpack- ages. The present book is a greatly expanded version of an earlier book, The MAPLE V Primer, by the author. A lot has happened to maple since. This book covers maple 7, the latest version of maple. The book is quite compre- hensive. It should serve both as an introduction to maple and as a reference. If you are learning maple for the first time, it is advised that you work slowly through the book until at least Chapter 7. Keep the book open with you at the computer as you try the commands. All the examples of maple commands used in the book, as well as supplementary files are available for download- ing from www.crcpress.com. The files are also available from the author’s site http://www.math.ufl.edu/∼frank/maple-book/mbook.html See Section 12.3. maple is both an interactive computer algebra system and a programming language. An important goal of this book is to show you how to write sim- ple maple programs (or procedures). Chapter 7 is a tutorial for learning the maple programming language. There are programming exercises for the reader to tackle. Their solution is given at the end of the chapter. Once the reader has learned how to program, he or she will appreciate the real power of maple. Hopefully readers will learn to write their own programs and packages to suit their needs. As you progress further into the book you will learn how to use maple (cid:2) Mapleisaregisteredtrademarkof WaterlooMapleInc., 57ErbStreetWest, Waterloo,Ontario, CanadaN2L5J2, Phone: 1-800-267-6583,(519)747-2373, Fax: (519)747-5284, E-mail: [email protected], Website: http://www.maplesoft.com. © 2002 by Chapman & Hall/CRC for more advanced mathematics: differential equations, linear algebra, vector calculus,complexanalysis,specialfunctions,statistics,finitefields,grouptheory, combinatorics, and number theory. maple has many packages that are not automatically loaded when a maple session is begun. To load a package, one needs to use the with(package) function. One of the big changes in maple 6 was the new LinearAlgebra package. All of maple’s packages are covered in the booktosomedegree. Somearecoveredingreatdepth,suchastheLinearAlgebra package in Chapter 9 and the stats package in Chapter 16. Additional maple packages and worksheets are available free at The Maple Application Center page on the Web at http://www.mapleapps.com. See Ap- pendix A for more information. maple hasfabulousbuilt-inhelpfacilities. Helpcanbefoundeitherthrough theinteractiveHelpmenuorbyusingthe? command. Forinstance,averyshort introduction to maple can be found by typing ?intro. maple isavailableonWindows, Macintosh, UNIX,andLinuxsystems. The author would like to thank Waterloo Maple, Inc., for permission to include pic- tures of the maple icons and buttons, and some portions of the text from the on-linehelpsystem. SpecialthanksgotoCynthiaWilsonGarvanandWeirHou, who helped a lot with Chapter 16, the chapter on statistics. The author thanks Bob Stern at CRC Press, for his encouragement and patience. Frank Garvan ([email protected]) Department of Mathematics University of Florida Gainesville, Florida © 2002 by Chapman & Hall/CRC CONTENTS 1. Getting Started............................................................................... 1 1.1 Starting a maple session.......................................................... 1 1.2 Different versions of maple ...................................................... 3 1.3 Basic syntax............................................................................. 3 1.4 Editing mistakes....................................................................... 5 1.5 Help ........................................................................................ 5 1.6 A sample session and context menus.......................................... 7 1.7 Palettes.................................................................................... 10 1.8 Spreadsheets ............................................................................ 12 1.9 Quitting maple ...................................................................... 14 2. MAPLE as a Calculator............................................................... 15 2.1 Exact arithmetic and basic functions......................................... 15 2.2 Floating-point arithmetic.......................................................... 16 3. High School Algebra..................................................................... 19 3.1 Polynomials and rational functions............................................ 19 3.1.1 Factoring a polynomial...................................................... 19 3.1.2 Expanding an expression................................................... 19 3.1.3 Collecting like terms.......................................................... 20 3.1.4 Simplifying an expression .................................................. 21 3.1.5 Simplifying radicals........................................................... 22 3.1.6 Working in the real domain............................................... 23 3.1.7 Simplifying rational functions............................................ 25 3.1.8 Degree and coefficients of a polynomial............................... 27 3.1.9 Substituting into an expression.......................................... 28 3.1.10 Restoring variable status................................................... 28 3.2 Equations................................................................................. 29 3.2.1 Left- and right-hand sides.................................................. 29 3.2.2 Finding exact solutions...................................................... 30 3.2.3 Finding approximate solutions........................................... 30 3.2.4 Assigning solutions............................................................ 31 3.3 Fun with integers...................................................................... 31 3.3.1 Complete integer factorization........................................... 31 3.3.2 Quotient and remainder..................................................... 32 3.3.3 Gcd and lcm..................................................................... 32 3.3.4 Primes.............................................................................. 33 3.3.5 Integer solutions................................................................ 33 3.3.6 Reduction mod p .............................................................. 34 3.4 Unit conversion........................................................................ 34 3.5 Trigonometry........................................................................... 36 3.5.1 Degrees and radians.......................................................... 36 3.5.2 Trigonometric functions..................................................... 37 3.5.3 Simplifying trigonometric functions.................................... 38 © 2002 by Chapman & Hall/CRC 4. Data Types.................................................................................... 41 4.1 Sequences................................................................................. 41 4.2 Sets......................................................................................... 42 4.3 Lists........................................................................................ 43 4.4 Tables...................................................................................... 44 4.5 Arrays ..................................................................................... 44 4.6 Data conversions....................................................................... 45 4.7 Other data types...................................................................... 46 5. Calculus......................................................................................... 47 5.1 Defining functions..................................................................... 47 5.2 Composition of functions........................................................... 48 5.3 Summation and product............................................................ 48 5.4 Limits...................................................................................... 50 5.5 Differentiation.......................................................................... 51 5.6 Extrema................................................................................... 52 5.7 Integration............................................................................... 54 5.7.1 Techniques of integration................................................... 56 5.7.1.1 Substitution................................................................. 56 5.7.1.2 Integration by parts...................................................... 57 5.7.1.3 Partial fractions............................................................ 57 5.8 Taylor and series expansions...................................................... 58 5.9 The student package.................................................................. 58 6. Graphics........................................................................................ 67 6.1 Two-dimensional plotting.......................................................... 67 6.1.1 Restricting domain and range............................................ 69 6.1.2 Parametric plots............................................................... 69 6.1.3 Multiple plots................................................................... 70 6.1.4 Polar plots........................................................................ 71 6.1.5 Plotting implicit functions................................................. 72 6.1.6 Plotting points.................................................................. 73 6.1.7 Title and text in a plot...................................................... 74 6.1.8 Plotting options................................................................ 76 6.1.9 Saving and printing a plot................................................. 79 6.1.10 Other plot functions.......................................................... 79 6.2 Three-dimensional plotting........................................................ 85 6.2.1 Parametric plots............................................................... 88 6.2.2 Multiple plots................................................................... 88 6.2.3 Space curves..................................................................... 89 6.2.4 Contour plots.................................................................... 90 6.2.5 Plotting surfaces defined implicitly..................................... 91 6.2.6 Title and text in a plot...................................................... 92 6.2.7 Three-dimensional plotting options .................................... 92 6.2.8 Other three-dimensional plot functions............................... 95 6.3 Animation................................................................................ 99 © 2002 by Chapman & Hall/CRC 7. MAPLE Programming................................................................ 101 7.1 The maple procedure.............................................................. 101 7.1.1 Local and global variables................................................. 102 7.2 Conditional statements............................................................ 103 7.2.1 Boolean expressions.......................................................... 105 7.3 The “for” loop......................................................................... 107 7.4 Type declaration...................................................................... 111 7.5 The “while” loop..................................................................... 112 7.6 Recursive procedures ............................................................... 115 7.7 Explicit return......................................................................... 117 7.8 Error statement....................................................................... 118 7.9 args and nargs....................................................................... 122 7.10 Input and output..................................................................... 123 7.10.1 Formatted output ............................................................ 123 7.10.2 Interactive input.............................................................. 125 7.10.3 Reading commands from a file.......................................... 127 7.10.4 Reading data from a file................................................... 127 7.10.5 Writing data to a file........................................................ 129 7.10.6 Writing and saving to a file............................................... 129 7.11 Generating C and Fortran code................................................ 131 7.12 Viewing built-in maple code.................................................... 132 7.13 The maple interactive debugger............................................... 132 7.14 Writing your own packages....................................................... 135 7.14.1 Packages as tables............................................................ 135 7.14.2 Modules for packages........................................................ 137 7.15 Answers to programming exercises............................................ 141 8. Differential Equations.................................................................. 147 8.1 Solving ordinary differential equations....................................... 147 8.1.1 Implicit solutions............................................................. 149 8.1.2 Initial conditions.............................................................. 149 8.1.3 Systems of differential equations....................................... 151 8.2 First-order differential equations............................................... 151 8.2.1 odeadvisor..................................................................... 151 8.2.2 Integrating factors............................................................ 154 8.2.3 Direction fields................................................................. 155 8.3 Numerical solutions................................................................. 157 8.4 Second- and higher order linear DEs......................................... 159 8.4.1 Constant coefficients......................................................... 159 8.4.2 Variation of parameters.................................................... 159 8.4.3 Reduction of order........................................................... 160 8.5 Series solutions........................................................................ 161 8.5.1 The method of Frobenius.................................................. 162 8.6 The Laplace transform............................................................. 164 8.6.1 The Heaviside function..................................................... 165 © 2002 by Chapman & Hall/CRC 8.6.2 The Dirac delta function .................................................. 168 8.7 The DEtools package................................................................ 169 8.7.1 DE plotting functions....................................................... 169 8.7.2 Dynamical systems........................................................... 170 8.7.3 DE manipulation ............................................................. 170 8.7.4 Lie symmetry methods..................................................... 171 8.7.5 Differential operators........................................................ 171 8.7.6 Closed form solutions....................................................... 172 8.7.7 Simplifying DEs and rifsimp........................................... 172 9. Linear Algebra............................................................................. 173 9.1 Vectors, Arrays, and Matrices................................................... 173 9.1.1 Matrix and Vector entry assignment.................................. 175 9.1.2 The Matrix and Vector palettes........................................ 177 9.1.3 Matrix operations............................................................ 178 9.1.4 Matrix and vector construction shortcuts........................... 180 9.1.5 Viewing large Matrices and Vectors................................... 182 9.2 Matrix context menu............................................................... 184 9.2.1 The Export As submenu................................................... 185 9.2.2 The Norm submenu.......................................................... 186 9.2.3 The Select Element submenu............................................ 186 9.2.4 The Solvers submenu........................................................ 186 9.2.5 The Conversions submenu................................................ 187 9.2.6 The In-place Options submenu.......................................... 188 9.3 Elementary row and column operations..................................... 189 9.4 Gaussian elimination................................................................ 191 9.5 Inverses, determinants, minors, and the adjoint......................... 192 9.6 Special matrices and vectors..................................................... 193 9.6.1 Band matrix.................................................................... 193 9.6.2 Constant matrices and vectors.......................................... 193 9.6.3 Diagonal matrices............................................................ 194 9.6.4 Givens rotation matrices................................................... 195 9.6.5 Hankel matrices............................................................... 195 9.6.6 Hilbert matrices............................................................... 195 9.6.7 Householder matrices....................................................... 196 9.6.8 Identity matrix................................................................ 196 9.6.9 Jordan block matrices...................................................... 197 9.6.10 Random matrices and vectors........................................... 197 9.6.11 Toeplitz matrices............................................................. 200 9.6.12 Vandermonde matrices..................................................... 200 9.6.13 Zero matrices and vectors................................................. 201 9.7 Systems of linear equations...................................................... 201 9.8 Row space, column space, and nullspace.................................... 205 9.9 Eigenvectors and diagonalization.............................................. 207 9.10 Jordan form............................................................................ 208 9.11 Inner products, and Vector and matrix norms........................... 209 © 2002 by Chapman & Hall/CRC

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.