You are on page 1of 10

f[x_] = Exp[x];

x0 = 0;
n = 2;
S2[x_] = Series[f[x], {x, x0, n}];
Print["Taylor's Series of e^x is ", S2[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor;s polynomial of e^x is ", p2[x]];
A[x_, n_] = D[f[x], {x, n + 1}];
A[c, n + 1] n+1
S2[x_, c_] = x ;
n + 1 !
T2[x_, c_] = p2[x] + S2[x, c];
Print[
"Taylor's Polynomial of e^x of degree 2 with Lagrange's form of remainder is ",
T2[x, c]];
m1 = NMinimize[{S2[x, c], 0 < c < x}, {x, c}];
m = m1[[1]];
Print["Remainder term is > ", m];
x2
Ifm > 0, Print"1+x+ ≤ex for all x>0"
2

x2
Taylor's Series of e^x is 1 + x + + O[x]3
2
x2
Taylor;s polynomial of e^x is 1 + x +
2
x2 ⅇc x 3
Taylor's Polynomial of e^x of degree 2 with Lagrange's form of remainder is 1 + x + +
2 6
-12
Remainder term is > 1.04635 × 10
x2
1+x+ ≤ex for all x>0
2

f[x_] = Cos[x] ;
x0 = 0;
n = 2;
S2[x_] = Series[f[x], {x, x0, n}];
Print["Taylor's Series of Cos[x] is ", S2[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor's polynomial of Cos[x] is ", p2[x]];
A[x_, n_] = D[f[x], {x, n + 1}]
A[c, n + 1] n+1
S2[x_, c_] = x ;
n + 1 !
T2[x_, c_] = p2[x] + S2[x, c];
Print["Taylor's Polynomial of Cos[x] of degree
2 with Lagrange's form of remainder(S2[x]) is ", T2[x, c]];
m1 = NMinimize[{S2[x, c], 0 < c < x}, {x, c}];
m2 = NMinimize[{S2[x, c], x < c < 0}, {x, c}];
m3 = m1[[1]];
m4 = m2[[1]];
m = Min[m3, m4];
Print["Remainder term is > ", m];
x2
Ifm > 0, Print"1- ≤Cos[x] for all x in R"
2
2 8 Mrinal110918.nb

x2
Taylor's Series of Cos[x] is 1 - + O[x]3
2
x2
Taylor's polynomial of Cos[x] is 1 -
2
Sin[x]

Taylor's Polynomial of Cos[x] of degree 2 with Lagrange's form of remainder(S2[x]) is


x2 1 3
1- + x Sin[c]
2 6
Remainder term is > 1.79431 × 10-15
x2
1- ≤Cos[x] for all x in R
2

f[x_, y_] = Cos[x y];


Series[f[x, y], {x, 0, 2}, {y, 1, 5}]
1 1
1+ - - y - 1 - y - 12 + O[y - 1]6 x2 + O[x]3
2 2

z[x_] = Series[Sin[x], {x, 0, 10}]


x3 x5 x7 x9
x- + - + + O[x]11
6 120 5040 362 880

Normal[z[x]]
x3 x5 x7 x9
x- + - +
6 120 5040 362 880

IF REMAINDER TERM CONVERGES TO 0 THEN TAYLOR SERIES CONVERGES TO “F[X]”

f[x_] = Exp[x] ;
x0 = 0;
S2[x_] = Series[f[x], {x, x0, 10}];
Print["Taylor's Series of Cos[x] is ", S2[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor's polynomial of Exp[x] of degree 8 is ", p2[x]];
A[x_, n_] = D[f[x], {x, n}];
A[c, n + 1]
S2[x_, c_] = x - x0n+1 ;
n + 1 !
r = Limit[S2[x, c], n → Infinity, Assumptions → 0 < c < x]
Ifr ⩵ 0,
Print"Lagrange's Remainder term is convergent to 0 and hence taylor's series
is convergent to f[x]=ⅇx "
Taylor's Series of Cos[x] is
x2 x3 x4 x5 x6 x7 x8 x9 x10
1+x+ + + + + + + + + + O[x]11
2 6 24 120 720 5040 40 320 362 880 3 628 800
Taylor's polynomial of Exp[x] of degree 8 is
x2 x3 x4 x5 x6 x7 x8 x9 x10
1+x+ + + + + + + + +
2 6 24 120 720 5040 40 320 362 880 3 628 800
0

Lagrange's Remainder term is convergent


to 0 and hence taylor's series is convergent to f[x]=ⅇ x
8 Mrinal110918.nb 3

f[x_] = Log[x] ;
x0 = 1;
S2[x_] = Series[f[x], {x, x0, 10}];
Print["Taylor's Series of Log[x] is ", S2[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor's polynomial of Log[x] of degree 10 is ", p2[x]];
A[x_, n_] = D[f[x], {x, n}];
A[c, n + 1]
S2[x_, c_] = x - x0n+1
n + 1 !
r = Limit[S2[x, c], n → Infinity, Assumptions → 0 < c < x]
Ifr ⩵ 0,
Print"Lagrange's Remainder term is convergent to 0 and hence taylor's series
is convergent to f[x]=ⅇx "
1 1 1
Taylor's Series of Log[x] is (x - 1) - (x - 1)2 + (x - 1)3 - (x - 1)4 +
2 3 4
1 1 1 1 1 1
(x - 1)5 - (x - 1)6 + (x - 1)7 - (x - 1)8 + (x - 1)9 - (x - 1)10 + O[x - 1]11
5 6 7 8 9 10
1 1 1
Taylor's polynomial of Log[x] of degree 10 is -1 - (-1 + x)2 + (-1 + x)3 - (-1 + x)4 +
2 3 4
1 1 1 1 1 1
(-1 + x)5 - (-1 + x)6 + (-1 + x)7 - (-1 + x)8 + (-1 + x)9 - (-1 + x)10 + x
5 6 7 8 9 10
- 1 + x1+n Log(1+n) [c]
1 + n !

Lagrange's Remainder term is convergent


to 0 and hence taylor's series is convergent to f[x]=ⅇ x

f[x_] = Sin[Log[Exp[Cos[x]]]] ;
x0 = 0;
S2[x_] = Series[f[x], {x, x0, 10}];
Print["Taylor's Series of Cos[x] is ", S2[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor's polynomial of Exp[x] of degree 8 is ", p2[x]];
A[x_, n_] = D[f[x], {x, n}];
A[c, n + 1]
S2[x_, c_] = x - x0n+1 ;
n + 1 !
r = Limit[S2[x, c], n → Infinity, Assumptions → 0 < c < x]
Ifr ⩵ 0,
Print"Lagrange's Remainder term is convergent to 0 and hence taylor's series
is convergent to f[x]=ⅇx "
4 8 Mrinal110918.nb

1 Cos[1] Sin[1]
Taylor's Series of Cos[x] is Sin[1] - Cos[1] x2 + - x4 +
2 24 8
7 Cos[1] Sin[1] 209 Cos[1] Sin[1] 1259 Cos[1] 193 Sin[1]
+ x6 + - + x8 + - x10 + O[x]11
360 48 40 320 960 3 628 800 241 920
1 Cos[1] Sin[1]
Taylor's polynomial of Exp[x] of degree 8 is - x2 Cos[1] + x4 - +
2 24 8
1259 Cos[1] 193 Sin[1] 209 Cos[1] Sin[1] 7 Cos[1] Sin[1]
x10 - + x8 - + + x6 + + Sin[1]
3 628 800 241 920 40 320 960 360 48
x1+n ∂{c,1+n} SinLogⅇCos[c] 
Limit , n → ∞, Assumptions → 0 < c < x
1 + n !

x1+n ∂{c,1+n} SinLogⅇCos[c] 


IfLimit , n → ∞, Assumptions → 0 < c < x ⩵ 0,
1 + n !
PrintLagrange's Remainder term is convergent
to 0 and hence taylor's series is convergent to f[x]=ⅇ x 

f[x_] = Sin[Log[Exp[Cos[x]]]] ;
Series[f[x], {x, 0, 1}]
Sin[1] + O[x]2

N[Log10[ⅇ]]
0.434294

N[Sin[1]]
0.841471

f[x_] = Sinh[x ^ 2] ;
x0 = 1;
S2[x_] = Series[f[x], {x, x0, 5}];
Print["Taylor's Series of Log[x] is ", S2[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor's polynomial of Log[x] of degree 10 is ", p2[x]];
A[x_, n_] = D[f[x], {x, n}];
A[c, n + 1]
S2[x_, c_] = x - x0n+1
n + 1 !
r = Limit[S2[x, c], n → Infinity, Assumptions → 0 < c < x]
Ifr ⩵ 0,
Print"Lagrange's Remainder term is convergent to 0 and hence taylor's series
is convergent to f[x]=ⅇx "
8 Mrinal110918.nb 5

Taylor's Series of Log[x] is


4 Cosh[1]
Sinh[1] + 2 Cosh[1] (x - 1) + Cosh[1] + 2 Sinh[1] (x - 1)2 + + 2 Sinh[1] (x - 1)3 +
3
7 Sinh[1] 19 Cosh[1] 4 Sinh[1]
2 Cosh[1] + (x - 1)4 + + (x - 1)5 + O[x - 1]6
6 15 3
Taylor's polynomial of Log[x] of degree 10 is 2 (-1 + x) Cosh[1] +
7 Sinh[1] 19 Cosh[1] 4 Sinh[1]
Sinh[1] + (-1 + x)4 2 Cosh[1] + + (-1 + x)5 + +
6 15 3
4 Cosh[1]
(-1 + x)2 Cosh[1] + 2 Sinh[1] + (-1 + x)3 + 2 Sinh[1]
3
- 1 + x1+n ∂{c,1+n} Sinhc2 
1 + n !

- 1 + x1+n ∂{c,1+n} Sinhc2 


Limit , n → ∞, Assumptions → 0 < c < x
1 + n !

- 1 + x1+n ∂{c,1+n} Sinhc2 


IfLimit , n → ∞, Assumptions → 0 < c < x ⩵ 0,
1 + n !
PrintLagrange's Remainder term is convergent
to 0 and hence taylor's series is convergent to f[x]=ⅇ x 

f[x_] = Tan[x] ;
x0 = 1;
S2[x_] = Series[f[x], {x, x0, 5}];
F[x_] = N[S2[x]];
Print["Taylor's Series of Tan[x] is ", F[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor's polynomial of Tan[x] of degree 5 is ", p2[x]];
A[x_, n_] = D[f[x], {x, n}];
A[c, n + 1]
S2[x_, c_] = x - x0n+1
n + 1 !
r = Limit[S2[x, c], n → Infinity, Assumptions → 0 < c < x]
If[r ⩵ 0,
Print["Lagrange's Remainder term is convergent to 0 and hence taylor's series
is convergent to f[x]=Tan[x]"]]
Taylor's Series of Tan[x] is 1.55741 + 3.42552 (x - 1.) +
5.33493 (x - 1.)2 + 9.4505 (x - 1.)3 + 16.4966 (x - 1.)4 + 28.9182 (x - 1.)5 + O[x - 1.]6
Taylor's polynomial of Tan[x] of degree 5 is
1 4 Tan[1]2
Tan[1] + (-1 + x) 1 + Tan[1]2  + (-1 + x)2 Tan[1] + Tan[1]3  + (-1 + x)3 + + Tan[1]4 +
3 3
2 Tan[1] 5 Tan[1]3 2 17 Tan[1]2
(-1 + x)4 + + Tan[1]5 + (-1 + x)5 + + 2 Tan[1]4 + Tan[1]6
3 3 15 15
- 1 + x1+n Tan(1+n) [c]
1 + n !

Lagrange's Remainder term is convergent


to 0 and hence taylor's series is convergent to f[x]=Tan[x]
6 8 Mrinal110918.nb

f[x_] = 1  1 - x ;
x0 = 0;
S2[x_] = Series[f[x], {x, x0, 10}];
Print["Taylor's Series of f[x] is ", S2[x]];
p2[x_] = Normal[S2[x]];
Print["Taylor's polynomial of f[x] of degree 10 is ", p2[x]];
A[x_, n_] = D[f[x], {x, n}];
A[c, n + 1]
S2[x_, c_] = x - x0n+1
n + 1 !
r = Limit[S2[x, c], n → Infinity, Assumptions → 1 > c > x]
Evaluate[r]
Ifr ⩵ 0,
Print"Lagrange's Remainder term is convergent to 0 and hence taylor's series
is convergent to f[x]=ⅇx ";
Taylor's Series of f[x] is 1 + x + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + O[x]11

Taylor's polynomial of f[x] of degree 10 is 1 + x + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10


1
x1+n ∂{c,1+n}
1-c

1 + n !
1
x1+n ∂{c,1+n}
1-c
Limit , n → ∞, Assumptions → 1 > c > x
1 + n !
1
x1+n ∂{c,1+n}
1-c
Limit , n → ∞, Assumptions → 1 > c > x
1 + n !

f[x_] = Exp- 1  x ^ 2


f '[x]
1
-
ⅇ x2

1
-
2ⅇ x2

x3

f ''[0]
1
Power::infy : Infinite expression encountered. 
02
Infinity::indet : Indeterminate expression ⅇComplexInfinity encountered. 
1
Power::infy : Infinite expression encountered. 
06
1
Power::infy : Infinite expression encountered. 
02
General::stop : Further output of Power::infy will be suppressed during this calculation. 

Infinity::indet : Indeterminate expression ⅇComplexInfinity encountered. 

Indeterminate

f[x_] = Piecewiseⅇ(-1/x^2) , x ≠ 0, {0, x ⩵ 0};


Print["f'[x] = ", D[f[x], {x, 1}]]
Print["f''[x] = ", D[f '[x], {x, 2}]]
Print["f'''[x] = ", D[f ''[x], {x, 3}]]
8 Mrinal110918.nb 7

1
-
2 ⅇ x2
f'[x] = x≠0
x3
0 True
1 1
- -
4 ⅇ x2 6 ⅇ x2
1 1 2 -
- - x6 x4
f''[x] = - 24 ⅇ7
x2
+ 24 ⅇ x2
+ x≠0
x x5 x3
0 True
f'''[x] =
1 1 1 1 1 1 1 1 1 1
- - - - - - - - - -
4 ⅇ x2 6 ⅇ x2 8 ⅇ x2 36 ⅇ x2 24 ⅇ x2 4 ⅇ x2 6 ⅇ x2 8 ⅇ x2 36 ⅇ x2 24 ⅇ x2
1 1 1 72 - 4 - + 72 - 6 - +
- - - x6 x4 x9 x7 x5 x6 x4 x9 x7 x5
1008 ⅇ x2 2064 ⅇ x2 720 ⅇ x2
- + - + + - x≠0
x11 x9 x7 x 7
x 6
x 5
x 4

0 True

OBSERVATION: Similariy fn (x) is also 0 hence Taylor series will become


0. So in this case there is non existence of Taylor series.

f[x_] = x ^ 3;
x1 = 1;
x2 = 5;
f2[x_] = D[f[x], {x, 2}];
Print["f''[x]= ", f2[x]];
a = Reduce[f ''[x] ≥ 0, {x}];
Print["f''[x]≥0 when ", a];
Print"Since x ∈ (1,5) ⇒ x>0 , therefore
f''[x] > 0 on (1,5). Hence, f[x]=x3 is CONVEX on (1,5)";
f[x2] - f[x1]
chord[x_] = f[x1] + * x - x1;
x2 - x1
Needs["PlotLegends`"];
Plot[{f[x], chord[x]}, {x, 1, 5}, PlotLegend → {"f(x)", "chord"},
PlotStyle → {{Blue, Thickness[0.01]}, {Thickness[0.01]}},
AxesStyle → Arrowheads[0.04], AxesLabel → {"x", "y"} ]
f''[x]= 6 x

f''[x]≥0 when x ≥ 0

Since x ∈ (1,5) ⇒ x>0 , therefore f''[x] > 0 on (1,5). Hence, f[x]=x 3 is CONVEX on (1,5)
y

100

80

60

40

20 f(x)

x
2 3 4
chord
8 8 Mrinal110918.nb

f[x_] = x ^ 3;
x1 = 1;
x2 = 5;
f2[x_] = D[f[x], {x, 2}];
Print["f''[x]= ", f2[x]];
a = Reduce[f ''[x] ≥ 0, {x}];
Print["f''[x]≥0 when ", a];
Print"Since x ∈ (1,5) ⇒ x>0 , therefore
f''[x] > 0 on (1,5). Hence, f[x]=x3 is CONVEX on (1,5)";
f[x2] - f[x1]
chord[x_] = f[x1] + * x - x1;
x2 - x1
Plot[{f[x], chord[x]}, {x, 1, 5},
PlotStyle → {{Magenta, Thickness[0.01]}, {Thickness[0.013]}},
AxesStyle → Arrowheads[0.04], AxesLabel → {"x", "y"} ]
f''[x]= 6 x

f''[x]≥0 when x ≥ 0

Since x ∈ (1,5) ⇒ x>0 , therefore f''[x] > 0 on (1,5). Hence, f[x]=x 3 is CONVEX on (1,5)
y

100

80

60

40

20

x
2 3 4

f[x_] = x ^ 3;
x1 = 1;
x2 = 5;
f2[x_] = D[f[x], {x, 2}];
Print["f''[x]= ", f2[x]];
a = Reduce[f ''[x] < 0, {x}]
Print["f''[x]≥0 when ", a];
Print"Since x ∈ (1,5) ⇒ x>0 , therefore
f''[x] > 0 on (1,5). Hence, f[x]=x3 is CONVEX on (1,5)";
f[x2] - f[x1]
chord[x_] = f[x1] + * x - x1;
x2 - x1
Needs["PlotLegends`"];
Plot[{f[x], chord[x]}, {x, 1, 5}, PlotLegend → {"f(x)", "chord"},
PlotStyle → {{Blue, Thickness[0.01]}, {Thickness[0.01]}},
AxesStyle → Arrowheads[0.04], AxesLabel → {"x", "y"} ]
f''[x]= 6 x
x<0
8 Mrinal110918.nb 9

f''[x]≥0 when x < 0

Since x ∈ (1,5) ⇒ x>0 , therefore f''[x] > 0 on (1,5). Hence, f[x]=x 3 is CONVEX on (1,5)
y

100

80

60

40

20 f(x)

x
2 3 4
chord

f[x_] = x ^ 3;
x1 = - 1;
x2 = 1;
f2[x_] = D[f[x], {x, 2}];
Print["f''[x]= ", f2[x]]
a = Reduce[f ''[x] ≥ 0, {x}];
Print["f''[x]≥0 when ", a];
Iff ''[x] ≥ 0, - 1 < x < 1,
Print"Since x ∈ (-1,1) ⇒ x⩾0 , therefore
f''[x] > 0 on (1,5). Hence, f[x]=x3 is CONVEX on (1,5)";
f[x2] - f[x1]
chord[x_] = f[x1] + * x - x1;
x2 - x1
Needs["PlotLegends`"];
Plot[{f[x], chord[x]}, {x, - 1, 1}, PlotLegend → {"f(x)", "chord"},
PlotStyle → {{Blue, Thickness[0.01]}, {Thickness[0.01]}},
AxesStyle → Arrowheads[0.04], AxesLabel → {"x", "y"} ]
f''[x]= 6 x

f''[x]≥0 when x ≥ 0
y

0.5

x
-1.0 -0.5 0.5

-0.5
f(x)

-1.0
chord
10 8 Mrinal110918.nb

f[x_] = x ^ 3;
a = Reduce[f ''[x] ≥ 0, {x}]

x≥0

You might also like