Next: Linear and Quadratic Up: Labs and Projects for Previous: Labs and Projects for

Maple Introduction Exercises

Purpose

To become familiar with Maple by using Maple.

Exercises

Go through the following exercises. Your report should be in the form of a Maple worksheet, showing your work. Be warned that some of the commands given below do not work correctly. If you find one that generates an error or a wrong answer, explain the error in your worksheet.

1. At the Maple prompt, enter the polynomial expression
```p:=1/4*x^3 - 1/5*x^2 -3*x -1;
```
1. Enter the following four Maple commands. For your report, describe what you get. Why does Maple distinguish between 2 and and and ?
```subs(x=2,p);
subs(x=2.0,p);
subs(x=1/2,p);
subs(x=.5,p);
```
2. Maple can also substitute expressions into other expressions. The next group of commands lead you through a derivation of the derivative of the expression p, which we'll learn about this term. For your report, explain what Maple is doing in each step, except the one involving limit, where you can speculate if you wish.
```a1:=subs(x=a,p);
a2:=subs(x=a+h,p);
a3:=(a2-a1)/h;
a3;
a4:=simplify(a3);
a5:=limit(a4,h=0);
```
3. In the tutorial, you set the x range for the plot command. You can also set the y range for a plot, as shown in the second command below. Can you think of a reason you would want to set the y range?
```plot(p,x=-5..5);
plot(p,x=-5..5,y=-5..5);
```
2. Repeat the first problem, but using a function instead of an expression. First, enter the following function definition.
```f:= x -> x^3/5 -x^4/4 -2*x -1 end;
```

The Maple commands using are given below to help you. Note any differences between how Maple handles functions and expressions.

```f(t);
f(2);
f(2.0);
f(1/2):
f(.5);
b1:=f(a);
b2:=f(a+h);
b3:=(b1-b2)/h;
b3;
b4:=simplify(b3);
b5:=limit(b4,h=0);
plot(f(t),t=-5..5);
plot(f(t),t=-5..5,s=-5..5);
```

3. Occasionally you have to investigate functions that are defined piece-wise. In this task, and the next, use defined by

This is entered in Maple by

```f:=t ->  if t < 2 then t^2 else t fi;
```

Then try each of the following commands.

```f(-1);
f(3);
f(1/2);
f(b);
plot(f,t=-2..4);
plot(f(t),t=-2..4);
plot('f(t)',t=-1..5);
plot('f(t)',t=-1..5,style=LINE);
```

Remember to close all the plot windows when you are done looking at the graphs.

4. Use the instructions in the handout to print a plot of the function used in the previous exercise. Include the plot with your lab writeup. If you are feeling adventurous, paste the plot right into your Maple worksheet.

5. Maple makes a strong distinction between an expression and a function. In your own words, describe how these two mathematical concepts differ. Note the word mathematical in the previous sentence. You are not being asked to simply describe how Maple handles expressions and functions, but to explain the concepts.

Next: Linear and Quadratic Up: Labs and Projects for Previous: Labs and Projects for

William W. Farr
Mon Jun 26 13:37:30 EDT 1995