Plotting Functions

Basic Plots Commands

plot(expression, x = a..b, other options);

So, let's try and example. We want to plot $y=x^{2}$; from $\,x=-4 $ to $\,x=4.$ Note how we write $x^{2}$ as x^2. The correct command is

> plot(x^2,x=-4..4);
MATH

Exercise: Now try to plot y = x^3; from x = -2; to x = 3.

f := any mathematical expression

Here are some examples: Note the power notation. In Maple we write

3^2 for $\;3^{2}$.

f := 1+2*(x-3)^2 Mathematically this expression is MATH
g: = (x+1)/(x^3-2) Mathematically this expression is MATH

Example. Plot f := $1+2(x-3)^{2}$, from $x=-1$. to $x=2.$ Execute the commands

>f := 1+2*(x-3)^2; Note the semicolon after each statement.

>plot(f,x=-1..2);
MATH

> plot(f,x=-4..4, -4..10);
MATH

Exercise: Now try to plot the expression representing the function $f(x)=x^{3}-2x+1$ from $x=-2$ to $x=3$ with the range $y=-3$ to $y=6$
MATH

Plotting Parametric Functions

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 $y=x^{2}$
MATH
To plot these parametric equations from $t=-1$ to $t=2$ execute the command

>plot(\lbrack t,t^2, $\ $t=-1..2\rbrack );

plot_primer2__33.png

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 $t$ is MATH

Exercise Plot the parametric equations MATH and MATH for $t=-2$ to $t=4.$ You should get the following graph.

plot_primer2__40.png

Exercises

  1. Plot the function $y=x^{3}-2x+1,$ from $x=-2$ to $x=3.$ Plot the function $y=x^{3}-2x+1,$ from $x=-2$ to $x=3$ with range from $-3$ to 4.

  2. Use the help manual to plot the function $y=x^{2}$ from $x=-2$ to $x=2 $ with plot thickness $2.$

  3. Use and expression for MATH and plot it from $-5$ to 5.

  4. Plot the parametric equation MATH for $t=1$ to $t=4.$

  5. Plot the parametric equation MATH for $t=-4$ to $t=4.$ (Hint. The absolute value function $\left| t\right| $ has the Maple syntax: abs(t).)

This document created by Scientific Notebook 4.0.