Maple contains the function diff that will allow
you to differentiate an equation. This function works in a way
similar to that of the function D in Mathematica.
The first argument to diff is the equation to be
differentiated. The second argument is the variable that the equation
should be differentiated with respect to. Some examples of the use of
diff are shown below.
> diff(3*x^4, x);
3
12 x
> diff(sin(x)+cos(2*x), x);
cos(x) - 2 sin(2 x)
> diff(log(5*x), x);
1/x
> diff(a*x^n+b*x^(n-1)+c, x);
n (n - 1)
a x n b x (n - 1)
------ + ------------------
x x
> diff(a*x^2+b*x+c, x);
2 a x + b
> diff(3*x^4+4*y^5+2*z^2, y);
4
20 y
The first five examples above were also used as examples for differentiation with Mathematica.
diff can also be used to differiate an equation any
number of times that you desire. This is done by adding the expression
$number to the second argument.
number represents the number of times you wish
the equation to be differentiated.
> diff(x^4, x$2);
2
12 x
> diff(5*sin(x)+cos(3*x), x$2);
- 5 sin(x) - 9 cos(3 x)
> diff(a*x^n+b*x^(n-1)+c, x$3);
n 3 n 2 n (n - 1) 3 (n - 1) 2
a x n a x n a x n b x (n - 1) b x (n - 1)
------- - 3 ------- + 2 ------ + ------------------- - 3 -------------------
3 3 3 3 3
x x x x x
(n - 1)
b x (n - 1)
+ 2 ------------------
3
x
> diff(a*x^2+b*x+c, x$2);
2 a
Again some of the examples above were used with differentiation in Mathematica. If you compare the results from the two programs you will notice that they have differing rules concerning how to express equations.
Last Modified: 97.08.19 Michael Carreno <mcarreno@cs.princeton.edu>