Differentiation of functions

We have previously described how an expression can be differentiated with respect to a varaible; however, we have also discussed function algebra. To differentiate a function, we will use the D operator.

[> D( cos );

$-sin$

[> D( sec + 2*csc + 3*cot + 4 );

$-3 \cot^2 - 2 \cot \csc + \sec \tan - 3$

[> id := (x) -> x;

$id := x \mapsto x$

[> p := id^3 + 5*id^2 + 2*id + 1;

$p := id^3 + 5 id^2 + 2 id + 1$

[> D( p );

$3 id^2 + 10 id + 2$

[> D( p )( 1 ); # Evaluate the derivative at 1

$15$

If Maple does not know anything about the function, it will return unevaluated:

[> D( sin + y + 1 );

$\cos + D(y)$

[> D( sin@(2*id) );  # diff( sin( 2*x ), x )

$2 \cos@(2 id)$

You can calculate higher derivatives by using D@@n to calculate the $n$th derivative:

[> (D@@4)( sin@(2*id) );  # diff( sin( 2*x ), x, x, x, x )

$16 \sin@(2 id)$

We will use unevaluated functions to write out differential equations and Taylor series:

[> D(y)(t) = y(t) + sin(t);

$D(y)(t) = y(t) + \sin(t)$

[> f(x + h) = f(x) + D(f)(x)*h + (D@@2)(f)(x)*h^2/2 + (D@@3)(f)(x)h^3/6;

$f(x + h) = f(x) + D(f)(x) h + \frac{1}{2} D^{(2)}(f)(x) h^2 + \frac{1}{6} D^{(3)}(f)(x) h^3$