With Maple -

Symbolic Derivatives

To take the of a , we use the diff() operation in Maple, which has the syntax:

diff(f(x), x)

This gives the function or as a symbolic expression.

Note: a symbolic expression is somewhere in between a function and an expression in Maple. You can think of a symbolic expression as 'a picture of a mathematical expression.' Symbolic expressions can be converted to actual mathematical expressions and functions, but it takes a little more effort.

So if we wanted to differentiate we do:

(1.1)

What if we want to differentiate with respect to s? Same idea:

(1.2)

What if we had defined a function and needed its derivative? Let's see:

(1.3)

(1.4) Higher Order Derivatives Let's say that we wanted to calculate the first and of the function ? Let's start by defining h(x):

(2.1) Now we take the first derivative:

(2.2)

(You should check that the above is infact correct, by the way... )

Now, we could just take the derivative of the above, but that would require us to type a lot. Maple has a way to take the second derivative directly. It goes like:

(2.3)

Notice the $2 after the x tells Maple to take the second derivative. How do you think we would do the third derivative or the fourth?

(2.4)

(2.5)

In general, if we want we type:

diff(f(x),x$n) to get it. And we don't have to define a function in order to use this. For example if we wanted to compute: , we type:

(2.6) (2.6)

and then sit back and enjoy the fact that we didn't have to do this by hand.

Using the Derivatives that We Find So now we can find derivatives as symbolic expressions, but how do we use them? How do we find the derivatives at specific values? How do we "catch" these symbolic expressions and turn them into functions that we can continue to work with?

Finding Derivatives at specific values

Let's say that we want to know f'(3) for ? Well, we could find:

(3.1.1)

and then calculate:

(3.1.2)

And as you can see, this works. But it's a lot of typing! There is an easier way, and it involves Maple's eval() command. If we want to evaluate any expressing in x at say x=a, then we type:

eval(expression in x, x=a) So to find f'(3) for the above f(x):

(3.1.3)

(3.1.4)

This has the effect of doing: (df/dx)|x=3. (2.6)

To see this idea a few more times, let's try to find h'(2), h''(3), and for .

(3.1.5)

First up: h'(2):

(3.1.6)

Next up: h''(3):

(3.1.7)

Finally, :

(3.1.8)

If we don't want an exact value, we can use evalf() right afterwards. So for instance, if we want the decimal approximation to h'(2) we can do:

(3.1.9)

"Catching" the Derivative as a New Function

Now imagine that we want to calculate the derivative of , but we want to then go on to use that derivative in further calculations. We can 'catch' the derivative of s(t) in a new function v(t), but we have to be a little bit careful how we do it. So let's begin:

(3.2.1)

Now, the natural thing to try next is to define v(t) := t->diff(s(t),t); and this works... kind of. It will produce the first derivative, but it will only produce the (2.6)

derivative as a static expression not as a function. What?!! I know, that's really technical, but what you need to understand is that Maple thinks about derivatives as expressions to be evaluated.

And this is the key to catching the derivative. Here's what we do:

(3.2.2)

And Maple tells us exactly what it is doing: it is taking the derivative of s(x) and then evaluating at x=t. Yes, you have to take the derivative with respect to x NOT t. Let's see if this gives us what we are after:

(3.2.3)

Looks good! (You should check this by hand of course!). Can we use this like any other function?

(3.2.4)

Again, you should check this by hand, but this is looking pretty solid.

What about the second derivative? Let's define a(t) to be the second derivative of s(t) - again we are going to be careful to take the derivative with respect to x, then evaluate at t:

(3.2.5)

(3.2.6)

Awesome! Now that we have the first and second derivative, we can evaluate them, or even graph them! Here is a graph of all three on the same set of axes: (2.6)

As one last example of this idea, let's find the derivative of and plot both f(x) and f'(x) on the same set of axes to see how the derivative relates to function:

(3.2.7)

(3.2.8)

Exercises: Open a new document, title it Derivatives in Maple, put your name underneath, and skip a few lines. (2.6)

1. For each of the following: write the question in text mode. Skip a line and then use Maple to carry out the instructions. a) Find the derivative of x^3 - 2x^7 + x b) Define the function f(x)=x^3 cos(2x). Find the first, second, and third derivatives of f(x).

2. Define a function g(x)=x^2 - 3/(x+5). Using eval() define h(x) to be the derivative of g(x) as a function. What is h(4)?

3. Using your function g(x) from above, use eval() to define the new function k(x) to be the fourth derivative of g(x). Find k(-3). Graph k(x) over the interval [-4.5,-2].

Save and print.