Page 813 - Advanced_Engineering_Mathematics o'neil
P. 813
APPENDIX A A MAPLE Primer 793
to obtain the general solution
1 2 1 2 2 1
y 1 (t) = t − t + c 1 , y 2 (t) = t + t + c 2 .
10 5 5 5
MAPLE can be used to write the first n terms of the power series solution of a differential
equation with analytic coefficients, expanded about 0, with initial condition(s) specified at 0. To
x
illustrate, give the differential equation y − cos(x)y = e the name deq1 by
deq1:= diff(y(x),x) - cos(x) y(x) = exp(x);
∗
Now obtain a power series solution about 0, with y(0) = 5, by
dsolve(deq1,y(0)=5,y(x),series);
This produces the output
7 1 7 5
3
2
5
4
6
y(x) = 5 + 6x + x + x − x − x + O(x ).
2 2 12 12
6
The symbol O(x ) means that terms involving sixth and higher powers of x have not been
included in this expression. In the absence of an instruction, MAPLE defaults to giving the first
six terms of a power series solution about 0, and these are the constant term and terms involving
N
k
x for k = 1,2,··· ,5. For terms up to and including x , include a value of N in the instruction.
10
For example, to obtain terms up to and including x , enter
dsolve({deq2,y(0)=5},y(x),series,order = 10);
For a phase portrait of a 2 × 2 system, we can use DEplot. For example,
DEplot([diff(x(t),t) = x(t)∧2 - y(t),diff(y(t),t) =
∗
x(t) y(t)],[x(t),y(t)],t=-7..0,[[x(0)=0,y(0)=1],
[x(0)=0,y(0)=2],[x(0)=0,y(0)=1/2]], stepsize=.02,
linecolor=0,color=black,arrows=MEDIUM,method=rkf45);
will produce a direction field (in black) for the system
2
x (t) = x − y, y (t) = xy
and solution curves through (0,1), (0,2), and (0,1/2). In applying the DEplot function, some
experimentation may be needed for the rang of values of t and for the selection of points through
which solution curves are to be drawn. In this example, if we set t = 0..1, we obtain an
error message. We do not know the solution explicitly, and some terms in it may blow up for
6t
certain values of t. For example, if a solution has an e term and we specify t:0..3, then, as t
6t
increases, the numbers e become too large for the program to handle. The key is to try various
t intervals. If one interval yields only parts of curves, try extending the range of t.Itisalsothe
case that some selections of initial data will work better than others.
A.3 Vector Operations
Vector operations can be carried out using the vector calculus package. Begin by loading this
package using
with(VectorCalculus);
n
Vector algebra can be done in R by either performing the operations (addition and scalar
multiplication) directly on the vectors, or by entering the vectors separately and then carrying
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
October 14, 2010 15:43 THM/NEIL Page-793 27410_24_appA_p789-800

