You are on page 1of 167

The Maple® O.D.E.

Lab Book
Springer
New York
Berlin
Heidelberg
Barcelona
Budapest
Hong Kong
London
Milan
Paris
Santa Clara
Singapore
Tokyo
Darren Redfern Edgar Chandler

The Maple®
O.D.E. Lab Book
With 50 Figures
DOS Diskette Included

Springer
Darren Redfern Edgar Chandler
Practical Approach Corporation Scottsdale Community College
151 Frobisher Drive, Suite C-210 9000 E. Chaparral Road
Waterloo, ON N2V 2C5 Scottsdale, AZ 85250
Canada USA

Library of Congress Cataloging-in-Publication Data


Redfern, Darren.
Maple® O.D.E. lab book/Darren Redfern, Edgar Chandler.
p. cm.
Includes bibliographical references and index.
1. Differential equations-Numerical solutions-Data processing.
2. Maple (Computer file) I. Chandler, Edgar. II. Title.
QA371.5.D37R43 1996
515'.352'078-dc20 96-19514

Maple is a registered trademark of Waterloo Maple, Inc.

Printed on acid-free paper.

© 1996 Springer-Verlag New York, Inc.


Softcover reprint of the hardcover 1st edition 1996
All rights reserved. This work may not be translated or copied in whole or in part without the
written permission of the publisher (Springer-Verlag New York, Inc., 175 Fifth Avenue, New
York, NY 10010, USA), except for brief excerpts in connection with reviews or scholarly
analysis. Use in connection with any form of information storage and retrieval, electronic
adaptation, computer software, or by similar or dissimilar methodology now known or
hereafter developed is forbidden.
The use of general descriptive names, trade names, trademarks, etc., in this publication,
even if the former are not especially identified, is not to be taken as a sign that such names,
as understood by the Trade Marks and Merchandise Marks Act, may accordingly be used
freely by anyone.

Production managed by Frank Ganz; manufacturing supervised by Jacqui Ashri.


Photocomposed copy prepared from the authors' "0-TEX files.

987654321
ISBN-13: 978-0-387-94733-4 e-ISBN-13: 978-1-4612-2402-0
DOl: 10.1007/978-1-4612-2402-0
We would like to gratefully dedicate this project to our families and
colleagues who, over the years, have been very supportive and helpful,
providing much appreciated guidance and direction.
Contents

1. Introduction 1
How This Lab Book Is Organized 2 • Using the
Diskette 2 • Where to Go for More Information 3 •
Acknowledgments 3

2. Getting Started with Maple 4


Starting Maple 4 • Basic Maple Syntax 5 •
Basic Maple Objects 8 • Mixing and Matching
Different Number Types 9 • Strings 10 • Maple
Expressions 11 • Sets and Lists 13 • Calling Maple
Commands 16 • Assignments and Equations 19 •
The Use of Quotes in Maple 22 • Activities for §2 23

3. First-Order ODEs 25
Defining and Solving First-Order ODEs 25 • Explicit vs.
Implicit Solutions 28 • Activities for §3 31

4. Applications of First-Order ODEs 33


Falling, Floating, or Accelerating Objects 33 • Mixture
Problems 40 • Activities for §4 42

vii
viii • Contents

5. Graphical Methods 45
Direction Fields 46 • Some Examples 49 • Activities
for §5 53

6. Homogeneous Linear Differential Equations 56


Activities for § 6 63

7. Non-homogeneous Linear Differential Equations 65


Activities for §7 69

8. Applications of Linear Differential Equations 71


Free, Undamped Motion 72 • Free, Damped
Motion 75 • Activities for § 8 81

9. More Applications and Systems of Differential Equations 83


Forced Motion 83 • Systems of Linear Differential
Equations 87 • Activities for §9 89

10. Phase Planes 91


Activities for § 10 98

11. Matrix Operations 100


Basic Concepts 100 • Characteristic Values and
Characteristic Vectors 106 • Activities for §11 109

12. Matrix Methods of Solution 111


Activities for § 12 116

13. Isoclines 117


Activities for § 13 119

14. Series Solutions 121


Activities for § 14 129
Contents • ix

15. Numerical Methods 131


Problems with Numerical Methods 136 • Activities for
§15 139

16. The Laplace Transform 140


Activities for §16 152

Bibliography 154

Index 157
Introduction
CHAPTER

The Maple ODE Lab Book is intended to provide a thorough introduc-


tion to using symbolic computation software to model, solve, explore, and
visualize ordinary differential equations. It is best used as a supplement to
existing texts (see the bibliography for some of our recommended texts).
Maple was chosen as our software package because of its ease-of-use,
affordability, and popularity at many universities and colleges around the
world. The version being used is Maple V Release 4. If you have a previous
release of Maple, some of the commands shown in this lab book will work
differently (or not at all), but the basic groundwork for solving ODEs hasn't
changed. Speak to your system administrator about upgrading to Release
4, or contact:

Waterloo Maple Inc.


450 Phillip Street
Waterloo, Ontario
CANADA N2L 5J2
Phone: (519) 747-2373
FAX: (519) 747-5284
E-mail: info@maplesoft.com
WWW: http://www.maplesoft.com

1
2 • Chapter 1. Introduction

How This Lab Book Is Organized


Each subsequent chapter of this lab book contains information and ex-
amples of how to apply Maple to various elements of ordinary differential
equations. It is suggested that you read the chapters with your computer on
and Maple V Release 4 running. You can then execute many of the com-
mands yourself and experiment by changing various parameters and/or
initial conditions, observing the corresponding changes in the results.
At the end of each chapter, a set of exercises is provided for the reader
to complete. Maple worksheets containing answers to all exercises (and
other valuable information) can be found on the diskette at the back of the
lab book.

U sing the Diskette


This lab book comes with a single DOS-formatted diskette, which contains
the following files:
• 15 worksheets, named chap2.mws through chap16.mws. Each work-
sheet contains answers to the corresponding exercises in the lab book,
as well as an experimentation section that approaches some of the ma-
terial from that chapter in a slightly different way than in the book.
• The files chart.mws and chart.m. These files contain the code for a
utility procedure (printchart) created in Chapter 4. Have your system
administrator place chart.m in a directory easily accessible by your
copy of Maple.
All files on this diskette should work on any computer platform that
Maple V Release 4 supports. If you are not on a DOS (i.e., Windows) based
machine, you should be able to transfer the contents of a DOS diskette onto
your system (for example, with the Mac utility AppleFileExchange).
If you cannot transfer the files, contact your system administrator. If
that fails, please contact us at one of the addresses listed in the next section.

Ground Mail: Practical Approach Corporation


151 Frobisher Drive, Suite C-210
Waterloo, Ontario
CANADA N2V 2C5
Acknowledgments • 3

FAX: (519) 747-2207

Email: info~practical.on.ca
darren~practical.on.ca

WWW: http://www.practical.on.ca

Where to Go for More Information


The range of Maple books, courseware, and third-party applications is
constantly growing. Apart from the standard Maple manuals (The Learn-
ing Guide, etc.) there are books on using Maple in subject areas from linear
algebra and calculus to physics and chemistry; and there are several more
volumes currently being written by authors in the academic and commer-
cial fields. The next few years will see an explosion in the number and
variety of Maple materials.
In addition, there have been many scholarly papers, reports, and theses
written around the Maple system. For more information on these or other
Maple materials, contact Waterloo Maple Inc.

Acknowledgments
A hearty thank you goes out to those colleagues who provided their time
and expertise to the project. Included in their ranks are Ian McGee, Jerry
Marsden, David Doherty, Bruce Barber, and David Raimondo.
Getti ng Started
CHAPTER

with Maple

This chapter is intended to familiarize you with how Maple works, how
expressions and commands are entered in Maple, and how to make sense
of the results.
There are dozens of areas that could be covered in a chapter such
as this. Instead of introducing all these aspects of Maple, we restrict our
focus to those general areas that have a direct bearing on the computations
performed in the rest of this supplement. For a broader overview of Maple's
functionality, refer to the materials mentioned in the Where to Go for More
Information section of Chapter 1.
More ODE-specific commands are detailed in the chapters where they
are first used. In this chapter we restrict ourselves to exploring the basic
structure of Maple expressions and operators, and the mechanics of how
to invoke commands.

Starting Maple
On systems which support command line interfaces (e.g., UNIX, DOS),
Maple is typically started by entering the command maple at the prompt.
Systems with more advanced graphical user interfaces (e.g., Macintosh,
NeXT, Windows, Amiga) have a Maple program icon that activates the
application.

4
Basic Maple Syntax • 5

On most platforms, when Maple is started, you are presented with a


new Maple worksheet, on which you can combine Maple input, output,
text, and graphics. At the top of this empty worksheet is a single input
prompt that typically looks like:

> x

Basic Maple Syntax


Input to Maple is typed in at the input prompt. A complete input statement
can consist of Maple commands, expressions, procedures, etc., and must be
properly terminated. There are two ways to terminate a Maple statement.
A semicolon (;) is the most commonly used Maple terminator. The resulting
output is displayed directly below the input. A colon (:) terminator tells
Maple to suppress the output and is particularly useful when the output
is an inconsequential intermediate result or is expected to be too large to
view conveniently.
Once you have typed all the input that you wish to enter on any indi-
vidual line, pressing the Enter key sends it to Maple's mathematical engine
to be interpreted. If your input contains a complete Maple statement (or
completes a previously incomplete one), then that complete statement is ex-
ecuted and the result displayed in an output region directly below. If your
input consists of an incomplete Maple statement, then the system holds
the incomplete statement in a buffer, givse you another input prompt, and
waits for you to complete that statement.

Sometimes problems arise when beginners (or even experts) enter input
lines.
As detailed above, if the input is an incomplete statement, Maple does
not perform any calculations, but provides you with another input prompt
directly below the line just entered. This behavior can happen naturally
when an input is so long that it stretches over several lines, but most often
it is because a semicolon or colon was omitted. (Beginning users often
mistake this lack of activity for inability to perform the calculation.) Simply
add a terminator on the new line and hit Enter.

> expand«x+l)~4)
6 • Chapter 2. Getting Started with Maple

> .

A common reaction to forgetting a terminator is to retype the entire com-


mand on the second line. This only leads to a syntax error, as Maple con-
catenates the two input lines together and tries to execute the resulting
expression.
> expand«x+l)-4)
> expand«x+l)-4);

syntax error. missing operator or


expand«x+l)-4);
..
, ., .

When there is a syntax error in the input, Maple prints a syntax error
message. A caret (-) marks where Maple's interpreter first ran into trouble.
It is then up to you to correct the error.
If your input is syntactically correct but contains another type of mis-
take, Maple issues an error message. Be warned, however, that Maple's
error messages occasionally are rather obtuse, failing to indicate exactly
what you did wrong or how you should go about fixing it.
> divide(x-2+1);

Error. wrong number (or type) of parameters in functio\


n divide
> assign([1.2.3.4]);
Error. (in assign) invalid arguments

When faced with such ambiguous error messages, it is usually helpful


to invoke Maple's on-line help system. A help page can be displayed for
any Maple command by prefacing the command name with a question
mark.
> ?divide
FUNCTION: divide - exact polynomial division

Calling Sequence:
divide(a. b. 'q')

Parameters:
Basic Maple Syntax • 7

a, b - polynomials with rational number coefficients


q - an unevaluated name

Synopsis:
- divide checks if the polynomial b divides a over the rationals. If so, true
is returned; otherwise false is returned.
- If the division is successful and there is a third argument 'q',then the
value of the quotient is assigned to q. In the case of an unsuccessful
division the name q will not be affected.

Examples:
> divide(x-3-y-3, x-y, 'q');
true

> q;
2 2
y + x y + x

See Also: rem, quo, gcd, Divide

Most help pages have fields (i.e., FUNCTION, CALLING SEQUENCE, etc.)
identical to the above.
Unlike our earlier stated rule, requests for help information do not need
to be terminated by a colon or semicolon.
If you are unsure of a command name, try reading ?intro and ?in-
dex. On windowing versions of Maple there is typically a Help Topic
Browser (usually accessed through the Help Menu) that allows you to
navigate through the many different command names available. Refer to
your platform-specific Maple documentation for more details.
Another basic consideration that often confuses new users is the ad-
dition of blank spaces in Maple input. For the most part, blank spaces
can be added at will and are automatically removed by Maple's parser if
redundant, but there are a few rules and exceptions. For example, blank
spaces cannot be added to the middle of a number or a command name.
> 1 234 567 / 89;
syntax error, unexpected number:
1 234 567 / 89;

If you wish, use the continuation character (\) to organize large numbers.
This character is simply ignored by the parser whenever it is encountered.
8 • Chapter 2. Getting Started with Maple

> 1\234\567 1 89;


1234567
89

Basic Maple Objects


Numbers, constants, strings, and names are the simplest objects in Maple.
The following sections give you a basic understanding of how to recognize,
create, and use these objects.

Example: Integers and Rationals


There are many different ways of specifying explicit values in Maple. Be-
cause Maple works in the symbolic realm, numbers need not always be
given in decimal representation (although you certainly may do so if you
wish). Integers are the most straightforward exact numbers to specify; ra-
tional numbers use the division operator (I) to separate numerator and
denominator.
> 31;

31
> 3/7;
3
7
> -39/13;
-3
Rationals are automatically put into their lowest terms.

Floating-point Numbers
Decimal representations of numerical values are expressed as you would
expect, and appear as the results of many of Maple's numerical proce-
dures. As well, numerical values can be represented in base 10 or scientific
notation.
Mixing and Matching Different Number Types • 9

> 2.3;

2.3
> -123.45678;

-123.45678
> .143 * 10-(-44);

.143000000010- 44
> Float(3141, -3);

3.141
> 1.234e10;

.123410 11

Mathematical Constants
While integers, rationals, and floating-point numbers can be thought of as
constants of a sort, Maple also supports many other common mathematical
constants. The list includes:
Pi Jr,3.1415926535 ...
exp(1) e, natural log base
I r-r
infinity 00
-infinity -00
gamma Euler's constant
Catalan Catalan's constant
true, false boolean values
Maple is case sensitive, so be sure to use proper capitalization when
stating these constants. The names Pi and pi are not equivalent!

Mixing and Matching Different Number Types


Being able to leave values in their exact representation (e.g., Pi not 3.14159 ... )
is part of the beauty of symbolic algebra. Normally, Maple allows you to
10 • Chapter 2. Getting Started with Maple

retain values in their exact form throughout many calculations. There is,
however, one situation where exact values are converted to approxima-
tions: when you mix and match types in an expression. The following
examples illustrate this idea.
> 1/3 + 2;
7
3
> 1/3 + 2.0;
2.333333333
Placing even one floating-point value in a large exact expression causes
complete conversion to floats.
> 1/2 + 2/3 + 3/5 + 5/7 + 7/11 + 1.2;

4.317316017

Strings
A string in Maple consists of a number of characters of any sort surrounded
by backquote characters ('). Following are two examples of Maple strings.
> 'This is a Maple string';

This is a Maple string


> '123abc';
123abc
> 'x + 5/9';

x + 5/9
Special characters (+, ., /, etc.) and blank spaces may be included any-
where in a string, as long as the backquote characters are present. If the
backquote characters are not present, then these special characters are
treated as normal Maple operators.
> directory/filename;
directory
filename
Maple Expressions • 11

> invert.src;
invertsrc
A name in Maple is a special type of string, which typically contains a
letter (a-z, A-Z) followed by zero or more letters, digits (0-9), and under-
scores C). There is no practical limit to the length of names; they can have
over 500,000 characters. Names are case sensitive. The name MyName is
distinct from myname. One difference between names and strings is that
names do not need to be enclosed with backquotes, unless the name con-
tains special characters that you do not wish to be evaluated. The following
are some examples of valid Maple names.
> MyVariable;

My Variable
> hello;
hello
> 'greatest common divisor';

greatest common divisor


Now here are examples of invalid Maple names.
> Ithequotient;
syntax error, 'I' unexpected:
Ithequotient;

> ... etc;


syntax error,' 'unexpected:
... etc;

Maple Expressions
Expressions are extremely important structures in Maple. All Maple ob-
jects are, at one level or another, made up entirely of expressions. At its most
basic level, an expression consists of a single value, unknown, or string.
Conversely, Maple expressions can consist of thousands upon thousands
12 • Chapter 2. Getting Started with Maple

of values, unknowns, and strings linked together with various arithmetic


operators.
Maple's arithmetic operators include:
+ addition
subtraction
* multiplication
/ division
exponentiation
factorial
absO absolute value
iqouO integer quotient
iremO integer remainder
When necessary, use blank spaces between terms to keep your expres-
sions readable. Following are examples of simple Maple expressions.
> a+b+c;
a+b+c

1 2 1 2
25 x + 36 Y
Maple echoes these expressions in a "pretty" form, the quality of which
depends upon the capabilities of your monitor.

Order of Operations
In expressions, the precedence of operators follows the standards found in
most other areas of computation. If there are any ambiguities, use paren-
theses, 0, to specify the order of operations.
> 2+3*4-5;
9
> (2+3)*4-5;

15
Sets and Lists • 13

-5
It is a good idea to use parentheses whenever there is any chance of am-
biguity. If a set of parentheses is redundant, Maple's parser eliminates it
during computation.

Expression Sequences
Another common data structure in Maple is the expression sequence. An
expression sequence is one or more Maple expressions separated by com-
mas. Most Maple commands require an expression sequence as input, and
many return a result that includes an expression sequence.
The simplest way to create an expression sequence is to enter it as such.
> 1, 2, 3, 4, 5;
1,2,3,4,5
> a+b, b+c, c+d, e+f, f+g;

a + b, b + c, c + d, e + (,f + g
Alternatively, there are two automatic ways to generate an implicit expres-
sion sequence. First, the $ operator can be used alone to create sequences
containing multiples of one element, or in conjunction with the ellipsis
operator (.. ), to create well-ordered sequences.
> a$6;

a,a,a,a,a,a
> $1. .6;
1,2,3,4,5,6

1,4,9,16,25,36

Sets and Lists

Now that you have learned how the create expressions and expression
sequences, it is time to put those skills to use creating the next level of
14 • Chapter 2. Getting Started with Maple

Maple objects: sets and lists. These two data types lend organization to
Maple objects, although the exact manner in which they do so varies.

Sets
A set is a non-ordered collection of expressions. Any valid Maple expres-
sion can be contained in a set. Sets are often used as input to Maple com-
mands and are frequently contained in Maple output. A set is written as
an expression sequence surrounded by braces, n. One important thing
to remember about sets is that repetitive elements are automatically re-
moved. The first of the following three examples demonstrates this "non-
repetitive" rule.
> {1, 1, 2, 3, 2};

{1,2,3}
> {a*x, blue, -234.456, 'Maple Tutorial'};

{a x, Maple Tutorial, blue, -234.456}


> {red, white, blue};

{white, blue, red}


As the last two examples show, the order in which you list the elements
of a set is not necessarily how Maple sees them internally. The ordering
in which the elements are displayed depends on the order in which the
elements are stored in Maple's internal memory.
There are four basic operators that work on sets: the union operator
combines the elements of two sets into one (eliminating any repetitive el-
ements, of course), the intersect operator creates a set that contains any
elements common to the two initial sets, the minus operator removes from
the first set any elements also found in the second set, and the member
operator tells whether a given element is contained in a set.
> {a, b, c, d} union {d, e, f};

{b, a, c, e, f, d}
> {1, 2, 3, 4, 5} intersect {2, 4, 6, 8, 10};

{2,4}
Sets and Lists • 15

> {xl, x2, x3} minus {xl, yl};

{x2,x3}

> member(n, {W, e, d, n, e, s, d, a, y});

true

Lists
Though similar in syntax, lists and sets have significant differences. Both
sets and lists are created from expression sequences, but lists are enclosed
with right and left brackets, [], as opposed to braces. As well, lists are
well-ordered objects, meaning that when you specify a list in Maple the
ordering that you indicated is preserved. A third fundamental difference is
that duplicate elements are valid within a list. The following are examples.
> [1,2,3,4,5,4,3,2,1];

[1,2,3,4,5,4,3,2,1]
> [a, d, c, b, e];

[a, d, c, b, e]
> [{c,a,t}, {d,o,g}, {m,o,u,s,e}];

[{a, c, t}, {d,g, oJ, Ie, 5,0, m, u}]

In the last example, the three sets are elements of the list enclosing them.
While the ordering of the elements within the sets may vary, the ordering
of the three sets themselves remains constant.
While the union, intersect, and minus operators do not work on lists,
the commands op and nops may be used to access and manipulate elements
of a list. (Recall that Maple's on-line help facility can be used to access
information on new commands such as ops and nops.)
> listl := [a, exp(3), 1,2/3];
~ 2
listl := [a, e-', 1, 3"]

> nops(listl);
4
16 • Chapter 2. Getting Started with Maple

> op(2 .. 3. list1);

Calling Maple Commands

Command Names
Learning about Maple expressions and other data types, such as lists and
sets, has led to their most common use: as parameters in commands. There
is a wealth of built-in commands stored in the Maple library. Each com-
mand is called in the following manner:
commandname(parameterl, parameter2, ... , parametern );
The following is an example of a command call to plot, which plots
the function y = x 2 - 4 with a horizontal (x) range of -5 .. 5 and a vertical
(y) range of -5 .. 10.

> plot(x~2-4, x=-5 ..5, y=-5 .. 10);

Command names have been chosen to best represent the functionality


of a command and, at the same time, to require the least possible amount
of typing. For example, the command for finding integer greatest common
divisors is called igcd and the command for determining the leading term
of a polynomial is called leadterm. Some command names are as short as
one character long (e.g., D), while others are over ten characters long (e.g.,
completesquare).
Most Maple commands are written entirely with lowercase letters. One
notable exception to this rule is inert functions. Inert functions are "place-
holders" for their active counterparts, and they are usually spelled identi-
cally except for having the initial letter capitalized. For example, Int is the
inert form of the int command. When Int is called, no actual calculations
take place, and the input is echoed back to you.
> Int(exp(x-2). x=1 .. 3);
Calling Maple Commands • 17

[Note: not all commands that start with a capital letter are inert (e.g., D,
C, GAMMA).]
Again, remember that Maple is case sensitive, which means that factor,
Factor, and FaCTor are all different in Maple. Whether they are used as
command names or variable names, Maple considers them three separate.
The following are examples of more valid calls to Maple commands.
> isprime(10889);

true

3x2 -10x+2
> sin(Pi/2);

Where's That Command?


It is not always sufficient simply to know the name of the command that
you want to enter-sometimes you must explicitly load the command from
some part of the Maple library before you can execute it. Because Maple
is forgiving in its nature, it lets you issue a command that has not been
loaded or does not yet exist and simply echoes the input back at you as if
to say, "OK, I'll let you use that command name, even though it doesn't
mean anything to me right now." Following are examples of such behavior.
> INT(x-2, x);

> mtaylor(sin(x-2+y-2), [x,y] , 8, [2,1]);

mtaylor(sin(x2 + y2), [x,y], 8, [2, 1])


> mean(l, 2, 3, 4, 5, 6);
mean(1,2,3,4,5,6)
When this happens, check to make sure that you have spelled the command
correctly (including proper lowercase and uppercase letters) and loaded the
command into Maple's memory.
18 • Chapter 2. Getting Started with Maple

Automatically Loaded and readlib Defined Functions


When Maple starts up, it does not have any commands entirely loaded into
memory. There are, however, many standard commands that have point-
ers to their locations loaded, so that when you call them for the first time,
Maple automatically knows where to go to load them. A list of these com-
mands can be accessed with ?index,function. Execute this help command
now, and take a few minutes to browse through the command names.
Some other functions that reside in the library are not automatically
loaded, but must be explicitly loaded with the Maple command readlib
(read from the Ii brary). If you try entering a command that is in the standard
library but it does not seem to work, try doing a readlib and calling it again.
The following are some examples of both automatically loaded and
readlib defined functions.
> expand«x-2)*(x+5));

