Plotting functions is one of the easiest functions of the Maple program. However, there are a couple of important syntax rules that you must follow. First of all, the general form is
plot(expression, x = a..b, other options);
So, let's try and example. We want to plot ; from to Note how we write as x^2. The correct command is
> plot(x^2,x=-4..4);
Exercise: Now try to plot y = x^3; from x = -2; to x = 3.
Sometimes it useful to plot a mathematical expression on which you are doing other things. For this purpose we define an expression as follows:
f := any mathematical expression
Here are some examples: Note the power notation. In Maple we write
f := 1+2*(x-3)^2 | Mathematically this expression is | |
g: = (x+1)/(x^3-2) | Mathematically this expression is |
Example. Plot f := , from . to Execute the commands
>f := 1+2*(x-3)^2;
Note the semicolon after each statement.
>plot(f,x=-1..2);
Next we include the (vertical) range for the plot. If we wish to plot the previous expression for f between and displaying the the vertical range from to we first define the expression and then include the range as the ``third argument'' of the plot command as follows. Note the commas between arguments of the plot command. Note the semicolon after each and every Maple statement.
> plot(f,x=-4..4, -4..10);
Exercise: Now try to plot the expression representing the
function from
to
with the range
to
It is important and easy to plot parametric equations. The basic form is
of the calling sequence is
>plot(\lbrack x(t),y(t),t=range of t\rbrack,h,v,options);
where h = horizontal range, v = vertical range, and other options. For
example the parametric equations of the parabola
To plot these parametric equations from
to
execute the command
>plot(\lbrack t,t^2,
t=-1..2\rbrack
);
Other examples of plot parametric commands are
> plot(\lbrack sin(t),cos(t),t=0..Pi\rbrack);
> plot(\lbrack x^2,x,x=0..3*Pi\rbrack,-8..8,-10..10);
> plot( \lbrack(t^2-1)/(t^2+1),2*t/(t^2+1),
t=-infinity..infinity\rbrack );
In the third example above, the range of is
Exercise Plot the parametric equations and for to You should get the following graph.
Exercises
Plot the function from to Plot the function from to with range from to 4.
Use the help manual to plot the function from to with plot thickness
Use and expression for and plot it from to 5.
Plot the parametric equation for to
Plot the parametric equation
for
to
(Hint. The absolute value function
has the Maple syntax: abs(t).)