The Use of Maple to Plot Graphs, Calculate Derivatives, Find Critical Points and Find

The Use of Maple to Plot Graphs, Calculate Derivatives, Find Critical Points and Find

The Use of Maple to plot graphs, calculate derivatives, find critical points and find candidates for inflection points

Maple is available in the department labs in MH 221. To start Maple you need an account number and a password. These are available if you have enrolled in Math 110L or if you pay an fee (about $25) at the department office. I hope that you have already enrolled in Math 110L. Let me know if this is a problem. Also you can do the project in teams of two students and so perhaps your partner has an account. If you use the labs you will need to bring a floppy disk or a USB drive to save your work. You can save your work temporarily on the temp directory on the computers in MH221 but you cannot expect that it will be there the next day. If you want to print your results you may be able to print from the lab (ask the lab assistant). You can also cut and past any part of the Maple session into word and take the word file home to print. That is how I created the examples below.

To start Maple, look for and double click on the icon with a maple leaf or look for Maple in the start / all programs list. The examples below are taken from an actual Maple session. Any line beginning with a # is a comment that is ignored by Maple. Lines starting with the Maple prompt “>” are commands that I typed in. Maple’s response follows each command.

Start of the Maple session:

# You can get help on any command by typing a question mark and the

# command. For example

> ?plot

# displays help on the plot command.

# You may need to go to the Window submenu to get back to maple

# We will now enter a function which we call f.

> f:=x->(95*x^3-57*x+30)/(x^5-1000);

# Notice how maple nicely formats this rational function.

# We will now draw a graph of the function for x range from -2 to 2

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

#It is not clear if we have a good choice of x values in order to see #the interesting parts of the plot. We can calculate critical

#points to help identify a reasonable range of x values.

#First we calculate the derivative using the diff command:

> f1:=diff(f(x),x);

#Here we are use the 1 in f1 to indicate the first derivative.

#To put f1 in a form so that we can use functional notation we need to

#use (for some weird reason) the unapply command:

> f1:=unapply(f1,x);

# Now in Maple we can evaluate f1 using the usual functional notation:

> f1(2.0);

#Note that I included a decimal point in the argument. If you leave #out the decimal point Maple will give your answer as an exact #fraction.

> f1(2);

#Usually it is preferable to have a decimal result.

#Now suppose that we want to get the critical points of f. We will

#find the points where f1(x) is zero by finding the zeros of the

#numerator of f1 as follows:

> f1num:=numer(f1(x));

> f1zero:=fsolve(f1num);

#This is a list of all the zeros of f1 (the derivative of f(x));

#To get the locations where the derivative of f(x) does not exist

#we can find the zeros of the denominator of f(x) as follows:

> f1den:=denom(f1(x));

> f1DNE:=fsolve(f1den);

#This is a list of points where f1 does not exist. It lists the same value twice because

# 3.98106 is a “double” root of (x5 – 1000)2. However this point is not too important.

#Now suppose that we want to get the candidates for the inflection #points. We can first find the second derivative (which we call f2)

#of f(x):

> f2:=diff(f(x),x$2);

#To put f2 in a form so that we can use functional notation we need to

#use (again for some weird reason) the unapply command:

> f2:=unapply(f2,x);

# We can get the values where f2 is zero by first letting Maple

# find the numerator of f2:

> f2num:=numer(f2(x));

# and then using fsolve to find all the zeros of this equation:

> f2zero:=fsolve(f2num);

# This is a list of all the locations where f2 is zero.

# The locations where f2 does not exist are the same one, 3.981, we

# found earlier where f1 (and f ) does not exist. Therefore we won’t do

# this calculation again.

#Looking back at the value of f1zero, f1DNE and f2zero we see that

# they range from -5.793 to 3.981. Perhaps a reasonable range of x

# is therefore x= -10 to x = +10. If we use the plot command we get:

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

# Here the y range is too large to clearly see the graph. We can

# evaluate the values of f(x) at the critical and (candidates

# for) inflection points as follows:

> f1zero:=array([f1zero]);

> map(f,f1zero);

#This applies f(x) to all the values of x in the array consisting

# of the entries where f1 (or f’(x)) is zero:

#Similarly we can find the values of f(x) where f2 is zero:

> f2zero:=array([f2zero]);

> map(f,f2zero);

# The values of f(x) vary between 2.9 and -.046 at these x values. Therefore perhaps we want to plot

# f(x) over the y range for y = -3 to y = 3. We can modify the plot command as follows to do this:

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

# A plot from x = -20 to x = 20 is even clearer:

> plot(f(x),x=-20 .. 20, -3 .. 3);

# Note that the vertical line at x = 3.98 is an artifact of the graphing routine an is not

# actually part of the plot.