x 2 +3x-l0
> realroot(x-3+37*x-21, 1/100);
1
realroot(x 3 + 37 x - 21, 100}
> readlib(realroot);
proc(poly, widthgoal} ... end
> realroot(x-3+37*x-21, 1/100);
9 73
[[16' 128]]
Once a command has been loaded into memory, it does not need to be
reloaded during the current Maple session.

Functions in Packages
Maple contains over a dozen specialized sets of commands called packages
(e.g., linalg, liesymm, etc.). The routines in these packages are not automat-
ically loaded, nor can they be accessed with the readlib command. Most of
these packages will not be used in this book, but it is a useful to know how
to access them nonetheless. The first method of accessing these commands
is to use the with command, which loads in pointers to all the commands in
a particular package. Then, when any command in that package is called, it
Assignments and Equations • 19

is automatically loaded into memory. Another way is to call the command


with its package name prepended to it. A few examples follow to illustrate
these methods.
> with(combinat);

Warning, new definition for Chi

[Chi, bell, binomial, cartprod, character, choose, composition, conjpart,


decodepart, encodepart, fibonacci, firstpart, graycode, inttovec, lastpart,
multinomial, nextpart, numbcomb, numbcomp, numbpart, numbperm,
partition, permute, powerset, prevpart, randcomb, randpart, randperm,
stirlingl, stirling2, subsets, vectoint]
> numbperm([l,2,3,4]);

24
> numtheory[divisors] (20);

{1, 2, 4, 5,10, 20}

Assignments and Equations


This section explains the difference between the assignment operator, :=
(the colon character immediately followed by the equal sign), and the equa-
tion operator, (=). It is important to understand the distinction between the
two.

Assignments
You have previously learned how to create expressions, special data types,
and Maple command calls; but these objects are transitory until you ac-
tually assign their values (or results) to some holder or variable. For ex-
ample, if you create a list containing the first ten prime numbers in order
and do not assign this to a variable name, then each time you wish to use
that structure within a Maple command or larger data structure, you must
recreate it from scratch. If, instead, you assign the list, with the := operator,
20 • Chapter 2. Getting Started with Maple

to a variable name, say first10primes, then you can easily use it in other
calculations or as input to other Maple commands.

> firstl0primes := [ithprime(i) $ i=1 .. 10];

fi,rstl0primes:= [2,3,5,7,11,13,17,19,23,29]

> product(firstl0primes[i], i=1 .. 10);

6469693230

Bear in mind that when you make an assignment, the expression to the right
of := is first evaluated, and then that value is assigned to the name on the
left of := until you tell Maple differently. Maple only remembers the most
recently assigned value for any variable-if you assign the variable x to 5
and then later assign it to 7.5, only the latter assignment is remembered.
As well, you must use caution when choosing names for assigned vari-
ables. Maple allows you to choose almost any name for a variable, includ-
ing names that are used as Maple commands. If you redefine a Maple
command name through an assignment, the standard meaning of that
command is temporarily lost and this can cause many unpredictable er-
rors within your session. To be sure that you are not using any predefined
names, try a Maple help command (i.e., ?name) for the variable name be-
fore you use it. One particular set of names to which Maple does not allow
you to assign values are keywords. Keywords are special words used by
Maple in its programming language, and are all in the following table.
and by do done elif
else end fi for from
if m intersect local mmus
mod not od option options
or proc quit read save
stop then to umon while

Equations
The most important thing to realize about equations is that they are not
the same as assignments. Equations are simply mathematical expressions
that show relationships between certain variables and values; they do not
infer any explicit values on the variables they contain. For example:
Assignments and Equations • 21

> x =Y+ 3;
x=y+3
> x;
x
> y;

y
The variables x and yare still unassigned.
The = operator is most frequently seen in either input to a Maple
command or output from a Maple command. One common family of
commands that makes extensive use of the = operator is the solve family
(i.e., solve, rsolve, dsolve, etc.). These commands take equations of various
forms and try to find a solution for a given set of variables.
For example, solve takes a set of linear or nonlinear equations and tries
to find a closed-form solution.
> sols := solve({x + y = 3,x - Y = 1}, {x, y});

sols := {y = 1,x = 2}
> x, y;

x,y
As you can see, the solution that you get is a set of equations for the specified
variables. If there are multiple solutions, they are all presented. Be aware
that x and y have not been assigned to the values 2 and 1, respectively.
If you wish to make such an assignment, use the assign command, which
takes an equation or set of equations and changes each equation to an
assignment.
> assign(sols);
> x, y;

2,1
> x := 'x'; y := 'y';

x:=x
y:=y
22 • Chapter 2. Getting Started with Maple

The Use of Quotes in Maple


There are three types of quotes used in Maple. Each has a separate meaning,
and it is important that you understand how to use each of them correctly.

Double Quote
The double quote operator (") is perhaps the easiest quote to remember.
Double quote recalls previous output in a Maple session. One double quote
recalls the most recent output, two ("") recall the second most previous
result, and three (" '''') recall the third most previous output. You cannot
go further back than three outputs.
Using double quote remains very straightforward when in command
line mode. Even if you use the colon terminator to suppress the display of
output from a particular command, the double quote operator can be used
to display that previously suppressed output.
Another way of looking at the double quote operator is as a short-
term replacement for assignment. In most cases, it is better to immediately
assign that output to some variable name (which allows you to refer to it
any time later in that session).
> expand((x-2)-3*(x-l));

x4 - 7 x 3 + 18 xl - 20 x +8
> factor(II);

X4 - 7 x 3 + 18 x 2 - 20 x +8
xl + 3x - 2

Backward Quote
The backward quote operator (') is used to enclose Maple strings. While
only strings with special characters (e.g., /, *, !) need backward quotes
around them, it is recommended that you get in the habit of using them on
all your strings.
Activities for §2 • 23

Single Quote
Single (forward) quotes can be used to unassign a variable that was previ-
ously assigned to a value.
> x := 3;

x:=3
> x := 'x';

x:=x

Activities for §2
1. The library contains the core of Maple's mathematical capabilities.
A complete description of every library routine is available by using
Maple's on-line help facility.
Print the contents of the output for the following command:
?Iibrary
2. Evaluate each of the following numerical expressions:

537 5 .J8640 458·247 48'


, '349'·' e
31n2 , (1 _.!2 + .!3 _ .!4 + .!)4
5

3. Perform the following algebraic operations and simplify the results.


Multiply:

(2x + 5)(3x - 2), (2t + 7u - 3)\ (e 2t - e t + 4)(3e 2t + Set - 3)

Factor:

x 2 - 4y2 - 2x + 4y, 12t5 + 16t4 - 127t 3 - 76t 2 + 325t - 150

4. Solve each of the following equations:


a. b2 - 4b + 2 = 0, for b
b. 2x - 3xy = 5, for x
c. In (t 2 - 1) = a, for t
d. 12x5 + 16x4 - 127x3 - 76x 2 + 325x - 150 = 0, for x
24 • Chapter 2. Getting Started with Maple

e. 2cos(u) + 3cos2 (u) = 1, for u

5. Graph each of the following functions using intervals which give a


complete graph.

3 2 sin(x).J 2 3x2 + 2
y=x -5x +2x+3,y= --,Y= 20-x ,Y= 2 4
x x -

6. In the graph ofy = x 3 -6x2 + 7x+2, there are two local extreme points
(called the local minimum and local maximum). Graph this function
and estimate the x and y coordinates of both these points. Improve
on your estimates by using the subs command (refer to the on-line
help page for syntax) to find the greatest or least value of y in each
neighborhood.
Hint: It is useful to first define the function using f:= x"3 - 6*XL ....
Use trial and error to improve your estimates.
Can you think of any ways (using graphs) that you could get a
better initial estimate of the local maximum and local minimum?
First-Order ODEs
CHAPTER

In this chapter you will use the following functions and commands for the
first time:

diff and D to represent derivatives


dsolve to solve a differential equation
dsolve(explicit) to solve a differential equation explicitly
simplify to put expressions in a more concise form
subs to verify solutions
rhs to extract the right-hand side of an equation
501[1] and 501[2] to access two elements of a set
plot to display solutions graphically

This chapter explores some first-order ordinary differential equations


(ODEs) for which closed-form symbolic solutions are obtainable. Maple
can determine symbolic solutions for most first-order ODEs that are exact,
separable, and linear.

Defining and Solving First-Order ODEs


There are two ways in Maple to indicate the derivative of y with respect to
x: diff(y(x), x) and D(y)(x). The variables x and y denote the independent

25
26 • Chapter 3. First-Order ODEs

and dependent variables respectively. These variables can be represented


by any two names, such as t and s, p and q, Fred and Wilma, etc.
> diff(y(x), x);
a
ax y(x)

> D(y)(x);
D(y)(x)

You must specify y(x) in diff(y(x), x), as opposed to simply y, because


the diff command has no way of knowing (unless you tell it so) that y is a
function of x. Otherwise, Maple differentiates the unknown y with respect
to x and gets o.
> diff(y, x);

o
Differential equations can be created using scalars and Maple's stan-
dard arithmetic operators: +, -, *, /, and A.

> 3*diff(t(s), s) + 6*s = 0;


a
3(-t(s))+6s=O
as
> D(Fred) (Wilma) = 2*Fred(Wilma)/(Wilma 2 A
+ Pi);

D(Fred)(Wilma) = 2 Fred(W;lma)
Wilma + TC
Using the diff(y(x), x) form to represent an ODE has the advantage that
the result ultimately returned for y(x) can easily be substituted back into
the ODE to verify that it is indeed a valid solution. 1 Because this sort of
verification is not possible with the D(x)(y) format, the diff(y(x), x) format
is used in the remainder of this book whenever possible.
Maple displays unevaluated calls to diff using the partial derivative no-
tation, a, instead of the standard derivative notation, d. This happens be-
cause Maple uses the same command, diff, to compute both partial deriva-
tives and standard derivatives. To maintain consistency, we use the partial
derivative notation throughout all parts of this book.

1 Also, the output resembles what you would write by hand.


Defining and Solving First-Order ODEs • 27

To demonstrate verification of solutions, solve a typical first-order


ODE , 1ty - 2ty
at - t 2 +4·

> deq := diff(y(t) ,t) = 2*t*y(t)!(t-2 + 4);

deq := ~ y(t) = 2 t y(t)


at t2 + 4
> dsolve(deq, yet));

y(t) = _Cl t 2 + 4 _Cl


Take note of the arbitrary constant LC1) in this result. Maple repre-
sents all such constants with names starting with the underscore character
L).2
To verify that this result is a valid solution, combine the equation that
was just returned with the original ODE in a call to the subs command.
Recall that the double quote (") refers to the last result.
> sol := rhs(II);

sol:= - Cl t 2 + 4 - Cl
> subs(y(t) = sol, deq);

~ ( Cl t 2 + 4 Cl) = 2 t L Cl t 2 + 4 _Cl )
at - - t2 + 4
Now, on the surface, this result doesn't tell you much; but if you sim-
plify both sides of the equation, you get
> simplify(II);

Because the resulting equation is an identity (i.e., true for all possible
values of the variable), the solution checks for all values of the constant
_C1.
The general solution, which is a one-parameter family of solutions, can
be shown graphically. The following plot command shows five different
members of the family of solutions obtained above.

2Several other Maple commands create variables or constants with names starting with
the underscore character. It is not recommended that you independently create any such
names.
28 • Chapter 3. First-Order ODEs

> plot({seq(subs(_C1=k, sol), k=-2 .. 2)}, t=-5 .. 5, y=-25 .. 25);

Five-member family of solutions to deq

If initial conditions are known, they can be included in the original


dsolve command. Simply change the first parameter of dsolve to a set con-
taining the differential equation and the initial condition(s). For example,
suppose that it is known in the above ODE that y(l) = 5; a particular
solution can be found as follows.

> dsolve({deq, y(l) = 5}, yet));

y(t) = t 2 +4
Notice that this particular solution is one member of the family of original
solutions above, in particular, the one where the constant _C1 = 1.

Explicit vs. Implicit Solutions


So far, all the results returned by dsolve have been explicit relations. Some-
times, dsolve returns an implicit relation.
Explicit vs. Implicit Solutions • 29

> deq1 := 2*y(t)*sin(t)*diff(y(t), t) = -(y(t)-2 + 1)*cos(t);

deql := 2 y(t) sin(t) (~y(t)) = _(y(t)2 + 1) cos(t)


at
> dsolve(deq1, yet));

(t)2 =- sin(t) + _Cl


y sin(~
If explicit solutions are desired, they can be obtained in two ways.
1) Using the explicit option to dsolve.
> dsolve(deq1, yet), explicit);

