MapleDiffIntEx.mws

Differentiation and Integration Examples

Use these examples for syntax.

Differentiation Examples

The capital "D" produces a statement of what you want to do and the value(%) computes the derivative.

>    Diff(3*x*sin(4*x^2),x);

Diff(3*x*sin(4*x^2),x)

>    value(%);

3*sin(4*x^2)+24*x^2*cos(4*x^2)

The small "d" computes the derivative immediately.

>    diff(3*x*sin(4*x^2),x);

3*sin(4*x^2)+24*x^2*cos(4*x^2)

>    diff((2*x^3-4*x)*(sin(2*x))^2,x);

(6*x^2-4)*sin(2*x)^2+4*(2*x^3-4*x)*sin(2*x)*cos(2*x)

Here is a second derivative.

>    diff(3*x*sin(4*x^2),x,x);

72*cos(4*x^2)*x-192*x^3*sin(4*x^2)

>    Diff(3*x*sin(4*x^2),x,x);

Diff(3*x*sin(4*x^2),`$`(x,2))

>    value(%);

72*cos(4*x^2)*x-192*x^3*sin(4*x^2)

In the example below the "a" is treated as a constant.

>    diff(a*x*sin(4*a*x^2),x);

a*sin(4*a*x^2)+8*a^2*x^2*cos(4*a*x^2)

This time the "x" is being treated as a constant.

>    diff(a*x*sin(4*a*x^2),a);

x*sin(4*a*x^2)+4*a*x^3*cos(4*a*x^2)

Here is a third derivative.

>    diff(3*x*sin(4*x^2),x,x,x);

-1152*x^2*sin(4*x^2)+72*cos(4*x^2)-1536*x^4*cos(4*x^2)

You can give a name to the function you wish to differentiate.

>    f:=sin(3*x^2)/(2*x^3+4*x);

f := sin(3*x^2)/(2*x^3+4*x)

>    diff(f,x);

6*cos(3*x^2)*x/(2*x^3+4*x)-sin(3*x^2)/(2*x^3+4*x)^2*(6*x^2+4)

>    poly1:=5*x^4-4*x^3+3*x^2-2*x+1;

poly1 := 5*x^4-4*x^3+3*x^2-2*x+1

>    diff(poly1,x,x);

60*x^2-24*x+6

>    diff(ln(x^2+x),x);

(2*x+1)/(x^2+x)

>    diff(ln(x^2+x),x,X);

0

Note the capital "X" above and the result.  The second differentiation was treated like differentiating a constant.

>    diff(ln(x^2+x),x,x);

2/(x^2+x)-(2*x+1)^2/(x^2+x)^2

>    Diff(exp(x),x);

Diff(exp(x),x)

>    diff(exp(x),x);

exp(x)

>    diff((2*x)^(x^2),x);

(2*x)^(x^2)*(2*x*ln(2*x)+x)

Integration Examples

Notice the difference between "Int" and "int".

>    Int(x*sqrt(3*x^2+4),x);

Int(x*(3*x^2+4)^(1/2),x)

>    value(%);

1/9*(3*x^2+4)^(3/2)

>    int(x*sqrt(3*x^2+4),x);

1/9*(3*x^2+4)^(3/2)

Here is a definite integral.

>    Int(x*sqrt(3*x^2+4),x=0..1);

Int(x*(3*x^2+4)^(1/2),x = 0 .. 1)

>    value(%);

7/9*7^(1/2)-8/9

>    int(x*sqrt(3*x^2+4),x=0..1);

7/9*7^(1/2)-8/9

You can use evalf to approximate.

>    evalf(%);

1.168917686

>    Int(x*exp(x^2+2),x);

Int(x*exp(x^2+2),x)

>    int(x*exp(x^2+2),x);

1/2*exp(x^2+2)

Note that Maple does not add the arbitrary constant in an indefinite integration.

>    int(1/x,x);

ln(x)

>    Int(1/x,x=1..5);

Int(1/x,x = 1 .. 5)

>    int(1/x,x=1..5);

ln(5)

>    Int(1/x,x=1..5);

Int(1/x,x = 1 .. 5)

>    evalf(%);

1.609437912

>    evalf(ln(5));

1.609437912

>    Int(cos(x^2),x=0..1);

Int(cos(x^2),x = 0 .. 1)

>    evalf(%);

.9045242379

Does the answer above look reasonable from an area interpretation?

>    with(plots):plot(cos(x^2),x=0..1);

[Maple Plot]

>