Mathematica Labs | Denis Shubleka

Subject: Calculus

Topic: Computing Limits

Goal: Investigate Limits

Task 1

Below we define three functions f(x), g(x), and h(x):

f[x_]:=(Cos[x]-1)/x
g[x_]:=1/x
h[x_]:=Sin[x]

Graphically, investigate the behavior of the following near the origin 
(as x approaches 0):

Plot[f[x],{x,-5,5}]

Plot[g[x],{x,-5,5}]

Plot[g[x]*h[x],{x,-5,5}]

Q : What happens to the y-values of each function as x approaches 0?


One can also use the Limit command in Mathematica to investigate. Try it:

Limit[f[x],x->0]

Limit[g[x],x->0]

Limit[g[x]*h[x],x->0]

One-sided limits can be tested as well. "Direction -> 1" implies "approach from
the left", whereas "Direction -> -1" implies "approach from the right". Try it:

Limit[g[x],x->0,Direction->-1]

Limit[g[x],x->0,Direction->1]

Based on the graph obtained earlier, these answers should not be surprising.

Interpret Mathematica's output when you compute the following limit:

Limit[Cos[x],x->∞]

Task 2

Goal: Investigate the Limit of a Piece-Wise Function

Below we define a piece-wise functions s(x):

s[x_]:=(Piecewise[{{(x^2)-2x+1 , x⩽1}, {(E^x), x>1}}])

Plot[s[x],{x,-1,3}]

Numerically, investigate the left-sided limit by constructing a table:

dataleft=Table[{N[1-(10^(-n))],N[s[1-(10^(-n))],15]},{n,1,5}];
Text@Grid[Prepend[dataleft,{"x","s(x)"}],Alignment->Left,Dividers->{Center,2->True}]

Next, investigate the right-sided limit by constructing a table:

dataright=Table[{N[1+(10^(-n))],N[s[1+(10^(-n))],15]},{n,1,5}];
Text@Grid[Prepend[dataright,{"x","s(x)"}],Alignment->Left,Dividers->{Center,2->True}]

Compare the one-sided limits. Does the overall limit exist?

Now confirm the one-sided limits using Mathematica:

Limit[s[x], x -> 1, Direction -> 1]
Limit[s[x], x -> 1, Direction -> -1]

One can also Manipulate to investigate the function values as x approaches 1.
What happens to function value when x < 1? When x > 1?
Does the overall limit exist?

Manipulate[s[x],{x,0.8,1.2}]

Related Exercises/Notes:

ap-calc.github.io