{VERSION 5 0 "IBM INTEL NT" "5.0" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0
1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }
{CSTYLE "" -1 257 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1
258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0
0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0
0 0 0 1 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }
{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{PSTYLE "Normal
" -1 0 1 {CSTYLE "" -1 -1 "Ohlfs" 0 14 47 1 236 0 2 2 2 0 0 0 0 0 0 1
}0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 0" -1 256 1
{CSTYLE "" -1 -1 "Times" 0 12 49 1 3 0 2 2 2 0 0 0 0 0 0 1 }0 0 0 -1
-1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 256 257 1 {CSTYLE "" -1 -1 "" 1 14
0 0 0 0 0 1 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE
"" 256 258 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }3 0
0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 256 259 1 {CSTYLE "" -1 -1 ""
0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }}
{SECT 0 {EXCHG {PARA 257 "" 0 "" {TEXT -1 32 "MAPLE for DIFFERENTIAL E
QUATIONS" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT
-1 122 "Glenn Ledder\nDepartment of Mathematics and Statistics\nUniver
sity of Nebraska-Lincoln\nsend comments to gledder@math.unl.edu" }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT
256 8 "Release " }{TEXT -1 1 "7" }}{PARA 256 "" 0 "" {TEXT -1 21 "Last
modified 8/27/01" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 258 "" 0 "
" {TEXT 257 41 "ELEMENTARY DIFFERENTIAL EQUATION COMMANDS" }{TEXT -1
1 "\n" }}{PARA 259 "" 0 "" {TEXT -1 27 "\"dsolve\", \" rhs\", \"odeplo
t\"" }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}{PARA 256 "" 0 "" {TEXT -1 459 "This worksheet demonstrates the mo
st elementary Maple commands used for differential equations, other th
an those in the \"DEtools\" package (see the DEtools sessions for demo
nstrations of ths package). It assumes that the reader is familiar wi
th elementary Maple commands, particularly \"diff\", \"subs\", and \"p
lot\". These commands are illustrated in the 2 sessions titled \"A MA
PLE PRIMER.\" This worksheet does not assume familiarity with the \"D
Etools\" package." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "
" {TEXT -1 171 "Some sections of this worksheet conclude with exercise
s. The recommended procedure is to work through the commands in each \+
section and then do the accompanying exercises." }}}{EXCHG {PARA 256 "
" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT 258 36 "A. DEFINING A \+
DIFFERENTIAL EQUATION" }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}}{EXCHG
{PARA 256 "" 0 "" {TEXT -1 326 "A differential equation can be defined
by entering the equation, using \"diff\" for derivatives, and assigni
ng the differential equation to a name. It is a good idea to define a
nd solve the differential equation in two distinct stages, since getti
ng Maple to display your differential equation helps you identify typi
ng errors." }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 432 "It is crucial th
at the variable names appearing in the differential equation have not \+
been assigned values earlier in the session, although it is fine to us
e the same variables in more than one differential equation. (See \"A
MAPLE PRIMER\" for more information.) One way to be careful about th
is is to cultivate the habit of restricting your use of the symbols \+
\"y\" and \"t\" to representing the variables in a differential equati
on." }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 114 "The following command d
efines the differential equation y'(t)=y(t) and assigns the equation t
o the name \"diffeq1\"." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "diffeq1 \+
:= diff(y(t),t) = y(t);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 149 "Not
e that \"diffeq1\" is the name of an EQUATION, not a FORMULA. The dis
tinction between an expression (formula) and an equation is quite impo
rtant. " }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 130 "An initial value p
roblem (a differential equation plus an appropriate number of algebrai
c conditions) is defined by forming a set." }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 26 "ivp1 := \{diffeq1, y(0)=1\};" }}}{EXCHG {PARA 256 ""
0 "" {TEXT -1 68 "We can also define higher-order differential equatio
ns using \"diff\"." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "diffeq2 := di
ff(y(x),x$2)+y(x)=0;" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 117 "Initia
l conditions involving derivatives cannot be specified using diff, but
can be specified using the \"D\" notation." }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 37 "ivp2 := \{diffeq2, y(0)=0, D(y)(0)=1\};" }}}{EXCHG
{PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT 259 50 "B. S
OLVING A DIFFERENTIAL EQUATION (with \"dsolve\")" }}{PARA 256 "" 0 ""
{TEXT -1 0 "" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 85 "The primary too
l for solving differential equations in Maple is the \"dsolve\" comman
d." }}{PARA 256 "" 0 "" {TEXT -1 103 "In the first examples, \"dsolve
\" gives the unique solutions to the initial value problems ivp1 and i
vp2." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "eq1 := dsolve(ivp1,
y(t));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "dsolve(ivp2, y(x
));" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 113 "In the next example, \"
dsolve\" is used to solve the differential equation \"diffeq1\" withou
t any initial condition." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "eq2 := \+
dsolve(diffeq1, y(t));" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 290 "Note
that Maple has included a constant called \"_C1\" as part of the solu
tion. A specific solution can still be chosen by substituting a numbe
r for the constant. In this statement, we use a new name \"eq3\" so t
hat the old name \"eq2\" still has the full solution to the differenti
al equation." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "eq3 := subs(_C1=2,e
q2);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 92 "Finally, note that all \+
three names \"eq1\", \"eq2\", and \"eq3\" refer to equations, not form
ulas." }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 ""
{TEXT 260 64 "C. PLOTTING THE SOLUTION TO A DIFFERENTIAL EQUATION (wit
h \"rhs\")" }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 256 ""
0 "" {TEXT -1 152 "When we applied \"dsolve\" to the initial value pro
blem \"ivp1\", we got a solution, which we named \"eq1\". Let's try t
o plot the function defined by \"eq1\"." }}{PARA 0 "> " 0 "" {MPLTEXT
1 0 19 "plot (eq1, t=0..1);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 147
"Note that we can't just \"plot\" the output of \"dsolve\". The reaso
n is that the output of \"dsolve\" is an EQUATION, but \"plot\" only p
lots FORMULAS. " }}{PARA 256 "" 0 "" {TEXT -1 184 "The formula that w
e want to plot appears on the right side of the equation \"eq1\". The
Maple command \"rhs\" is used to extract the expression appearing on \+
the right side of an equation." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "y
1 := rhs(eq1);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 249 "To the human
observer, \"eq1\" and \"y1\" are pretty much the same thing. But to \+
Maple, \"y1\" is an expression that can be manipulated in ways not all
owed for equations. The \"plot\" command produces the desired graph w
hen applied to the expression \"y1\"." }}{PARA 0 "> " 0 "" {MPLTEXT 1
0 18 "plot (y1, t=0..1);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 0 "" }}
{PARA 256 "" 0 "" {TEXT -1 632 "EXERCISES FOR SECTIONS A-C\n 1. Solv
e the problem y'-y=cos x, y(0)=c, where c is a parameter. Compare the
solution you obtain by hand with the solution you obtain using MAPLE.
Are they the same function for any specific choice of c?\n 2. Plot
together the solutions from exercise 1 using c values of -0.7, -0.5, \+
and -0.3, using an interval from x=0 to some appropriately chosen righ
t end point. (Try to choose an endpoint that gives a plot showing the
behavior of the solutions for large and moderate values of x.) Contr
ast the behavior of the solutions. In particular, what happens to the
solutions as x approaches infinity?" }}}{EXCHG {PARA 256 "" 0 ""
{TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT 261 48 "D. OBTAINING NUMERICAL
SOLUTIONS (with \"dsolve\")" }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}}
{EXCHG {PARA 256 "" 0 "" {TEXT -1 102 "Let's begin by defining an init
ial value problem for a system of 2 first order differential equations
." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 81 "deq1 := diff(R(t),t)=(2-1.2*F(
t))*R(t); \ndeq2 := diff(F(t),t)=(-1+0.9*R(t))*F(t);" }}}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 36 "ivp2 := \{deq1,deq2,R(0)=2,F(0)=5/3\};" }
}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 185 "Now let's try to solve the in
itial value problem analytically using \"dsolve\". Note that the vari
ables R(t) and F(t) are specified as a set. Be prepared to wait a whi
le for the result." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "soln := dsolv
e (ivp2, \{R(t),F(t)\});" }{TEXT -1 0 "" }}}{EXCHG {PARA 256 "" 0 ""
{TEXT -1 357 "Maple did not find a solution. Curiously, older version
s of Maple report a solution that involves Lambert functions. This so
lution is not very useful even if you know what a Lambert function is.
Instead, let's ask Maple to obtain an approximate numerical solution
. We do this by adding the word \"numeric\" as an optional argument t
o the \"dsolve\" command." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "soln :
= dsolve (ivp2,\{R(t),F(t)\},numeric);" }}}{EXCHG {PARA 256 "" 0 ""
{TEXT -1 249 "Note that the Maple output consists of a cryptic stateme
nt that is intelligible only to Maple experts. You will not find out \+
what the result looks like until you have Maple sketch the graph. You
can evaluate the solution at a specified value of t." }}{PARA 0 "> "
0 "" {MPLTEXT 1 0 8 "soln(0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 8 "soln(1);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "
" 0 "" {TEXT 262 48 "E. PLOTTING NUMERICAL SOLUTIONS (with \"odeplot\"
)" }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 256 "" 0 ""
{TEXT -1 225 "The \"plot\" command cannot be used to plot the output o
f \"dsolve/numeric\" because the output is a procedure and not a formu
la. Maple provides the \"odeplot\" routine for this purpose; to use i
t we must load the \"plots\" package." }}{PARA 0 "> " 0 "" {MPLTEXT 1
0 12 "with(plots);" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 264 "In the f
irst example, we use the numerical solution procedure obtained in the \+
previous section to obtain a graph of R(t). The range specifier is fo
r the independent variable. Note that the command does not work if yo
u use \"t=\" as part of the range specification." }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 34 "odeplot (soln, [t,R(t)], t=0..20);" }}}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 32 "odeplot (soln, [t,R(t)], 0..20);" }}}
{EXCHG {PARA 256 "" 0 "" {TEXT -1 226 "The graph seems rather coarse. \+
We can improve the picture by specifying the minimum number of points
to be computed (the default minimum is 49). Increasing this value wi
ll also cause Maple to take longer to produce the plot." }}{PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 47 "odeplot (soln, [t,R(t)], 0..20, numpoints=100)
;" }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 195 "We can get a single graph
with both R(t) and F(t) by specifying a list of desired curves. Note
that the curves have to be specified as a list with \"[\" and \"]\" r
ather than a set with \"\{\" and \"\}\"." }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 43 "odeplot (soln, [[t,R(t)],[t,F(t)]], 0..10);" }}}
{EXCHG {PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT -1
954 "EXERCISES FOR SECTIONS D-E\n 1. Consider the problem y'=x^2+y^2
, y(0)=1. Solve this problem analytically and plot the solution on th
e interval [0,0.9]. Solve the problem numerically and plot on the sam
e interval. Now restart the kernel. Measure how long it takes to sol
ve the equation and plot the solution using each of the two methods. \+
How useful is a complicated exact solution?\n 2. Consider the bounda
ry value problem y''=sqrt(1+(y')^2), y(0)=0, y(1)=0, where x and y are
the coordinates of points on a rope hanging freely under its own weig
ht. We can solve this problem numerically using the method of shootin
g. What we do is solve problems using the same differential equation,
but with initial conditions y(0)=0, y'(0)=s. We don't know what to p
ick for s, but we do know that we have picked the right value of s if \+
we get y(1)=0. Try s=-0.52 for this problem. First check to see that
y(1) comes out close to 0, then plot the solution." }}}}{MARK "35" 0
}{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }