Professional Documents
Culture Documents
Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal
publications. They may be distributed outside this class only with the permission of the
Instructor.
DIFFERENTIAL CALCULUS
LIMIT OF A FUNCTION
𝐋𝐢𝐦𝐢𝐭[𝒇[𝒙], 𝒙 → 𝒂, 𝐃𝐢𝐫𝐞𝐜𝐭𝐢𝐨𝐧 → 𝟏] computes the left hand limit of the function 𝑓(𝑥) at
the point 𝑥 = 𝑎 i.e. the value of lim𝑥→𝑎− 𝑓(𝑥) will be computed.
Examples:
i) Limit[(𝑥^5 − 32)⁄(𝑥^3 − 8) , 𝑥 → 2, Direction → 1]
20
Ans: .
3
ii) 𝑓[x_]: = 1⁄𝑥
Limit[𝑓[𝑥], 𝑥 → 0, Direction → 1]
Ans: −∞.
𝐋𝐢𝐦𝐢𝐭[𝒇[𝒙], 𝒙 → 𝒂, 𝐃𝐢𝐫𝐞𝐜𝐭𝐢𝐨𝐧 → −𝟏] computes the right hand limit of the function 𝑓(𝑥)
at the point 𝑥 = 𝑎 i.e. the value of lim𝑥→𝑎+ 𝑓(𝑥) will be computed.
Examples:
i) Limit[(𝑥 5 − 32)⁄(𝑥 3 − 8) , 𝑥 → 2, Direction → −1]
20
Ans: .
3
ii) 𝑓[x_]: = 1⁄𝑥
Limit[𝑓[𝑥], 𝑥 → 0, Direction → −1]
Ans: +∞.
𝐋𝐢𝐦𝐢𝐭[𝒇[𝒙], 𝒙 → 𝒂] computes the limit of the function 𝑓(𝑥) at the point 𝑥 = 𝑎 i.e. the
value of lim𝑥→𝑎 𝑓(𝑥) will be computed.
Examples:
i) Limit[(𝑥^5 − 32)⁄(𝑥^3 − 8) , 𝑥 → 2]
20
Ans: .
3
ii) 𝑓[x_]: = 1⁄𝑥
Limit[𝑓[𝑥], 𝑥 → 0]
Ans: ∞.
𝑥 5 −32
Problem-1: Suppose 𝑓(𝑥) = is a function.
𝑥 3 −8
i) Find the left hand limit of the function 𝑓(𝑥) at 𝑥 = 2 i.e. find lim𝑥→2− 𝑓(𝑥)
ii) Find the right hand limit of the function 𝑓(𝑥) at 𝑥 = 2 i.e. find lim𝑥→2+ 𝑓(𝑥)
iii) Test whether or not the limit of the function 𝑓(𝑥) at 𝑥 = 2 exist?
iv) Find the limit of the function 𝑓(𝑥) at 𝑥 = 2 i.e. find lim𝑥→2 𝑓(𝑥)
Solution:
1
Problem-2: Suppose 𝑓(𝑥) = 𝑥 is a function.
i) Find the left hand limit of the function 𝑓(𝑥) at 𝑥 = 0 i.e. find lim𝑥→0− 𝑓(𝑥)
ii) Find the right hand limit of the function 𝑓(𝑥) at 𝑥 = 0 i.e. find lim𝑥→0+ 𝑓(𝑥)
iii) Test whether or not the limit of the function 𝑓(𝑥) at 𝑥 = 0 exist?
iv) Find the limit of the function 𝑓(𝑥) at 𝑥 = 0 i.e. find lim𝑥→0 𝑓(𝑥)
Solution:
1
𝑓[x_]: = ;
𝑥
v) lhl = Limit[𝑓[𝑥], 𝑥 → 0, Direction → 1]
Ans: −∞ .
vi) rhl = Limit[𝑓[𝑥], 𝑥 → 0, Direction → −1]
Ans: ∞ .
vii) If[lhl == rhl, Print["Limit Exist"], Print["Limit does not exist"]]
Ans: Limit does not exist
viii) Limit[𝑓[𝑥], 𝑥 → 0]
Ans: ∞ .
Problem-3: Using MATHEMATICA code, check whether or not limit of the function,
𝑥2
𝑓(𝑥) = (𝑥−1)(𝑥−2) at 𝑥 = 0 exist.
Solution:
2 Calculus with MATHEMATICA
f[x_]:=x^2/(x-1)(x-2);
lhl=Limit[f[x],x 0, Direction 1];
rhl=Limit[f[x],x 0, Direction -1];
If[lhl==rhl, Print["Limit Exist"], Print["Limit does not exist"]]
Method-1:
𝑓[x_] ≔ Piecewise[{{3 + 2𝑥, −3⁄2 ≤ 𝑥 < 0}, {3 − 2𝑥, 0 ≤ 𝑥 < 3⁄2},
{−3 − 2𝑥, 𝑥 ≥ 3⁄2}}]
Method-2 (From Keyboard):
i) Find the left hand limit of the function 𝑓(𝑥) at 𝑥 = 0 i.e. find lim𝑥→0− 𝑓(𝑥)
ii) Find the right hand limit of the function 𝑓(𝑥) at 𝑥 = 0 i.e. find lim𝑥→0+ 𝑓(𝑥)
iii) Test whether or not the limit of the function 𝑓(𝑥) at 𝑥 = 0 exist?
iv) Find the value of the function 𝑓(𝑥) at 𝑥 = 0 i.e. find 𝑓(0)
v) Check the continuity of the function 𝑓(𝑥) at 𝑥 = 0
vi) Find the left hand limit of the function 𝑓(𝑥) at 𝑥 = 3/2 i.e. find lim𝑥→3/2− 𝑓(𝑥)
vii) Find the right hand limit of the function 𝑓(𝑥) at 𝑥 = 3/2 i.e. find lim𝑥→3/2+ 𝑓(𝑥)
viii) Test whether or not the limit of the function 𝑓(𝑥) at 𝑥 = 3/2 exist?
ix) Find the value of the function 𝑓(𝑥) at 𝑥 = 3/2 i.e. find 𝑓(3/2)
x) Check the continuity of the function 𝑓(𝑥) at 𝑥 = 3/2
xi) Sketch the graph of the function 𝑓(𝑥)
Solution:
𝑓[x_]: = Piecewise[{{3 + 2𝑥, −3⁄2 ≤ 𝑥 < 0}, {3 − 2𝑥, 0 ≤ 𝑥 < 3⁄2}, {−3 − 2𝑥, 𝑥
≥ 3⁄2}}]
4 2 2 4
10
1; 𝑥 < 0
𝜋
1 + sin 𝑥 ; 0 ≤ 𝑥 < 2
Problem-2: Suppose 𝑓(𝑥) = is a function.
𝜋 2 𝜋
{2 + (𝑥 − 2 ) ; 𝑥≥ 2
𝜋
i) Discuss the continuity of the function 𝑓(𝑥)at 𝑥 = 0 and 𝑥 = 2 .
ii) Sketch the graph of the function .
Solution:
ClearAll[𝑓]
i)
Continuity at 𝒙 = 𝟎:
fv = 𝑓[0];
If[lhl == rhl == fv, Print["f is continuous at x = 0"], Print["f is not continuous at x = 0"]]
Ans: f is continuous at x = 0.
𝝅
Continuity at 𝒙 = 𝟐 :
fv = 𝑓[Pi⁄2];
40
30
20
10
10 5 5 10
5𝑥 − 4; 0 < 𝑥 ≤ 1
Problem-3: Suppose 𝑓(𝑥) = {4𝑥 2 − 3𝑥; 1 < 𝑥 < 2is a function.
3𝑥 + 4; 𝑥 ≥ 2
i)
Continuity at 𝒙 = 𝟏:
Clear All[f];
f[x_]:= Piecewise[{{5*x-4,0<x 1},{4*x^2-
3*x,1<x<2},{3*x+4,x 2}}];
lhl=Limit[f[x],x 1,Direction 1]
rhl=Limit[f[x],x 1,Direction -1]
fv=f[1]
If[lhl==rhl==fv,Print["f(x) is continuous at x=1"],Print["f(x) is not
continuous at x=1"] ]
Continuity at 𝒙 = 𝟐:
Clear All[f];
f[x_]:= Piecewise[{{5*x-4,0<x 1},{4*x^2-
3*x,1<x<2},{3*x+4,x 2}}];
lhl=Limit[f[x],x 2,Direction 1]
rhl=Limit[f[x],x 2,Direction -1]
fv=f[2]
If[lhl==rhl==fv,Print["f(x) is continuous at x=2"],Print["f(x) is not
continuous at x=2"] ]
ii) Plot[f[x],{x,-5,5}]
Output:
15
10
4 2 2 4
Solution:
Part-1:
ClearAll[f]
f[x_]:=Abs[x]+Abs[x-1];
lhl=Limit[f[x],x 0,Direction 1]
rhl=Limit[f[x],x 0,Direction -1]
fv=f[0]
If[lhl==rhl==fv,Print["f(x) is continuous at
x=0"],Print["f(x) is not continuous at x=0"] ]
Part-2:
Plot[f[x],{x,-10,10}]
Output:
20
15
10
10 5 5 10
Solution:
Part-1:
ClearAll[f]
f[x_]:=Abs[x]/x;
lhl=Limit[f[x],x 0,Direction 1]
rhl=Limit[f[x],x 0,Direction -1]
fv=1;
If[lhl==rhl==fv,Print["f(x) is continuous at
x=0"],Print["f(x) is not continuous at x=0"] ]
Part-2:
Output:
1.0
0.5
10 5 5 10
0.5
1.0
DIFFERENTIABLE FUNCTION
5𝑥 − 4; 0 < 𝑥 ≤ 1
Problem-1: Suppose 𝑓(𝑥) = {4𝑥 2 − 3𝑥; 1 < 𝑥 < 2 is a function.
3𝑥 + 4; 𝑥 ≥ 2
Solution:
Differentiability at 𝒙 = 𝟏:
ClearAll[f]
f[x_]:=Piecewise[{{5*x-4,0<x 1},{4*x^2-
3*x,1<x<2},{3*x+4,x 2}}];
lhd=Limit[(f[x+h]-f[x])/h,h 0,Direction 1]/.x 1
rhd=Limit[(f[x+h]-f[x])/h,h 0,Direction -1]/.x 1
If[lhd==rhd,Print["f is differentiable at x=1"], Print["f is not
differentiable atx=1"]]
Differentiability at 𝒙 = 𝟐:
ClearAll[f]
f[x_]:=Piecewise[{{5*x-4,0<x 1},{4*x^2-
3*x,1<x<2},{3*x+4,x 2}}];
lhd=Limit[(f[x+h]-f[x])/h,h 0,Direction 1]/.x 2
rhd=Limit[(f[x+h]-f[x])/h,h 0,Direction -1]/.x 2
If[lhd==rhd,Print["f is differentiable at x=2"], Print["f is not
differentiable at x=2"]]
−3
3 + 2𝑥; ≤𝑥<0
2
3
Problem-2: Suppose 𝑓(𝑥) = 3 − 2𝑥; 0 ≤ 𝑥 < 2 is a function. Discuss the differentiability of
3
{ −3 − 2𝑥; 𝑥≥2
the function 𝑓(𝑥) at 𝑥 = 0.
Solution:
Clear All[f];
f[x_]:= Piecewise[{{3+2*x,-3/2 x<0},{3-2 *x,0 x<3/2},{-3-
2 *x,x 3/2}}];
lhd=Limit[(f[x+h]-f[x])/h,h 0,Direction 1]/.x 0
rhd=Limit[(f[x+h]-f[x])/h,h 0,Direction -1]/.x 0
If[lhd==rhd,Print["f is differentiable at x=0"], Print["f
is not differentiable atx=0"]]
DIFFERENTIATION OF A FUNCTION
Note that D treats every symbol in an expression that does not explicitly depend on x
as a constant.
ii) f[x_]:=Sin[x]^10;
Derivative[4][f][x]
Output: 5040Cos[𝑥]4 Sin[𝑥]6 − 4680Cos[𝑥]2 Sin[𝑥]8 + 280Sin[𝑥]10
Examples:
i) D[x^5 + x^4 + x^3 + x^2 + x + 1, {x, 3}]/. x → 1
Output:90
ii) 𝑓[x_]: = 𝑥^5 + 𝑥^4 + 𝑥^3 + 𝑥^2 + 𝑥 + 1;
D[f[x], {x, 2}]/. x → 1
Output:40
g:=Derivative[2][f]
g[1]
Output:40
2
Problem-1: Compute the values of the first ten derivatives of 𝑓(𝑥) = 𝑒 𝑥 at x = 0. Put the results
in tabular form.
Solution:
ClearAll[f]
f[x_]:=Exp[x^2];
dt=Table[{n,D[f[x],{x,n}]/.x 0},{n,1,10}];
TableForm[dt,TableHeadings{None,{"n","fn(0)"}}]
Output:
Solution:
ClearAll[f]
f[x_]:=x^6-x^4+x^2-1;
dt=Table[{n,D[f[x],{x,n}]/.x 0},{n,1,7}];
Problem-3: Sketch the graph of the function 𝑓(𝑥) = 𝑥 4 − 50𝑥 2 + 300 and it’s derivative, on
one set of axes for −10 ≤ 𝑥 ≤ 10.
Solution:
ClearAll[f]
f[x_]:=x^4-50x^2+300;
df=D[f[x],{x,1}];
Plot[{f[x],df},{x,-10,10},PlotLegends{"f[x]","df"}]
Output:
2000
1000
10 5 5 10
1000
2000
f x
3000
df
Problem-4: Sketch the graph of the function 𝑓(𝑥) = √𝑥 6 + 5 − 𝑥 3 and it’s first and second
derivative, on one set of axes for −1.5 ≤ 𝑥 ≤ 5.
Solution:
ClearAll[f]
f[x_]:=Sqrt[x^6+5]-x^3;
df1=D[f[x],{x,1}];
df2=D[f[x],{x,2}];
Plot[{f[x],df1,df2},{x,-1.5,5},PlotLegends{"f[x]","df1","df2"}]
Problem-1: Find the relative maxima and relative minima of the function 𝑓(𝑥) = 𝑥 + sin 5𝑥 on
the interval [0, 𝜋].
Solution:
ClearAll[f]
f[x_]=x+Sin[5*x];
Plot[f[x],{x,0,Pi}]
Output:
FindMaximum[f[x],{x,1.5}]
Output: {2.590863808066234,{x→1.6110679109439814}}
FindMaximum[f[x],{x,2.9}]
Output: {3.8475008695021513,{x→2.8677049718826826}}
FindMinimum[f[x],{x,0.9}]
Output: {-0.07758968519439935,{x→0.9022062119188224}}
FindMinimum[f[x],{x,2.1}]
Output: {1.179047376241518,{x→2.158843273417874}}
Note: Caution must be taken to examine the results of the calculation. The value obtained is not
necessarily the one closest to the initial guess. For example,
FindMaximum[f[x],{x,2.8}]
Output: {5.104137930938069,{x→4.124342033826391}}
but the value of x is not between 0 and π.
ClearAll[f]
f[x_]:=17-15x+9x^2-x^3;
Plot[f[x],{x,-7,7}]
d1f=D[f[x],x];
sol=Solve[d1f0]
Output:
800
600
400
200
6 4 2 2 4 6
{{x→1},{x→5}}
d1fmito1=d1f/.xRandomReal[{-1000000,1}];
If[d1fmito1<0,Print["f is decreasing on (-,1)"],Print["f
is increasing on (-,1)"]]
d1f1to5=d1f/.xRandomReal[{1,5}];
If[d1f1to5<0,Print["f is decreasing on (1,5)"],Print["f is
increasing on (1,5)"]]
d1f5toi=d1f/.xRandomReal[{5.1,1000}];
If[d1f5toi<0,Print["f is decreasing on (5,)"],Print["f is increasing
on (5, )"]]
Output:
f is decreasing on (-∞,1)
f is increasing on (1,5)
Concavity:
d2f=D[f[x],{x,2}];
sol=NSolve[d2f0]
Output:
{{x→3.}}
d2fmi=d2f/.xRandomReal[{-1000,3}];
If[d2fmi<0,Print["f is concave down on (-,3)"],Print["f is
concave up on (-,3)"]]
d2f3=d2f/.xRandomReal[{3,3000}];
If[d2f3<0,Print["f is concave down on (3,)"],Print["f is concave up
on (3,)"]]
Output:
f is concave up on (-∞,3)
Inflection Point(s):
f[3]
Output: 26
Since f changes from concave up to concave down at the point 𝑥 = 3. The inflection point is
(3, 𝑓(3)) = (3, 26 ). All of these conclusions are consistent with the graph of f .
Solution:
ClearAll[f]
f[x_]:=3x^4+4x^3-12x^2+2;
Plot[f[x],{x,-3,3}]
d1f=D[f[x],x];
17 Calculus with MATHEMATICA
sol=Solve[d1f0]
Output:
100
80
60
40
20
3 2 1 1 2 3
20
{{x→-2},{x→0},{x→1}}
d1fmitom2=d1f/.xRandomReal[{-1000000,-2}];
If[d1fmitom2<0,Print["f is decreasing on (-,-
2)"],Print["f is increasing on (-,-2)"]]
d1fm2to0=d1f/.xRandomReal[{-2,0}];
If[d1fm2to0<0,Print["f is decreasing on (-2,0)"],Print["f
is increasing on (-2,0)"]]
d1f0to1=d1f/.xRandomReal[{0,1}];
If[d1f0to1<0,Print["f is decreasing on (0,1)"],Print["f is
increasing on (0,1 )"]]
d1f1toi=d1f/.xRandomReal[{1,10000}];
If[d1f1toi<0,Print["f is decreasing on (1,)"],Print["f is
increasing on (1,)"]]
Output:
f is decreasing on (-∞,-2)
f is increasing on (-2,0)
f is decreasing on (0,1)
f is increasing on (1,∞)
Concavity:
d2f=D[f[x],{x,2}];
sol=NSolve[d2f0]
18 Calculus with MATHEMATICA
Output:
{{x→-1.2152504370215302},{x→0.5485837703548635}}
d2fmi=d2f/.xRandomReal[{-1000,-1.21525}];
If[d2fmi<0,Print["f is concave down on (-,-1.21525)"],Print["f is
concave up on (-,-1.21525)"]]
Output:
f is concave up on (-∞,-1.21525)
d2fm1=d2f/.xRandomReal[{-1.21525,0.548584}];
If[d2fm1<0,Print["f is concave down on (-1.21525,0.548584)"],Print["f
is concave up on (-1.21525,0.548584)"]]
Output:
d2fp5=d2f/.xRandomReal[{0.548584,1000}];
If[d2fp5<0,Print["f is concave down on (0.548584,)"],Print["f is
concave up on (0.548584,)"]]
Output:
f is concave up on (0.548584,∞)
Inflection Point(s):
f[-1.2152504370215302]
Output:
-16.3577816624136
f[0.5485837703548635]
Output:
-0.6792553746234349
Since f changes from concave up to concave down at the point 𝑥 = −1.2152504370215302 and
concave down to concave up at the point 𝑥 = 0.5485837703548635. The inflection points are
(−1.2152504370215302, 𝑓(−1.2152504370215302))
i) f ( x) 5 12 x x3
ii) 𝑓(𝑥) = 𝑥 3
iii) 𝑓(𝑥) = 𝑥 2 − 4𝑥 + 3
iv) 𝑓(𝑥) = 𝑥 3 − 3𝑥 2 + 1
v) 𝑓(𝑥) = 𝑥 + 2 sin 𝑥
Problem-1: Find the absolute maximum and minimum values of the function
𝑓(𝑥) = −2𝑥 5 + 17𝑥 4 − 46𝑥 3 + 39𝑥 2 + 4𝑥 on the interval [0, 4].
Solution:
f[x_]:=-2x^5+17x^4-46x^3+39x^2+4x;
a=0;b=4;
ep={a,b};
df:=D[f[x],x];
cp=NSolve[df0]
pt=Union[ep,cp[[All,1,2]]]
a< x< b/.cp
Output:
{{x→-
0.0472410743439684},{x→1.0596216588487413},{x→2.274656668634987}
,{x→3.5129627468602407}}
{-
0.0472410743439684,0,1.0596216588487413,2.274656668634987,3.5129
627468602407,4}
{False,True,True,True}
Output:
{0,1.0596216588487413,2.274656668634987,3.5129627468602407,4}
Output:
Output:
Plot[f[x],{x,0,4}]
Output:
20
15
10
1 2 3 4
Solution:
ClearAll[f]
f[x_]:=x^4-4x^3+2x^2+4x+2;
a=0;b=4;
ep={a,b};
df:=D[f[x],x];
Output:
{{x→-
0.4142135623730952},{x→0.9999999999999999},{x→2.414213562373095}
}
{-0.4142135623730952,0,0.9999999999999999,2.414213562373095,4}
{False,True,True}
pt=Complement[pt,{pt[[1]]}]
Print["The absolute Maximum is ",Max[f[pt]]]
Print["The absolute Minimum is ",Min[f[pt]]]
Plot[f[x],{x,0,4}]
Output:
{0,0.9999999999999999,2.414213562373095,4}
15
10
1 2 3 4
Alternative Method:
22 Calculus with MATHEMATICA
Maximize[{f, cons},x] will maximize the function f with respect to x and subject to the
constraints, cons.
Minimize[{f, cons},x] will minimize the function f with respect to x and subject to the
constraints, cons.
Problem-1: Find the absolute maximum and minimum values of f on the given closed interval,
and state where those values occur.
a) 𝑓(𝑥) = 𝑥 4 − 4𝑥 3 + 2𝑥 2 + 4𝑥 + 2; [0, 4]
b) 𝑓(𝑥) = 𝑥 + sin 5𝑥; [0, 𝜋]
c) 𝑓(𝑥) = −2𝑥 5 + 17𝑥 4 − 46𝑥 3 + 39𝑥 2 + 4𝑥 ; [0, 4]
d) 𝑓(𝑥) = 2𝑥 3 − 15𝑥 2 + 36𝑥 ; [1, 5]
4 1
e) 𝑓(𝑥) = 6𝑥 3 − 3𝑥 3 ; [−1, 1]
Solution:
a)
ClearAll[f]
f[x_]:=x^4-4x^3+2x^2+4x+2
Plot[f[x],{x,0,4}]
Maximize[{f[x],0 x 4},x]
Minimize[{f[x],0 x 4},x]//Simplify
Output:
15
10
1 2 3 4
{50,{x→4}}
{1,{x→1+√2}}
b)
ClearAll[f,x]
f[x_]:=x+Sin[5x];
Plot[f[x],{x,0,Pi}]
Maximize[{f[x],0 x Pi},x]//N
23 Calculus with MATHEMATICA
Minimize[{f[x],0xPi},x]//N
Output:
c)
ClearAll[f]
f[x_]:=-2x^5+17x^4-46x^3+39x^2+4x
Plot[f[x],{x,0,4}]
Maximize[{f[x],0 x 4},x]//N
Minimize[{f[x],0 x 4},x]//Simplify
Output:
20
15
10
1 2 3 4
{20.133970119213018,{x→3.5129627468602433}}
{0,{x→0}}
d)
ClearAll[f]
f[x_]:=2x^3-15x^2+36x
24 Calculus with MATHEMATICA
Plot[f[x],{x,1,5}]
Maximize[{f[x],1 x 5},x]//N
Minimize[{f[x],1 x 5},x]//Simplify
Output:
45
40
35
30
25
2 3 4 5
{55.,{x→5.}}
{23,{x→1}}
e)
ClearAll[f]
f[x_]:=6x^(4/3)-3x^(1/3)
Plot[f[x],{x,-1,1}]
Maximize[{f[x],-1 x 1},x]//N
Minimize[{f[x],-1 x 1},x]//Simplify
Output:
3
{3.,{x→1.}}
ASYMPTOTES
Problem-1: Find the horizontal, vertical, oblique and curvilinear asymptotes (if they exist) of the
following function:
𝑥3
a) 𝑓(𝑥) = 𝑥 2 −1
1
b) 𝑓(𝑥) = 𝑥 2 +1
2𝑥 2 +7
c) 𝑓(𝑥) = 3𝑥 2 +𝑥+12
2𝑥 2 −3𝑥+5
d) 𝑓(𝑥) = 3𝑥 2 +5𝑥−12
𝑥 3 −1
e) 𝑓(𝑥) = 𝑥
(𝑥−2)3
f) 𝑓(𝑥) = 𝑥2
Solution:
a)
ClearAll[f,x,m,n]
f[x_]:=x^3/(x^2-1);
Horizontal asymptotes:
Limit[f[x],x ]
Limit[f[x],x -]
Output:
∞
-∞
Vertical asymptotes:
Solve[x^2-1==0,x]
Output:
{{x→-1},{x→1}}
Oblique asymptotes:
m=Limit[(f[x])⁄x,x→Infinity]
Output:
1
n=Limit[f[x]-m*x,x→Infinity]
Output:
Output:
b)
Horizontal asymptotes:
ClearAll[f,x,m,n]
f[x_]:=1/(x^2+1);
Limit[f[x],x ]
Output:
Vertical asymptotes:
Solve[x^2+1==0]
Output:
{{x→-ⅈ},{x→ⅈ}}
ClearAll[f,x,m,n]
f[x_]:=(2x^2+7)/(3x^2+x+12);
Limit[f[x],x ]
Limit[f[x],x -]
Output:
2/3
2/3
Therefore, the horizontal asymptote is the line, 𝑦 = 2/3.
Vertical asymptotes:
Solve[3x^2+x+12==0,x]
Output:
{{x→1/6(-1-ⅈ√143)},{x→1/6(-1+ⅈ√143)}}
d)
Horizontal asymptotes:
ClearAll[f,x,m,n]
f[x_]:=(2x^2-3x+5)/(3x^2+5x-12);
Limit[f[x],x ]
Limit[f[x],x -]
Output:
2/3
2/3
Vertical asymptotes:
Solve[3x^2+5x-12==0,x]
{{x→-3},{x→4/3}}
e)
Horizontal asymptotes:
ClearAll[f,x,m,n]
f[x_]:=(x^3-1)/x;
Limit[f[x],x ]
Limit[f[x],x -]
Output:
Vertical asymptotes:
Curvilinear asymptotes:
m=Limit[(f[x])⁄(x^2),x→∞]
Output:
n=Limit[(f[x]-m*x^2),x→∞]
Output:
Output:
f)
Horizontal asymptotes:
ClearAll[f,x,m,n]
f[x_]:=(x-2)^3/x^2;
Limit[f[x],x ]
Limit[f[x],x -]
Output:
-∞
Vertical asymptotes:
Solve[x^2==0,x]
Output:
{{x→0},{x→0}}
Oblique asymptotes:
m=Limit[(f[x])⁄x,x→Infinity]
Output:
n=Limit[f[x]-m*x,x→Infinity]
Output:
-6
30 Calculus with MATHEMATICA
Print["The Oblique asymptote is y=",m*x+n]
Output:
IMPLICIT DIFFERENTIATION
𝑑𝑓
Dt[f, x] gives the total derivative 𝑑𝑥 .
Examples:
i) Dt[a*x+b,x]
Output:
a+xDt[a,x]+Dt[b,x]
ii) Dt[a*x+y,x]
Output:
a+xDt[a,x]+Dt[y,x]
%//TraditionalForm
Output:
𝑥 ⅆ𝑎/ ⅆ𝑥 + 𝑎 + ⅆ𝑦/ ⅆ𝑥
where as D[a*x+y,x]gives a as output.
𝑑𝑛 𝑓
Dt[f, {x,n}] gives the multiple derivative 𝑑𝑥 𝑛.
Examples:
i) Dt[x^2y,{x,2}]
Output:
2y+4xDt[y,x]+x^2 Dt[y,{x,2}]
%//TraditionalForm
Output:
2
ⅆ2𝑦 ⅆ𝑦
𝑥 2
+ 4𝑥 + 2𝑦
ⅆ𝑥 ⅆ𝑥
i) 𝑥𝑦 − 1 = 0
ii) 5𝑦 2 + sin 𝑦 − 𝑥 2 = 0
i)
a=x*y-1
b=Dt[a,x]
Output:
-1+xy
y+xDt[y,x]
c=Solve[b==0,Dt[y,x]]
Output:
{Dt[y,x]→-y/x}}
%//TraditionalForm
ⅆ𝑦 𝑦
{{ → − }}
ⅆ𝑥 𝑥
ii) ClearAll[a,b,c]
a=5y^2+Sin[y]-x^2
b=Dt[a,x]
c=Solve[b==0,Dt[y,x]]
Output:
-x^2+5y^2+Sin[y]
-2x+10yDt[y,x]+Cos[y]Dt[y,x]
2𝑥
{{Dt[𝑦, 𝑥] → }}
10𝑦+Cos[𝑦]
𝑑2 𝑦
Problem-2: Use implicit differentiation to find 𝑑𝑥 2 if
i) 4𝑥 2 − 2𝑦 2 = 9
ii) 𝑦 + 𝑠𝑖𝑛 𝑦 − 𝑥 = 0
iii) 2𝑥 2 + 3𝑦 2 = 4
iv) 𝑥3𝑦3 = 4
Solution:
i)
Output:
−9 + 4𝑥 2 − 2𝑦 2
8 x-4 y Dt[y,x]
{{Dt[y,x](2 x)/y}}
8-2 (2 Dt[y,x]2+2 y Dt[y,{x,2}])
{{Dt[y,{x,2}](2-Dt[y,x]2)/y}}
f=e/.Dt[y,x](2 x)/y
{{Dt[y,{x,2}](2-(4 x2)/y2)/y}}
%//TraditionalForm
{{2y/x2(2 (y2-2 x2))/y3}}
ii)
ClearAll[a,b,c,d,e,f]
a=y+Sin[y]-x
b=Dt[a,x]
c=Solve[b==0,Dt[y,x]]
d=Dt[a,{x,2}]
e=Solve[d==0,Dt[y,{x,2}]]
Output:
-x+y+Sin[y]
-1+Dt[y,x]+Cos[y] Dt[y,x]
{{Dt[y,x]1/(1+Cos[y])}}
Dt[y,{x,2}]+Cos[y] Dt[y,{x,2}]-Dt[y,x]2 Sin[y]
{{Dt[y,{x,2}](Dt[y,x]2 Sin[y])/(1+Cos[y])}}
f=e/.Dt[y,x]1/(1+Cos[y])
{{Dt[y,{x,2}]Sin[y]/(1+Cos[y])3}}
%//TraditionalForm
{{2y/x2sin(y)/(cos(y)+1)3}}
-4+2 x2-3 y2
4 x-6 y Dt[y,x]
{{Dt[y,x](2 x)/(3 y)}}
4-3 (2 Dt[y,x]2+2 y Dt[y,{x,2}])
{{Dt[y,{x,2}](2-3 Dt[y,x]2)/(3 y)}}
f=e/.Dt[y,x](2 x)/(3 y)
{{Dt[y,{x,2}](2-(4 x2)/(3 y2))/(3 y)}}
%//TraditionalForm
{{2y/x2(2-(4 x2)/(3 y2))/(3 y)}}
iv)
ClearAll[a,b,c,d,e,f]
a=x^3y^3-4
b=Dt[a,x]
c=Solve[b==0,Dt[y,x]]
d=Dt[a,{x,2}]
e=Solve[d==0,Dt[y,{x,2}]]
Output:
-4+x3 y3
3 x2 y3+3 x3 y2 Dt[y,x]
{{Dt[y,x]-(y/x)}}
6 x y3+18 x2 y2 Dt[y,x]+x3 (6 y Dt[y,x]2+3 y2 Dt[y,{x,2}])
{{Dt[y,{x,2}]-((2 (y2+3 x y Dt[y,x]+x2 Dt[y,x]2))/(x2 y))}}
f=e/.Dt[y,x]-(y/x)
{{Dt[y,{x,2}](2 y)/x2}}
%//TraditionalForm
{{2y/x2(2 y)/x2}}
34 Calculus with MATHEMATICA
ROLLE’S THEOREM
Problem-1: Apply Rolle’s theorem to find the values of c for the following functions:
Solution:
i)
f[x_]:=4x+39x^2-46x^3+17x^4-2x^5
a=0;b=4;
Plot[f[x],{x,a,b}]
f[a]==f[b]==0
df=D[f[x],x]
dfc=df/.x c
sol=NSolve[dfc==0]
Print["The values of c inside the interval are"]
For[i=1,i4,i++,If[a<c<b/.c sol[[i,1,2]],Print[sol[[i,1,2]]]]]
Output:
20
15
10
1 2 3 4
True
4+78 x-138 x2+68 x3-10 x4
4+78 c-138 c2+68 c3-10 c4
{{c-0.0472411},{c1.05962},{c2.27466},{c3.51296}}
The values of c inside the interval are
1.05962
2.27466
3.51296
35 Calculus with MATHEMATICA
ii)
f[x_]:=-2+x-x^2+x^3+x^4
a=-2;b=1;
Plot[f[x],{x,a,b}]
f[a]==f[b]==0
df=D[f[x],x]
dfc=df/.x c
sol=NSolve[dfc==0]
Print["The values of c inside the interval are"]
For[i=1,i3,i++,If[a<c<b/.c sol[[i,1,2]],Print[sol[[i,1,2]]]]]
2.0 1.5 1.0 0.5 0.5 1.0
True
1-2 x+3 x2+4 x3
1-2 c+3 c2+4 c3
{{c-1.28858},{c0.269292_-0.348559 },{c0.269292_+0.348559 }}
The values of c inside the interval are
-1.28858
Less::nord: Invalid comparison with _0.269292_-0.348559 _ attempted.
Less::nord: Invalid comparison with _0.269292_-0.348559 _ attempted.
Less::nord: Invalid comparison with _0.269292_-0.348559 _ attempted.
General::stop: Further output of _Less::nord_ will be suppressed during this
calculation.
i)
ClearAll[f,x]
f[x_]:=Exp[-x]Sin[x]
a=0;b=Pi;
f[a]==f[b]==0
Plot[f[x],{x,a,b}]
True
0.30
0.25
0.20
0.15
0.10
0.05
ii)
ClearAll[f,x]
f[x_]:=x^2-3x+2
a=1;b=2;
f[a]==f[b]==0
Plot[f[x],{x,a,b}]
True
0.05
0.10
0.15
0.20
0.25
df=D[f[x],x]
dfc=df/.x c
s=FindRoot[dfc==0,{c,1.5}]
If[a<c<b/.s,Print["Rolle's Theorem is verified"]]
-3+2 x
-3+2 c
{c1.5}
Rolle's Theorem is verified
iii)
ClearAll[f,x]
f[x_]:=Log[4+2x-x^2]
a=-1;b=3;
f[a]==f[b]==0
Plot[f[x],{x,a,b}]
True
1.5
1.0
0.5
1 1 2 3
df=D[f[x],x]
dfc=df/.x c
s=FindRoot[dfc==0,{c,1.1}]
If[a<c<b/.s,Print["Rolle's Theorem is verified"]]
38 Calculus with MATHEMATICA
(2-2 x)/(4+2 x-x2)
(2-2 c)/(4+2 c-c2)
MEAN-VALUE THEOREM
Problem-1: Apply Mean-Value Theorem to find the values of c for the following functions;
hence verify the Mean-Value Theorem.
Solution:
i)
ClearAll[f,x]
f[x_]=(x-1)(x-2)(x-3)
a=0;b=4;
ContourPlot[{y==f[x],(x-a)/(a-b)==(y-f[a])/(f[a]-f[b])},{x,a,b},{y,-
6,6},AxesTrue,FrameFalse]
(-3+x) (-2+x) (-1+x)
1 2 3 4
sol=FindRoot[f[b]-f[a](b-a)f'[c],{c,{1,3}}]
{c{0.845299,3.1547}}
For[i=1,i 2,i++,If[a<c<b/.c sol[[1,2,i]],Print["Mean-value Theorem is verified"]]]
Mean-value Theorem is verified
ii)
ClearAll[f,x]
f[x_]=Sqrt[x]+Sin[2Pi*x]
a=0;b=2;
ContourPlot[{y==f[x],(x-a)/(a-b)==(y-f[a])/(f[a]-f[b])},{x,a,b},{y,-
1,3},AxesTrue,FrameFalse]
x
+Sin[2 x]
1
s1=FindRoot[f[b]-f[a]==(b-a)f'[c],{c,{0.25,0.75,1.25,1.75}}]
{c{0.257071,0.753319,1.24344,1.75836}}
For[i=1,i 4,i++,If[a<c<b/.c s1[[1,2,i]],Print["Mean-value Theorem is
verified"];Break[];]]
Mean-value Theorem is verified
iii)
ClearAll[f,x]
f[x_]=x^3+x-4
a=-1;b=2;
ContourPlot[{y==f[x],(x-a)/(a-b)==(y-f[a])/(f[a]-f[b])},{x,a,b},{y,-
7,10},AxesTrue,FrameFalse]
-4+x+x3
s1=FindRoot[f[b]-f[a]==(b-a)f'[c],{c,0.8}]
{c1.}
If[a<c<b/.s1,Print["Mean-value Theorem is verified."]]
Mean-value Theorem is verified.
iv)
ClearAll[f,x]
f[x_]=Sqrt[25-x^2];
a=-5;b=3;
ContourPlot[{y==f[x],(x-a)/(a-b)==(y-f[a])/(f[a]-f[b])},{x,a,b},{y,-
2,5},AxesTrue,FrameFalse]
4 2 2
s1=FindRoot[f[b]-f[a]==(b-a)f'[c],{c,-2}]
{c-2.23607}
If[a<c<b/.s1,Print["Mean-value Theorem is verified."]]
Mean-value Theorem is verified.
POWER SERIES
Series[f,{x,x0,n}] generates a power series expansion for f about the point x=x 0 to order
(x-x0)n.
SeriesCoefficient[series,n] finds the coefficient of nth order term in the form generated
by series.
SeriesCoefficient[f,{x,x0,n}] find the coefficient of (x-x0)n in the expansion of f about the
point x=x0 .
𝜋
Problem-1: Expand 𝑆𝑖𝑛 𝑥 in power of (𝑥 − ).
2
Solution:
Series[Sin[x],{x,Pi/2,10}]
1-1/2 (x-/2)2+1/24 (x-/2)4-1/720 (x-/2)6+(x-/2)8/40320-(x-/2)10/3628800+O[x-/2]11
𝜋
Problem-2: Expand 𝐶𝑜𝑠 𝑥 in power of (𝑥 − 2 ).
Solution:
43 Calculus with MATHEMATICA
Series[Cos[x],{x,Pi/2,10}]//Normal
/2-x+1/6 (-(/2)+x)3-1/120 (-(/2)+x)5+(-(/2)+x)7/5040-(-(/2)+x)9/362880
Solution:
s=Series[Exp[x],{x,0,7}]
1+x+x2/2+x3/6+x4/24+x5/120+x6/720+x7/5040+O[x]8
SeriesCoefficient[s,7]
1/5040
OR
SeriesCoefficient[Exp[x],{x,0,7}]
1/5040
Problem-4: Construct the Taylor polynomials about x=1 for 𝑓(𝑥) = 𝑆𝑖𝑛𝑥 of degree 9. In
addition, construct an error function and computes it’s value from x=1 to 2 in increment 0.2.
Finally, Place the results in the form of a table and comment on the values on the error as x gets
further from 1.
Solution:
s1=Series[Sin[x],{x,1,9}]//Normal
err[x_]=Abs[s1-Sin[x]];
s=Table[{x,err[x]},{x,1,2,0.2}];
TableForm[s,TableHeadings →{None,{"x","err(x)"}}]
Problem-5: Construct the Taylor polynomials about x=0 for 𝑓(𝑥) = 𝑒 𝑥 of degree 11. In
addition, construct an error function and computes it’s value from x=0 to 8 in increment 2.
Finally, Place the results in the form of a table.
s1=Series[Exp[x],{x,0,11}]//Normal
err[x_]=Abs[s1-Sin[x]];
s=Table[{x,err[x]},{x,0,8,2}];
TableForm[s,TableHeadings→{None,{"x","err(x)"}}]
1+x+x2/2+x3/6+x4/24+x5/120+x6/720+x7/5040+x8/40320+x9/362880+x10/3628800+x11/39
916800
Problem-1: Obtain the equation of tangent and normal for the following curves at the point
given with them and plot them in the same set of axes:
a) 𝑥 2 + 2𝑦 2 = 3 at (−1, 1)
b) 𝑦 = 𝑥 2 at (2, 4)
c) 𝑦 2 = 8𝑥 at (2, 4)
d) 𝑥 2 − 𝑦 2 = 9 at (5, 4)
Solution:
a)
x1=1;y1=-1;
d1=Dt[x^2+2y^2==3,x]
2 x+4 y Dt[y,x]0
sol=Solve[d1,Dt[y,x]]
{{Dt[y,x]-(x/(2 y))}}
m=sol[[1,1,2]]/.{x x1,y y1}
1/2
tangent=y-y1m(x-x1)//Simplify
45 Calculus with MATHEMATICA
normal=y-y1-(1/m)(x-x1)//Simplify
x3+2 y
2 x+y1
ContourPlot[{x^2+2y^2==3,x3+2 y,2 x+y1},{x,-2,3},{y,-
2,2},AxesTrue,FrameFalse]
2
2 1 1 2 3
b)
x1=2;y1=4;
d1=Dt[y==x^2,x]
sol=Solve[d1,Dt[y,x]]
m=sol[[1,1,2]]/.{x x1,y y1}
tangent=y-y1m(x-x1)//Simplify
normal=y-y1-(1/m)(x-x1)//Simplify
Dt[y,x]2 x
{{Dt[y,x]2 x}}
4
4 x4+y
x+4 y18
ContourPlot[{y==x^2,4 x4+y,x+4 y18},{x,-5,5},{y,-
5,10},AxesTrue,FrameFalse]
4 2 2 4
c)
x1=2;y1=4;
d1=Dt[y^28x,x]
sol=Solve[d1,Dt[y,x]]
m=sol[[1,1,2]]/.{x x1,y y1}
tangent=y-y1m(x-x1)//Simplify
normal=y-y1-(1/m)(x-x1)//Simplify
2 y Dt[y,x]8
{{Dt[y,x]4/y}}
1
2+xy
x+y6
ContourPlot[{y^28x,2+xy,x+y6},{x,-10,10},{y,-
10,10},AxesTrue,FrameFalse]
10 5 5 10
10
d)
x1=5;y1=4;
d1=Dt[x^2-y^29,x]
sol=Solve[d1,Dt[y,x]]
m=sol[[1,1,2]]/.{x x1,y y1}
tangent=y-y1m(x-x1)//Simplify
normal=y-y1-(1/m)(x-x1)//Simplify
2 x-2 y Dt[y,x]0
{{Dt[y,x]x/y}}
5/4
5 x9+4 y
(4 x)/5+y8
ContourPlot[{x^2-y^29,5 x9+4 y,(4 x)/5+y8},{x,-10,10},{y,-
10,10},AxesTrue,FrameFalse]
10 5 5 10
10
a) ∫ 𝑥 2 𝑒 𝑥 𝑠𝑖𝑛𝑥 ⅆ𝑥
1
b) ∫ (√𝑥 + 𝑥) ⅆ𝑥
√
1
c) ∫ √1−𝑥 2 ⅆ𝑥
1
d) ∫ (𝑥 4 +1)2 ⅆ𝑥
Solution:
a)
Integrate[x^2Exp[x]Sin[x],x]
1/2 x (-(-1+x)2 Cos[x]+(-1+x2) Sin[x])
b)
Integrate[(Sqrt[x]+1/Sqrt[x]),x]
2/3 x (3+x)
c)
Integrate[(1/Sqrt[1-x^2]),x]
ArcSin[x]
Integrate[(1/(x^4+1)^2),x]
1/32 ((8 x)/(1+x4)-6 2 ArcTan[1- 2
x]+6 2
ArcTan[1+ 2
x]-3
2 Log[1- 2 x+x2]+3 2 Log[1+ 2 x+x2])
Solution:
tab=Table[{n,Integrate[Sin[x]^n,x]},{n,0,10}];
TableForm[tab,TableHeadings {None,{"n","\[Integral](Sinnx dx"}}]
Solution:
Integrate[Sin[Sin[x]],{x,0,1}]//N
0.430606
Integrate[1/((1+x^2)Sqrt[1-x^2]),{x,4,10}]//N
0._-0.0258087
Integrate[x*Exp[x]*Sin[x],{x,0,1}]
1/2 (-1+ Sin[1])
NIntegrate[x*Exp[x]*Sin[x],{x,0,1}]
0.643678
f[x_]=Sin[x];
a=0;b=Pi;
Plot[f[x],{x,a,b}]
1.0
0.8
0.6
0.4
0.2
arclen=NIntegrate[Sqrt[1+(f'[x])^2],{x,a,b}]
3.820197789023311
Problem-5: Compute the approximate length of one complete arc of a cosine curve.
Solution:
f[x_]=Cos[x];
a=-Pi/2;b=Pi/2;
Plot[f[x],{x,a,b}]
1.0
0.8
0.6
0.4
0.2
arclen=NIntegrate[Sqrt[1+(f'[x])^2],{x,a,b}]
3.820197789023311
Problem-6: Find the length of the following curve from x=1 to x=2:
𝑦 = (𝑥 + 1)(𝑥 + 2) − 1/8𝑙𝑛(2𝑥 + 3)
11
10
6
1.2 1.4 1.6 1.8 2.0
6.04206
Problem-7: Find the area bounded by the curve 𝑦 = sin 𝑥, the axis of x and straight lines x=0 to
x=𝜋.
Solution:
ClearAll[f];
f[x_]=Sin[x];
ContourPlot[{y==f[x],x==0,x==Pi},{x,-
1,4},{y,0,1},Axes→True,Frame →False]
area=Integrate[f[x],{x,0,Pi}]
0.8
0.6
0.4
0.2
1 1 2 3 4
2
Problem-8: Find the area bounded by the curve 𝑦 = 𝑥 2 , the axis of x and two straight lines
𝑥 = 1, 𝑥 = 3.
Solution:
ClearAll[f];
f[x_]=x^2;
ContourPlot[{y==f[x],x==1,x==3},{x,0,4},{y,0,10},Axes→True,
Frame→False]
area=Integrate[f[x],{x,1,3}]
1 2 3 4
26/3
Problem-9: Compute the area bounded by the following curves:
Solution:
a)
ClearAll[f];
f1[x_]=1-x^2;
f2[x_]=x^4-3x^2
Plot[{f1[x],f2[x]},{x,-2,2},FillingTrue]
-3 x2+x4
b)
ClearAll[a,b];
f1[y_]=y^2/4;
f2[y_]=(y+4)/2;
Plot[{f1[y],f2[y]},{y,-4,4},Filling True]
Solve[f1[y]==f2[y]]
{{y-2},{y4}}
a=-2;b=4;
area=NIntegrate[(f2[y]-f1[y]),{y,a,b}]
9.
𝑥2 𝑦2
Problem-10: Find the volume of the solid generated by revolving the ellipse 𝑎2 + 𝑏2 = 1 about
x-axis.
Solution:
Solve[x^2/a^2+y^2/b^2==1,y]
2 2 2 2
{{y-((b a x )/a)},{y(b a x )/a}}
2 2
y=(b a x )/a
Volume=Integrate[Pi*y^2,{x,-a,a}]
2 2
(b a x )/a
4/3 a b2
56 Calculus with MATHEMATICA
𝑥2 𝑦2
Problem-11: Find the volume of the solid generated by revolving the ellipse 𝑎2 + 𝑏2 = 1 about
y-axis.
Solution:
ClearAll[x,y,a,b];
Solve[x^2/a^2+y^2/b^2==1,x]
Solution:
ClearAll[a,b,x,y];
y=Sqrt[r^2-x^2];
a=-r;b=r;
volume=Pi*Integrate[y^2,{x,a,b}]
(4 r3)/3
[1] The Student’s Introduction to Mathematica ® A Handbook for Precalculus, Calculus, and
Linear Algebra, Second edition, Bruce F. Torrence & Eve A. Torrence, CAMBRIDGE
UNIVERSITY PRESS, 2009.
[2] Mathematica, Third Edition, Eugene Don, Schaum’s Outline Series, 2019.
[3] MATHEMATICA, Hafizur, Sanjit and Sarwar, TITAS MATH SERIES, 2012.
[5] Analysis with Mathematica® Volume 1: Single Variable Calculus, Galina Filipuk, Andrzej
Kozłowski, 2019.
**********************************************************************