y( t
)-_ Jsin(t) (-sin(t) + _Cl) , y()t __
-
Jsin(t) (- sin(t) + _Cl)
sin(t) sin(t)
2) Imposing an initial condition on the equation.
> so11 := dsolve({deq1, y(Pi/2) = 1}, yet));
1.- () _
so1 .- y t -
J -(sin(t). -()2) sin(t)
sm t
This solution must be carefully checked, to see if it satisfies all of the
given conditions.
> subset = Pi/2, so11);
1
y( 2: rr) =
J i
-(sin( 1f) - 2) sin(! rr)
. (1 )
sm 2:rr
> simplify (") ;
1
y( 2:rr) = 1

It is clear that the explicit solution satisfies the initial condition y( I) =


1. Therefore, it is a valid solution.
Consider another example, namely

y2-2xcry y-3
xy2 cry-~'

which distinguishes implicit from explicit solutions.


30 • Chapter 3. First-Order ODEs

d 2 ._ (y(x)2 - 2x)
eq .- ( )2
xy X
(* y(x))
=
y(x) - 3
x2
> dsolve(deq2, y(x»;

y(x) _ ~ + ~ = _Cl
x x y(x)
> dsolve(deq2, y(x), explicit);

3 1 1 /
y(x) = 2: + 2: _Cl X + 2:" 9 + 6 _Cl X + _Cl 2 x 2 - 8 x,

y(x) = ~2 +.!.2-Cl X -.!.2"/9 + 6 - Cl X + - C1 2 x 2 - 8X

In some cases, Maple cannot solve explicitly for y(x) but may be able
to solve for x(y). Consider the following ODE, which is linear in x but not
in y.

yax + (xy2 + X - y)Oy = O.

> deq3 := y + (x*y-2 + x - y)*D(y) (x) = 0;

deq3 := y + (xy2 + X - y) D(y)(x) = 0


> dsolve(deq3, y(x), explicit);
eRootOf(2_Z (e_Z )2 x2_(e_ Z )2_2 e-z _Gl-_GI 2 ) + Cl
y(x) = ------=-:---:----::--=----::-----:;---
eRootOf(2_Z (e_ Z )2 x2-(e_ Z )2_2e_Z _GI-_GI 2 ) X

Maple is unable to solve explicitly for y(x). In this case, the dsolve command
tells you so by returning a result containing Rootof functions. However,
if you redefine the ODE so that x is the dependent variable and y is the
independent variable, Maple can successfully solve for x(y).
> deq4 := y*D(x)(y) + x*y-2 + x ~ y = 0;

deq4:= yD(x)(y) +xy2 +x - Y = 0


> dsolve(deq4, x(y), explicit);

1+ e(-1I2 y2) _Cl


x(y)=-----
y
Activities for §3 • 31

Now examine the plot of the result for five different values of the arbitrary
constant _C1.
> plot ({seq(subs CC1=k, rhs(II)), k=-2 . . 2)}, y=-2 . . 2, x=-10 .. 10);

Five-member family of solutions to deq4

Activities for §3
1. a. Find the general solution for the following ODE which is linear in
y.

&y 2
- -y=t
at
b. Plot, simultaneously, five members of this family of solutions, where
the arbitrary constant takes on the following values: -2, -1,0,1,2.
c. Manually identify and label each of the five graphs with the appro-
priate value of the constant.
2. Find a general solution for each of the following first-order ODEs.
When possible, find explicit solutions.
a. ~ + 2x = 2y
32 • Chapter 3. First-Order ODEs

b. 2xy Z+ 3x 2 + y2 = 0
c. X2 Z+ 3xy = xy3
d. ~
= l:s~~
e. sin(8)ar + (rcos(8) - 8 + 3)a8 = 0
f• ay_x2+~
ax -y x

3. Solve each of the following initial-value problems and carefully check


to see if each explicit solution is valid.
a. : = ;';i,y(l) = 2
b. (sin(y))2ax + (cos(y))2&y = O,y(%) = %
4. Solve the following initial-value problem and plot the solution to verify
it satisfies the initial condition.

(3y - 6x 2 )ax + (3x - 2y)&y = 0, y(O) = -2

S. Consider the ODE : +y = Se- bt , where b is non-negative and y(S) =


10.
a. Solve this initial-value problem when b = 2 and plot the solution
for t ~ o.
b. Solve this initial-value problem when b = 0 and plot the solution
for t ~ o.
c. Describe the behavior of each as t increases without bound (t --+
+00).
Appl ications of
CHAPTER

First-Order ODEs

In this chapter you will use the following commands from earlier chapters:

diff, D, dsolve, simplify, rhs, subs, plot

and the following commands for the first time:

fsolve to solve an equation numerically


evalf to evaluate a constant numerically
limit to compute the limiting value of an expression
proc to create your own simple Maple looping structures
save to save a procedure to a file

Falling, Floating, or Accelerating Objects


In this book, the Imperial (British) System of measurement is used, with
the following units.
force £(pounds)
mass slugs (pounds/g)
distance feet
time seconds
acceleration due to gravity (g) 32ft
sec 2

33
34 • Chapter 4. Applications of First-Order ODEs

Also, the following symbols are used.


time t seconds
distance x feet
velocity v s~~ (v = dxldt)
acceleration f\ (a = dvldt)
a sec
mass m slugs
Newton's second law of motion states that the mass of an object times
acceleration equals the sum of all the forces acting on the object. In symbols:

m av =F
at

Try an example:
Suppose that an airliner is cruising at an altitude of 10,000 feet when
the cargo door falls off. The door weighs 152 pounds. Ignore its horizontal
motion at the moment it becomes free of the plane. Assume that air resis-
tance (denoted by kv, where k is a constant) is proportional to the velocity
at any time t. The first-order ODE which describes the motion of the door
1S

152 av
- - = 152-kv
32 at

Or, in Maple syntax:


> k := 'k':
> deqv := 152/32*diff(v(t), t) = 152 - k*v(t);
19 a
deqv := 4 (at v(t)) = 152 - k v(t)

Since the downward motion of the cargo door begins with an initial velocity
of zero, the initial condition of v(O) = 0 holds. You can solve for velocity
as a function of time.
> solv := simplify(dsolve({deqv, v(O)=O}, vet)));
-1 + e(-4/19kt)
solv := v(t) = -152 k

You can now define the first-order ODE which describes the rate of change
of distance with respect to time
Falling, Floating, or Accelerating Objects • 35

> deqx := diff(x(t), t) = rhs(solv);


a -1 + e(-4/19kt)
deqx := at x(t) = -152 k

and solve for distance as a function of time. Downward motion is used


as positive distance, and the point where the fall began as the origin, such
that x(O) = o.
> solx := simplify(dsolve({deqx, x(O)=O}, x(t»);
4kt + 19 e( -4119 k t) - 19
solx := x(t) = 38 k2
How long will it take for the door to strike the ground? You know that
the door will be on the ground when x(t) = 10,000. As well, the answer
to this question certainly depends upon the value of k. Solve for t using
Maple's fsolve command with k equal to 0.1, 1,2, and 5.
> 'to.l' := fsolve(rhs(subs(k=O.l, solx» = 10000, t);
to.l := 27.39921852
When faced with entering several closely related Maple commands,
you can use several "tricks" to speed up the process and avoid annoying
typos:
• Some Maple interfaces (e.g., DOS, Unix-tty) have a command buffer
that holds a large number of the commands previously entered in a
session. Typically this buffer is accessed through the t and -J.. keys. Once
the previously entered command that is related to the new command
is visible, it can be edited with the ~ and -+ keys or with the standard
<DELETE> and <BACKSPACE> keys, and re-entered.
• Worksheet oriented interfaces (e.g., Windows, Mac) have menu or
command-key combinations that allow you to perform standard Cut/
Copy /Paste operations. These can be used to duplicate the desired
part of previous commands in the worksheet. If you are not concerned
about whether the previously computed input/output regions remain
in your worksheet, the earlier commands can be directly edited and
re-entered. The new output then replaces the old output.
• The Maple commands seq and map can be used to lessen the amount of
typing and compute the desired results with a single command. There
are several examples of this technique throughout this book.
36 • Chapter 4. Applications of First-Order ODEs

> 'tl' := fsolve(rhs(subs(k=l, solx)) = 10000, t);

tl := 70.53947200
> 't2' := fsolve(rhs(subs(k=2, solx)) = 10000, t);

t2 := 133.9539474
> 't5' := fsolve (rhs (subs (k=5, solx)) = 10000, t);

t5:= 329.8973684
Notice that, as expected, for larger values of k (which represent greater
air resistance), it takes longer for the door to reach the ground. This makes
sense. Now graph solx over the first 350 seconds for several different values
of k. Notice the colon (:) at the end of the next command line.
> curves := seq(subs(k=i, rhs(solx)), i = [0.1, 1, 2, 5]) :
> plot({curves} , t = 0.. 350, x = 0 . 10000);
.

10000

8000

6000
x
4000

2000

150 t200 250 300 350

Distance vs. time for large values of time

Away from the origin these graphs all appear to be linear. Why is that?
Look at them in greater detail nearer to the origin. This gives a much better
picture of the motion near the beginning of the fall.
Falling. Floating. or Accelerating Objects • 37

> plot ({curves} , t = 0 .. 4, x O . 200);


.

200

150
x
100

50

Distance vs. time for smaller values of time

Thus, it is apparent that for smaller values of k the graph of x(t) gets
steeper faster. This means that near the beginning of the fall the door ac-
celerates faster (i.e., the velocity is increasing at a quicker pace) for smaller
values of k. Later in the fall, the velocities for all values of k are nearly
constant (the graphs of x(t) appear linear for large values of t), with the
greater limiting velocities occurring for smaller values of k.

In a second example, a car weighs 1,500 pounds and its air resistance
has been determined to be 8/5 times its velocity. We want to find the con-
stant force required to accelerate the car from 40 to 60 feet/second in a
period of 18 seconds.
Begin by assuming that mass times acceleration (~) equals the sum of
all forces acting on the car. Let F pounds represent the unknown constant
force, and write the differential equation for this system in Maple.
> deq2 := 1500/32*diff(v(t), t) = F - 8/5*v(t);
375 a 8
deq2 := -8- (at v(t)) = F - "5 v(t)
38 • Chapter 4. Applications of First-Order ODEs

> s012 := ds01ve({deq2, v(O) = 40}, v(t));

5 (64) 5
soI2:= V(t) = gF+e-18'73 t (-gF+40)

Now substitute t = 18 in the right-hand side of the above solution.


> subs (t=18, rhs(s012));
5 (-384) 5
g F + e 6IT" (-g F + 40)

Also, the velocity at 18 seconds must be 60 feet/second, so solve the equa-


tion v( 18) = 60 for the unknown force F.
> fs01ve("=60, F);

133.7115172

So, about 134 pounds of force is required to accelerate the car from 40 to
60 feet/second in 18 seconds.

Now, a different type of question: If a constant force were to continue


indefinitely, how fast would the car eventually travel? You can answer this
question by finding the limiting value of the velocity.
Take the limit of the velocity as t increases without bound (i.e., to 00).
> 1imit(rhs(s012), t=infinity);

~F
8
Thus the limiting velocity is five-eighths of the constant force applied.
To look at this another way, have Maple print a chart of results for
large values of tat F = 134. First, set the appropriate values and simplify
the resulting expression.

> F := 134;

F:= 134
> s012 := simp1ify(s012);

335 175 ( 64 )
sol2 := v(t) = - - - - - e -18'75 t
4 4
Falling, Floating, or Accelerating Objects • 39

Ma pIe does not contain a simple command to print out such a chart of
values, so you must create one to fit your needs. The following procedure,
printchart, l takes four parameters:
1. A list containing the values to be evaluated and displayed. The results
are displayed in the order they are specified. (In this particular case,
the list is [t, rhs(soI2)].)
2. The variable that you are substituting for. (In this case, t.)
3. The range of values over which you wish to substitute. (In this case,
1 . .751.)
4. The incremental value for the above range. (In this case, 50.)
> printchart := proc(values, var, numrange, increment)
> local i,j,k,fmtstr;
> fmtstr:= cat(seq('% lOs " k=l .. nops(values)));
> for i from lhs(numrange) by increment to rhs(numrange) do
> printf(fmtstr, seq(convert(evalf(subs (var=i,
> values[j]), 5), string), j=l .. nops(values)));
> lprint();
> od;
> end:
Don't spend too much time dwelling on how printchart was programmed.
It is a rather basic Maple procedure, but we don't go further into program-
ming at this time.
Before this command is used, save it to file so that it can be used again
in later chapters.
> save printchart, 'chart.m';

In future, the printchart command can be reinstalled by issuing the


command read 'chart.m':.
> printchart([t, evalf(rhs(so12))], t, 1 .. 500, 50);

o 40.000
50. 75.811
100. 82.309
150. 83.489

IThe printchart command is included in The Practical Approach Utilities for Maple. The
version given here is a skeleton of that larger command, with less error checking and fewer
alternate parameter sequences.
40 • Chapter 4. Applications of First-Order ODEs

200. 83.703
250. 83.741
300. 83.748
350. 83.750
400. 83.750
450. 83.750
500. 83.750

The limiting velocity is about 83.75 feet per second when 134 pounds of
constant force is applied to a 1500 pound car. Also observe that (5/8) * 134
is 83.75, confirming the earlier result.
The air resistance in this problem is eight-fifths of the velocity, and the
limiting velocity turns out to be five-eighths of the constant force applied.
It appears that when the constant of proportionality for air resistance is
a positive constant B, the limiting velocity is the reciprocal of B times the
constant force F.
Try to verify this conjecture. First, reset the variables t and F.
> t := 't': F := 'F':
> deq2 := 1500/32*D(v)(t) = F - B*v;
375
deq2 := -8- D(v)(t) = F - B v

> so12 := dso1ve({deq2, v(0)=40}, vet));


F- e(-8/375B.t) (F - 40B)
sol2 := v(t) = B

Now build a seq command, as hinted to above, showing the limiting


values of the velocity for several values of B.
> seq(limit(subs(B=i, rhs(so12)), t=infinity), i = [2,4,6,8,10]);
1 1 1 1 1
"2 F, "4 F, "6 F, "8 F, 10 F
Does this support the conjecture that the limiting velocity is ~ F when
B is a positive constant?

Mixture Problems
A tank initially holds 40 pounds of salt dissolved in 200 gallons of water.
Another brine solution is pumped into the tank at the rate of 5 gallons per
Mixture Problems • 41

minute, and a well-stirred solution simultaneously flows out of the tank at


the same rate. If the concentration of salt in the brine flowing into the tank
is 3/5 pounds of salt per gallon of water, find the amount of salt present in
the tank at any time t.
Let A(t) represent the pounds of salt in the tank at time t minutes.
Then, the net rate at which A(t) changes is given by
dA/dt = (rate at which salt is entering)-(rate at which salt is leaving).
The rate at which salt is entering the tank is

gallons 3 pounds .
5. . -5 II = 3 pounds per mmute.
mmute ga on

The rate at which salt is leaving the tank is

gallons A(t) pounds A(t) .


5.
mmute
. 200 11
ga on
= 40 pounds per mmute.

Thus, the first-order ODE which describes this system is given by


> deq3 := D(A)(t) = 3 - A/40;
1
deq3 := D(A)(t) = 3 - 40 A

Now solve this ODE subject to the initial condition A(O) = 40.
> 5013 := dsolve({deq3, A(0)=40}, A(t));

sol3:= A(t) = 120 - 80e(-1I40t)

Have Maple construct a chart showing the amount of salt present in the
tank at several different values of time.
> printchart([t, evalf(rhs(so13))], t, 0 .. 200, 20);

0 40.
20. 71.478
40. 90.570
60. 102.15
80. 109.17
100. 113.43
120. 116.02
140. 117.58
160. 118.53
42 • Chapter 4. Applications of First-Order ODEs

180 . 119.11
200. 119.46

It appears that the limiting amount of salt as time increases without bound
is about 120 pounds. This can be verified by graphing A(t} . But first, reset
the variable t.
> t : = 't':
> plot({rhs(so13), 120}, t=0 .. 200, O.. 140);

140
120r-------------~======----

100

40
20

o 50 100 150 200

Amount of salt vs. time

Activities for §4
1. An aircraft carrier which weighs 44,000 tons is moving away from
dock through the entrance of a bay at a speed of 4 feet per second.
Upon reaching the open sea, the captain increases the thrust to to a
constant 68 tons. As the ship passes through the water, it experiences
a resistance of 10,400v pounds, where v is the velocity of the carrier.
a. Find the velocity of the carrier on the open sea as a function of time.
b. Determine the limiting velocity as time increases without bound and
check it by building a table for 0 :::: t :::: 2000.
c. How long will it take the carrier to reach 85% of its limiting velocity?
Activities for §4 • 43

d. Graph the velocity function for t ::: 0, showing its intersection with
the horizontal line representing 85% of the limiting velocity.
2. Sue, a medical doctor, and her husband George, a mathematician, are
fishing from a boat when Sue hooks a 5 pound trout. George, also
an avid photographer, grabs his camera and starts taking pictures. But
George gets so excited he drops the camera into the water. George
knows the camera weighs 1 pound and the buoyancy of the water is
twice the square of the velocity of the sinking camera. He also has a
fishing net with a handle extending to 24 feet. George quickly calculates
how much time he has to grab the net and snare the camera before it
is out of reach. How much time does he have? (Unfortunately, before
George can retrieve the camera, Sue plays the trout up to the side of
the boat, but loses it off the hook.)
3. Newton's Law of Cooling states that the rate at which the temperature
of an object changes (~;) is proportional to the difference between the
temperature of the object (T) and the temperature of the surrounding
medium (To). That is

aT
- = k(T(t) - To),
at
where t is time and k is a constant.
When a baked potato is removed from an oven at 350° into a 75°
room, it cools to 200° in 5 minutes.
a. Find the temperature of the potato at any time t minutes.
b. If a potato is edible at 90°, how long must you wait for it to cool
down?
c. Build a numerical table showing times and temperatures, for times
between zero and twice the time it takes the potato to reach eating
temperature, using increments of 5°.
d. Graph the temperature function over the same interval in the pre-
vious question, showing its intersection with the horizontal line at
90°.
4. All the fish are found to be dead in a small lake which holds 2500 units
of water. (Each unit is 1025 gallons.) The US Environmental Agency
44 • Chapter 4. Applications of First-Order ODEs

studies the situation and finds that there are 2 tons of a chemical pol-
lutant in the lake, put there by a nearby industrial plant. The plant
agrees to clean the lake water with a cleaning operation that removes
the pollutant at a rate of 5 units per day with 90% efficiency.

units 90 A(t) tons 90


5 day . 100 . 2500 units = 50000 A(t) tons per day.

a. Find the amount (A(t) tons) of chemical pollutant in the lake at any
time t (in days) after the plant begins the cleaning process.
b. If fish can survive when the chemical pollutant is reduced to 100
pounds, find the number of years required before fish can be re-
introduced into the lake.
c. Build a numerical table showing the amount of pollutant in both
tons and pounds from t = 0 until 450 days after fish can survive
in the lake. Use increments of 200 days.
d. Graph the amount of pollutant from t = 0 until 150 days after fish
can survive in the lake, showing the intersection of that function
with the horizontal line showing the 100 pound level of pollutant.
Graphical
CHAPTER

Methods

In this chapter you will use the following commands from earlier chapters:

subs

and the following commands for the first time:

DEtools[DEplot] to generate a slope field with or without specific


solutions of an ODE

A differential equation does not always have a closed-form exact so-


lution involving elementary functions. Even if it does, such a solution may
be extremely difficult to obtain. Many important applications in science
and engineering fall into these categories, and so alternate methods are re-
quired for finding approximate solutions to these equations. In this chapter,
graphical methods of approximating solutions to ODEs are discussed.
Note: If you are running the examples in this chapter on machines
with less than 8 MB of memory available for Maple, you may encounter
problems. We suggest that before you start this chapter, you restart Maple,
close any other unnecessary applications, and do whatever else you can to
free up more memory.

45
46 • Chapter 5. Graphical Methods

Direction Fields
The topic of direction fields assumes that you start with a first-order ODE
of the form y' = F(x, y), where x and yare the independent and dependent
variables, respectively. At every point P(x, y) within the domain of F, the
function F can be evaluated to obtain a numerical value, denoted by F(P).
Represent a solution to the ODE by y = f(x) and interpret the numerical
value F(P) graphically.
Notice that F(P) = y' = f'(x), which is equivalent to the numerical
slope of the tangent line to the graph at every point P for which the function
F is defined.
If you actually sketch small line segments at a large number of points
in the plane (each line segment having the slope of the tangent to the graph
of a solution), you get a direction field. You can even sketch a particular
solution that passes through any fixed point (which would be given as
either initial or boundary conditions) by following the flow of the tangent
segments across the cartesian plane. Of course, such tasks are tedious and
time consuming without the help of computers. Now get Maple to graph
the direction field for the first-order ODE, y' = x 2 y.

> deql := diff(y(x) , x) = x-2*y;

deql := -
a y(x) = x2 y
ax

The Maple command which graphs direction fields is DEtools[DEplot].


The on-line help can be used to determine syntax and formatting for DEplot.

> with(DEtools):
> DEplot(deql, y(x), x=-2 .. 2, y=-2 .. 2);
Direction Fields • 47

Direction field for deq 1

Notice that the slopes of all the line segments are positive in quadrants
I and II (i.e., where y > 0), while they are negative in quadrants III and
IV (i.e., where y < 0). Check the definition of deq1 again to see why this
ISso.
In order to graph specific solutions (called flow lines), one or more
initial conditions must be specified. Graph the direction field for the same
ODE and show four different flow lines through the points listed below.

> init := {[l,lJ, [-l,lJ, [-l,-lJ, [1,-1]};

init := {[1, 1], [-1,1], [-1, -1], [1, -1]}


48 • Chapter 5. Graphical Methods

> DEplot(deql, y(x), x=-2 .. 2, init, y=-2 .. 2);

l1Iit/II//"
I 1I / I / ---'+----.
1 I / / ......
-;::::::+:~~
" ' 1 1 / . /..,
1 I 1 I I ~"' ..fik~f-<-.-.
, 1 I I h!V -'~'-'I-I'f--
!II/,
/ I /.!v./
./.: -~~:t:::::::
~
/ ..-::; '----I:........~

Direction field with flow lines for deq1

Each of these flow lines is a graphical representation of a solution to


the ODE passing through a specific point.
Consider another example: y' = 2 x - y.

> deq2 := diff(y(x) , x) 2*x - y;

deq2 := -
a y(x) = 2x - y
ax

Graph four flow lines using the same initial values as above.

> DEplot(deq2, y(x), x=-2 .. 2, in it , y=-2 .. 2);


Some Examples • 49

Direction field with flow lines for deq2

Again, you see four representatives from the family of solutions to the
ODE. Make up other examples on your own and experiment with different
sets of initial conditions.

Some Examples
Let's revisit some examples from Chapter 4 using this new graphical tech-
nique for obtaining an approximation to each solution.
The following first-order ODE was used to find the velocity as a func-
tion of time for a 152 pound door falling off an airplane at 10,000 feet
with wind resistance set at k = 2.

152 av = 152 _ 2v
32 at

> deqv : = 152/32 * diff(v(t), t) = 152 - 2*v;


19 a
deq v:="""4 (at v(t)) = 152 - 2v

Maple can now provide a graphical approximation to the solution for


velocity as a function of time. Use DEplot with an initial condition v(O) = O.
50 • Chapter 5. Graphical Methods

> DEplot(deqv, vet), t=o .. 10, {CO, OJ}, v=O .. 80);

8 '

60
v(t)
40

2 '4 '6 ' . 8 10


t
I

Direction field for deqv with solution through (0,0)

This motion appears to have a limiting velocity of between 70 and


80 feet per second. Would you expect the limiting velocity to change if
the wind resistance were smaller (say at k = 1)? If so, would the limiting
velocity increase or decrease?

> deqv2 .= 152/32 * diff(v(t), t) 152 - l*v;

19 a
deqv2 := -4 (- v(t)) = 152 - v
at

> DEplot(deqv2, vet), t=O .. 15, {CO, OJ}, v=O .. 150);


Some Examples • 51

14 ..-------------------------------~----~
120
100
v(t)
80
60
40

2 4 6' t' e '10 2

Direction field for deqv2 with solution through (0,0)

It appears that the limiting velocity is increased to about 140 feet per
second when the wind resistance is lowered to 1. Now increase the wind
resistance to k = 5.

> deqv3 := 152/32 * diff(v(t), t) 152 - 5*v;

19 a
deqv3:= - (- v(t)) = 152 - 5v
4 at
52 • Chapter 5. Graphical Methods

> DEplot(deqv3, v(t), t=O .. 10, {[a, OJ}, v=O .. 40);

40

3
v(t)
20

2 ' I 4 ' '6 ' I 8'


t

Direction field for deqv3 with solution through (0,0)

What is the limiting velocity in this case? Are you surprised?


Another example from Chapter 3 is the mixture problem where a tank
contains 40 pounds of salt dissolved in 200 gallons of water. Another
brine solution with 3/5 pounds of salt per gallon of water is pumped into
the tank at the rate of 5 gallons per minute and a well-stirred solution
simultaneously flows out of the tank at the same rate. The ODE describing
this system is

where A(t) represents the number of pounds of salt in the tank at t minutes.
To obtain a graphical solution, first define the differential equation and use
DEplot as follows.

> deqA := diff(A(t), t) = 3 - A/40;

a
deqA:= -A(t) = 3 - - A
1
at 40
Activities for §5 • 53

> DEplot(deqA, A(t), t=O .. 150, {EO, 40]}, A=0 .. 150);

Direction field for deqA with solution through (0,40)

As seen in Chapter 4, the amount of salt gets close to 120 pounds as


time increases indefinitely.

Activities for §5
1. An aircraft carrier which weighs 44,000 tons is moving away from
dock through the entrance of a bay at a speed of 4 feet per second.
Upon reaching the open sea, the captain increases the thrust to to a
constant 68 tons. As the ship passes through the water, it experiences
a resistance of 10, 400v pounds, where v is the velocity of the carrier.
a. Use the DEplot command to obtain a graphical solution showing
the ship's velocity as a function of time.
b. Estimate the ship's limiting velocity.
2. Sue, a medical doctor, and her husband George, a mathematician, are
fishing from a boat when Sue hooks a 5 pound trout. George, also
an avid photographer, grabs his camera and starts taking pictures. But
George gets so excited he drops the camera into the water. George
54 • Chapter 5. Graphical Methods

knows the camera weighs 1 pound and the buoyancy of the water is
twice the square of the velocity of the sinking camera. He also has a
fishing net with a handle extending to 24 feet. George quickly calculates
how much time he has to grab the net and snare the camera before it
is out of reach. How much time does he have? (Unfortunately, before
George can retrieve the camera, Sue plays the trout up to the side of
the boat but loses it off the hook.)
a. Use the DEplot command to obtain a graphical solution showing
the camera's velocity as a function of time (for t = 0 .. 0.2 seconds).
b. Estimate the camera's limiting velocity.
3. Newton's Law of Cooling states that the rate at which the temperature
of an object changes (~~) is proportional to the difference between the
temperature of the object (T) and the temperature of the surrounding
medium (To). That is,

aT
- = k(T(t) - To),
at
where t is time and k is a constant.
When a turkey is removed from an oven at 300 0 into a 70° room,
k = -0.08.
a. Use the DEplot command to obtain a graphical solution showing
the temperature as a function of time. Be sure to use a large enough
time interval to clearly show the limiting temperature of the turkey.
4. All the fish are found to be dead in a small lake which holds 2500 units
of water. (Each unit is 1025 gallons.) The US Environmental Agency
studies the situation and finds that there are 2 tons of a chemical pol-
lutant in the lake, put there by a nearby industrial plant. The plant
agrees to clean the lake water with a cleaning operation that removes
the pollutant at the following rate:

units 90 A(t) tons 90


5 day . 100 . 2500 units = 50000 A(t) tons per day.
a. Use the DEplot command to obtain a graphical solution showing
the amount of pollutant (A(t) tons) as a function of time.
Activities for §5 • 55

b. Estimate the time it takes for the amount of pollutant to be reduced


to 100 pounds.
Homogeneous
CHAPTER

Linear Differential
Equations

In this chapter you will use the following commands from earlier chapters:

dsolve, fsolve, subs, evalf, simplify

and the following commands for the first time:

solve to solve an ordinary equation symbolically


factor to factor an expression
linalg[matrix] to create a matrix of values
linalg[det] to compute the determinant of a matrix

This chapter explores Maple's capabilities in solving higher-order linear


differential equations of the form

where the aj(x) are continuous functions on some interval, I, of reals.


We also consider the notion of linear independence of a set of functions
on an interval. To test whether or not a set of functions is independent
over an interval I, use Maple to evaluate the Wronskian determinant of
the functions. (See your course text for the definition.) If the Wronskian
determinant is non-zero for at least one value of x in the interval I , then
the functions are linearly independent over that interval.

56
Chapter 6. Homogeneous Linear Differential Equations • 57

In order to determine the Wronskian determinant, you must be able to


calculate the Wronskian matrix. Maple has a built-in command to deter-
mine these matrices, but it will nonetheless be helpful to see how to define
a matrix and evaluate its determinant.
Before any matrix commands can be performed, the linear algebra
library package, linalg, must be loaded.
> with(linalg):

Warning, new definition for norm


Warning, new definition for trace

To define a 3 x 3 matrix named A, use the following command and syntax.

n
> A := matrix([[l, 2, 3], [1, 1, 1], [-8, 5,0]]);

A:=[j ~
To evaluate the determinant of A use the det command.
> det(A);

18
The same type of operations can be performed on a matrix whose elements
are not predefined.
> B := matrix(2, 2, E));

B := array(1..2, 1..2, [])


> det(B);

BI,I B2,2 - BI,2 B2,1

Now back to the specific example. Given a set of functions, you can deter-
mine whether or not they are linearly independent by examining the Wron-
skian determinant. Consider the following functions defined for x > 0:

x 2 3x lnx

The wronskian command in the linalg package takes these functions as


a list and computes the Wronskian matrix.
58 • Chapter 6. Homogeneous linear Differential Equations

> V := [x-2, 3*x, In(x)];


V := [x 2 ; 3 x, In(x)]
> Wm := wronskian(V, x);

3x In(X)]
3 I
xl
o -XI
> detWm := det(Wm);
detWm:= 9 - 6 In(x)
Are the three functions linearly independent on the domain (x > O)?
On any interval? To answer this, first solve for the zeros of the determinant
ofW.
> solve(detWm = 0, x);

> evalf(II);

4.481689070
The determinant of W has only one real zero, so the three functions given
above are linearly independent over any interval of positive real numbers.
Now, consider solving homogeneous linear differential equations with
constant coefficients. Consider the following third-order homogeneous lin-
ear ODE:

2y'" - 5y" - 9y' + 18y = 0

The auxiliary equation is 2 m 3 - 5 m2 - 9m + 18 = O.


> auxeqn := 2 * m-3 - 5 * m-2 - 9 * m + 18 = 0;

auxeqn:= 2m 3 - 5m2 - 9m+ 18 = 0


Maple can factor the left side of this equation
> factor(auxeqn);

(m - 3)(2m - 3)(m + 2) = 0
or solve for the three distinct roots directly.
Chapter 6. Homogeneous Linear Differential Equations • 59

> solve (auxeqn, m);


3
3, 2,-2
So, the general solution to the ODE is

y(x) = c1 e3x + c2 e-2x + c3 if


You need not enter the factor or solve commands. Maple can solve this
ODE directly.
> deq := 2*diff(y(x) , x$3) - S*diff(y(x) , x$2) - 9*diff(y(x) , x)
> + 18*y(x) = 0;

a3 a2 a
deq := 2 (ax 3 y(x)) - 5 (ax 2 y(x)) - 9 (ax y(x)) + 18 y(x) = 0

> sol := dsolve(deq, y(x));


sol := y(x) = _Cl e(-2x) + _C2 e(3x) + _C3 e(3/2x)
You can check this general solution by substitution.
> simplify(subs(y(x) = rhs(sol) , deq));

The following is an example of a sixth-order linear ODE with constant


coefficients.
> deq2 := 2*diff(x(t), t$6) + diff(x(t), t$S) - 30*diff(x(t), t$4)
> + S*diff(x(t), t$3) + 130*diff(x(t), t$2) - 84*diff(x(t), t)
> - 72*x(t) = 0;
a6 as a4 a3 a2
deq2 := 2 (at 6 x(t)) + (at S x(t)) - 30 (at 4 x(t)) + 5 (at 3 x(t)) + 130 (at 2 x(t))
a
- 84 (at x(t)) - 72 x(t) =0
The auxiliary equation is
> auxeqn2 := 2 * m-6 + m-S - 30 * m-4 + S * m-3 + 130 * m-2
> - 84 * m - 72 = 0;
auxeqn2 := 2 m 6 + m S - 30 m 4 + 5 m 3 + 130 m 2 - 84 m - 72 = 0
Calling factor and solve produces the desired results.
60 • Chapter 6. Homogeneous Linear Differential Equations

> factor(auxeqn2);
(2m + 1) (m + 3)2 (m - 2)3 = 0
> solve(auxeqn2, m);
-1
2' -3, -3,2,2,2
There are repeated real roots to the auxiliary equation, so the general
solution is

Again, Maple can solve directly for the general solution.


> dsolve(deq2, x(t));
x(t) = _Cl e(-3t) + _C2 e(2t) + _C3 e(-1I2t) + _C4e(2t) t + _C5 e(-3t) t
+ _C6 e(2t) t 2
Here is one final example of a linear homogeneous ODE with constant
coefficients.
> deq3 := 3*diff(x(t), t$3) -10*diff(x(t), t$2) + 7*diff(x(t), t)
> + 10 * x(t) = 0;
~ ~ a
deq3 := 3 (at 3 x(t)) - 10 (at 2 x(t)) + 7 (at x(t)) + 10x(t) = 0
Proceed as before.
> auxeqn3 := 3 * m-3 - 10 * m-2 + 7 * m + 10 = 0;

auxeqn3:= 3m 3 -10m 2 + 7m + 10 = 0
> factor(auxeqn3);
(3 m + 2) (m 2 - 4m + 5) = 0
> solve (auxeqn3 , m);
-2
3,2 + i,2 - i
Observe that there is one real root and a pair of complex conjugate
roots. The general solution is

x(t) = c1 e--Y
21
+ e2 t (c2 sin(t) + c3 cos(t))
Chapter 6. Homogeneous Linear Differential Equations • 61

or, solving directly,


> dsolve(deq3, x(t»;
X(t) = _Cl e(-2J3t) + _C2 e(2t) COS(t) + _C3 e(2t) sin(t)
In each of the three examples, the general solution to the linear ODE
must be a linear combination of linearly independent functions. Now use
the methods learned earlier to check whether the functions in the last ex-
ample are indeed linearly independent. The ODE is 3Td degree and the three
solutions are

e-¥, e2t sin(t), and e2t cos(t),

which you can enter as a list named F.


> F := [exp(-2/3*t), exp(2*t)*sin(t), exp(2*t)*cos(t)];
F := [e(-2/3t), e(2t) sin(t), e(2t) cos(t)]
Now define the Wronskian of these solutions.
> Wm := wronskian(F, t);
e(-2/3t) e(2 t) sin(t) e(2t) cos(t) ]
Wm := [ -j e(-2J3t) 2 e(2t) sin(t) + e(2t) cos(t) 2e(2t) cos(t) - e(2t) sin(t)
1 e(-2/3t) 3 e(2t) sin(t) + 4 e(2t) cos(t) 3e(2t) cos(t) -4e(2t) sin(t)
9
Find all zeros of the determinant of this Wronskian.
> detWm := det(Wm);

detWm :=
73 e(-2/3t) (e(2t))2
-9" .
sm(t)2 -
73 e(-2/3t) (e(2t))2
9" cos(t)2

> detWm := simplify(detWm);

73 e(lO/3t)
detWm := _
9
You can see by inspection that detWm =I 0 for any real number t.
Thus, the three solutions are indeed linearly independent.
This chapter concludes with examples of homogeneous linear ODE's
with non-constant coefficients.
> deq4 := x-2*diff(y(x) , x$2) + x*diff(y(x) , x) + y(x) = 0;
2 a a
deq4 := x 2 (-2 y(x))
ax + x (-ax y(x)) + y(x) = 0
62 • Chapter 6. Homogeneous Linear Differential Equations

> dso1ve(deq4, y(x»;


y(x) = _Cl sin(ln(x)) + _C2 cos(ln(x))
If the initial conditions y( 1) = 2 and y' (1) = -1 are given, a unique
solution can be obtained. The initial condition y' (1) = -1 is represented
in Maple as D(y)(1) = _1.1
> so14 : = dso1ve({deq4, y(l) = 2, D(y)(l) = -1}, y(x»;

sol4 := y(x) = - sin(ln(x)) + 2 cos(ln(x))


Use the subs command to check this solution in deq4.
> simp1ify(subs(y(x) = rhs(so14), deq4»;

You can also plot this solution and verify that the initial conditions
y( 1) = 2 and y' (1) = -1 are satisfied on the graph.
> plot (rhs(so14), x = 0 .. 5);

1.5

0.5

o 2 x
-0.5

-1

Solution of deq4

ITo represent a specific value at an nth derivative, use (D@@n). For example, to represent
y"(O) = 5 use (D@@2)(y)(O) = (5).
Activities for §6 • 63

One more example:


> 4eq5 ;= (1 - t-2)*diff(x(t), t$2) - 2*t*diff(x(t), t) = 0;
a2 a
deq5 := (1 - t 2 ) (at 2 x(t)) - 2 t (at x(t)) = 0

> so15 ;= dsolve(deq5, x(t));


1 1
solS := x(t) = _Cl + _C2 (2: In(t - 1) - 2: In(t + 1))

> simplify(subs(x(t) = rhs(so15), deq5));


0=0

Activities for §6
1. Prove that the functions cos{lnx) and sin(lnx) are linearly independent
on any interval of positive real numbers.
2. Are the functions cos2x and (sinx)2 linearly independent on the in-
terval [0, 21l"]? Justify your answer by citing appropriate theorems or
definitions.
3. Are the functions x+exp x, exp (-2x) - 3x, and 3 exp x+exp (-2x) lin-
early independent? Justify your answer by citing appropriate theorems
or definitions.
4. Find the general solution for each of the following differential equa-
tions.
a. xiv - lOx'" + 46x" - 114x' + 117x = 0
b. 2yvi - 15yv + 25yiv + lOy'" - 60y" + 53y' - 15y = 0
5. Find the general solution to the second-order ODEx 2 y" -4xy' +6y = o.
Check your solution by substituting back into the differential equation
and simplifying.
6. Find the particular solution to the second-order ODE x 2 y" - 4xy' +
6y = 0 with the initial conditions y(l) = 3 and y'(1) = -2. Graph
your solution on an appropriate interval and verify graphically that
the initial conditions are satisfied.
7. Find the general solution to the second-order ODE (1 - t 2 )x" - 2tx' +
6x = O. Determine the domain of the solution.
64 • Chapter 6. Homogeneous Linear Differential Equations

8. Find the particular solution to the second-order ODE (1 - t 2 )X" -


2tx' + 6x = 0 with the initial conditions x(2) = 5 and x'(2) = 2.
Graph your solution on an appropriate interval and verify graphically
that the initial conditions are satisfied.
CHAPTER
Non-homogeneous
Linear Differential
Equations

In this chapter you will use the following commands from earlier chapters:

dsolve, subs, plot, simplify, Ihs, rhs I


This chapter explores Maple's capabilities to solve higher-order linear
differential equations of the form

ao(x) . y(n) + at (x) . y(n-l) + ... + an-l (x) . y(1) + an(x) . y = F(x),

where the a;(x) and F(x) are continuous functions on some interval, I, of
reals.
The general solution of this type of equation can be written in the form
y = Yc +yP' where Yc is the complementary solution from the homogeneous
equation and YP is the particular solution with no arbitrary constants.
Consider the following example.
> deql := diff(y(x) , x$2) - 4*diff(y(x) , x) + 3*y(x) = 4*exp(x);

a2 a
deql := (ax 2 y(x)) - 4 (ax y(x)) + 3y(x) = 4ex

> 5011 := dsolve(deql, y(x));

5011 := y(x) = -2x eX - eX + _Cl eX + _C2 e(3x)


The complementary solution is

65
66 • Chapter 7. Non-homogeneous Linear Differential Equations

> ye := _C1*exp(x) + _C2*exp(3*x);

yc:= _Cl e" + _C2 e(3x)


and the particular solution is
> yp := - exp(x) - 2*x*exp(x);

yp:= -2xe" - e"


Now check each of these solutions by substituting it in for y(x) in the
left-hand side of the original differential equation.
> simp1ify(subs(y(x) = ye, 1hs(deq1)));

o
Thus, Yc is a solution to the related homogeneous differential equation.
> simp1ify(subs(y(x) = yp, 1hs(deq1)));

Thus, YP is a solution to the non-homogeneous differential equation. The


entire solution can be checked as follows.
> simp1ify(subs(y(x) = rhs(so11), deq1));

Consider the following non-homogeneous linear ODE with initial con-


ditions x(O) = 2 and x'(O) = -2.
> deq2 := diff(x(t), t$2) - diff(x(t), t) - 6*x(t) =
> exp(-2*t) - 3*exp(3*t);
2 a
deq2 := ( - x(t)) -
a
( - x(t)) - 6 x(t) = e(-2t) - 3 e(3t)
at2 at
> so12 := dso1ve({deq2, x(O) = 2, D(x)(O) = -2}, x(t));

5012 .= x(t) = --1 e(-St) e(3t) t + _3 1


e(-St) e(8t) _ _ e(-St) e(3t)
. 5 25 25
_ ~e(-St)e(8t)t+ 37 e(-2t) 11 (3t)
5 25 + 25 e
This solution can be checked by substitution.
Chapter 7. Non-homogeneous linear Differential Equations • 67

> simp1ify(subs(x(t) = rhs(so12), deq2));


e(-2t) _ 3e(3t) = e(-2t) _ 3e(3t)

So, you can conclude that the solution 5011 checks out. Graphing the
solution, the initial conditions can be verified.
> plot (rhs(so12), t = -1 . . 2, -2 .. 5);

-1 1.5 2

Solution of deq2 through the point (0,2)

Consider the following third-order linear non-homogeneous ODE.


> deq3 := diff(y(x) , x$3) - 5*diff(y(x) , x$2)
> - 2*diff(y(x) , x) + 24*y(x) = x-2 - 2;

a3 a2 a
deq3 := (ax 3 y(x)) - 5 (ax 2 y(x)) - 2 (ax y(x)) + 24y(x) = x2 - 2

> so13 := dso1ve(deq3, y(x));


113
5013 := y(x) = - - - +-1 x + -1 x2 + Cl e(3x) + C2 e(4x) + C3 e(-2x)
1728 144 24 - - -
The general solution, which has three arbitrary constants, can be sub-
stituted back into the original ODE for verification.
68 • Chapter 7. Non-homogeneous Linear Differential Equations

> simp1ify(subs(y(x) = rhs(so13), deq3));

X2 - 2= X2 - 2

So, the general solution checks out again. If initial conditions y(1) = 5,
y' (1) = 3, and y" (1) = 6 are known, you can solve for a unique solution
as follows.

> so13:= dso1ve({deq3, y(1)=5, D(y)(1)=3, (D@@2)(y)(1)=6}, y(x));

sol3 :=
113 1 1 1081 e(3x) 289 e(4x) 61
y(x) = -1728 + 144 x + 24 x 2 + 135 (e)3 - 64 (e)4 + 40 (e)2 e(-2x)
Now graph this solution and check that the initial conditions are satisfied
at x = 1.

> plot (rhs(so13), x=0 . . 2, y=-5 . . 10);

10
8
6
Y
4

0 0.5 x 2
-2

-4

Solution to deq3 through the point (1,5)

Finally, consider the following non-standard example of a linear non-


homogeneous ODE followed by the verification of the general solution.
Activities for §7 • 69

> deq4 := x-2*diff(y(x), x$2) + 3*x*diff(y(x), x) - 3*y(x) = x-2-4*xj

a2
deq4 := x 2 (-2 y(x))
a
+ 3 x (ax- y(x)) - 3 y(x) = x 2 - 4x
ax
> so14 := dso1ve(deq4, y(X))j
1 1 C2
sol4 := y(x) = :5 x 2 - x In(x) + 4" x + _Cl x + -x 3
> simp1ify(subs(y(x) = rhs(so14), deq4))j

x (x - 4) = x 2 - 4x

Activities for §7
1. Consider the ODE x"(t) - x'(t) - 2x(t) = 5te2t •
a. Solve the ODE and verify your general solution by substitution.
b. Solve for the unique solution to the ODE with initial conditions of
x(O) = -5 and x'(O) = 5.
c. Plot that solution for -1 ::: t ::: 1, and notice the point (0, -5) on
the graph, thereby verifying that the initial condition is satisfied.
2. Consider the ODE y"'(x) - 3y"(x) - 4y'(x) + 12y(x) = sinx.
a. Solve the ODE and verify your general solution by substitution.
b. Solve for the unique solution to the ODE with initial conditions of
y(O) = 0, y'(O) = -5, and y"(O) = 10.
c. Plot that solution for -1 ::: x ::: 1, and notice the point (0,0) on
the graph.
d. Give a written explanation of why the graph satisfies each of the
initial conditions. Include in the explanation a discussion of slope
and concavity at the point (0,0).
3. Consider the ODE t 2 x" (t) + tx' (t) + (t 2 - ! )x(t) = d.
a. Solve the ODE and verify your general solution by substitution.
b. Solve for the unique solution to the ODE with initial conditions of
x(5) = 0 and x'(5) = 2.
c. Plot that solution for 0 ::: t ::: 10, and notice the point (5,0) on the
graph.
70 • Chapter 7. Non-homogeneous Linear Differential Equations

d. Give a written explanation of why the graph satisfies each of the


initial conditions.
Appl ications of
CHAPTER

Linear Differential
Equations

In this chapter you will use the following commands from earlier chapters:

dsolve, solve, subs, evalf, plot, rhs

and the following command for the first time:

combine to put expressions in a more concise form

Many standard textbook techniques for solving linear ODEs are unnec-
essary when using a sophisticated symbolic computing system like Maple.
Maple computes most closed-form exact solutions directly, without us-
ing techniques like reduction of order, finding integrating factors, finding
complementary and particular solutions separately, variation of parame-
ters, undetermined coefficients, etc. And, if any of these techniques are used
within the algorithms Maple employs, the external users need not be aware
or concerned. Another advantage of Maple is that it can find general or
unique solutions when initial conditions are known.
The significance of these facts is profound. The modern student should
concentrate on the basic concepts and principles of ordinary differential
equations, on methods of setting up differential equations to solve specific
applications, and on interpreting the results in the context of the original
problem. If a student or a professional can model an applied problem as an
ordinary differential equation which has a symbolic solution, a computer

71
72 • Chapter 8. Applications of Linear Differential Equations

with computation abilities such as those provided by Maple will be able


to produce the correct solution. Even when the ODE has no symbolic
solution, Maple will provide graphical (see Chapters 5 & 10) or numerical
(see Chapter 15) solutions.
In this chapter, you will use the following mathematical model to rep-
resent the vibrating motion of a mass attached to the end of a spring:
m . x"(t) + a . x'(t) + k . x(t) = F(t), where

• x(t) represents displacement from equilibrium at time t,


• x'(t) represents velocity at time t,
• x"(t) represents acceleration at time t,
• m represents the mass of the object attached to the spring,
• a represents the damping constant,
• k represents the spring constant, and
• F(t) represents the sum of all external forces acting on the system.

The units used can vary between the British (pounds, slugs, feet, and
seconds), metric cgs (dynes, grams, centimeters, and seconds), or metric
mks (newtons, kilograms, meters, and seconds). The British system is used
in this manual and the downward direction continues to be defined as
positive. Remember that, in the British system, acceleration due to gravity
is 32 feet per second per second (i.e., g = 32\t).
sec

Free, Undamped Motion


A system is said to be free when there are no external forces acting upon it
(i.e., F(t) = 0) and undamped when there is no resisting force, such as air
resistance, acting upon it (i.e., a = 0).
When a spring is suspended from a beam and a 12 pound weight is
attached, the spring is stretched 8 inches beyond its natural length. The
weight is pulled down an additional 6 inches, held motionless, and then
released. Neglecting the effect of resistance of the medium (air or liquid),
you can find a function x(t) which represents displacement as a function
of time.
To set the mathematical model, the following constants and function
must be determined.
Free, Undamped Motion e 73

e m = 12/32 slug
ea=O
Since the displacement is 8/12 ft. when 12 lbs. of force is applied,
12 = (8/12) k (by Hooke's Law), and thus k = 18. F(t) = O.
So, the differential equation which defines this system is
> deq := 12/32*diff(x(t), t$2) + 18*x(t) = 0;
3 a2
deq := 8" (at 2 x(t)) + 18 x(t) = 0

The initial conditions for this problem are x(O) = 6/12 or 112 andx'(O) = O.
> sol := dsolve({deq, x(O) = 1/2, D(x)(O) = O}, x(t));
1
sol := x(t) = "2 cos( 4 v'3 t)

Graph this solution and verify the initial conditions. Also, you want to
determine the amplitude, period, and frequency of the resulting motion.
> plot(rhs(sol) , t = 0 .. 3, -1 .. 1);

-1

Solution of deq through the point (0, !)

You can see from the graph that the motion seems to complete one
cycle or period in a little less than one second.
74 • Chapter 8. Applications of Linear Differential Equations

> period := eva1f(2*Pi/(4*sqrt(3)));

period:=.9068996827
> frequency := l/period;

frequency := 1.102657790

Thus, the weight moves with a frequency of about 1.1 oscillations per
second while the amplitude is 0.5 or 1/2 foot.
Suppose the same system (weight and spring) is given an initial velocity
of 3 feet per second downward after first being pulled 6 inches downward.
What would be the new period, frequency, and amplitude?
The differential equation is the same as before, just the initial conditions
have changed to x(O) = 112 and x'(O) = 3.
> so12 := dso1ve({deq, x(O) = 1/2, D(x)(O) = 3}, x(t));

sol2 := x(t) = ~ cos(4.J3 t) +~ sin(4.J3 t).J3

Now graph both solutions and compare the results.


> p1ot({rhs(sol) , rhs(so12)}, t = o .. 3, -1 .. 1);

-1

Combined solutions to deq


Free, Damped Motion • 75

You observe that the second solution appears to have the same period
(the time between high peaks) and frequency, but the amplitude has been
increased.
> period2 := evalf(2*Pi/(4*sqrt(3)));

period2 := .9068996827
> frequency2 := 1/period2;

frequency2 := 1.102657790
The amplitude is given by the square root of the sum of the squares of
the coefficients of the sine and cosine functions in 5012 above.
> amplitude2 := sqrt((1/4*sqrt(3))-2 + (1/2)-2);
.
amplttude2 := 41 v'7
> amplitude2 := evalf(");
amplitude2 := .6614378278
So, by giving an initial velocity of 3 feet per second downward, the fre-
quency stays the same (about 1.1 oscillations per second) but the amplitude
increases to about 0.66 feet.

Free, Damped Motion


A more realistic model is obtained when you do not ignore the resistance
of the medium upon the mass attached to the spring (i.e., when a > 0).
You still assume that there are no external forces present (i.e., F(t) = 0).
Suppose a 4 pound weight is attached to a spring and stretches the spring
4 inches beyond its natural length. If the resistance of the medium is 0.5
times the velocity, the weight is pulled above the equilibrium 1 foot, and
an initial velocity of 10 feet per second downward is given the weight, find
the displacement as a function of time.
The constants are m = 4/32, a = 1/2, and 4 = (4112) k or k = 12. The
differential equation is
> deq3 := 4/32*diff(x(t), t$2) + 1/2*diff(x(t), t) + 12*x(t) = 0;

1 a2 1 a
deq3 := "8 (at 2 x(t)) + :2 (at x(t)) + 12 x(t) = 0
76 • Chapter 8. Applications of Linear Differential Equations

The initial conditions are x(O) = -1 and x'(O) = 10.


> so13 : = dsolve({deq3, x(O) = -1, D(x)(O) = 10}, x(t));

soB := x(t) = _e(-2t) cos(2 m t)


4
+ -.J23
23
e(-2t) sin(2 m t)

Graph the displacement function to help analyze the motion.


> plot (rhs(so13), t = 0 .. 2, -1 .. 1);

1.5

-1

Solution of deq3 with initial point (0, -1)

You can now observe damped oscillating motion from the graph. The
quasi-period (the time elapsed between high points) appears to be between
0.6 and 0.7 seconds.
> qperiod : = evalf(2*Pi/(2*sqrt(23)));

qperiod:= .6550673513
The variable damping function is
> dampf : = sqrt(16/23 + 1)*exp(-2*t);
1
dampf := 23 .J897 e(-2t)
Free, Damped Motion • 77

and you can show how this factor dampens the oscillations by displaying
it with the original function. The graphs of dampf and -dampf create an
envelope which is shown below.
> plot({rhs(so13), dampf, -dampf}, t=O .. 2, -1 .. 1);

Solution to deq3 with envelope

In yet another case, when the resistance is very great, the weight does
not oscillate but moves slowly toward the equilibrium. This is known as
being overdamped.
Instead of giving the damping constant as 0.5, assume it is an unknown,
a, and find all values of a for which overdamped motion will result. The
differential equation is now (1/8) . x"{t) + a . x/{t) + 12 . x{t) = 0 and the
auxiliary equation can be entered as

eq := m 2 + 8 a m + 96 = 0
The roots of this equation are
> eqroot := solve(eq, m);

eqroot := -4 a + 4 Ja2 - 6, -4 a - 4 -Ja,2 - 6


78 • Chapter 8. Applications of Linear Differential Equations

The solution to the differential equation will have no oscillation whenever


the roots to the auxiliary equation eq are real (i.e., when a2 - 6 ~ 0).

> solve(a-2 - 6 > 0);

RealRange( -00, Open( -.J6)), ReaIRange(Open(.J6), (0)

> eva1f(sqrt(6));

2.449489743

Since the damping constant must be positive, then a > 2.45.


H a is larger than 2.45, the weight on the spring will not oscillate.
Check this by letting a = 3 and solving the resulting differential equation.

> deq4 := 1/8*diff(x(t), t$2) + 3*diff(x(t), t) + 12*x(t) = 0;

1 a2 a
deq4:= -8 (-2 x(t))
at + 3 (-
at x(t)) + 12x(t) = 0

> so14 := dso1ve({deq4, x(O) = -1, D(x)(O) 10}, x(t));

5014 '= x(t) =


.
(-~ .J3 -
12
.!.)
2
e(4 (-3+J3) t) - ~ (-1 + 2.J3).J3 e(-4 (3+v'3) t)
12

Graphing this displacement function should verify that there are no oscil-
lations.

> plot (rhs(so14), t = O.. 1, -1 .. 0.2);


Free, Damped Motion • 79

0.2
02 04 t 06 08
Olr---~--~~~====~~--

-0.2

-0.4

-0.6

-0.8

-1

The overdamped case of deq4

There appear to be no oscillations; and the weight is very close to the


equilibrium position within one second.
Suppose you want to considerably slow the time it takes for the weight
to get close to equilibrium (i.e., to within one inch). Would increasing the
damping constant accomplish this? Increasing the damping constant indi-
cates that the spring and weight are immersed in a more viscous liquid or
gas. Solve the differential equation above in the general case, not assigning
a value to a.

> deq5 : = 1/8*diff(x(t), t$2) + a*diff(x(t), t) + 12*x(t) 0;

1 2 a + a (-
a
deq5 := -8 (2 x(t))
at at x(t)) + 12 x(t) = 0

> 5015 := dsolve({deq5, x(O) = - 1, D(x)(O) = 10}, x(t)) ;

1 (2 a + 2 -./a2 - 6 - 5) e(-4 (a--./a L 6) t)


solS := x(t) = - - . . : . . . . . - - - - - - - ; = ; ; ; : = = - - - - -
4 Ja 2 - 6
1 (2a - 2-./a 2 - 6 - 5) e(-4(a+Ja 2 -6)t)
+- - - ---r::::;<:==-----
4 -./a2 - 6
80 • Chapter 8. Applications of Linear Differential Equations

Graph several of these solutions by substituting different values for a.


Include in the plot the line for one inch (i.e., -1/12 feet).

> plot({seq(subs(a=i, rhs(so15)), i=[3, 5, 10, 25]), -1/12},


> t = O.. 8, -1. .0.1);

-1

Solutions to deq5 with a = 3,5,10,25

You can see from this graph that when the value of a is increased, the
time it takes to get closer to the equilibrium is indeed longer. The following
table compares the four values of a with the time required for the weight
to be within one inch of equilibrium (as estimated from the graph).

a t
3 0.5
5 1
10 2
25 5
Activities for §8 • 81

Activities for § 8
1. A 12 pound weight stretches a spring 8 inches. The weight is then
released from rest 6 inches below the equilibrium position.
a. Construct a table showing the position and weight at t seconds,
where t varies from 0 to 2 seconds by increments of 0.25 seconds.
b. Construct a table showing the velocity of the weight at each of the
values of t in the table of in Question 1. In each case indicate the
direction of motion (either up or down).
c. After resetting the symbol t to be an unassigned variable (with the
command t := 't'), graph both the displacement and the velocity
functions for 0 :5 t :5 2.
d. For 0 :5 t :5 2, find all times (correct to 5 digits) when the weight
passes through the equilibrium position.

2. A 10 pound weight stretches a spring 5 inches. The weight is then


released 4 inches above the equilibrium position with an upward ve-
locity of 5 feet per second. Find the answers to a), and c) to at least
three significant digits and use proper units.
a. What are the period and frequency of the vibrating motion?
b. Graph the displacement function through two periods.
c. At what time does the weight first attain a displacement of one-half
the amplitude above equilibrium?

3. An 8 pound weight is attached to a spring with a constant of 2 lb.-ft.


and the system is immersed in a liquid which imparts a damping force
of 3/2 of the velocity.

a. Determine the equation of motion when the weight is released 4


feet below the equilibrium position.
b. Graph the resulting displacement function on the interval 0 :5 t :5
3.
c. Are there any oscillations? How long will it take for the weight to
be within 1 inch of the equilibrium position?
d. Determine the equation of motion when the weight is released 4
feet below the equilibrium motion with an upward velocity of 50
feet per second.
82 • Chapter 8. Applications of Linear Differential Equations

e. Graph both displacement functions on the interval 0 ::: t ::: 4 and


give an explanation for the differences in the two functions.
f. Find the greatest distance above the equilibrium that the weight in
the second motion achieves.
4. A 96 pound weight is attached to a spring which stretches 4.8 feet.
The system is immersed in a liquid which imparts a damping force of
4 times the velocity, and is pulled down 1 foot and released.
a. Find the displacement function if the initial velocity is O.
b. Graph the displacement function on the interval 0 ::: t ::: 8.
c. Solve for t for each of the first four times that the weight is at the
equilibrium position.
d. Find the displacement function if the initial velocity is represented
in general by Vo.
e. Graph three displacement functions together for 0 ::: t ::: 8 by
substituting VO = 0, -2, -4 into the function found in d).
f. Find which one has the greatest displacement from the equilibrium
position and explain why.
More Applications
CHAPTER

and Systems of
Differential Equations

In this chapter you will use the following commands from earlier chapters:

dsolve, .-
.-, limit, plot, combine, rhs, printchart

Forced Motion
We now turn our attention to the situation where the oscillating system
has an external force applied to it. Consider the case where the external
force is periodic and can be represented by F(t) = Fo cos(bt) for constants
Fo and b.
Suppose a 64 lb. weight is attached to a spring whose spring constant
is 1/4 lb.lfoot. The system has a damping constant of 1/5, with initial
conditions x(O) = -1/2 and x'(O) = o. If an external force of F(t) = cos( ~)
is applied to the system, find the displacement as a function of time.
> deq := 64/32*diff(x(t), t$2) + 1/5*diff(x(t), t) +
> 1/4*x(t) = cos(1/2*t);
a2 1a 1 1
deq := 2 (at 2 x(t)) + :5 (at x(t)) + 4" x(t) = cos("2 t)

> dsolve({deq, x(O) = -1/2, D(x)(O) = a}, x(t)) ;


170 7 17 10 7 . 17
x(t) = 203 cos( 20 t) cos( 20 t) - 203 cos( 20 t) sm( 20 t)

83
84 • Chapter 9. More Applications and Systems of Differential Equations

30 7 3 10 7 . 3 10. 7 3
- 7 cos( 20 t) cos( 20 t) +7 cos( 20 t) sm( 20 t) +7 sm( 20 t) cos( 20 t)
30 . 7 . 3 10 . 7 17 170. 7 . 17
+7 sm( 20 t) sm( 20 t) + 203 sm( 20 t) cos( 20 t) + 203sm( 20 t) sm( 20 t)

+ -171 e(-1/20t) cos(-


7 t) 629 e(-1I20t) sm(-
- -
. 7 t)
58 20 406 20
> sol := combine(". trig);
sol := x(t) =
100 1
- - cos(- t) + -40 . 1
sm(- t) + -171 e(-1I20t) 7 629
cos(- t) - -
7
e(-1I20t) sin(- t)
29 2 29 2 58 20 406 20
> plot(rhs(sol). t = 0 . .48);

Solution to deq with initial point (0, -! )


The graph shows the displacement of the weight as a function of time.
This solution can be partitioned into the transient part (the two terms with
the exponential factor) and the steady-state part (the remaining two terms).
> trsol := op(3. rhs(sol)) + op(4. rhs(sol));
171 7 629 . 7
trsol := - e(-1I20t) cos(- t) - - e(-1I20t) sm(- t)
58 20 406 20
Forced Motion • 85

> sssol : = opel, rhs(sol)) + op(2, rhs(sol));

100 1 40 . 1
sssol := - 29 cos( 2: t) + 29sm( 2: t)

These parts can be graphed to see what effect they have on the total solu-
tion.

> plot({trsol, sssol}, t 0 .. 48);

Transient and steady-state solutions of deq

Notice that because the transient solution gets closer and closer to zero,
the steady-state solution determines the final motion of the system.

> limit(trsol, t = infinity);

o
Now, graph all three functions together and identify the transient, the
steady-state, and the final solution.
86 • Chapter 9. More Applications and Systems of Differential Equations

> p1ot({trso1, sssol, rhs(sol)}, t = 0 .. 48);

Transient, steady-state, and final solutions of deq

Finally, to illustrate the behavior of these components numerically for


both small and large values of t, construct a table showing values of all
three functions. Use the printchart command that was created and saved
in a previous session. (See Chapter 4, page 39.)

> read 'chart.m';


> printchart([t, eva1f(trso1), eva1f(sssol), eva1f(rhs(sol))] ,
> t, O.. 100, 10);

0 2.9483 -3.4483 -.5000


10. - 1.3450 -2.3007 -3.6457
20. .44323 2.1430 2.5863
30. -.873e-2 3.5165 3.5078
40. -.15315 -.1480 -.30115
50. .17719 -3.6006 -3.4234
60. -.14494 -1.8947 -2.0396
70. .99460e-l 2.5256 2 . 6251
80. -.5966ge-l 3.3275 3.2678
90. .31193e-l -.6379 -.60671
100. -.13482e-l -3.6894 -3.7029
Systems of Linear Differential Equations • 87

In this table, values of t are in the first column, values of the transient
part are in the second column, values of the steady-state part are in the
third column, and the last column contains values of the total solution.
Notice that for small values of t, the transient part has a large effect on the
total solution, while, for large values of t, the transient part is almost zero
and the steady-state part dominates the system.

Systems of Linear Differential Equations


Differential operators are presented as a means of solving linear systems of
differential equations. Maple can solve many such systems directly. Con-
sider the following system, where D is the first-order differential operator.

(2D - 3)x(t) + (D -l)y(t) = 2t

(D - 4)x(t) + (D -l)y(t) = et
Now define these differential equations in Maple as a system named
sys. Notice that the equations are separated by a comma. But first, the
symbol t must be reset as an unassigned variable.
>t:= 't';

t:= t
> sys := 2*D(x)(t) - 3*x(t) + D(y)(t) - yet) =
> 2* t, D(x)(t) - 4*x(t) + D(y)(t) - yet) = exp(t);

sys :=

2 D(x)(t) - 3 x(t) + D(y)(t) - y(t) = 2 t, D(x)(t) - 4 x(t) + D(y)(t) - y(t) = et


Now solve the system.
> sol := dsolvel{sys}, {x(t), yet)});

sol := {x(t) = e(-t) _Cl + 2 t - 2 - 2:1 e t ,

y (t) = ~2- Cl et - ~2 e(-t) - Cl + e t - C2 - 8t + 2 + ~4 e t - ~2 e t t}


88 • Chapter 9. More Applications and Systems of Differential Equations

Notice that the solutions for both x(t) and y(t) are returned, which can
be accessed as 501[1] and 501[2].

> sol [1] ;

x(t) = e(-t) _Cl +2t - 2- 2:1 e t

> 501[2];

5
y (t) = -
2-
Cl e
t
-
5(t)
-
2
e -
-
Cl + e t - C2 - 8t + 2 + -45 e t - 1t
- e
2
t

If a system has a set of initial conditions, Maple produces unique solutions.


For example, if x(O) = -2 and y(O) = 4 in the problem just solved, proceed
as follows.

> sol := dsolve({sys, x(O) = -2, yeo) = 4}, {x(t), yet)});

1 5
sol := {x(t) = -2 e(-t) + e(-t) (2 e t t - 2 et _ _ e(2t) + -),
2 2
y(t) = -13 e t -
5 1
8 t + 2 - - e t t}
- e(-t) -
442

Graph this pair of solutions and identify each function by the initial con-
ditions.

> plot({rhs(sol[l]), rhs(sol[2])}, t = -4 .. 4, -5 .. 10);


Activities for §9 • 89

-4 4

-4

Solutions to sys with initial points x(O) = -2 and


y(O) = 4

Activities for §9
1. An 8 pound weight is attached to a spring with a constant of 12 lb.lft.
The weight is pushed up to 1 foot above the equilibrium position be-
fore being released with no initial velocity. The system experiences air
resistance in the amount of 3/2 times the velocity and an external force
of F(t) = 12 cos 2t is applied to the system.
a. Find the displacement as a function of time. Be sure to use the com-
bine(rr r trig) command to simplify the solution.
b. Graph the solution on the interval 0 :::: t :::: 6.
c. Identify and define the transient (trsol) and steady-state (sssol) parts
of the solution.
d. Graph both the transient and steady-state parts on the interval 0 ::::
t :::: 6.

2. Consider the following linear system.

(2D - 1)x(t) + (D - 1)y(t) = 1 - t 2


90 • Chapter 9. More Applications and Systems of Differential Equations

(D + l)x(t) + (D - l)y(t) = 5t
a. Find the general solutions of the system.
b. Find the particular solutions for x(t) and y(t) that satisfy the initial
conditions x(O) = 5 and y(O) = O.
c. Graph these solutions together on at least two different intervals.
Identify each of x(t) and y(t) on:
• one small interval close to the origin
• another larger interval showing points further away from the
origin
d. Notice that both of these particular solutions are made up of two
parts which are easily distinguishable: one part a quadratic poly-
nomial and the other part involving exponential functions. Discuss
how this affects the graphs of each on both sides of the origin.
Phase Planes
CHAPTER

In this chapter you will use the following command from earlier chapters:

DEplot

A general system of two first-order ODE's can be written as follows:

ax
- = f(t,x,y)
at

ay
at = g(t, x, y),

where t represents time.


On the other hand, many useful differential equations are independent
of time. These are known as autonomous differential equations.

ax
at = f(x,y)

ay
at = g(x v\
J. ,

91
92 • Chapter 10. Phase Planes

At each point P in the xy-plane, the function values f(P) and g(P) de-
termine a two-dimensional vector < f(P),g(P) >. All such vectors in the
plane make up the phase plane for the autonomous system. When initial
conditions are known, such as x(O) = a and y(O) = b, then the particular
solution through the point (a, b) is called an orbit.
A graph of several orbits of an autonomous system on the phase plane
is called a phase portrait. This portrait reveals much about the stability of
a system of autonomous differential equations.
Maple graphs both phase planes and phase portraits with the DEplot
command. This command is found in the DEtools package which must first
be loaded into the Maple session.

> with(DEtools):

Consider the following example and notice the particular manner in which
each function is defined in the Maple session.

ay
-ax
at
= x, - = cos y -
at
O.02x

> A := [diff(x(t),t) = x(t), diff(y(t),t) = cos(y(t))-0.02*x(t)];

a a
A:= [at x(t) = x(t), at y(t) = cos(y(t)) - .02x(t)]

The following command generates the phase plane for this autonomous
system.

> DEplot(A, [x(t),y(t)], t=O .. 5, x=0 .. 15, y=0 .. 5);


Chapter 10. Phase Planes • 93

5 /';'------------------------------
-----~ ------
---- -----------.:--
..................... ~----~---...-------------
"""'"-
-...-...-------..:
................. """---- --~-----------

-....... ------- ----


////;'----------------
~------------------------------------­

!//'///-------------
I~/;'----~--------------­
!I/~~~~~~~~~~~~-~--

u 2 . 4 x 8 10 12 14

Phase plane

To produce an orbit passing through the point (1,4), the appropriate


initial condition must be added to the DEplot command.
> DEplot(A, [x(t),y(t)], t=O .. 5, {[O,1,4]}, x=O .. 15, y=O .. 5);

5 /'-----------------------------

------------
-.... --------
-.-,------...-- --
--.....-......------.---
---------
....

/;'----._------------------------
I ,/./ ---.~-.-------------­
/ / ""yo.,..., .-'--'~~~------ ..--.-----~
/ '/,." /.,..,-'--.--------~-.--
1~<~//~~~~~~~~-~
--------
2 4 x 8 10 12 14

Phase plane with one initial condition


94 • Chapter 10. Phase Planes

To graph a phase portrait, several initial conditions must be defined.

> init := {[0,1,0], [0,1,2], [0,1,4]};

in it := {[O, 1,4], [0, 1,0], [0,1, 2]}

> DEplot(A, [x(t),y(t)], t=0 .. 5, init, x=0 .. 15, y=0 .. 5);

5 / .....--------~-----

4
~........-........... ------------- -------
--"""'---- -- --------
.................. ' -...........

10 12 14

Phase plane with three initial conditions

If an object is moving along the x-axis (x = x(t)), it is useful to know


not only where that object is at time t but also what its velocity is at time
t. In order to sketch a graph capturing both the position and the velocity
of the object, you need parametric equations x = x(t) and v = x'(t). In this
situation, the horizontal x-axis represents position and the vertical v-axis
represents velocity.
This arrangement can be used to graph solutions to a second-order
differential equation which models an object in motion. For example, sup-
pose x(t) represents the distance to the left (x < 0) and right (x > 0) of
the equilibrium position (x = 0) of a mass attached to a pendulum. In this
case, the acceleration is proportional to the position of the mass and is in
the opposite direction of that position. Thus, the following second-order
Chapter 10. Phase Planes • 95

harmonic oscillator ODE would model this motion.

where x(O) = 2 and v(O) = x'(O) = O.


This results in the following autonomous system when v(t) is substi-
tuted for x'(t).

ax av
- =v,- = -9x.
at at

The phase plane along with the orbit through the point (x = 2, v = 0)
for this system is obtained with the following commands.
> B := [diff(x(t),t) = v(t), diff(v(t),t) = -9*x(t)];
a a
B := [at x(t) = v(t), at v(t) = -9 x(t)]

> DEplot(B, [x(t) ,v(t)], t=O .. 3, {[O,2,O]}, x=-6 .. 6, v=-6 .. 6,


> stepsize=O.l);

Phase portrait of a harmonic oscillator


96 • Chapter 10. Phase Planes

The resulting orbit appears elliptical, intersecting the x-axis at 2 and


-2, and intersecting the v-axis at 6 and -6. The horizontal position of the
mass starts at x = 2 and varies to x = 0, X= -2, x = 0, and back to x = 2
as it completes one cycle of its harmonic motion. Notice that the velocity
°
starts at v = and then varies to v = -6, v = 0, v = 6, and back to v = °
as one cycle is completed.
Another interesting application of autonomous systems is a popula-
tion model for two competing animal species. One such model for two
populations which compete for resources is the following predator-prey
model.

ax
- = -alX + blxy
at

In this model, x represents the population of the predator and y repre-


sents the population of the prey at any time t. The four coefficients are all
positive constants.
at and a2 are the natural growth rates of the populations x and y,
respectively. Consider that without the prey (i.e., y = 0) the predator has
a negative growth rate and would become extinct with time.
The coefficients of the xy terms, b l and b 2 , are a measure of the effect of
one population on the other. In this model, population x (the predator) has
a negative effect on population y (the prey) because -b2 is a negative value.
Conversely, population y (the prey) has a positive effect of population x
(the predator) because +b l is a positive value.
Suppose that x represents the number of foxes (in thousands) on an
island and y is the number of rabbits (in ten thousands). The following
autonomous system gives a predator-prey model for these species on this
island with three different initial conditions.

> C := [diff(x(t),t) = -O.8*x(t) + O.7*x(t)*y(t),


> diff(y(t),t) = O.9*y(t) - O.6*x(t)*y(t»);

a a
C:= [at x(t) = -.8x(t) + .7x(t)y(t), at y(t) = .9y(t) - .6x(t)y(t)]
Chapter 10. Phase Planes • 97

> inits := {[0.2.1]. [0.2.3]. [0.2.5]};

inits := nO, 2, 5], [0,2,1], [0,2, 3]}

> DEplot(C. [x(t).y(t)]. t=0 .. 10. inits. x=0 .. 7. y=0 .. 6.


> stepsize=0.1);

Phase portrait for predator-prey model

In this phase portrait, the horizontal axis (x) is the fox population, the
vertical axis (y) represents the rabbit population, and the three orbits result
from the three different sets of initial conditions.

1. When x = 2 and y = 5 initially, the outer orbit results in wildly fluc-


tuating populations of both species resulting in near extinction of the
rabbits followed by the same for the foxes.
2. When x = 2 and y = 3 initially, the middle orbit is produced, show-
ing smaller fluctuations in both populations and much less disastrous
results.
3. When x = 2 and y = 1 initially, the inside orbit results, which is much
more stable and better in the long term for both foxes and rabbits.
98 • Chapter 10. Phase Planes

Activities for §10


1. Sketch the phase portrait of each of the following autonomous systems
of ODEs with initial conditions.
a. x' = -y, y' = x + y/2;
[0,0,1], [0,0,2]
b. x' = y, y' = cos x - y;
[0,1,1], [0, 1,3], [0, 1,5], [0, 1, -2], [0, 1, -4]
Determine which of these orbits converge to the equilibrium point.
c. x' = cos2x - y, y' = sin2x - y;
[0, -1,0], [0,0,0], [0, 1,0], [0,2,0], [0,3,0), [0,4,0), [0,5,0)
2. Suppose that the following second-order ODE models the motion of a
mass attached to the end of a spring whose other end is attached to a
stationary block.

a2 x
-
at2
ax
+0.4- -cosx =
at °
If the mass is sliding on a table top, friction results in the slowing and
eventual stopping of the harmonic motion. Let x feet be the displace-
ment of the mass from the equilibrium position at time t seconds and
at velocity of v feet per second.
a. Substitute v for x' in this ODE to obtain an autonomous system.
b. Graph the phase portrait for this system with the following initial
conditions.

t = O,x = 0, and v = °
t = 0, x = 0, and v = -1
] t = 0, x = 0, and v = 2

c. Describe each orbit in terms of motion and velocity at various times.


d. Identify the equilibrium point and explain what it means in the
system for each orbit to converge.
3. Consider the fox and rabbit example in this chapter. Complete the
following questions.
Activities for §10 • 99

a. Determine an equilibrium point, i.e., a point where both the fox


and rabbit populations are constant.
b. A fox enthusiast from the mainland decides to transport 60,000
more rabbits over to the island in order to provide more "fox food."
Would you advise her to carry out this plan? Explain why.
4. In the following predator-prey model, x represents the human popula-
tion fishing for tuna in the Pacific ocean and y is the quantity of tuna
present.

x' = -x + xy,y' = 2y - Sxy,

with initial conditions t = 0, x = 2, and y = 2.


a. Draw the phase portrait of this system for
showing the orbit through the point [0,2,2].
°.: :
x .:::: 4 and °.: :
y .:::: 3,

b. Draw long-term conclusions about the tuna population according


to this model.
c. The second term (-Sxy) in the second equation has a negative
effect on the tuna population due to the amount of fishing done by
humans. By changing the coefficient on that term (it must remain
negative, however) can you produce a system that results in better
long-term stability?
d. Show your resulting system and phase portrait.
Matrix
CHAPTER

Operations

In this chapter you will use the following commands from earlier chapters:

linalg[matrix], linalg[det], simplify

and the following commands for the first time:

linalg[matadd] to add two matrices together


linalg[multiply] to multiply two matrices together
linalg[inverse] to compute the inverse of a matrix
linalg[transpose] to compute the transpose of a matrix
Ii nalg[charpoly] to compute the characteristic polynomial of a matrix
linalg[eigenvals] to compute the characteristic values of a matrix
linalg[eigenvects] to compute the characteristic vectors of a matrix
linalg[nullspace] to compute the null space of a matrix
evalm to evaluate an expression containing matrices
alias to alias one name to another

Basic Concepts
Maple is a powerful and efficient tool for performing matrix calculations
and related applications. The commands needed for these calculations are

100
Basic Concepts • 101

contained in the linear algebra package, linalg, which can be loaded using
the with command.

> with(linalg);

Warning, new definition for norm


Warning, new definition for trace

[BlockDiagonal, GramSchmidt,JordanBlock, L Udecomp, QRdecomp,


Wronskian, addcol, addrow, adj, adjoint, angle, augment, backsub, band,
basis, bezout, blockmatrix, charmat, charpoly, cholesky, col, coldim,
colspace, colspan, companion, concat, cond, copyinto, crossprod, curl,
definite, delcols, delrows, det, diag, diverge, dotprod, eigenvals,
eigenvalues, eigenvectors, eigenvects, entermatrix, equal, exponential,
extend, ffgausselim, fibonacci, forwardsub, frobenius, gausselim,
gaussjord, geneqns, genmatrix, grad, hadamard, hermite, hessian,
hilbert, htranspose, ihermite, indexfunc, innerprod, intbasis, inverse,
ismith, issimilar, iszero, jacobian, jordan, kernel, laplacian, leastsqrs,
linsolve, matadd, matrix, minor, minpoly, mulcol, mulrow, multiply,
norm, normalize, nullspace, orthog, permanent, pivot, potential,
randmatrix, randvector, rank, ratform, row, rowdim, rowspace, rowspan,
rref, scalarmul, singularvals, smith, stack, submatrix, subvector,
sumbasis, swapcol, swaprow, sylvester, toeplitz, trace, transpose,
vandermonde, vecpotent, vectdim, vector, wronskian]

Note the many linear algebra commands to which you now have access.
We begin by defining two matrices and one column vector and per-
forming some basic operations. In this chapter, the matrix(m, n, L) format
is used for defining a matrix or vector, where m is the number of rows, n
is the number of columns, and L is a list of the m*n entries.
102 • Chapter 11. Matrix Operations

> A := matrix(3, 3, [3, 4, -5, -2, 0, 12, 5,3, -1]);


3 4
-5 ]
A:= [ -2 0 12
5 3 -1
> B := matrix(3, 3, [0, -2, 15, 3, -3, 1, -1, -1, 6]);
-2
B:= [
-1
~ -3
-1
> V := matrix(3, 1, [5, -2, 4]);

V:= [-n
A and B have been defined as 3 x 3 matrices and V as a 3 x 1 column
vector. Standard mathematical operations (addition, multiplication, inver-
sion, transposition, etc. ) can be performed on matrices through the use of
linalg commands created specifically for each of these operations.
> C := matadd(A, B) ;
2
10 ]
c:=[! -3 13
2 5

> M := multiply(A, B);


17 -13
19 ]
M:= [ -12 -8 42
10 -18 72

> IA := inverse(A);

]
-18 -1 24

IA:= [ 1r \4 !l3
77
-3
77
"7
1
14
-V
77
> multiply(A, IA);

[ ]
1 0 0
0 1 0
0 0 1
Basic Concepts • 103

> evalm(2*C);

4 20]
-6 26
4 10
> multiply(B, V);

> TM := transpose(M);

17 -12
TM:=[ -13
19
-8
42
10 ]
-18
72
Maple can also compute the determinant of any square matrix.
> det(A);

154
> det(M);

-8008
Functions and/or expressions can be used as entries in matrices.
> X ;= matrix(3, 1, [x-2, 2*x, exp(-x)]);

X:= [ ;: ]
e(-x)

> multiply(A, X);

3x2 + 8 x - 5 e( -x) ]
[ _2x2 + 12e(-x)
5 x 2 + 6 x - e( -x)

In Maple, &* 0 represents the identity matrix for any dimension. If you
wish to use the identity matrix extensively, it is easier to assign an alias,
like the symbols Id, to represent the identity.
104 • Chapter 11. Matrix Operations

> alias(Id = &*());

i,Id
Another way of performing certain standard operations on matrices
is by representing them as matrix expressions within the evalm (evaluate
and a matrix) command. Since matrix multiplication is non-commutative
(i.e., A . B =J. B· A), the non-commutative operator &* must be used when
performing matrix multiplications within the evalm command.
> evalm(A + B);

[ ]
3 2 10
1 -3 13
4 2 5
> evalm(2*");

[ 6
2
8
-6
4

4
20
26
10 ]
> evalm(A &* Id);

[ 3 4
-2 0
5 3
-5
12
-1
]
[-n
> evalm(V &* Id);

> Y := matrix(3, 1, [x, y, zJ) ;

Y:~ [ ~ ]
> evalm(B &* Y);

[ -2y+15z
3x-3y+z
-x - y+6z ]
Basic Concepts • 105

The adjoint of matrix A is defined to be the transpose of the matrix of


the cofactors of A, while the inverse of A is the reciprocal of the determinant
times the adjoint of A.
> adjB := adjoint(B);

-17
adjB:= [ -19
-3 43]
15 45
-6 2 6
> detB := det(B);
detB:= -52
> invB := evalm(l/detB*adjB);

invB := [~ {~s
26 26
it]
26
The last result should be the inverse of matrix B. This can be checked in
two separate ways:
1. Multiply invB times B.
> multiply (invB, B);

1 00]
[ 010
001
2. Use the inverse command to find the inverse of B directly.
> inverse(B);

it ]
26

Powers of square matrices can be calculated as the following verified


examples show.
> evalm(A-2) = multiply(A, A);
-3
38 ]
28 -2
17 12
106 • Chapter 11. Matrix Operations

> evalm(B-4) = multiply(B, B, B, B);

-261 83 -520] [-261 83 -520]


[ -242 46 176 = -242 46 176
19 59 -440 19 59 -440

Characteristic Values and Characteristic Vectors


Characteristic values and vectors are also known as eigenvalues and eigen-
vectors, respectively. We now define a matrix M and find all its character-
istic values and vectors.

-n
> M := matrix(3, 3, [1, 0, 4, 4, 1, -2, 5, 0, 2]);
10
[
M:= ; ~

The characteristic matrix of M (which is the first step in finding the other
values) is calculated as follows.
> charmat(M, lambda);
)..-1 o
[ -4 )..-1
-5 o
Any unassigned symbol or name, such as x or a, can be used in place of
lambda. Maple automatically transforms the Greek name lambda into the
appropriate symbol.
The characteristic polynomial of matrix M is obtained by finding the
determinant of the characteristic matrix.
> det(");

Alternatively, the charpoly command finds the characteristic polynomial


directly.
> CP := charpoly(M, lambda);
Cp:=)..3 - 4)..2 - 15)" + 18
Characteristic Values and Characteristic Vectors • 107

The characteristic values are the zeros of the characteristic polynomial.


> factor(CP);
(A-1)(A-6)(A+3)

> solve(CP = 0, lambda);


1,6, -3
As before, Maple can find these characteristic values directly, with the help
of the eigenvals command from the linalg package.
> charvals := eigenvals(M);

charvals := 1,6,-3
In this particular case, there are three distinct eigenvalues which can be
accessed as charvals[1] , charvals[2], and charvals[3].
There is a characteristic vector of the matrix M corresponding to each
characteristic value. A characteristic vector is a non-zero matrix solution
to the matrix equation M X = A X, where X is a 3 x 1 column matrix. You
must solve for X for each value of charvals found above.
> nullspace(charmat(M, charvals[l]»;

no, 1, on
> nullspace(charmat(M, charvals[2]»;

> nullspace(charmat(M, charvals[3]»;

{[-1,~,1J}
Of course, Maple has an eigenvects command which provides sets of char-
acteristic vectors directly.
> eigenvects(M);

[10 25J }], [-3,1, {[3


[6,1, { 3,1, 6 -1, 2' 1J}], [1, 1, nO, 1, oJ}]

The output of the eigenvects command is a set of lists of the form [e, m,
{v}], where e is a characteristic value, m is its multiplicity (in this example,
108 • Chapter 11. Matrix Operations

all of the characteristic values have multiplicity 1), and v is a characteristic


vector corresponding to the given characteristic value
A characteristic vector v is actually a basis vector for an eigenspace, so
that any constant times v is also a characteristic vector corresponding to
that characteristic value.
Now, check the characteristic vectors found above by substituting them
into the matrix equation M X = A X. First, define the characteristic vectors
as cvec1, cvec2, and cvec3 corresponding to charvals[1], charvals[2], and
charvals[3], respectively.
> cvecl := matrix(3, 1, [0, 1, 0]);

cved:= [ !]
> cvec2 := matrix(3, 1, [10/3, 1, 25/6]);

cvee2:= [ ~J
> cvec3 := matrix(3, 1, [-1,3/2, 1]);

cvec3 := [ -~321 J
> evalm(M &* cvecl charvals[l] * cvecl);

UJ-[!]
So, the matrix equation M X = A X is satisfied for X = cvec1 and A =
charvals[1]. The verifications for the other two characteristic vectors fol-
low.
> evalm(M &* cvec2 charvals[2] * cvec2);
Activities for §11 • 109

> evalm(M &* cvec3 = charvals[3] * cvec3);

Thus, all three characteristic vectors check. Check one more thing; as stated
above, each characteristic vector found is a basis for an eigenspace, so that
k • v is also an characteristic vector for any constant k. A representation
for the arbitrary vector in the space defined by cvec3 is defined as vector
cvecx below.
> cvecx := evalm(k * cvec3);

cvecx := [ -_32kkk ]

Now, check the general vector cvecx in the matrix equation M X = A X,


as you did with the others.
> evalm(M &* cvecx =charvals[3] * cvecx);

So, for any number k, the vector cvecx checks as a characteristic vector.

Activities for § 11
1. Use these matrices in the following problems.

A=U
-3
-1
1
2
7
-1 l B=[
-1

9
2
1
-3
0
q. c=Ul
-2
X= [ l~x
1-x
]

a. Find A + 2B.
b. Find A x B.
c. Find the inverse of A x B.
d. Find A times its inverse.
110 • Chapter 11. Matrix Operations

e. Find the transpose of B.


f. Find the transpose of B x C.
g. Find -10(A x B).
h. Find -10(A x X).
i. Find A3.
j. Find B x C + X.
k. Evaluatethe determinant of the transpose of B.
1. Multiply the determinant of the inverse of A times B.
2. Find all eigenvalues and corresponding eigenvectors for each of the
given matrices. Check by substituting each eigenvalue and correspond-
ing eigenvector in the matrix equation M x V = A x V (where A is an
eigenvalue and V its corresponding eigenvector).

a. A =[ 6
-2
-5
9 l
[ 1
-4 0 6
b. A= 2 4 -4
2 0 7

1
2 -3 1
c. A = [ 2 -3 0
6 -45 12
Matrix
CHAPTER

Methods of
Solution

In this chapter you will use the following commands from earlier chapters:

linalg[matrix], linalg[eigenvals], linalg[eigenvects], & *, evalm, diff

This chapter demonstrates how Maple can be used to solve systems of


homogeneous linear ODE's with constant coefficients. We start with two
equations in two unknown functions, written as

x/(t) = all x(t) + a12 y(t) and


y' (t) = a21 x(t) + a22 y(t),

where the coefficients are real constants. Such a system can be expressed
as a matrix equation DX = A X, with the following definitions of matrices
A, X, and DX.

X = [ x(t)
y(t)
]
,
DX = [ x/(t) ]
y/(t)

Consider the following example.

X' = 3x + 4y
y' = 12x - 5y

111
112 • Chapter 12. Matrix Methods of Solution

Now, define the matrices; but first you must load the linalg package.
> with(linalg):
Warning. new definition for norm
Warning. new definition for trace
> A := matrix(2. 2. [3. 4. 12. -5J);

A:= [1~ _~ ]
> X := matrix(2. 1. [x. yJ);

X:= [ ~ ]

> OX := matrix(2. 1. [Ox. OyJ);

DX:= [ ~~ ]

Recall that the matrix equation is DX = AX.


> evalm(OX = A &* X);

[ ~~ ] - [ 13 ;x~~Yy ]

Assume there are solutions of the form x(t) = c eat and y(t) = d eat, where
a, c, and d are constants. To write the solutions in vector form, you must
define one more matrix.
> V := matrix(2. 1. [c. dJ);

V:= [ ~ ]

The solutions can be expressed now in the vector form X = V eat.


> evalm(X =V * exp(a*t));

[ Xy ] =[ e(a t) c ]
e(at) d
Notice that the derivative of the vector X can be expressed as DX = a V ~t.
By substitution, the first matrix equation above can be written as a V eat =
A V ~t. This simplifies to A V = a V, where A is the 2 x 2 coefficient
Chapter 12. Matrix Methods of Solution • 113

matrix, V is the 2 x 1 constant vector, and a is a constant. This is the same


type of matrix equation solved in chapter 9, where a is a characteristic
value of matrix A, and V is a characteristic vector corresponding to the
characteristic value. So, the solutions to the system can be found by solving
for the characteristic values and corresponding characteristic vectors of
matrix A.
> eigenvals(A);

-9,7
> eigenvects(A);

[-9,1, {[I, -3]}], [7, 1, {[I, I]}]


Therefore, when a = 7,
> V1 := matrix(2, 1, [1, 1]);

V1 := [ !]
and when a = -9,
> V2 := matrix(2, 1, [1, -3]);

Thus, the solutions are of the form

X:= c1 V1 e(7t) + c2 V2 e(-9t)


Remember, the matrix X has the two unknown functions (x(t) and y(t)) as
its components, so the solutions are
> sols := evalm(");
c1 e(7t) + c2 e(-9t) ]
sols := [ c1 e(7t) - 3 c2 e(-9t)

> xt := 5015[1,1];
xt := c1 e(7t) + c2 e(-9t)
114 • Chapter 12. Matrix Methods of Solution

> yt := s01s[2,1];

yt := c1 e(7t) - 3 c2 e(-9t)

where c1 and c2 are arbitrary constants. Finally, check these solutions.


> diff(xt, t) = 3*xt + 4*yt;
7 c1 e(7t) - 9 c2 e(-9t) = 7 c1 e(7t) - 9 c2 e(-9t)

> diff(yt, t) = 12*xt - 5*yt;

7 c1 e(7t) + 27 c2 e(-9t) = 7 c1 e(7t) + 27 c2 e(-9t)


You see that x' = 3 x + 4 y and y' = 12 x - 5 y for all values of c1 and c2.
These general solutions are therefore verified.
Let's summarize this method of solution.
Find the eigenvalues (a1 and a2) and the corresponding eigenvectors
(V1 and V2) for the coefficient matrix A. The general solutions are ob-
tained from the following matrix equation:

x = c1 V1 e a1t + c2 V2 ea2t
where c1 and c2 are arbitrary constants.
This method can be extended to solve larger systems. Using this matrix
method, solve the system

x' = - 2x +5y +5z


y' = -x+4y+5z
z'=3x-3y+2z

> A := matrix(3, 3, [-2, 5, 5, -1, 4, 5, 3, -3, 2]);

A:=
[
-2
-~
5 5]
4 5
-3 2
Find the characteristic values with the corresponding characteristic vectors.
> eigenva1s(A); eigenvects(A);

2,3, -1
Chapter 12. Matrix Methods of Solution • 115

-5 -3 ]
[2,1, {[-5, -5, I]}], [3, 1, {[I, 1, On], [-1,1, {[ 2' 2' 1 }]

Define the three eigenvectors corresponding to the three eigenvalues. Cor-


responding to the eigenvalue -1:
> Vi := matrix(3, 1, [-5/2, -3/2, 1]);

VI:= [ fJ
Corresponding to the eigenvalue 2:
> V2 := matrix(3, 1, [-5, -5, 1]);

V2:= [=n
Corresponding to the eigenvalue 3:
> V3 := matrix(3, 1, [1, 1, 0]);

V3:=UJ
The general solutions are given by the following matrix equation.
> X := evalm(c1*V1*exp(-1*t) + c2*V2*exp(2*t) + c3*V3*exp(3*t»;

X:= [
_i c1 e(-t) -
-~ c1 e(-t) -
5 c2 e(2t) + c3 e(3t)
5 c2 e(2t) + c3 e(3t)
J
c1 e( -t) + c2 e(2 t)

You now have the solutions for x(t}, y(t}, and z(t}.
> xt := X[1, 1]; yt := X[2, 1]; zt := X[3, 1];

xt := -~ c1 e(-t)- 5 c2 e(2t) + c3 e(3t)


2
3
yt := - - c1 e(-t) - 5 c2 e(2t) + c3 e(3t)
2
zt := c1 e(-t) + c2 e(2t)

Finally, verify these solutions.


116 • Chapter 12. Matrix Methods of Solution

> diff(xt, t) = -2*xt + 5*yt + 5*zt;


5
- c1 e(-t) - 10 c2 e(2t) + 3 c3 e(3t) = -5 c1 e(-t) - 10 c2 e(2t) + 3 c3 e(3t)
2 2
> diff(yt, t) = -xt + 4*yt + 5*zt;
3
- c1 e(-t) - 10 c2 e(2t) + 3 c3 e(3t) = 3
- c1 e(-t) - 10 c2 e(2t) + 3 c3 e(3t)
2 2
> diff(zt, t) = 3*xt - 3*yt + 2*zt;
-c1 e(-t) + 2 c2 e(2t) = -c1 e(-t) + 2 c2 e(2t)

Thus, the three general solutions check out.

Activities for § 12
Solve each of the following linear systems of differential equations and
check the general solutions.
1. x' = 6x+5y
y' = -2x - 5y
2. x' = 3x
y' = -8x+2y
3. x' = 5x+4y
y' =x+2y
4. x' = -x + 4y - 2z
y' = -3x+4y
z' = -3x + y + 3z
5. x' = -x+7y-z
y' = y
z' = 15y - 2z
Isoclines
CHAPTER

In this chapter you will use the following commands from earlier chapters:

subs, DEtools[DEplot], plots[display]

Before reading this chapter, review Chapter 5, Graphical Methods, in


order to better understand using isoclines.

Assuming a first-order ODE of the form y' = F(x, y), curves of the form
F(x, y) = k (for some arbitrary constant k) are called isoclines. They are
of particular importance because every member of the family of solutions
to a differential equation passes through the isocline with the same slope.
This holds because for any value of k, F(x, y) = k => y' = k.
Have Maple graph several isoclines for the ODE y' = 2x - y. The
isoclines are of the form 2 x - y = k, which when solved for y gives y =
2x- k.

> iso:= 2*x - k;

iso:= 2x - k

Notice that the isoclines in this example are all lines with slope of 2 and
y-intercept of -k.

> plot({seq(subs(k=i, iso), i=[-S,-2,O,2,S])}, x=-S .. S,

117
118 • Chapter 13. Isoclines

> y=-8 .. 8);

Isoclines for y' = 2x - y

The isoclines for the ODE y' = x 2 y are more interesting. They are x 2 y =
k, which implies that y = klx 2 for different values of k. The following
commands show the isoclines for k = -3, -1/2, 2, and 4, overlaid with
the original direction field.
As you enter these commands, pay special attention to the commands
that end with a colon (instead of a semi-colon), which suppresses unwanted
output. You may also note that the results of the plotting commands are as-
signed to variable names. This allows you to use the related plot structures
in later commands.
> with(DEtools): with(plots):
> deq := diff(y(x), x) = x-2*y(x);

deq := -
a y(x) = x 2 y(x)
ax
> deqfield := DEplot(deq, y(x), x=-2 .. 2, y=-2 .. 2,
> stepsize=O.l):
> deqiso := plot({seq(k/x-2, k=[-3,-1/2,2,4])}, x=-2 .. 2,
> y=-2 .. 2):
Activities for §13 • 119

The display command from the plots package combines the two plots
into one.
> display({deqfield, deqiso});

Direction field and isoclines for deq

From the graph, is it plausible that the slopes along each isocline are
constant?
Find the isocline where k = -3. Are the slopes along that isocline all
-3?
Find the isocline where k = -1/2. Are the slopes along that isocline all
-1I2?
Find the isocline where k = 2. Are the slopes along that isocline a1l2?
Find the isocline where k = 4. Are the slopes along that isocline all 4?

Activities for § 13
For each of the following first-order ODEs:
• Graph the direction field over an appropriate interval and suppress the
output. (Some experimenting might be necessary.)
• Graph at least three isoclines and suppress the output.
120 • Chapter 13. Isoclines

• Graph both the direction field and the isoclines together by using the
display command. Label each isocline with the proper value of k.
1.y'=~
2. y' = !r
x
3. y' = sinx - y
4. y' = x 2 +y2
Series
CHAPTER

Solutions

In this chapter you will use the following commands from earlier chapters:

dsolve, proc, print, plot, Detools[DEplot], plots[display]

and the following commands for the first time:

convert to convert a series data structure to a polynomial data


structure
Order to specify the order of series solutions

Another method for approximating a solution to an ODE is represent-


ing the solution with a power series. ODEs whose coefficients are functions
instead of constants are examples of appropriate places for application of
series methods. Two things to remember about a power series representa-
tion to a solution to an ODE are:
1. A power series about a point a is of the form L~o en (x - a)n.
2. Every power series has an interval of convergence outside of which the
series diverges.
Maple will find series solutions to some ODEs about the point a = o.
Thus, you expect the series solution to be closest to the actual solution of an
ODE when you look close to zero. You will see this illustrated by graphing
and comparing some series solutions and also by comparing numerical
results obtained from the series solutions.

121
122 • Chapter 14. Series Solutions

> deq := (x-2-1) * diff(y(x) , x$2) + 2*x*diff(y(x) , x) -


> 3*x*y(x) = 0;
a2 a
deq:= (x 2 - 1) (ax 2 y(x)) + 2x (ax y(x)) - 3xy(x) =0
To find a power series representation to the solution for this ODE, use the
type=series option to dsolve as shown below. (Not to be confused with the
series command!) The series solution to this ODE is about the point a = 0
with the initial conditions y(O) = 2 and y'(O) = 1.
> sol := dsolve({deq, yeo) = 2, D(y)(O) = 1}, y(x), type=series);
23 1 2
sol := y(x) = 2 +x - 3 x - 4 x -"5 x + O(x )
4 5 6

The Maple default for the order of the series is 6. This order can be changed
by manipulating the global variable Order.
> Order := 12:
> so12 := dsolve({deq, y(0)=2, D(y)(0)=1}, y(x), type=series);

2 3 1 4 2 5 1 6 15 7 3 8 49 9
sol2 := y(x) = 2 +x - 3x - 4 x -"5 X - 10 x - 56 x - 56 x - 240 x -

19 10 51 11 O( 12)
560 X - 30S X + X

To obtain information from the series solutions, such as numerical


evaluation at specific points or graphs of the solution curve, the series
must first be converted to a polynomial data structure with the convert
command.
> poly1 := convert (rhs (sol) , polynom);

2 3 1 4 2 5
polyl := 2 +X - 3X - 4 x -"5 x
> poly2 := convert (rhs(so12), polynom);
2 3 1 4 2 5 1 6 15 7 3 8 49 9 19 10
poly2 := 2 +x - 3x - 4 x -"5 x - 10 x - 56 x - 56 x - 240 x - 560 x

51 11
- 30S x
While it may appear on the surface that the only difference between the
series found in sol and the polynomial poly is the order term, there is much
Chapter 14. Series Solutions • 123

more going on here than meets the eye. The internal data structures for
series and polynomials are very different. To see this, use the op command
to view their structure.

> op(rhs(sol));

-2 -1 -2
2,0,1,1, 3,3, 4,4, 5,5,0(1),6

> op(poly1);

Now, compare numerical results of these series solutions of different order


over the interval -1 :::: x :::: 1, by having Maple construct a table of values.
Use the printchart command that was created and saved in a previous
session. (See Chapter 4, page 39.)

> read 'chart. m' ;


> printchart([x, evalf(poly1), evalf(poly2)], x, -1 .. 1, 0.2);

-1. 1. 8167 2.2669


-.8 1.5700 1.6290
-.6 1.5427 1. 5471
-.4 1.6404 1.6405
-.2 1.8050 1.8050
0 2. 2.
.2 2.1942 2.1942
.4 2.3468 2.3459
.6 2.3925 2.3765
.8 2.2252 2.0886
1.0 1.6833 .85812

From the table, you can see the close agreement between the numerical
values of the two polynomials when x is close to zero. But you can also
see that they differ more and more as x takes on values further away from
zero. Now compare these polynomials graphically.
124 • Chapter 14. Series Solutions

> plot({polyl, poly2}, x=-2 .. 2, y=-S .. S);

2~

Series solution to deq

From the graph, you can verify the earlier observations. The point
being made is that a series solution is more accurate close to the point
about which the series is expanded. Also, note from the graph that the
initial conditions appear to be satisfied (i.e., y(O) = 2 and y'(O) = 1) on
both graphs.
Now consider an ODE for which Maple cannot find an exact solution,
but can give a series representation to the solution. The ODE is first-order,
allowing you to do a field plot and compare that with a graph of the series
solution.
> deq := diff(y(x), x) = 2*x - cos(y(x»;

deq := -
a y(x) = 2x - cos(y(x))
ax
> dsolve(deq, y(x));
Maple cannot give an exact solution. Try doing a field plot of the system
with the initial condition y(O) = -1.
> with(DEtools):
Chapter 14. Series Solutions • 125

> DEplot(deq, y(x), x=-2 .. 2, {CO, -l]});

Field plot for deq with initial condition y(O) = -1

Find a series solution after resetting the order to 6.

> Order := 6:
> sol := evalf(dsolve({deq, yeO) = -l}, y(x), type=series));

sol := + 1.227324357 x 2 -
y(x) = -1. - .5403023059 X .3179645107 x 3 _
.02821284205 x4 + .1344648441 x 5 + O(x 6 )

Convert the solution to a polynomial.

> poly := convert(rhs(sol), polynom);

poly := -1. - .5403023059 x + 1.227324357 x 2 - .3179645107 x 3


- .02821284205x4 + .1344648441x 5
126 • Chapter 14. Series Solutions

> plot(poly, x=-2 .. 2);

Series solution for deq

Do the curves in the last two graphs appear to be the same? Do they
both satisfy the initial condition of y(O) = -1? To get a closer comparison
of these two graphs, combine them on one set of axes. Note again the use
of colons to suppress intermediate output.

> with(plots) :
> A := DEplot(deq, y(x), -2 .. 2, {[O,-i]}):
> B := plot(poly, x=-2 .. 2, y=-2 .. 2):

You must now use the display command which is in the plots package.

> display({A, B});


Chapter 14. Series Solutions • 127

-2

Combination of series solutions and field plot for deq

Observe that close to x = 0 the graphs match, but as x moves further


away from the origin the graphs diverge. Also observe that the initial con-
dition, y(O) = -1, is satisfied by both graphs. Identify which curve is from
the field plot and which curve represents the polynomial taken from the
series approximation to the solution. Which graph do you expect is more
accurate? Why?
Now try an example for which Maple can find both the exact solution
and a series approximation and compare the results both numerically and
graphically.
> deq2 := diff(x(t), t) = x(t) + t * sin(2*t);

deq2 := ~
at x(t) = x(t) +t sin(2 t)

> so12 := rhs(dso1ve({deq2 , x(O) = 1}, x(t)));


4 2 8 4 2 .
50/2 '= - - t cos(t)2
. 5
+ -5 t - -
25
cos(t)2 + -25 - -5 t sm(t) cos(t)

6 . ) 29 t
+ 25 sm(t) cos(t + 25 e
Find series solutions for two different orders: 6 and 12.
128 • Chapter 14. Series Solutions

> so13 := dsolve({deq2, x(O) = 1}, x(t), type=series);

sol3 := x(t) = 1+ t + ~ t2 + ~ t3 + ;4 :0
t4 - t5 + O(t 6 )
> Order := 12:
> so14 := dsolve({deq2, x(O) = 1}, x(t), type=series);

5014 := x(t) = 1 + t + ! t2 + ~ t3 + ~ t4 - ~ t5 - ~ t6 + ~ t7 + ~ t8_


2 6 24 40 80 336 2688
859 9 859 10 4261 11 12
362880 t - 3628800 t + 39916800 t + O(t )
Convert these to regular polynomials.
> poly3 := convert (rhs(so13), polynom);
1 2 5 3 5 4 9 5
poly3 := 1 + t + "2 t +"6 t + 24 t - 40 t
> poly4 := convert (rhs(so14), polynom);

1253549536117118
poly4 := 1 + t + "2 t +"6 t + 24 t - 40 t - 80 t + 336 t + 2688 t
859 9 859 10 4261 11
362880 t - 3628800 t + 39916800 t
Now construct a table of values and compare the exact solution in the
second column with the series approximations in the last two columns.
First, the printchart commands, saved in an earlier session, must be read
into Maple.
> read 'chart.m';
> printchart([t, evalf(so12), evalf(poly3), evalf(poly4)], t,
> -2.5 .. 2.5,0.5);
-2.5 .92805 18.715 .500e-1
-2.0 .13221 4.8667 . 7478e-1
-1.5 -.23604 .5758 -.23772
-1.0 .3588e-1 .10000 . 35877e-1
-.5 .54005 .54088 .54005
0 1.0000 1. 1.
.5 1.7348 1.7352 1.7349
1.0 3.3135 3.3166 3.3134
1.5 5.9258 5.7836 5.9253
2.0 9.4108 7.8000 9.4022
Activities for §14 • 129

2.5 14 . 166 5 . 811 14.140

Notice that the values of the 11 th degree polynomial (in the last column) are
much better approximations to the exact solution (in the second column)
than the values from the 5 th degree polynomial (in the third column).
Finally, graph the exact solution together with the two series approxi-
mations.

> plot({so12, poly3, poly4}, t=-3 .. 3 , x=-2 .. 10);

2 3

Compare these graphs with the numerical data generated above and
identify the three functions.
You can also plot these three graphs over different ranges to observe
that the 11 th degree polynomial is significantly closer to the exact solution
over a larger interval than the 5th degree polynomial.

Activities for § 14

1. For each of the following, find at least two series solutions with dif-
ferent orders. Use the convert command to rewrite each solution as a
130 • Chapter 14. Series Solutions

polynomial and graph the polynomials on the same axes over an ap-
propriate interval containing the origin. Verify visually that the initial
conditions are satisfied.
a. y" - xy' + x 2 y = 0, y(O) = 1, y'(0) = -3
b. y" - xy' + x 2 y = In (x + 1), y(O) = 2, y'(O) = 1
c. (x - 3)y" + y' - 2x 2 y = 0, y(O) = 0, y'(O) = -2
d. y" - (3x - 2)y' - 2y = 0, y(O) = 0, y'(O) = 2
2. For each of the following, find series solutions for the following ODEs
with orders 6 and 12. Have Maple build a table of values for x between
-3 and 3 with an increment of 0.5, showing the values of both series
solutions at those x values.
a. (x 2 - l)y" + 2y' - 4xy = 0, y(O) = 5, y'(0) = -2
b. y" - (x 2 + x)y' - 6xy = 0, y(O) = 1, y'(O) = 3
3. For each of the following ODEs, find exact solutions and two series
solutions with different orders. Graph all these solutions on the same
axes and identify each.
a. x' = t2 - 2x, x(O) =3
b. x' = x + 5 sin t - t, x(O) = 1
4. For each of the following, graph both the slope field (with DEplot) and
the series approximation of the solution with order 10. Combine these
graphs as shown in this chapter and estimate the largest interval on the
x-axis for which the series solution provides a good approximation of
the actual solution.
a. y' = siny + xcosx, y(O) = °
b. y' = exp (-y) + 2x, y(O) =°
Numerical
CHAPTER

Methods

In this chapter you will use the following commands from earlier chapters:

dsolve, plot

and the following command for the first time:

assign to assign variables to their respective solutions

Many schemes have been developed to obtain numerical approxima-


tions to ODEs. In this chapter, we use the 4 th -order Runge-Kutta method
and the dsolve command with the type=numeric option. We find numerical
solutions to initial value ODEs of the form y' = ((x, y), where y(xo) = Yo,
using these two methods. When possible, the numerical results are com-
pared with the exact solution both numerically and graphically.

> deq := diff(y(x) , x) = sin(x) * y(x);

deq := ~ y(x) = sin(x) y(x)


ax
First, find and graph the exact solution to this ODE with the initial condi-
tion y(O) = 1.

131
132 • Chapter 15. Numerical Methods

> dsolve({deq, y(O) = 1}, y(x));


1
y(x) = eCos(x) e(-l)
> simplify(II);
y(x) = e(-cos(x)+l)

Use the assign command to assign to the symbols y(x) the exact solution
just found. You can then evaluate and graph this expression by using its
name.
> assign(II);
> plot(y(x) , x = -7 .. 7, Y = -2 .. 8);

-6 -4 -2 2 x 4 6

-2

Solution to deq through (0, 1)

Notice the solution is periodic with period 2n, and is also symmetric
with respect to the y-axis.
The following commands result in Runge-Kutta approximations from
x = 0 to x = 2, and they also display the values in a chart. The exact value
is in the third column and the approximation is in the second column.
> F := (x,y) -> sin(x) * y;
F := (x, y) --+ sin(x) y
Chapter 15. Numerical Methods • 133

> h := 0.2: xO := 0: yO := 1:
> printlevel := 0:

If you are using a windowing version of Maple, when typing in the


following for/d%d loop be sure to use the keystroke combination for a
carriage return (as opposed to the key for entering the input) after each
line except the last. This allows you to easily correct any typing mistakes.
For details on the relevant keystroke combinations for your computer, see
the platform-specific information that came with Maple.
> for n from 0 to 9 do
> k1:= h*F(x.n, y.n):
> k2:= h*F(x.n+h/2, y.n+k1/2):
> k3:= h*F(x.n+h/2, y.n+k2/2):
> k4:= h*F(x.n+h, y.n+k3):
> K:= 1/6*(k1 + 2*k2 + 2*k3 + k4):
> x.(n+1):= x.n + h: y.(n+1) := y.n + K:
> print(x.(n+1), y.(n+1), evalf (subs (x=x. (n+1), y(x))))j
> od:
.2,1.020133424,1.020133420
.4,1.082138289,1.082138316
.6,1.190846289,1.190846484
.8,1.354310863,1.354311613
1.0,1.583592979,1.583595182
1.2,1.892009363,1.892014710
1.4,2.293383004,2.293394093
1.6,2.798804462,2.798824540
1.8,3.411638387,3.411670640
2.0,4.121163498,4.121210113
Using an increment of h = 0.2 from x = 0 to x = 2, the approximation
is accurate to five significant digits (rounded to four decimal places) on the
entire interval.
You can further observe the accuracy of the Runge-Kutta method by
combining plots of the exact and estimated result over the appropriate
ranges. First save the plot of the exact result as the variable A.
> A := plot(y(x), x=0 .. 3, y=0 .. 5):

Then, by using the plot command with a list of values [Xl, Yl, ... , X n, Yn],
save the plot of the estimated result as the variable B.
134 • Chapter 15. Numerical Methods

> pointseq := [seq([i/5, y.i], i=1 . . 10)]:


> B := plot(pointseq, x=O .. 3, y=O .. 5, style=POINT,
> symbol=CIRCLE):

Now, use plots[display] to combine the two.


> plots [display] ({A, B});

3
Y
2

o 0.5 x 1.5 2 2.5 3

Solutions of deq with estimated points

Before continuing, you must reset the values of y(x), n, and printlevel.
> y(x) := 'y(x)': n := 'n': printlevel := 1:

Maple can give numerical estimates of higher order ODEs by using


the type=numeric option in the dsolve command. The method that Maple
uses is more advanced and is called the Fehlberg fourth-fifth order Runge-
Kutta method. Students should access and print the on-line help file for
?dsolve[numeric] now and read about the syntax used and the output pro-
duced with this option.
Solve the following second-order ODE numerically and graph the re-
sults.
> deq := 5*diff(y(x) , x$2) - (x + 3)*diff(y(x) , x) +
Chapter 15. Numerical Methods • 135

a2 a
deq := 5 (a
x
2 y(x)) - (x + 3)(-
ax
y(x)) + x 2 y(x) = 0

Use the dsolve command with the type=numeric option and the initial
conditions y(O) = 0, y'(0) = 1. Notice that the output of this command is
assigned to F; it is a procedure which can be evaluated and graphed like a
function.

> F := dsolve({deq. yeo) = o. D(y)(O) = 1}. y(x). type=numeric);

F := proc(rkf45_x) ... end

This output can be used to determine the value of the solution at any point
or at any sequence of points.

> F(-3); F(-2); F(-l); F(O); F(l); F(2); F(3); F(4);

a
[x = -3, y(x) = -.557413491899462210, ax y(x) = -1.08831101456095936]
[
x = -2, y(x) = -1.08886312606435998,

~ y(x) = -.00786695359308297454]
ax
[x = -1,y(x) = -.766268482242866589, -y(x) a = .569546416982045334]
ax
a
[x = 0, y(x) = 0, - y(x) = 1.]
ax
a
[x = 1, y(x) = 1.41033180568169247, ax y(x) = 1.93722410727395777]
a
[x = 2, y(x) = 3.93990469726372528, ax y(x) = 2.89549628660927283]
a
[x = 3, y(x) = 5.29634448025473947, ax y(x) = -2.18101035668896692]
a
[x = 4, y(x) = -5.04657127348778456, ax y(x) = -18.6076999164779266]

Have Maple plot the numeric solution to this ODE with the plots[odeplot]
command.
136 • Chapter 15. Numerical Methods

> plots[odeplot](F, [x, y(x)], -3 .. 4, numpoints=28);

Estimated solution to deq using type=numeric option

Now, carefully compare the numerical results obtained earlier with the
graph for consistency (e.g., F(l) ;:::::: 1.41 [point] and F'(l) ~ 1.9 [slope]).

Problems with Numerical Methods


Difficulties can occur when using numerical methods to approximate a
solution to a differential equation. Some very subtle problems can arise
from variations in the step size, h. Too small a value for h can cause round-
off errors. As well, the nature of the differential equation itself can cause
difficulties. We illustrate these problems with an example.
Most of the difficulties displayed here are too complex to address in
great depth in this book; however, you are encouraged to explore other,
more in-depth differential equation and numerical analysis texts.
Consider the following non-linear ODE with initial condition y(O) = 1.
> deqn := diff(y(t), t) = t + y(t)-2;

deqn
a y(t) = t + y(t)2
:= -
at
Problems with Numerical Methods • 137

Maple does not return an exact solution containing elementary functions,


nor a solution using the laplace option. (See Chapter 16 for information
on the laplace option to the dsolve command.)
> dsolve({deqn, y(0)=1}, yet));

't
v~
(-3 r( ~)2 31/3 BesselY( -f'~ t 3/2 ) +
r(~)2J5/6_4]f
Besse
IJ( -2 ~ t3/2))
3' 3
y(t)=-
-3
re)23 1/3
J
B
esse
lye 23/2 )
J,J t
r( ~)2 35/6-4]f
+ Besse IJ(1.3' ~3 t 3/2)
> dsolve({deqn, y(0)=1}, yet), laplace);
Try the Runge-Kutta method used earlier in this chapter. First, define
the function, the step size, and the initial values to and Yo.
> F := (t,y) -> t + y-2;

F := (t, y) ~ t + y2
> h := 0.1: to := 0: yO := 1:
> printlevel := 0:

Remember to use the carriage return as detailed earlier.


> for n from 0 to 9 do
> k1:= h*F(t.n, y.n):
> k2:= h*F(t.n+h/2, y.n+k1/2):
> k3:= h*F(t.n+h/2, y.n+k2/2):
> k4:= h*F(t.n+h, y.n+k3):
> K:= (1/6)*(k1 + 2*k2 + 2*k3 + k4):
> t.(n+1):= t.n + h: y.(n+1) := y.n + K:
> print(t.(n+1), y.(n+1));
> od:
.1,1.116491850
.2,1.273562543
.3,1.488017086
.4,1.789346485
.5,2.234480977
.6,2.949258908
.7,4.277324860
.8,7.601294892
.9,28.62566707
1.0,910954.2743
138 • Chapter 15. Numerical Methods

> n := 'n': printlevel := 1:

According to this chart, the solution to the ODE is 7.60 at t = 0.8,


28.63 at t = 0.9, and over 910,000 at t = 1.0. This sudden change in
magnitude should grab your attention; it is an indicator of what is referred
to as instability.
To investigate this situation further, see if Maple can give a series solu-
tion, of , for example, order 11.
> Order := 11:
> dsolve({deqn, y(O)=l}, yet), type=series);

3 2 4 3 17 4 31 5 149 6 2239 7 2141 8 2329 9


y(t) = 1 + t + 2. t +"3 t + 12 t + 20 t + 90 t + 1260 t + 1120 t + 1134 t +
200203 10 O( 11)
90720 t + t

> poly := convert(rhs(") , polynom);


poly:=
3 2 4 3 17 4 31 5 149 6 2239 7 2141 8 2329 9 200203 10
1+t+ 2. t +"3 t + 12 t + 20 t + 90 t + 1260 t + 1120 t + 1134 t + 90720 t
Check the value of this solution at t = 0.8,0.9,1.0.
> for i from 8 to 10 do print(i/10., subs(t=i/10., poly)); od;

.8000000000,6.170817449
.9000000000,10.04952752
1.000000000,17.40476190
There is a huge discrepancy from the numerical approximations provided
by the Runge-Kutta method.
Now try one more method: the type=numeric option of the dsolve
command.
> F := dsolve({deqn, y(O)=l}, yet), type=numeric);

F := proc(rkf45_x) ... end


> F(0.8); F(0.9); F(1.0);

[t = .8, y(t) = 7.62277587921045718]


[t = .9, y(t) = 32.7084412056097804]
Activities for §15 • 139

Error, (in F)
rkf45 is unable to achieve requested accuracy

Again, these values disagree with those provided by both the other meth-
ods. The results can be summarized in a table as follows.

t Runge-Kutta Series Numeric


0.8 7.60 6.17 7.62
0.9 28.63 10.05 32.71
1.0 910,954 17.40 Error

Which are the correct values? Because these methods do not seem at
all trustworthy, you must conclude that they fail when t is close to 1. To
determine why failures of this type happen is beyond the scope of this
book. However, it is hoped that you can recognize such problems when
they occur. Approximate values that vary wildly from one step to another
are common indicators of an instability that renders the results useless.

Activities for §15


1. Use the Runge-Kutta method to approximate numerical solutions to
the first-order ODEs in Questions (a) and (b). Also find the exact so-
lutions and print a table displaying the values over the given intervals
with an increment of 0.25. Determine the greatest error and plot the
exact and numerical solutions together over an appropriate range.
x 2 _y2 y (0) -
a. y , -- -y-' - ,
1 0 :::: x :::: 3
b. y' = cosx + 2y, y(-2) = 0, -2 :::: x:::: 1
2. Use the type=numeric option of the dsolve command to obtain numer-
ical solutions to the ODEs with initial conditions in Questions (a) and
(b). Construct a chart of values over the given interval with an incre-
ment of 0.5. Also, graph the numerical solutions using the style=POINT
option of the plot command.
a. (x 2 + l)y" - (x + 3)y' + y = 0, y(O) = 0, y'(O) = 1, -3 :::: x :::: 1
b. y" + xy' + x 2 y = sin x, y(O) = 0, y'(O) = -2, -1 :::: x :::: 5
The Laplace
CHAPTER

Transform

In this chapter you will use the following commands from earlier chapters:

I dsolve, solve

and the following commands for the first time:

inttrans[laplace] to apply the Laplace transform


inttrans[invlaplace] to calculate an inverse Laplace transform
Heaviside to represent the Heaviside step function

There are several ways that Maple can assist with using Laplace trans-
forms to solve ODEs.
First, Maple can be used to solve ODEs the same way it would be done
by hand using the laplace and invlaplace commands, which are found in
the inttrans package:
• Take the Laplace transform of both sides of the ODE.
• Solve for the Laplace transform of the dependent variable.
• Take the inverse Laplace transform of both sides of the resulting equa-
tion.
A second method of using the Laplace transform in Maple is to use the
method=laplace option in the dsolve command. This option is most useful

140
Chapter 16. The Laplace Transform • 141

when a discontinuous function (such as an impulse driving function) is


involved. Both methods are illustrated in this chapter.
Follow the sequence of steps described above and graph the solution
for the following third-order ODE.
> deq := diff(y(t), t$3) - 3*diff(y(t), t$2) - diff(y(t), t)
> + 3*y(t) = 8*t*exp(-2*t);

a3 a2 a
deq:= (-3 y(t)) - 3 (-2 y(t)) - ( - y(t)) + 3y(t) = 8 te(-2t)
at at at
Now take the Laplace transform of both sides of the differential equation.
> with(inttrans):
> leq := laplace (deq, t, s);

leq := S (s (s laplace(y(t), t, s) - y(O)) - D(y)(O)) - D(2)(y)(O)

- 3 s (s laplace(y(t), t, s) - y(O)) + 3 D(y)(O) - s laplace(y(t), t,s) + y(O)


8
+ 3Iaplace(y(t), t, s) = (s + 2)2

Define and substitute a set of initial conditions into the equation above
(Ieq).

> in it := {yeO) = -5, D(y)(O) = 2, (D@@2)(y)(O) = -4};


in it := {D(2)(y)(O) = -4, y(O) = -5, D(y)(O) = 2}
> leq := subs (init, leq);

leq := S (s (s laplace(y(t), t, s) + 5) - 2) +5- 3 s (s laplace(y(t), t, s) + 5)


8
- s laplace(y(t), t, s) + 3Iaplace(y(t), t, s) = 2
(s + 2)
Now solve the last equation for the Laplace transform of y(t) and sim-
plify the result.
> sol := solve(leq, laplace(y(t), t, s));

sol ._ _ 5 s4 + 3 s3
- 43 s2 - 48 s + 12
.- s5 + s4 - 9 s3 - 13 s2 + 8 s + 12
Now solve for the solution to the differential equation by using the in-
vlaplace command.
142 • Chapter 16. The Laplace Transform

> deqsol := invlaplace(sol ,5 ,t);

deqso/.= -71
- et + -33- e(3t) _ 19 8 te(-2t) ___
_ e(-t) _ _ 184 e(-2t)
. 36 200 8 15 225
Graph this solution over the interval [-5/2,2]. Verify that the initial con-
ditions are satisfied from the graph.
> plot(deqsol, t=-5/2 .. 2);

Solution to deq

When the initial conditions are included, the laplace option of the
dsolve command gives the solution directly.
> sol := dsolve({deq, y(O) -5, D(y)(O) = 2, (D@@2)(y)(O) = -4},
> y(t), method=laplace);

so/·= y(t)
71 et + --
= -- 33 e(3t) - 19 e(-t) _ _
-
8 te(-2t) ___
184 e(-2t)
. 36 200 8 15 225
In many applications, you frequently encounter discontinuous functions
which can be described as being either on or off. For example, an external
force applied to a mechanical oscillating system or a voltage acting on a
circuit may be turned off after a short period of time. To describe this
behavior mathematically, Maple uses what is called the Heaviside step
Chapter 16. The Laplace Transform • 143

function. First use the on-line help to see the definition of the Heaviside
function.

> ?Heaviside

FUNCTION: Dirac - the Dirac delta function

FUNCTION: Heaviside - the Heaviside step function

Calling Sequence:
Dirac(t)
Dirac(n, t)
Heaviside(t)

Parameters:
t algebraic expression
n - nonnegative integer

Synopsis:
- The Dirac and Heaviside functions are distributions. The Dirac(t) delta
function is defined as zero everywhere except at t = 0 where it has a
singularity. It also has the property that
Int(Dirac(t),t = -infinity .. infinity) = 1
- Derivatives of the Dirac function are denoted by the two-argument Dirac
function. The first argument denotes the order of the derivative. For
example, diff(Dirac(t), t$n) will be automatically simplified to Dirac(n, t
) for any integer n.
- The Heaviside(t) function is defined as zero for t < 0, 1 for t > 0 and is
not defined at O. It is related to the Dirac function by diff(Heaviside(t),
t) = Dirac(t).
- These functions are typically used in the context of integral transforms
such as laplace(), mellin() or fourier() or the solving of differential
equations. They are also used to represent piecewise continuous functions
with conversion routines available.

See Also: laplace, mellin, fourier, convert[piecewise]

The Heaviside step function is defined as:

t<O
Heaviside(t) = { ~: t>0
144 • Chapter 16. The Laplace Transform

This means that a horizontal translation of a units is obtained as follows:

t < a
Heaviside(t - a) = { ~: t> a

Now examine the graphs of a few examples to get a better idea of what
this step function looks like.

> plot (Heaviside(t), t -2 .. 2, Y -2 .. 2, style=POINT,


> symbol=DIAMOND);

2
y

-2 -1 2

-1

-2

Heaviside(t)

> plot(Heaviside(t - 4), t = -2 .. 8, Y -2 .. 2, style=POINT,


> symbol=DIAMOND);
Chapter 16. The Laplace Transform • 145

2
y

-2 2 4 6 8

-1

-2

Heaviside(t - 4)

Vertical translations and vertical stretches can be performed.


> plot(Heaviside(t - 4) + 3, t = -2 . . 8, Y = -2 .. 5,
> style=POINT , symbol=DIAMOND);

y
2

-2 2 4 6 8
-1

-2

Heaviside(t - 4) + 3
146 • Chapter 16. The Laplace Transform

> plot(3*Heaviside(t - 4), t = -2 .. 8, Y = -2 .. 5,


> style=POINT, symbol=DIAMOND);

3
Y
2

-2 2 4 6 8
-1

-2

3 Heaviside(t - 4)

Suppose you want to represent the following discontinuous function


by using Heaviside.

0, t < 0
f(t) = { 5, 0~t ~ 1
0, t> 1

This can be done as follows:


> f := 5*Heaviside(t) - 5*Heaviside(t - 1);

f := 5 Heaviside(t) - 5 Heaviside(t - 1)

The first term in f is 0 when t is less than 0 and 5 when t is to the right of
o. The second term is 0 when t is less than 1 and is 5 when t is to the right
of 1. When these terms are subtracted in this order, the resulting function
has a value of 5 when t is between 0 and 1 and a value of 0 elsewhere. To
check this, graph these terms.
> plot (5*Heaviside(t), t -2 .. 4, Y -2 . . 8, style=POINT,
Chapter 16. The Laplace Transform • 147

> symbol=DIAMOND) ;

6
y
4

-2 -1 2 t 3 4

-2

5 Heaviside(t)

> plot(5*Heaviside(t - 1), t = -2 .. 4, Y = -2 .. 8,


> style=POINT, symbol=DIAMOND);

6
y
4

-2 -1 2 t 3 4

-2

5 Heaviside(t - 1)
148 • Chapter 16. The Laplace Transform

Now, graph f, which is the step function described above.


> plot(f, t = -2 .. 4, Y = -2 .. 8, style=POINT, symbol=DIAMOND);

6
Y
4

-2 -1 2 t 3 4

-2

5 Heaviside(t) - 5 Heaviside(t - 1)

Now consider a second-order ODE which uses this discontinuous step


function f.
> deq2 := 3*diff(y(t), t$2) + 2*diff(y(t), t) + 5*y(t) = f;

deq2 :=

3 ( a2 y(t))
2
+ 2 (~y(t)) + 5 y(t) = 5 Heaviside(t) - 5 Heaviside(t - 1)
at at
Solve this ODE using the method=laplace option with the following initial
conditions.
> init2 := yeo) = 0, D(y)(O) = 0;

init2 := y(O) = 0, D(y)(O) = 0

> so12 := dsolve({deq2, init2}, yet), method=laplace);

5012 := y(t) = 1 - e(-1/3 t) cos( ~ v't4 t) - ~ e(-1I3 t) v'I4 sin( ~ v'I4 t)


3 14 3
Chapter 16. The Laplace Transform • 149

1
- Heaviside(t - 1) + Heaviside(t - 1) e(-1/3t+1/3) cos( 3" v'l4 (t - 1))

+ ~ Heaviside(t - 1) e(-1I3t+1I3) 54 sin( ~ 54 (t - 1))


14 3
Notice that the solution is given using the Heaviside function. However,
it is continuous, as the graph shows.

> plot(rhs(so12) , t = -0.2 .. 15);

Solution to deq2

If you interpret this graph as describing an oscillating mechanical sys-


tem (such as a mass attached to the end of a spring), the initial position is
the origin with an initial velocity of O. The forcing function, f, is on with
a constant magnitude of 5 for 1 second which sets the system into motion.
The forcing function is then turned off for all t greater than 1 and the
system is apparently damped and oscillates briefly with rapidly decreasing
magnitude.
Consider the same second-order ODE as above except that the forcing
function is changed to the following.

> g := 5*Heaviside(t) - 5*Heaviside(t - 1) + 5*Heaviside(t - 3)


150 • Chapter 16. The Laplace Transform

> - 5*Heaviside(t - 4) + 5*Heaviside(t - 6) - 5*Heaviside(t - 7);

g := 5 Heaviside(t) - 5 Heaviside(t - 1) + 5 Heaviside(t - 3)


- 5 Heaviside(t - 4) + 5 Heaviside(t - 6) - 5 Heaviside(t - 7)
> plot(g, t = -1 .. 10, Y = -1 .. 8, style=POINT, symbol=DIAMOND);

6
y
4

2 4 6 8 10

Graph of g

Notice that this forcing function is turned on with a magnitude of 5


on three separate one-second intervals: [0,1], [3,4], and [6,7]. Can you
predict what effect this will have on the oscillatory motion described above?
> deq3 := 3*diff(y(t), t$2) + 2*diff(y(t), t) + 5*y(t) = g;

deq3 :=
2
3 ( a 2 y(t)) + 2 (~y(t)) + 5 y(t) = 5 Heaviside(t)
at at
- 5 Heaviside(t - 1) + 5 Heaviside(t - 3) - 5 Heaviside(t - 4)
+ 5 Heaviside(t - 6) - 5 Heaviside(t - 7)
Solve this ODE with the same initial conditions as before.
> so13 := dsolve({deq3, init2}, yet), method=laplace);

sol3 := y(t) = 1 - e(-1I3t) cos(! .J14t) - ~ e(-1I3t) 54 sin(! 54t)


3 14 3
Chapter 16. The Laplace Transform • 151

1
- Heaviside(t - 1) + Heaviside(t - 1) e(-1I3t+l/3) COS(3".J14 (t - 1))

+ ~ Heaviside(t - 1) e(-1I3t+l/3) v14 sin( ~ .J14 (t - 1))


14 3
+ Heaviside(t - 3) - Heaviside(t - 3) e(-1I3t+l) COS(~.J14 (t - 3))

- ~ Heaviside(t - 3) e(-1/3t+1) v14 sin(! .J14 (t - 3))


14 3
- Heaviside(t - 4) + Heaviside(t - 4) e(-1I3t+4/3) COS(~.J14 (t - 4))

+ ~ Heaviside(t - 4) e(-1I3t+4/3) v14 sin( ~.J14 (t - 4))


14 3

+ Heaviside(t - 6) - Heaviside(t - 6) e(-1/3t+2) cos( ~ .J14 (t - 6))

- ~ Heaviside(t - 6) e(-1/3t+2) v14 sin(~.J14 (t - 6))


14 3
- Heaviside(t - 7) + Heaviside(t - 7) e(-1/3t+7/3) cos( ~.J14 (t - 7))

+ ~ Heaviside(t - 7) e(-1/3 t+7/3) v14 sin(! .J14 (t - 7))


14 3
> plot(rhs(so13). t = -0 . 2 .. 20);

Solution to deq3
152 • Chapter 16. The Laplace Transform

Does this graph look as you expected? Describe the behavior you ob-
serve, giving your reasons.

Activities for §16


1. For each of the following ODEs, execute the following sequence of
steps.
• Find the Laplace transform of both sides of the ODE.
• Substitute the initial conditions into the equation obtained above.
• Solve for the y(t).
• Find the inverse Laplace transform of the equation found above.
• Graph the solution on an appropriate interval (giving a readable
graph about the origin). Visually verify that the initial conditions
are satisfied.
a. y" + 4y' + 5y = e- t , y(O) = 0, y'(O) = 2
b. 3y" + lOy' - 8y = e- 3t cos t, y(O) = 2, y'(O) = -5
c. 3y'" - 2y" + 3y' - 2y = sin 2t, y(O) = 3, y'(O) = -1, y"(O) = -3
2. In each of the following problems, you are given an ODE with a dis-
continuous function.
• Use the method=laplace option of the dsolve command to solve
each ODE. Rewrite the discontinuous function as a linear combi-
nation of the Heaviside function before solving .
• Graph the solution on an appropriate interval.
a. y(O) = 2 and 4y' - 5y = F, where
0,
F = { -30t,
0,

b. y(O) = 1 and 4y' + 5y = G, where


0, t < 0
G = { sin 8t, 0 <t ~ 2
0, t > 2
Activities for §16 • 153

y(O) =1
c. y(O) = 0, y'(0) = 0 and y" + 5y' + 2y = H, where

0, t < 0
H = { 8, 0< t ::: 1
0, t> 1

y(O) = O,y'(O) = 0

d. y(O) = 0, y'(O) = 0 and 3y" + 3y' + 2y =], where

0, t < 0
]= { 5, 0 < t ::: 5
0, t> 5

y(O) = O,y'(O) = 0
e. y(O) = 0, y'(O) = 0 and 2y" + 5y = K, where

0, t < 0
{
K = 6, 0 < t ::: 2
0, t> 1

y(O) = 0, y'(O) = 0
Bibliography

W.E. Boyce, R.C. DePrima, Elementary Differential Equations, 5th Edi-


tion, John Wiley & Sons, New York, 1992.
B.W. Char, K.O. Geddes, G.H. Gonnet, B.L. Leong, M.B. Monagan, S.M.
Watt, First Leaves: A Tutorial Introduction to Maple V, Springer-
Verlag, New York, 1992.
B.W. Char, K.O. Geddes, G.H. Gonnet, B.L. Leong, M.B. Monagan, S.M.
Watt, Maple V Library Reference Manual, Springer-Verlag, New York,
1991.
W. Ellis Jr., E. Johnson, E. Lodi, D. Schwalbe, Maple V Flight Manual,
Brooks/Cole, California, 1992.
D. Redfern, The Maple Handbook: Maple V Release 4, Springer-Verlag,
New York, 1995.
D. Redfern, The Practical Approach Utilities for Maple, Springer-Verlag,
New York, 1996.
S.L. Ross, Introduction to Ordinary Differential Equations, 4th Edition,
Wiley, New York, 1989.
D.B. Small, J.M. Hosack, Explorations in Calculus with a Computer Al-
gebra System, McGraw-Hill, Inc., New York, 1991.
M.R. Spiegel, Applied Diffeential Equations, 3rd Edition, Prentice-Hall,
Englewood Cliffs, N.J., 1981.

155
156 • Bibliography

D.G. Zill, A First Course in Differential Equations with Applications, 2nd


Edition, Prindle Weber & Schmidt, Boston, 1982.
Index

!, 12 arithmetic operators, 12, 26


",22 assign, 21, 132
"",22 assignments, 19
""",22 auxiliary equations, 58
$,13
&*, 104 Backward quotes, 22
&*0,103
0, 12 Case sensitivity, 9, 17
"",13 characteristic polynomials, 106
*, 12 characteristic values, 106, 113
+, 12 characteristic vectors, 106, 107, 113
-, 12 charmat, 106
1,8 charpoly, 106
:,5 closed-form solutions, 25
:=,19 commands
;,5 readlib defined, 18
=, 19-21 finding, 17
?,6 names, 16
[], 15 in packages, 18
\, 7 constants
., 12 arbitrary, 27
_,27 mathematical, 9
., 10,22 convert, 122
n,14
D,25
Adjoint, 105 damping, 72
air resistance, 34 damping constant, 79
amplitude, 73 damping function, 76

157
158 • Index

dependent variables, 26 impulse driving functions, 141


DEplot, 46, 92, 118 independent variables, 25
det, 57, 103 initial conditions, 29, 41, 47
determinants, 57, 103 input
DEtools package, 46 and blank spaces, 7
diff,25 computing, 5
direction fields, 46 incomplete, 5
discontinuous functions, 142 installation, 2
diskette file transfer, 2
installation, 2 integers, 8
display, 119 intersect, 14
double quotes, 22 inttrans package, 140
dsolve, 27, 59, 73, 87 inverse, 102
explicit, 29 invlaplace, 140
method=laplace, 140 isoclines, 117
type=numeric, 134
type=series, 122 Keywords, 20

Eigenvals, 107 Laplace, 140


eigenvalues, 106 Laplace transforms, 140
eigenvectors, 106 limiting velocity, 37, 38, 50
eigenvects, 107 linalg package, 57, 101
equations, 20 linear independence, 56, 61
equilibrium, 72 lists, 15
error messages, 6 ordering, 15
evalm, 103, 104 vs. sets, 15
experimentation, 2
explicit, 29 Map, 35
expressions, 11 Maple
order of operations, 12 commands, 16
on-line help, 6
Factor, 58, 107 other books, 3
floating-point numbers, 8 starting, 4
flow lines, 47 syntax, 5
forces Maple V Release 4, 1
constant, 37 mass and spring problems, 72, 83
external, 72 matadd,102
forcing functions, 149 matrices, 100
frequency, 73 adjoints, 105
characteristic, 106
Greek characters, 106 defining, 101
definition, 57
Heaviside, 143 determinants, 57, 103
identity, 103
Identity matrix, 103 in finding solutions, 111
implicit relations, 28 standard operations, 102
Index 159

matrix, 101 period,73


member, 14 phase planes, 91
minus, 14 phase portraits, 92
mixture problems, 40 plot, 27, 62, 118,132
motion plots package, 119
damped oscillating, 76 plotting, 27, 36, 45, 67, 84
final,85 direction fields, 46
forced,83 flow lines, 47
free, damped, 75 isoclines, 117
free, undamped, 72 numerical approximations, 135
overdamped, 77 orbits, 93
multiply, 102 phase planes, 91
phase portraits, 92
Names, 11 population models, 96
nops, 15 printchart, 2, 39, 86, 123
nullspace, 107 printlevel, 134
numerical methods, 131
instability, 138 Quadrants, 47
problems with, 136 quotes, 22
backward, 22
Odeplot, 135 double, 22
ODEs single, 23
applications, 33, 71, 83
autonomous, 91
Rational numbers, 8
auxiliary equations, 58
read,39
defining, 25
readlib,18
exact, 25
reduction of order, 71
first-order, 25
homogeneous linear, 56 repeated roots, 60
Laplace methods, 140 RootOf,30
linear, 25 Runge-Kutta, 132
non-homogeneous linear, 65
numerical methods, 131 Save, 39
separable, 25 scientific notation, 8
solving, 27 seq, 35, 40
systems of, 87 sequences, 13
on-line help, 6 series, 121
topic browser, 7 converting to polynomials, 122
op, 15, 123 order, 122
orbits, 92 sets, 14
Order, 122 operators, 14
output ordering, 14
suppressing,S, 118 vs. lists, 15
simplify,27
Packages, 18 single quotes, 23
partial derivatives, 26 solutions
160 • Index

solutions (cont.) Techniques


approximate, 45, 131 computational, 71
closed-form, 45, 71 textbook, 71
comparing, 74 terminators, 5
complementary, 65 textbook techniques, 71
explicit, 28
texts, 1
general, 27, 61, 65, 115
transient solutions, 84
graphical methods, 45
implicit, 28 transpose, 103
matrix methods, 111
particular, 28, 65 Union, 14
plotting, 27, 36
series, 121
steady-state part, 84 Variables
to systems of ODEs, 87 dependant, 26
transient part, 84 independent, 25
verification, 26 names, 20
verifying, 29 unassigning, 23
solve, 21, 58, 107 vectors, 92
steady-state solutions, 84
strings, 10, 22
special characters, 10 With,18
subs, 27, 59 worksheets, 2, 5, 35
substitution, 59, 66 wronskian, 57
syntax errors, 6 Wronskian determinant, 56

You might also like