Page 811 - Advanced_Engineering_Mathematics o'neil
P. 811
APPENDIX A A MAPLE Primer 791
enter
∗
s:=x→ piecewise(x < -1,x,x < 4,cos(3 x),x < 9,x∧2,sin(4 x));
∗
We can differentiate f (x) by
diff(f(x),x);
This can be done with a previously entered f (x), or we can put the function into the command,
as with
∗
∗
∗
∗
diff(x cos(3 x) exp(2 x),x);
We can also take a derivative using D(f)(x).
To evaluate an indefinite integral f (x)dx, use the int command:
int(f(x),x);
b
The variable of integration must be specified. For a definite integral f (x)dx, include the limits
a
of integration:
int(f(x),x=a..b);
This also can be used with improper integrals. For example, enter
int(exp(-x),x=0..infinity);
∞
to evaluate e −x dx = 1.
0
MAPLE has a sum command. If a1,···an are n numbers that have been defined in some
way, then their sum is computed as
sum(aj,j=1..n);
It may be necessary to precede this command with evalf to obtain a decimal evaluation. Often it
is convenient in a summation to define the sequence as a function. For example, if we define
∗
a:=j → j sin(Pi/j);
then
sum(a(j),j=4..7);
will produce the sum
4sin(π/4) + 5sin(π/5) + 6sin(π/6) + 7sin(π/7).
Preceding the sum command with evalf will produce the decimal value of the sum.
If a MAPLE file is saved, any code that has been entered will be retained. However, if the
file is closed and then reopened, some commands may have to be reactivated. For example, if a
function f(x) was previously entered, then place the cursor at the end of the line defining f(x)
and hit ENTER again to reactivate this function.
A.2 Ordinary Differential Equations
Some operations with differential equations require that a special package of subroutines be
opened. This is done by
with(DEtools);
2
For a direction field of y = y on a grid −2 < x < 2,−2 < y < 2, type
DEplot(diff(y(x),x) = y(x)∧2,y(x),x=-2..2,y=-2..2,color=black);
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-791 27410_24_appA_p789-800

