This first tutorial explains:
|
Start >
Programs >
Maple 11 >
Maple 11
Help >
Take a Tour of Maple
or
Help >
Quick Reference
> ?index
> ?command
where command can be, as examples
NOTE:
curly braces { } and square brackets
[ ] do NOT
represent parentheses in Maple.
> x := 9 ;
> w := x+3 ;
> y := x/2 ;
> z := y^3 ;
> qaz := 5*w ;
> qwe := sqrt(x) ;
> zaq := y + w ;
> x := 9 ;
> x := 4 ;
> x := 'x' ;
> x := 9 ;
> x;
> restart;
> f := x^2 + cos(x) ;
> plot( f, x = -2..Pi, title = `your title` ) ;
NOTES: The number Pi is represented
by
Pi
(not pi).
In Maple, pi
represents the Greek letter Pi.
> f := x^2 + cos(x) ;
> r := subs( x = 0, f ) ;
> r;
> subs( x = Pi, f ) ;
> evalf( subs( x = Pi, f ) ) ;
> R := evalf( subs( x = Pi, f ) ) ;
NOTE:
One does not evaluate expression
f at x = 0 by entering f(0);.
This is because f is defined as an expression,
not as a function.
> f := x^2 + x*y;
> r := subs( x = 1, y = 3, f ) ;
Functions
> f := x -> x^3-3*x^2-9*x+6 ;
> f(z);
> f(x+h);
> plot( f(x), x = -4..5 ) ;
> plot( f, -4..5 ) ;
> f(1);
Try these (with f defined as above):
> expand( f(x+h) - f(x) ) ;
> factor( f(x+h) - f(x) ) ;
> factor( ( f(x+h) - f(x) ) / h ) ;
> limit( %, h = 0 ) ;
NOTE:
A percent % references the previous
result; two %% references the second previous
result; three %%% references the
third previous result.
Example: Suppose we had defined
y = x3 - 3x2 - 9x + 6
as an expression:
> y := x^3-3*x^2-9*x+6 ;
To turn it into a function, use unapply:
> f := unapply( y, x ) ;
> f(2);
> f := (x,y) -> y * cos(x) ;
> r1 := f(0,2) ;
> f(Pi,2) ;
Example: Suppose we had defined
z = y cos x
as an expression:
> z := y * cos(x) ;
To turn it into a function, use unapply:
> f := unapply( z, (x,y) ) ;
> f(0,2);
> f(Pi,2);
> Q1 := cos(x)^3 - 4*sin(x)^5 ;
> Q2 := combine(Q1) ;
> Q1 := sin(x+y) ;
> Q2 := expand(Q1) ;
> f := x -> piecewise( x <= -1, x+5, x<2, x^2+1, x=2, 1,
x>2, 7-x) ;
> f(-3);
> f(2);
> plot( f(x), x = -6..8, title = `A Piecewise Function` ) ;
> limit( f(x), x = -1, left ) ;
> limit( f(x), x = -1, right ) ;
> limit( f(x), x = -1 ) ;
> limit( f(x), x = 2 ) ;
> 8*4;
> 8/4;
> 9^4;
> evalf(9/4);
> factor( x^5 - 8*x^3 + 16*x ) ;
> simplify( (x^5 - 8*x^3 + 16*x) / x ) ;
> factor(%) ;
> evalf(Pi) ;
> evalf(pi) ;
> evalf( cos(3) ) ;
> evalf( log(exp(-4)) ) ;
NOTE: The quantity
e-4 is entered as exp(-4), not as
e^(-4).
Likewise, for example, ex2 is
entered as
exp(x^2), not as e^(x^2).
> f := exp(x);
> plot( f, x = -2..2 ) ;
> subs( x = 2, f ) ;
> exp(2);
> evalf( exp(2) ) ;
> g := sqrt(x) ;
> plot( g, x = 0..2 ) ;
> combine( sin(2*x)*cos(4*x) + cos(2*x)*sin(4*x) ) ;
> expand( sin(6*x) ) ;
> combine(%);
> expand( cos(x-y) ) ;
> combine( sin(3*x)^4 ) ;
> plot( {f,g}, x = 0..2 ) ;
NOTE: The quantity
e-4
is entered as
exp(-4), not as
e^(-4).
Likewise, for example,
e-x2
is entered as
exp(-x^2),
not as
e^(-x^2),
and not as
exp((-x)^2).
Maple knows many other functions.
+
addition
*
multiplication
__
2 times x+1 is
2*(x+1), not
2(x+1)
-
subtraction
/
division
^
exponentiation
variable x is 9
variable w is 12
variable y is 9/2 (not 4.5)
variable z is 729/8
variable qaz is 60
variable qwe is 3
variable zaq is 33/2
variable x is 9
variable x is now 4
variable x is reset or "unassigned"
variable x is 9
will show that x is 9
The title is enclosed in left quotes, not right quotes.
defines f as an expression
substitutes x=0 into f and stores cos(0) in
r
shows that r is 1
returns: 8.8696044
stores 8.8696044
in R
defines f as an expression
substitutes x=1 and y=3 into f and stores result in r
f(x) = x3 - 3x2 - 9x + 6
f is defined as a function
returns z3 - 3 z2 - 9 z + 6
returns (x+h)3 - 3 (x+h)2
- 9 x - 9 h + 6
plots f(x) from x=-4 to 5
plots f from -4 to 5
evaluates f at x=1
called the "difference quotient" of f
y is defined as an expression
turns expression y into a function f(x)
evaluates f(2) and returns -16.
f is defined as a function of x and y
evaluates f(0,2) and stores result 2 in r1.
evaluates f(Pi,2) and returns -2.
z is defined as an expression involving x and y
turns expression z into a function f(x,y)
evaluates f(0,2) and returns 2.
evaluates f(Pi,2) and returns -2.
f(x) =
x + 5 if x < -1
x2 + 1 if -1 < x < 2
1 if x = 2
7 - x if x > 2
Note that the order is:
(
range 1, function 1,
range 2, function 2, . . .
)
evaluates f(-3)
evaluates f(2)
plots f(x) on interval [-6,8] and gives
the plot a title
evaluates the left-sided limit of f(x) at -1
evaluates the right-sided limit of f(x) at -1
evaluates the limit of f(x) at -1 (it does not
exist)
evaluates the limit of f(x) at 2
the number Pi
The Greek letter pi
is not a number.
to plot two expressions on a common graph.
Written and maintained by
Last modified: 08/13/08
Copyright © 1997-2008 Kevin G. TeBeest. All rights reserved.
Maple® is a registered trademark of Waterloo Maple Software.
Prof. Kevin G. TeBeest
Applied Mathematics
Kettering University