Limits, continuity, and derivatives

sm121_deriv1.mws

NOTE on the syntax: As you'll see almost all commands must end in either a ":" (to suppress output) or a ";" and almost always an "=" sign is preceeded by a ":".

EXAMPLE 1: Let's begin by examining the function sin(x)/x. It's plot (NOT drawn to scale) is as follows.

> plot(sin(x)/x,x=-10*Pi..10*Pi,y=-1..1);

[Maple Plot]

Nearer to x=0, the (correctly scaled) plot looks like to following.

> plot(sin(x)/x,x=-Pi/10..Pi/10,y=-1.1..1.1,scaling=CONSTRAINED);

[Maple Plot]

A table of values of sin(x)/x is easily computed as well.

> print(`x`.` `.`sin(x)/x`);
for i from -10 to 10 do
if i<>0 then print(evalf(i/100),evalf(sin(i/100)/(i/100)));
else print(`undefined at x=0`);
fi;
od;

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

We define f(x) (in MAPLE's "arrow" notation ->) to be sin(x)/x as follows.

> f:=x->sin(x)/x;

[Maple Math]

> Limit(f(x), x=0);
limit(f(x), x=0);

[Maple Math]

[Maple Math]

To test if sin(x)/x is continuous, we must make MAPLE load some commands in the package of programs called "iscont" as follows.

> readlib(iscont):

> iscont(f(x), x=-5..5 );

[Maple Math]

To compute the derivative type the diff command as follows.

> diff(f(x),x);

[Maple Math]

To us, this is a function of x but not to MAPLE. To get a function of x which is the derivative of f(x), the easiest is to use the following command.

> Df := unapply(diff(f(x),x),x);

[Maple Math]

> Limit(Df(x), x=0);
limit(Df(x), x=0);

[Maple Math]

[Maple Math]

> iscont(Df(x), x=-5..5 );

[Maple Math]

> plot1 := plot({f(x),Df(x)},x=-10..10):
plot2 := plots[textplot]({[1.2,-0.5,`y=D(sin x/x)`],[3,0.5,`y=sin x/x`]},align = RIGHT):

> plots[display]({plot1,plot2});

[Maple Plot]

EXERCISE for Example 1(optional): Do all the same commands but replace sin(x)/x by (1-cos(x))/x^2.

EXAMPLE 2: Let's do some of the same things as we did above but for the simpler function sin(x). Since sin(x) is a predefined symbol in MAPLE, to set f(x)=sin(x) we don't have to use the arrow notation if we don't want to. The following command is shorter.

> f:=sin;

[Maple Math]

> Df := unapply(diff(f(x),x),x);

[Maple Math]

> plot1 := plot({f(x),Df(x)},x=-1..5):
plot2 := plots[textplot]({[.2,1.1,`y=D(sin x)`],[3,0.5,`y=sin x`]},align = RIGHT):

> plots[display]({plot1,plot2});

[Maple Plot]

> plots[display]({plot1,plot2},scaling=CONSTRAINED);

[Maple Plot]

EXERCISE for Example 2(optional): Do all the same commands but replace sin(x) by cos(x).

EXAMPLE 3: The next example below illustrates the idea of a cusp.

> f:=x->1+((x^2)^(1/3)/(1+x^2)^(1/3));

[Maple Math]

> plot(f(x),x=-5..5,y=0..2,scaling=CONSTRAINED);

[Maple Plot]

> Df := unapply(diff(f(x),x),x);

[Maple Math]

> Limit(Df(x), x=0,right);
limit(Df(x), x=0,right);
Limit(Df(x), x=0,left);
limit(Df(x), x=0,left);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

> plot1 := plot({f(x),Df(x)},x=-5..5,thickness=3):
plot2 := plots[textplot]({[2.1,-1.2,`y=D(f(x))`],[1.8,2.5,`y=f(x)`]},align = RIGHT):

> plots[display]({plot1,plot2});

[Maple Plot]

EXAMPLE 4: Let's do some of the same things as we did above but for the following piecewise-defined function f(x).

> f:=x->piecewise(x<0,x^2,x<Pi,sin(x),x-Pi);
plot(f(x),x=-1..5);

[Maple Math]

[Maple Plot]

> Df := unapply(diff(f(x),x),x);

[Maple Math]

> Limit(f(x), x=Pi);
limit(f(x), x=Pi);

[Maple Math]

[Maple Math]

> Limit(Df(x), x=Pi, right);
limit(Df(x), x=Pi, right);
Limit(Df(x), x=Pi, left);
limit(Df(x), x=Pi, left);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

Is this function f(x) continuous on the interval -1 < x < 5?

> iscont(f(x), x=-1..5 );

[Maple Math]

> iscont(Df(x), x=-1..1 );

[Maple Math]

> iscont(Df(x), x=1..3 );

[Maple Math]

> iscont(Df(x), x=3..5);

[Maple Math]

> plot1 := plot({f(x),Df(x)},x=-1..5,thickness=3):
plot2 := plots[textplot]({[2.1,-1.2,`y=D(f(x))`],[1.8,1.3,`y=f(x)`]},align = RIGHT):

> plots[display]({plot1,plot2});

[Maple Plot]

EXERCISE for Example 4(optional): Do all the same commands but replace

f:=x->piecewise(x<0,x^2,x<Pi,sin(x),x-Pi);

by the "on-off" function

f:=x->Heaviside(x)-Heaviside(x-1)+Heaviside(x-2)-Heaviside(x-3);

(In MAPLE, the unit step function u(x) is denoted Heaviside(x).)

EXAMPLE 5: MAPLE knows the product rule for differentiation.

> diff(F(x)*G(x),x);

[Maple Math]

> S:=p->(1-p+p^2)*sin(p+1):
S(p);

[Maple Math]

> diff(S(p),p);
DS:=unapply(diff(S(p),p),p);
S(.75);
DS(.75);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

EXERCISE for Example 5(optional): Do all the same commands but replace p by t and S(p) by

s:=t->sin(t)*exp(t);

EXAMPLE 6: MAPLE knows the quotient rule for differentiation.

> diff(F(x)/G(x),x);
simplify(diff(F(x)/G(x),x));

[Maple Math]

[Maple Math]

> h:=x->(x+1)/(x^3+x^2+1000*x-3001);

[Maple Math]

> diff(h(x),x);

[Maple Math]

EXERCISE for Example 6(optional): Do all the same commands but replace h(x) by

j:=x->sin(t)/(t^2+1);

EXAMPLE 7: MAPLE knows the chain rule for differentiation.

> diff(F(G(x)),x);

[Maple Math]

> k:=t->exp(t^3+1999*t);

[Maple Math]

> diff(k(t),t);

[Maple Math]

EXERCISE for Example 7(optional): Do all the same commands but replace k(t) by

k:=t->sin(t^2+1);



last updated 6-22-99 by wdj