calculus.mws

Click on a box with a + inside to expland the section.

Limits

> limit((x+2)^(1/ln(x)),x=infinity); Evaluate a limit, exactly if possible.

exp(1)

> limit((x^2+3*x)/(4*x^2-3e^(-x)), x=infinity);

.2500000000

Derivatives

> f:=x-> 5*x^2+1; Define the function f to be the map taking x to 5*x^2+1.

f := proc (x) options operator, arrow; 5*x^2+1 end ...

> D(f); take the derivative of the function f. The answer is another function.

proc (x) options operator, arrow; 10*x end proc

> D(D(f)); Derivative of the derivative.

10

> f; This is not a good way to see what the function is.

f

> f(x); Evaluate f at x to see what function it is.

5*x^2+1

> diff(f(x),x); Take the derivative of the expression f(x) with respect to x . The answer is an expression, not a function.

10*x

> g:=unapply(10*x,x); Turn an expression into a function.

g := proc (x) options operator, arrow; 10*x end pro...

> g(2); Evaluate the function g at 2

20

> unapply(f(x),x); Turn the expression f(x) into a function. This is another way of seeing what function f is.

proc (x) options operator, arrow; 5*x^2+1 end proc

> diff((x^2-3*x^4)/(ln(x)+x^(-3)),x); Just for kicks!

(2*x-12*x^3)/(ln(x)+1/(x^3))-(x^2-3*x^4)*(1/x-3/(x^...

Antiderivatives

> F:=x->int(f(t),t=1..x); An antiderivative of f , a Maple function. The variable t is a dummy.

F := proc (x) options operator, arrow; int(f(t),t =...

> F(x); Evaluate F at x to see what function it is

5/3*x^3-8/3+x

> P:=x->int((sin^2)(x)*cos(x),x); The function P is the antiderivative of an expression.

P := proc (x) options operator, arrow; int((sin^2)(...

> P(x); See explicitly what function P is.

1/3*sin(x)^3

> Q:=int((sin^4)(x)*cos(x),x); The expression Q is the antiderivative of an expression.

Q := 1/5*sin(x)^5

> Q(2); Q is an expression, not a function, so this does not produce what you might expect!

1/5*sin(x)(2)^5

> unapply(Q,x)(2); This is better. First turn Q into a function, then evaluate at 2.

1/5*sin(2)^5

> evalf(%); Evaluate numerically.

.1243253831

Definite Integrals

> int(f(x),x=1..5); Evaluate the definite integral exactly.

632/3

> int(exp(-x^3),x=1..5); There is no closed form expression for this integral, so Maple gives up.

int(exp(-x^3),x = 1 .. 5)

> Int(exp(-x^3),x=1..5); Set up, but do not evaluate the integral.

Int(exp(-x^3),x = 1 .. 5)

> evalf(%); Evaluate the integral numerically.

.8546832943e-1

Rectangles under graphs of functions

> with(student); Load the package called student . The output lists the functions included in this package.

[D, Diff, Doubleint, Int, Limit, Lineint, Product, ...
[D, Diff, Doubleint, Int, Limit, Lineint, Product, ...

> with(student): Use a colon rather than a semicolon to suppress the output.

> f:=x->9-x^2; Define a function.

f := proc (x) options operator, arrow; 9-x^2 end pr...

> rightbox(f(x),x=1..6,20); Plot the function together with 20 right-hand endpoint rectangles.

[Maple Plot]

> rightsum(f(x),x=1..6,20); Set up the Riemann sum corresponding to the total area of these rectangles.

1/4*Sum(9-(1+1/4*i)^2,i = 1 .. 20)

> value(%); Give the exact value of the previous expression.

-995/32

> R:=[[n,rightsum(f(x),x=1..6,n)] $n=2..60]: Set up the Riemann sum for an arbitrary number n of right-hand endpoint rectangles.

> plot(R,x=2..60,style=point,symbol=circle);

[Maple Plot]

> L:=[[n,leftsum(f(x),x=1..6,n)] $n=2..60]: Set up the Riemann sum for an arbitrary number n of left-hand endpoint rectangles.

> plot(L,x=2..60,style=point,symbol=circle);

[Maple Plot]

> T:=(L+R)/2: The trapezoidal rule is supposed to converge more quickly

> plot(T,x=2..60,style=point,symbol=circle);

[Maple Plot]

> int(f(x),x=1..6); Confirm the value of the integral.

-80/3