Maple_Intro.mw

Maple Technology Manual

by

Donald Hartig
Department of Mathematics

California Polytechnic State University

San Luis Obispo, CA

to accompany

Differential Equations and Mathematical Modeling by Glenn Ledder


Copyright ©2005 by The McGraw-Hill Companies, Inc. All rights reserved. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written consent of The McGraw-Hill Companies, Inc., including, but not limited to, in any network or other electronic storage or transmission, or broadcast for distance learning.

Preface

This manual provides a straightforward and practical introduction to the computer algebra system Maple for students and instructors who wish to use it in the study of ordinary differential equations. Readers will find what they need to get a quick start with the program in the context of simple numerical calculations, fundamental calculus computations, and elementary graphing techniques. Applications are interwoven with explanations of how Maple works and examples illustrating the important features of this important software tool.

Once a sufficient level of confidence has been attained, the reader is guided through Maple procedures designed to solve differential equations, analyze the behavior of solutions, and use solutions, both exact and approximate, in the mathematical modeling process. The exercises can be used to clarify the reader's understanding of how the procedures work. Annotated examples guide the reader through the more challenging problems.

Prerequisites and Corequisites

Instructions in the manual are written with the assumption that the reader knows how to start a computer and make a document using a word processor. The ability to use a mouse: point and click, select and drag, pull down a menu, etc. will be taken for granted. The only mathematics prerequisite is the successful completion of a university level calculus course or its equivalent. As a corequisite it is hoped that the reader is actively engaged in the learning of the fundamentals of ordinary differential equations. Please note that this is not a text in differential equations. Indeed, the reader will often be referred to a differential equations textbook (Ledder) for statements of definitions, algorithms, solution techniques, and solution formulas, as well as background material for some of the examples and exercises.

Software and Hardware Requirements

The manual was written on a Macintosh computer using Maple, version 9.5. As a warning to both students and instructors, the minimal requirements for Maple 9.5 on a Macintosh are OS X (10.3 or higher is best) and 256 MB of RAM; 512 MB would be even better to avoid frequent pageouts due to file swapping. Maple 9.5 will run on a G3 processor, but it is so slow that the G4 is recommended as a minimal configuration. Minimal requirements for a PC include 256 MB of RAM. As with a Macintosh, the more RAM the better.

The manual is divided into four (unequal) parts, Exercises, an Appendix, and solutions to selected exercises.

Part I. The Maple Worksheet

This is a brief overview of Maple's worksheet interface. The essential components of a worksheet are described and simple examples illustrate how to enter and process mathematics and text.

Part II. Calculations and Calculus with Maple

The second part contains a more detailed introduction to Maple and how to use it to "do mathematics." The input/output paradigm is stressed as the reader learns how to use Maple as a calculator. Input and output sequences are discussed. Maple output can be used as subsequent input by assigning the output a name, and then referring to it by that name just as one might do using paper and pencil. The notion of assignments are important for the successful use of any mathematics software to a problem that requires more than one calculation. This idea is illustrated several times using familiar examples from calculus. Graphing examples introduce plotting procedures.

Part III. First Order Ordinary Differential Equations

The discussion of differential equations in Maple starts here in the context of mathematical models requiring first order equations in their analysis. Readers who are already familiar with Maple are encouraged to skim over Parts I and II and begin in Part III. Direction fields and exact solution curves are plotted. Implementation of Euler's method provides the reader with an opportunity to learn how to write a Maple program that can easily be converted into a user-defined procedure.

Part IV. Linear Differential Equations

Linear differential equations, linear systems, and Laplace transforms are featured in this part of the manual. Procedures in the LinearAlgebra package are introduced to handle vectors and matrices gracefully.

Exercises

Exercise sets are divided by Part and Section. Solutions to asterisked exercises appear in the solution section.

Appendix

The appendix, which itself is divided into parts 1 - 5 contains miscellaneous items that did not fit nicely into Part I, II, III, or IV: Power series and special functions, Picard iterates, Partial differential equations, A glossary of the Maple terms and procedures, and some Sound advice and encouraging words.

Solutions to Selected Exercises

A list of solutions to the exercises that appear with an asterisk.

The Table of Contents that follows is detailed enough to be used as a complete outline of the topics that are treated in the manual.

Table of Contents

Part I. The Maple Worksheet

 Section 1. Execution groups: Input/Output.................................1
   Input comments: Use a hash mark #.......................................1

   The pull down menus.................................
....................2

 Section 2. Entering a Block of Text.......................................4
   Annotating input and output: An example...............
