Next: About this document ... Up: lab_template Previous: lab_template

Subsections

# Solving Equations and Differentiation

## Solving a function or an expression algebraically

You can set an expression or function equal to another expression, function, or number inside a solve command.As an example, you may want to find where the following two parabolas intersect.
> g := 9*x^2-14;
> h:=-x^2;
> plot([g,h],x=-2..2);
> solve(g=h,x);

The plot shows that there are two intersection points and the solve command finds both values. It is good to get into the habit of naming your output so you can use it in a later command. Giving the values a name makes it easy to plug them into the expression to find the values.
> ip:=solve(g=h,x);

Since there are two values called , use [ ] to call up the one you want.
> subs(x=ip[1],g);
> subs(x=ip[2],h);

Therefore the two intersection points are and . This seems like the answer shown on the graph.

## Solving a function or an expression numerically

If you want to find where the following function crosses the x-axis, just set it equal to zero.
> f:=theta->-1/2*theta+sin(theta);
> plot(f(theta),theta=-8*Pi..8*Pi);
> solve(f(theta)=0,theta);

Wow, what is that?!?! We know from the graph that there should be three answers and solve wasn't a great option so try fsolve.
> fsolve(f(theta)=0,theta);

Where are the other two answers!? This is actually how fsolve usually works. It shoots for one answer and only gives that one. But you can tell fsolve where to look by getting an idea from the graph and typing that domain into the fsolve command.
> a:=fsolve(f(theta)=0,theta=-5..-1);
> b:=fsolve(f(theta)=0,theta=-1..1);
> c:=fsolve(f(theta)=0,theta=1..5);

To find the values just plug in the names of the values.
> f(a);
> f(b);
> f(c);

(Of course the y-values are zero!)

## The Limit Definition of the Derivative

The limit definition of the derivative of often written as is defined as:

It can be interpreted geometrically as the slope of the tangent line to the graph of at a point and functionally as the instantaneous rate of change of at . You can use the definition and the Maple limit command to compute derivatives directly, as shown below. You can also compute derivatives using Maple's diff or D command. The following limit determines f'(x).
> limit((f(x+h)-f(x))/h,h=0);

The example below shows how to use the limit definition of derivative to find with Maple.
> f := x -> x^2+3*x+5;
> limit((f(1+h)-f(1))/h,h=0);


## The Maple D and diff commands

These commands can be summarized as follows.
• The D command acts on a function.
• The diff command acts on an expression or a function and differentiates that expression with respect to a variable specified by the user.

When you use the D operator to compute the derivative of a function, be careful with the parentheses. It is one of the only commands in Maple where the gets its own parentheses.

> f:=x->x^2;
> D(f)(x);

Finding the derivative at a specific value is easy. (Again be careful of the parentheses.)
> D(f)(2);


The D operator CANNOT be used on expressions. To differentiate expressions, you need to use the diff command. Here is an example.

> p:=3*x+2;
> diff(p,x);

Remember the diff command can also be applied to functions. However, the syntax for plugging in an value is a little longer with the diff command. To compute the value of the derivative at a specific value of requires you to use the subs command. First, give the diff command a name so you can call it up in the subs command.
> pprime:=diff(p,x);
> subs(x=2,pprime);

Another option is to embed the commands.
>subs(x=2,diff(p,x));


## Exercises

1. For the functions and , plot both functions on the same graph using an -domain that clearly shows all the intersection points and then find the and coordinates of the intersection points using Maple's solving capabilities.

2. Find the dervative of the function using the limit definition of the derivative, the diff command and then the D command and then use all three methods to find the slope of at .

3. For the function in the last exercise, find all points on the graph of where the tangent line is horizontal. Remember that a point has an and a value.

Next: About this document ... Up: lab_template Previous: lab_template
Jane E Bouchard
2011-10-19