..................4
   Undo it: Command-Z......................................................5

   Delete it: Command-[delete]..................................
...........5

Part II. Calculations and Calculus with Maple

 Section 1. Getting Started: Maple as a Calculator.........................6
   Parentheses for grouping must be the round kind: ().............
........7
   Square brackets and set brackets........................................8

   
Input sequences: The sequence operator..................................9
   More complicated sequences: The sequence procedure.....................10

   The sequence procedure is more versatile........................
.......11
   But the sequence operator is more handy.........................
.......11
   Moving towards symbolic calculations: Factoring in Maple........
.......12

 Section 2. Symbolics: Equations and Assignments..........................14
   Variables, equations, and assignments...........................
.......14
   Multiple assignments: Full evaluation...........................
.......15
   Solving equations exactly: The solve procedure..................
.......16
   Check by substitution: simplify if needed.......................
.......17
   Solving equations approximately: The fsolve procedure...........
.......17
   More about solve and fsolve.....................................
.......19
   Using variables as functions....................................
.......20

 Section 3. Functions as Transformations..................................23
   Using a transformation to define a function.....................
.......23
   Parametric plots................................................
.......25
   Plot several tangent lines......................................
.......25
   Find the length of the curve....................................
.......26
   An area calculation.............................................
.......27
   Higher derivatives..............................................
.......28
   Unevaluated derivatives.........................................
.......30
   The chain rule..................................................
.......31
   Just a little bit about differential equations..................
.......31
   Working with the solution..............................................32

   Use the unapply procedure to make functions out of expressions.......
..33

Part III. First Order Ordinary Differential Equations

 Section 1. Entering and Solving..........................................34
   Solve this: dsolve.....................................................34

   Checking the solution: odetest.........................................34

   Plotting solution curves...............................................35

   Solving an initial value problem.......................................35

   Getting information out of the solution formula........................36

   A solution formula in terms of the initial condition...................36

   Look before you leap...................................................37

   To obtain implicit solutions add the keyword implicit..................40

 Section 2. Working with Solutions: Modeling..............................43
   Exponential Models.....................................................43

   A more interesting problem.............................................44

   Monthly payments.......................................................45

   Heating and cooling....................................................46

   Orthogonal trajectories................................................50

 Section 3. Slope Fields: DEplot..........................................53
   The tool you need: DEplot..............................................53

   Step size matters......................................................55

   Keep your eye on f(t,y)................................................56

   Go with the flow.......................................................59

 Section 4. Approximate Solutions.........................................62
   One step at a time: Euler's algorithm..................................62

   Make it yours: User defined procedures.................................64

   Modify it: The Euler two step algorithm................................65

   Using dsolve to generate numeric solutions.............................67

   The dsolve/numeric procedure...........................................68

   A preview of second order equations: An aging spring...................70

Part IV. Linear Differential Equations

 Section 1. Linear Oscillators............................................72
   Solve this too: dsolve and the unforced equation.......................72

   The phase plane trajectory.............................................74

   Simple harmonic motion.................................................76

   Damped unforced motion.................................................76

   The phase plane trajectory for underdamped oscillations................78

   Phase plane trajectories and vector fields.............................79

 Section 2. State Space...................................................82
   Autonomous equations...................................................82

   Force it: A non-autonomous equation....................................84

   State space trajectories: The spacecurve procedure.....................86

   Numerical solutions: DEplot............................................87

   Numerical solutions: dsolve............................................89

 Section 3. Two Dimensional Systems.......................................92
   Fields and flows.......................................................92

   Numerical output: dsolve/numeric.......................................94

   Nullclines and critical points.........................................94

   Symbolic solutions, integral curves....................................95

   Linear systems, linear flows...........................................96

 Section 4. Matrix Methods................................................99
   The LinearAlgebra package: Matrices and Vectors........................99

   Maple's "column entry" method for vectors and matrices................101

   Eigenvectors and eigenvalues..........................................104

   Eigenvector solutions to v' = Av, the 2 x 2 case......................105

   The matrix exponential................................................108

   A three dimensional example, approximate solutions....................108

 Section 5. The Laplace Transform........................................112
   The inttrans package..................................................112

   Piecewise vs Heaviside: Both are winners..............................113

   Typical driver: Off, then on, then off again..........................114

   Use an alias..........................................................117

   The Dirac delta: Dirac................................................118

   Applying the Laplace transform method to a linear system..............119

Exercises

Appendices

 A1. Power Series and Special Functions

 A2. Picard Iteration

 A3. Partial Differential Equations

 A4. Glossary

 A5. Sound advice and encouraging words

Selected Solutions