You are on page 1of 41

UNIVERSITY OF SOUTHERN MINDANAO

COLLEGE OF ENGINEERING AND INFORMATION TECHNOLOGY


KABACAN, COTABATO

EcE 224
Advanced Engineering Mathematics
for ECE

LABORATORY REPORT 2
Power Series

Rica G. Aniñon

Name
2/BSEcE/A

Submitted to:

CHENNEEMAE B. BANDOY
Faculty in Charge
EcE 224 | Advanced Engineering Mathematics for ECE

Intended Learning Outomes


By the end of this activity, you must be able to:
ILO 5 Describe infinite series, their concepts and properties (CO 1)
ILO 6 Test for divergence or convergence of infinite series (CO 2)
ILO 7 Describe power series, Taylor series and Maclaurin series (CO 1)
ILO 8 Derive power, Taylor and Maclaurin series representation of functions
(CO 2)
ILO 9 Solve for power series solution of differential equations (CO 2)

Introduction
One of the key ideas in mathematics is the concept of an infinite series. It
describes the total of a collection of illimitable numbers. The series is referred to as an
infinite series if it has infinite terms, and the sum of the first n terms, Sn, is referred to as
a partial sum of the specified infinite series. When the partial sum, or the sum of the first
n terms, Sn, is given a limit as n approaches infinity, the limit is referred to as the sum to
infinity of the series, and the outcome is known as the sum of infinite of series. An
infinite series that does not converge is said to diverge. In the case of divergence, no
value of a sum is assigned. For example, the nth partial sum of the infinite series 1 + 1 +
1 +⋯ is n. As more terms are added, the partial sum fails to approach any finite value (it
grows without bound). Thus, the series diverges. (Hosch, 2006).
A series containing words using a variable is referred to as a power series. More
specifically, if the variable is x, then powers of x are present in every term of the series.
A power series can be viewed as an endless polynomial as a result. Power series are
employed in both the representation and definition of new functions. This section
defines power series and demonstrates how to spot when a power series converges
and diverges. Additionally, we demonstrate the use of power series to express several
functions.A series of the form

∑ 𝑐𝑛𝑥𝑛 = 𝑐0 + 𝑐1𝑥 + 𝑐2𝑥2 + ⋯,


𝑛=0

where x is a variable and the coefficients 𝑐𝑛 are contants, is known as a power series.
The series

1 + 𝑥 + 𝑥 + ⋯ = ∑ 𝑥𝑛
2

𝑛=0
EcE 224 | Advanced Engineering Mathematics for ECE

is an example of a power series. Since this series is a geometric series with ratio 𝑟 = 𝑥,
we know that it converges if |𝑥| < 1 and diverges if |𝑥| ≥ 1.

Figure 1. For a series graph 𝑛=0 𝑐𝑛 (𝑥 − 𝑎)𝑛 (a) shows a radius of convergence
∑∞
at 𝑅 = 0 ,graph (b) shows a radius of convergence at 𝑅 = ∞, and graph (c) shows a
radius of convergence at R. For graph (c) we note that the series may or may not
converge at the endpoints 𝑥 = 𝑎 + 𝑅 𝑎𝑛𝑑 𝑥 = 𝑎 − 𝑅

Combining power series, multiplying power series, differentiating and integrating


power series based on terms, and having a unique power series are some of the
properties of the power series.

Here's where the Taylor and Maclaurin Series come into play. When we want to
define a function as a power series, the Taylor series and the Maclaurin series are
important.For a differentiable function, one can use Taylor polynomials to approximate
the function around any value. In other words, while using a Taylor series, you
presumptively know where to look for your function's derivatives. Although Taylor
polynomials have a somewhat unsightly appearance, they may be quickly used to
approximating functions if they are broken down into small sections.
EcE 224 | Advanced Engineering Mathematics for ECE

𝑓(𝑐) 𝑓 (𝑐)

𝑓′′(𝑐) 𝑓′′′(𝑐) 𝑓′′′′(𝑐) (𝑥 − 𝑐)4
𝑃 (𝑥) = + (𝑥 − 𝑐) + (𝑥 − 𝑐)2 (𝑥 − 𝑐)3
0! 1! 2! 3! 4!
+ +
𝑓′′′′′(𝑐)
+ 5! (𝑥 − 𝑐)5 …

around the point x=2.

The "a" in a Maclaurin series, on the other hand, is centered on the value of x =
0. Following Scottish mathematician Colin Maclaurin, the series bears his name.
Although you can use calculus to calculate Maclaurin series, there are already a lot of
series for common functions. The Maclaurin series and the expansion's sigma notation
are displayed in the following table, for instance, for five popular functions.

Table 1. Shows the Maclaurin series and the expansion sigma notation

Power series are practical tools that can be utilized in all engineering disciplines.
They can be used to evaluate intervals of convergence, solve equations, extend other
functions, and act as trial functionsAn important application of power series in the field
of engineering is spectrum analysis.In radio, audio, and light applications, it is very
useful to be able to receive a wide range of frequencies and be able to pinpoint which
frequencies are the loudest/brightest (Jake L, 2015).

Procedure
A. Creating a New M-File
After opening Matlab in my laptop, I clicked the “New Script” in the Menu bar.
Then I saved the file with a filename of Aninon_EcE224Lab2.m
EcE 224 | Advanced Engineering Mathematics for ECE

B. Infinite Series (ILO 5)


B.1. I entered the following code to determine the sum of the first 100 positive
integers: syms n
f(n)= n;
S=symsum(f(n),n,1,100);
strjoin({'Sum of first 100 positive integers is ',char(S)})

B.2. The output that was shown in the Command Window when I hit the run button
was as follows:
EcE 224 | Advanced Engineering Mathematics for ECE

>> Aninon_EcE224Lab2

ans =

'Sum of first 100 positive integers is 5050'

B.3 Prior to moving on to the next steps, I highlighted the preceding codes by clicking
CTRL + R to make them into comments. For the following questions, I then completed
steps B.1 and B.2, and the results are as follows:

a. First 100 even integers


Code:

syms n
f(n)=2*n
S=symsum(2*n,n,1,100);
strjoin({'Sum of first 100 positive integers is',char(S)})

Command Window Output:


>> Aninon_EcE224Lab2

f(n) =2*n

ans =
EcE 224 | Advanced Engineering Mathematics for ECE

'Sum of first 100 positive integers is 10100'

b. First 100 odd integers:


Code:

syms n
f(n)= 2*n-1
S=symsum(2*n-1,n,1,100);
strjoin({'Sum of first 100 odd integers is',char(S)})

Command Window Output:

>> Aninon_EcE224Lab2

f(n) =2*n - 1

ans =

'Sum of first 100 odd integers is 10000'

>>
EcE 224 | Advanced Engineering Mathematics for ECE

c. First 100 terms of the arithmetic sequence with a common difference of


1/2 Codes:

syms n
f(n)=(n+1)/2
S=symsum((n+1)/2,n,1,100);
strjoin({'Sum of first 100 terms of the arithmetic sequence with a common difference of
1/2 is',char(S)}

Command Window Output:


>> Aninon_EcE224Lab2

ans =

'Sum of first 100 terms of the arithmetic sequence with a common difference of 1/2 is
2575'
EcE 224 | Advanced Engineering Mathematics for ECE

d. First 100 terms of the geometric sequence with common ratio of 2

Codes:
syms n
f(n)=2^n;
S=symsum(2^n,n,1,100);
strjoin({'Sum of first 100 terms of the geometric sequence with a common ratio of 2
is',char(S)})

Command Window Output:


>> Aninon_EcE224Lab2

f(n) =2^n

ans =

'Sum of first 100 terms of the geometric sequence with a common ratio of 2 is
2535301200456458802993406410750'

>>
EcE 224 | Advanced Engineering Mathematics for ECE

e. First 100 terms of a harmonic sequence with a common difference of


3. Codes:
Command Window Output:

B.4. Before running this new code, I first highlighted the prior code and then used
CTRL+R to make the highlighted portions into comments. I entered the following code
to find the sum of the first 100 terms of the function 𝑓(𝑥) = 0 ∑𝑁 𝑥𝑛:

syms x n
f(n) = x^n;
S=symsum(f(n),n,0,99);
strjoin({'f(x) =',char(S)})

B.5. When I pressed the "run" button, the following results appeared in the Command
Window:
>> Aninon_EcE224Lab2

ans =

'f(x) = piecewise(x == 1, 100, x ~= 1, - 1/(x - 1) + x^100/(x - 1))'

>>

According to Wolfram MathWorld:


A piecewise function is a function that is defined on a sequence of intervals. A
common example is the absolute value,

−𝑥 𝑓𝑜𝑟 𝑥 < 0
|𝑥| = { 0 𝑓𝑜𝑟 𝑥 = 0
𝑥 𝑓𝑜𝑟 𝑥 > 0
EcE 224 | Advanced Engineering Mathematics for ECE

Piecewise functions are implemented in the Wolfram Language as


Piecewise[{{val1, cond1}, {val2, cond2}, ...}].
Additional piecewise functions include the Heaviside step function, rectangle
function, and triangle function.
Semicolons and commas are sometimes used at the end of either the left or the
right column, with particular usage apparently depending on the author. The words "if"
and "for" are sometimes used in the right column, as is "otherwise" for the final (default)
case.

B.6. I repeated step B.4 but this time I typed Inf in instead of 99 to modify the maximum
number of terms from 100 to infinity. Step B.5 was also repeated for the outcome.

syms x n
f(n) = x^n;
S =symsum(f(n),n,0,inf);
strjoin({'f(x) =',char(S)})
EcE 224 | Advanced Engineering Mathematics for ECE

>> Aninon_EcE224Lab2

ans =

'f(x) = piecewise(1 <= x, Inf, abs(x) < 1, -1/(x - 1))'

>>

C. Convergence (ILO 6)
C.1. Prior to continuing, I first highlighted the prior code and then used CTRL+R to turn it
1
into comments. Then, I discovered the initial ten terms of the function 𝑓(𝑛) = by
2𝑛
entering the codes below:
for n=1:10
F(n)=1/(2^n);
strjoin({' F(',num2str(n), ')= ', num2str(F(n))})
end

C.2. Afterward, I selected "run," and the following results appeared in the Command
Window:
>> Aninon_EcE224Lab2

ans =
' F( 2 )= 0.25'
' F( 1 )= 0.5'

ans =
ans =
EcE 224 | Advanced Engineering Mathematics for ECE

' F( 3 )= 0.125' ' F( 7 )= 0.0078125'

ans = ans =

' F( 4 )= 0.0625' ' F( 8 )= 0.0039063'

ans = ans =

' F( 5 )= 0.03125' ' F( 9 )= 0.0019531'

ans = ans =

' F( 6 )= 0.015625' ' F( 10 )= 0.00097656'

>>
ans =
EcE 224 | Advanced Engineering Mathematics for ECE

C.3. Using this table, I computed the ratio of the present to the past value 𝑓(𝑛) 𝑓(𝑛−1)
and the nth root of the present value 𝑛√𝑓(𝑛)
𝒏 𝒇(𝒏) 𝒇(𝒏) 𝒏
√𝒇(𝒏)
𝒇(𝒏 − 𝟏)
1 0.5 N/A 0.5
2 0.25 0.5 0.5
3 0.125 0.5 0.5
4 0.0625 0.5 0.5
5 0.03125 0.5 0.5
6 0.015625 0.5 0.5
7 0.0078125 0.5 0.5
8 0.0039063 0.5 0.5
9 0.0019531 0.5 0.5
10 0.00097656 0.5 0.5

C.4. Before running the new code, I first highlighted the original code and then used
CTRL+R to make the highlighted portions into comments. By entering the code below, I
was able to determin the sum of ∑𝑁 𝑓(𝑛) where 𝑓(𝑛) = at rising limit N:
1

0 2𝑛

clear; clc
for N=1:10
for n=1:N
f(n)=1/(2^n);
end
strjoin({' Sum(N = ',num2str(N), ') ',num2str(sum(f))})
end
EcE 224 | Advanced Engineering Mathematics for ECE

C.5 I clicked the run button, and the output in the Command Window were as follows:

' Sum(N = 4 ) 0.9375' 0.99219'


ans =

' Sum(N = 1 ) 0.5' ans = ans =

' Sum(N = 5 ) ' Sum(N = 8 ) 0.99609'


ans = 0.96875'

' Sum(N = 2 ) 0.75' ans =


ans =
' Sum(N = 9 ) 0.99805'
ans = ' Sum(N = 6 )
0.98438'
' Sum(N = 3 ) 0.875' ans =

ans = ' Sum(N = 10 ) 0.99902'


ans =
' Sum(N = 7 ) >>
EcE 224 | Advanced Engineering Mathematics for ECE

C.6. Using this table, I computed the difference between the present value of the sum
and the previous by subtracting the past value 𝑺𝒖𝒎(𝑵 − 𝟏) from the present value
𝑺𝒖𝒎(𝑵).
N 𝑆𝑢𝑚 (𝑁) 𝑆𝑢𝑚(𝑁) − 𝑆𝑢𝑚(𝑁 − 1)
1 0.5 N/A
2 0.75 1/4
3 0.875 1/8
4 0.9375 1/16
5 0.96875 1/32
6 0.98438 1/64
7 0.99219 1/128
8 0.99609 1/256
9 0.99805 1/512
10 0.99902 1/1024

C.7. I repeated steps C.1 to C.6 for the following functions:


1
a. 𝑓(𝑛) =
𝑛
Code:
for n=1:10
f(n)=1/(n);
strjoin({' F(',num2str(n), ')= ', num2str(f(n))})
end
EcE 224 | Advanced Engineering Mathematics for ECE

Command Window output:


>> ' F( 7 )=
Aninon_EcE224L ans = 0.14286'
ab2
' F( 4 )= 0.25'
ans = ans =

' F( 1 )= 1' ans = ' F( 8 )= 0.125'

' F( 5 )= 0.2'
ans = ans =

' F( 2 )= 0.5' ans = ' F( 9 )=


0.11111'
' F( 6 )=
ans = 0.16667'
ans =
' F( 3 )=
0.33333' ans = ' F( 10 )= 0.1'

>>
𝒏 𝒇(𝒏) 𝒇(𝒏) 𝒏
√𝒇(𝒏)
𝒇(𝒏 − 𝟏)
1 1 N/A 1
2 0.5 1/2 0.7071
3 0.33333 2/3 0.693
4 0.25 3/4 0.7071
5 0.2 4/5 0.7248
6 0.16667 5/6 0.7418
7 0.14286 6/8 0.7573
8 0.125 7/8 0.7711
9 0.11111 8/9 0.7838
10 0.1 9/10 0.7943

CODE:
clear; clc
for N=1:10
for n=1:N
f(n)=1/n;
end
strjoin({' Sum(N = ',num2str(N), ') ',num2str(sum(f))})
EcE 224 | Advanced Engineering Mathematics for ECE

end

Command Window Output:


ans = ' Sum(N = 4)
2.0833'
' Sum(N = 1 ) ans =
1'
ans = ' Sum(N = 8)
2.7179'
ans = ' Sum(N = 5)
2.2833'
' Sum(N = 2) ans =
1.5'
ans = ' Sum(N = 9)
2.829'
ans = ' Sum(N = 6)
2.45'
' Sum(N = 3) ans =
1.8333'
ans = ' Sum(N = 10 )
2.929'
ans = ' Sum(N = 7)
2.5929' >>
EcE 224 | Advanced Engineering Mathematics for ECE

N 𝑆𝑢𝑚 (𝑁) 𝑆𝑢𝑚(𝑁) − 𝑆𝑢𝑚(𝑁 − 1)


1 1 N/A
2 1.5 1/2
3 1.8333 1/3
4 2.0833 1/4
5 2.2833 1/5
6 2.45 1/6
7 2.5929 1/7
8 2.7179 1/8
9 2.829 1/9
10 2.929 1/10
1
b. 𝑓(𝑛) =
𝑛2
CODE:/
for n=1:10
f(n)=1/(n^2);
strjoin({' F(',num2str(n), ')= ', num2str(f(n))})
end
Command Window Output:
>> Aninon_EcE224Lab2
' F( 4 )= 0.0625' ans =
ans =
' F( 8 )= 0.015625'
' F( 1 )= 1' ans =

' F( 5 )= 0.04' ans =


ans =
' F( 9 )= 0.012346'
' F( 2 )= 0.25' ans =

' F( 6 )= 0.027778' ans =


ans =
' F( 10 )= 0.01'
' F( 3 )= 0.11111' ans =
>>
' F( 7 )= 0.020408'
ans =
EcE 224 | Advanced Engineering Mathematics for ECE

𝒏 𝒇(𝒏) 𝒇(𝒏) 𝒏
√𝒇(𝒏)
𝒇(𝒏 − 𝟏)
1 1 N/A 1
2 0.25 1/2 0.7071
3 0.11111' 2/3 0.693
4 0.0625 3/4 0.7071
5 0.04 4/5 0.7248
6 0.027778 5/6 0.7418
7 0.020408 6/8 0.7573
8 0.015625 7/8 0.7711
9 0.012346 8/9 0.7838
10 0.01 9/10 0.7943

CODE:
clear; clc
for N=1:10
for n=1:N
F(n)=1/(n^2);
end
strjoin({' Sum(N = ',num2str(N), ') ',num2str(sum(F))})
end

Command Window Output:


ans = ' Sum(N = 4)
1.4236'
' Sum(N = 1 ) ans =
1'
ans = ' Sum(N = 8)
1.5274'
ans = ' Sum(N = 5)
1.4636'
' Sum(N = 2) ans =
1.25'
ans = ' Sum(N = 9)
1.5398'
ans = ' Sum(N = 6)
1.4914'
' Sum(N = 3) ans =
1.3611'
ans = ' Sum(N = 10 )
1.5498'
ans = ' Sum(N = 7)
1.5118' >>
EcE 224 | Advanced Engineering Mathematics for ECE

N 𝑆𝑢𝑚 (𝑁) 𝑆𝑢𝑚(𝑁) − 𝑆𝑢𝑚(𝑁 − 1)


1 1 N/A
2 1.25 1/4
3 1.3611 1/9
4 1.4236 1/16
5 1.4636 1/25
6 1.4914 1/36
7 1.5118 1/49
8 1.5274 1/64
9 1.5398 1/81
10 1.5498 1/100

c. 𝑓(𝑛) = 𝑒𝑛

CODE:
for n=1:10
f(n)=(exp(n));
strjoin({' F(',num2str(n), ')= ', num2str(f(n))})
end

Command Window Output:


>> '(F7)= 0.00091188'
Aninon_EcE224L ans =
ab2
'F(4)= ans =
ans = 0.018316'
'F(8)=
' F(1 )= 0.00033546'
0.36788' ans =

'F(5)= ans =
ans = 0.0067379'
F(9)=
' F(2 )= 0.00012341'
0.13534' ans =

F(6)= ans =
ans = 0.0024788'
' F(10)= 4.54e-
'F(3)= 05'
0.049787' ans =
>>
EcE 224 | Advanced Engineering Mathematics for ECE

𝒏 𝒇(𝒏) 𝒇(𝒏) 𝒏
√𝒇(𝒏)
𝒇(𝒏 − 𝟏)
1 2.7183 N/A 2.7183
2 7.3891 2.7183 2.7183
3 20.0855 2.7183 2.7183
4 54.5982 2.7183 2.7183
5 148.4132 2.7183 2.7183
6 403.4288 2.7183 2.7183
7 1096.6332 2.7183 2.7183
8 2980.958 2.7183 2.7183
9 8103.0839 2.7183 2.7183
10 22026.4658 2.7183 2.7183

CODE:
clear; clc
for N=1:10
for n=1:N
F(n)=(exp(1)^n);
end
strjoin({' Sum(N = ',num2str(N), ') ',num2str(sum(F))})
end
Command Window Output:

' Sum(N = 4)
ans = 84.791' ans =

' Sum(N = 1) ' Sum(N = 8)


2.7183' ans = 4714.2241'

' Sum(N = 5)
ans = 233.2042' ans =

' Sum(N = 2) ' Sum(N = 9)


10.1073' ans = 12817.3081'

' Sum(N = 6)
ans = 636.633' ans =

' Sum(N = 3) ' Sum(N = 10 )


30.1929' ans = 34843.7738'

' Sum(N = 7) >>


ans = 1733.2661'
N 𝑆𝑢𝑚 (𝑁) 𝑆𝑢𝑚(𝑁) − 𝑆𝑢𝑚(𝑁 − 1)
1 2.7183 N/A
2 10.1073 e2
3 30.1929 e
3

4 84.791 e4
5 233.2042 e
5

6 636.633 e6
7 1733.2661 e
7

8 4714.2241 e8
9 12817.3081 e
9

10 34843.7738 e
10

1
d. 𝑓(𝑛) =
𝑛!
Code:
for n=1:10
F(n)=1/factorial(n);
strjoin({' F(',num2str(n), ')= ', num2str(F(n))})
end

Command Window Output:


>>
Aninon_EcE224L
ab2 ans = ans =

ans = ' F( 4 )= ' F( 7 )=


0.041667' 0.00019841'
' F( 1 )= 1'

ans = ans =
ans =
' F( 5 )= ' F( 8 )=
' F( 2 )= 0.5' 0.0083333' 2.4802e-05'

ans = ans = ans =

' F( 3 )= ' F( 6 )= ' F( 9 )=


0.16667' 0.0013889' 2.7557e-06'
EcE 224 | Advanced Engineering Mathematics for ECE

' F( 10 )= >>
ans = 2.7557e-07'

𝒏 𝒇(𝒏) 𝒇(𝒏) √𝒇(𝒏)


𝒏

𝒇(𝒏 − 𝟏)
1 1 N/A 1
2 0.5 0.5 0.5
3 0.16667 0.16667 0.16667
4 0.041667 0.041667 0.041667
5 0.0083333 0.0083333 0.0083333
6 0.0013889 0.0013889 0.0013889
7 0.00019841 0.00019841 0.00019841
8 2.4802e-05 2.4802e-05 2.4802e-05
9 2.7557e-06 2.7557e-06 2.7557e-06
10 2.7557e-07 2.7557e-07 2.7557e-07

Code:
clear; clc
for N=1:10
for n=1:N
F(n)=1/factorial(n);
end
strjoin({' Sum(N = ',num2str(N), ') ',num2str(sum(F))})
end

Command Window Output:

ans = ans =
ans =
' Sum(N = 1 ) 1' ' Sum(N = 4 )
1.7083' ' Sum(N = 7 )
1.7183'
ans =
ans =
' Sum(N = 2 ) 1.5' ans =
' Sum(N = 5 )
1.7167' ' Sum(N = 8 )
1.7183'
ans =

ans =
' Sum(N = 3 )
1.6667' ans =
' Sum(N = 6 )
1.7181' ' Sum(N = 9 )
1.7183'
EcE 224 | Advanced Engineering Mathematics for ECE

' Sum(N = 10 ) >>


ans = 1.7183'

N 𝑆𝑢𝑚 (𝑁) 𝑆𝑢𝑚(𝑁) − 𝑆𝑢𝑚(𝑁 − 1)


1 1 N/A
2 1.5 1/2
3 0.16667 1/6
4 1.7083 1/24
5 1.7167 1/120
6 1.7181 1/720
7 1.7183 1/5040
8 1.7183 1/40320
9 1.7183 1/362880
10 1.7183 1/3628800

D. Power Series (ILO 7 & 8)


D.1 Before running the new code, I first highlighted the original code and then used
CTRL+R to make the highlighted portions into comments. By entering the code below, I
was able to determine the Taylor Series representation of 𝑒 𝑧 :
EcE 224 | Advanced Engineering Mathematics for ECE

D.2. I clicked run and the output shown in the Command Window were as follows:
ans =

'Taylor expansion of f(z) using MATLAB function taylor()


exp(z0) + (exp(z0)*(z - z0)^2)/2 + (exp(z0)*(z - z0)^3)/6 + (exp(z0)*(z - z0)^4)/24 +
(exp(z0)*(z - z0)^5)/120 + exp(z0)*(z - z0)'

ans =

'Taylor Series expansion of f(z) using taylor series formula


exp(z0) + (1/ 1 !)*( exp(z0) )*(z-z0)^ 1 + (1/ 2 !)*( exp(z0) )*(z-z0)^ 2 + (1/ 3 !)*(
exp(z0)
)*(z-z0)^ 3 + (1/ 4 !)*( exp(z0) )*(z-z0)^ 4 + (1/ 5 !)*( exp(z0) )*(z-z0)^ 5 + (1/ 6 !)*( exp(z0)
)*(z-z0)^ 6 + (1/ 7 !)*( exp(z0) )*(z-z0)^ 7 + (1/ 8 !)*( exp(z0) )*(z-z0)^ 8 + (1/ 9 !)*( exp(z0)
)*(z-z0)^ 9 + (1/ 10 !)*( exp(z0) )*(z-z0)^ 10'

>>

D.3 Before proceeding, I highlighted the previous codes and pressed CTRL + R to turn
them into comments. This time, I determined the Maclaurin series representation of 𝑒 𝑧
by typing the following codes:

D.4 I clicked run, and the output in the Command Window were as follows:
EcE 224 | Advanced Engineering Mathematics for ECE

ans =

'Maclaurin Series expansion of f(z) using MATLAB function taylor() at z0=0


z + z^2/2 + z^3/6 + z^4/24 + z^5/120 + 1'

ans =

'Maclaurin Series expansion of f(z) using taylor expansion formula at z0=0


1 + (1/ 1 !)*( 1 )*z^ 1 + (1/ 2 !)*( 1 )*z^ 2 + (1/ 3 !)*( 1 )*z^ 3 + (1/ 4 !)*( 1 )*z^ 4 + (1/ 5
!)*( 1 )*z^ 5 + (1/ 6 !)*( 1 )*z^ 6 + (1/ 7 !)*( 1 )*z^ 7 + (1/ 8 !)*( 1 )*z^ 8 + (1/ 9 !)*( 1 )*z^ 9
+ (1/ 10 !)*( 1 )*z^ 10'

>>

D.5. I modifed 𝑓(𝑧) in step D.3 and repeated step D.4 for the following functions:

a. f(z) = 1/(1-z)

Command Window Output:


ans =

'Maclaurin Series expansion of f(z) using MATLAB function taylor() at z0=0


EcE 224 | Advanced Engineering Mathematics for ECE

z + z^2 + z^3 + z^4 + z^5 + 1'

ans =

'Maclaurin Series expansion of f(z) using taylor expansion formula at z0=0


1 + (1/ 1 !)*( 1 )*z^ 1 + (1/ 2 !)*( 2 )*z^ 2 + (1/ 3 !)*( 6 )*z^ 3 + (1/ 4 !)*( 24 )*z^ 4 + (1/
5 !)*( 120 )*z^ 5 + (1/ 6 !)*( 720 )*z^ 6 + (1/ 7 !)*( 5040 )*z^ 7 + (1/ 8 !)*( 40320 )*z^ 8 + (1/
9 !)*( 362880 )*z^ 9 + (1/ 10 !)*( 3628800 )*z^ 10'

>>

b. f(z)=ln(z+1)

Command Window Output:


ans =

'Maclaurin Series expansion of f(z) using MATLAB function taylor() at z0=0


z - z^2/2 + z^3/3 - z^4/4 + z^5/5'

ans =
EcE 224 | Advanced Engineering Mathematics for ECE

'Maclaurin Series expansion of f(z) using taylor expansion formula at z0=0


0 + (1/ 1 !)*( 1 )*z^ 1 + (1/ 2 !)*( -1 )*z^ 2 + (1/ 3 !)*( 2 )*z^ 3 + (1/ 4 !)*( -6 )*z^ 4 + (1/
5 !)*( 24 )*z^ 5 + (1/ 6 !)*( -120 )*z^ 6 + (1/ 7 !)*( 720 )*z^ 7 + (1/ 8 !)*( -5040 )*z^ 8 + (1/ 9
!)*( 40320 )*z^ 9 + (1/ 10 !)*( -362880 )*z^ 10'

>>

c. f(z)=sinz

Command Window Output:


ans =

'Maclaurin Series expansion of f(z) using MATLAB function taylor() at z0=0


z - z^3/6 + z^5/120'

ans =

'Maclaurin Series expansion of f(z) using taylor expansion formula at z0=0


EcE 224 | Advanced Engineering Mathematics for ECE

0 + (1/ 1 !)*( 1 )*z^ 1 + (1/ 2 !)*( 0 )*z^ 2 + (1/ 3 !)*( -1 )*z^ 3 + (1/ 4 !)*( 0 )*z^ 4 + (1/ 5
!)*( 1 )*z^ 5 + (1/ 6 !)*( 0 )*z^ 6 + (1/ 7 !)*( -1 )*z^ 7 + (1/ 8 !)*( 0 )*z^ 8 + (1/ 9 !)*( 1 )*z^ 9
+ (1/ 10 !)*( 0 )*z^ 10'

>>

d. f(z) = cosz

Command Window Output:


ans =

'Maclaurin Series expansion of f(z) using MATLAB function taylor() at z0=0


z^4/24 - z^2/2 + 1'

ans =

'Maclaurin Series expansion of f(z) using taylor expansion formula at z0=0


1 + (1/ 1 !)*( 0 )*z^ 1 + (1/ 2 !)*( -1 )*z^ 2 + (1/ 3 !)*( 0 )*z^ 3 + (1/ 4 !)*( 1 )*z^ 4 + (1/ 5
!)*( 0 )*z^ 5 + (1/ 6 !)*( -1 )*z^ 6 + (1/ 7 !)*( 0 )*z^ 7 + (1/ 8 !)*( 1 )*z^ 8 + (1/ 9 !)*( 0 )*z^ 9
+ (1/ 10 !)*( -1 )*z^ 10'
EcE 224 | Advanced Engineering Mathematics for ECE

>>

e. f(z)=sinhz

Command Window Output:

ans =

'Maclaurin Series expansion of f(z) using MATLAB function taylor() at z0=0


z + z^3/6 + z^5/120'

ans =

'Maclaurin Series expansion of f(z) using taylor expansion formula at z0=0


0 + (1/ 1 !)*( 1 )*z^ 1 + (1/ 2 !)*( 0 )*z^ 2 + (1/ 3 !)*( 1 )*z^ 3 + (1/ 4 !)*( 0 )*z^ 4 + (1/ 5
!)*( 1 )*z^ 5 + (1/ 6 !)*( 0 )*z^ 6 + (1/ 7 !)*( 1 )*z^ 7 + (1/ 8 !)*( 0 )*z^ 8 + (1/ 9 !)*( 1 )*z^ 9
+ (1/ 10 !)*( 0 )*z^ 10'

>>
f. f(z)=coshz
EcE 224 | Advanced Engineering Mathematics for ECE

Command Window Output:

ans =

'Maclaurin Series expansion of f(z) using MATLAB function taylor() at z0=0


z^2/2 + z^4/24 + 1'

ans =

'Maclaurin Series expansion of f(z) using taylor expansion formula at z0=0


1 + (1/ 1 !)*( 0 )*z^ 1 + (1/ 2 !)*( 1 )*z^ 2 + (1/ 3 !)*( 0 )*z^ 3 + (1/ 4 !)*( 1 )*z^ 4 + (1/ 5
!)*( 0 )*z^ 5 + (1/ 6 !)*( 1 )*z^ 6 + (1/ 7 !)*( 0 )*z^ 7 + (1/ 8 !)*( 1 )*z^ 8 + (1/ 9 !)*( 0 )*z^ 9
+ (1/ 10 !)*( 1 )*z^ 10'

>>

E. Power Series DE Solution (ILO 9)

E.1. In this activity, instead of using MATLAB application in my mobile phone, I used my
pc. But before proceeding, I highlighted first the the previous codes and clicked CTRL +
C to turn them into comments. Then, I typed the following line of codes.
EcE 224 | Advanced Engineering Mathematics for ECE

E.2 I clicked the run button, and the output shown in the Command Window were as
follows:
>> Aninon_EcE224Lab2

ans =

C1*exp(x)

>>

E.3. As usual, before proceeding, I highlighted the previous codes and then pressed
CTRL+ R to turn them into comments. Then I modified the code in step E.1 to solve for
the power series solution of the differential equation by replacing the last line with the
following code:
EcE 224 | Advanced Engineering Mathematics for ECE

E.4. I clicked the run button, and the output in the Command Window were as follows:
>> Aninon_EcE224Lab2

ans =

C2*exp(ExpansionPoint)

>>

E.5. After highlighting the previous codes and turning them into comments by pressing
CTRL + R, I repeated the code in step E.1 this time with modification to solve for 𝑦
′′ + 𝑦 = 0. To find the second derivative 𝑦′′, use the following code:

E.6. After that, I clicked run and the output in the Command Windows shows:
>> Aninon_EcE224Lab2

ans =

C3*cos(x) - C4*sin(x)

>> E.7. I turn the previous codes again into comments by highlighting it and pressing
CTRL + C. After that, I modified the code in step E.5 to solve for the power series
solution of the differential equation by replacing the last line with the following code:
EcE 224 | Advanced Engineering Mathematics for ECE

E.8. I clicked the run button and the result in the Command Window were as follows:
>> Aninon_EcE224Lab2

ans =

C5*cos(ExpansionPoint) - C6*sin(ExpansionPoint)

>>
E.9 I repeated steps E.5 to E.8 for the following differential equations:
a. 𝑦 ′′ − 2𝑦′ + 𝑦 = 0

Code:
syms y(x)
d2y = diff(y,x,2);
ode = d2y-2*dy+y == 0;
dsolve(ode)

Command Window output:


>> Aninon_EcE224Lab2

ans =

C7*exp(x) + C8*x*exp(x)

>>
EcE 224 | Advanced Engineering Mathematics for ECE

Code:
syms y(x)
d2y = diff(y,x,2);
ode = d2y-2*dy+y == 0;
dsolve(ode,'ExpansionPoint')

Command Window output:


>> Aninon_EcE224Lab2

ans =

C7*exp(x) + C8*x*exp(x)

>> Aninon_EcE224Lab2

ans =

C9*exp(ExpansionPoint) + C10*ExpansionPoint*exp(ExpansionPoint)

>>
b. 𝑦 ′′ − 7𝑦′ = 0
Code:
syms y(x)
d2y = diff(y,x,2);
ode = d2y-(7*dy)== 0;
dsolve(ode)

Command Window:
>> Aninon_EcE224Lab2

ans =

C11 + C12*exp(7*x)

>>

Code:
syms y(x)
d2y = diff(y,x,2);
ode = d2y-(7*dy)== 0;
EcE 224 | Advanced Engineering Mathematics for ECE

dsolve(ode,'ExpansionPoint')

Command Window Output:


>> Aninon_EcE224Lab2

ans =

C13 + C14*exp(7*ExpansionPoint)

>>
c. 2𝑦 ′′ − 𝑦 = 0
Code:
syms y(x)
d2y = diff(y,x,2);
ode = 2*d2y-dy == 0;
dsolve(ode)

Command Window:
>> Aninon_EcE224Lab2

ans =

C15 + C16*exp(x/2)

>>
Code:
syms y(x)
d2y = diff(y,x,2);
ode = 2*d2y-dy == 0;
dsolve(ode,'ExpansionPoint')

Command Window Output:


>> Aninon_EcE224Lab2

ans =

C17 + C18*exp(ExpansionPoint/2)

>>
EcE 224 | Advanced Engineering Mathematics for ECE

d. 𝑦 ′′ + 𝑦 ′ − 𝑦 = 0
Code:
syms y(x)
d2y = diff(y,x,2);
ode = d2y+dy-y == 0;
dsolve(ode)

Command Window output:


>> Aninon_EcE224Lab2

ans =

C19*exp(-x*(5^(1/2)/2 + 1/2)) + C20*exp(x*(5^(1/2)/2 - 1/2))

>>
Code:
syms y(x)
d2y = diff(y,x,2);
ode = d2y+dy-y == 0;
dsolve(ode,'ExpansionPoint')

Command Window Output:


>> Aninon_EcE224Lab2

ans =

C21*exp(-ExpansionPoint*(5^(1/2)/2 + 1/2)) + C22*exp(ExpansionPoint*(5^(1/2)/2


- 1/2))

>>

Guide Questions
1. What are the common properties of infinite series that you have observed? (ILO 5)
In this laboratory activity, the following properties of the infinite series that I
have observed are: nth Term property of a Convergent infinite series, Basic
Summation/Product properties of infinite Series, and Reindexing an Infinite
Series.

2. Explain what does the table in C.3 and C.6 show about the series? (ILO 6)
The table in the C.3 shows that the result of f(n) approaches to zero. On the other
hand, the table in the C.6. shows that the result of f(n) approaches to 1.
EcE 224 | Advanced Engineering Mathematics for ECE

3. Determine if the different series in C.7 with given 𝑓(𝑛) converge or diverge by
explaining the result in the table in C.3 and C.6. (ILO 6)
In C7, we can say that the result converges or diverges depending on its result. If
L<1, then the series converges; if L>1, the series diverges; and if L=1, the series
may diverge or converge.

4. What are the common properties of power series that you have observed? (ILO 7)
The common properties of power series that I have observed in this
laboratory activity are: Combining power series, Multiplication of power series,
and differentiation of power series.
5. In part D, Compare the results using MATLAB function taylor () with using the
taylor series formula. What are the advantage and the disadvantage of using the
MATLAB built-in function versus implementing manually the code from the given
mathematical formula? (ILO 8)
Using the MATLAB function makes it easier and faster than the manual
solving since you have to do the step-by-step process in the manual solving
which will take too much of your time.

6. What are the advantage and disadvantage of expressing complex and


transcendental functions into its power series representation? (ILO 8)
Complex transcendental functions are more complicated to see. I myself
gets worried every time I see functions that looks like this one. But with the power
series, it may look easier.

7. Compare the solution of differential equations using direct methods and using
power series. What are the advantage and disadvantage of using one to that of
the other? (ILO 9)

For me, using direct method in solving differential equations is faster


because I’m more familiar in that way, while the power series takes more time for
me since I’m still not used to doing it.

8. Share your experiences in this laboratory activity? What new learnings or interest
did you gain? What challenges and problems did you encounter?

In this laboratory activity I encountered a lot of problems since most of the codes
had errors and we must find ways to decode it. Since I still don’t have a background in
MATLAB programming, I’m still having a hard in understanding it’s function. But thanks
to uncle Google because he gave me answers to the things that I don’t know. But even
though I am having a hard time in coding, I still enjoy doing it because I learned a lot of
things and it also made me explore a lot of things on my own.
EcE 224 | Advanced Engineering Mathematics for ECE

Conclusion
In this lab exercise, we can claim that there are many different kinds of infinite
series, including arithmetic, geometric, and harmonic series. In addition, depending on
their pattern, they have various equations. Additionally, we can add that every power
series has a possibility for the series to diverge or converge. Furthermore, the Taylor
Series is the generalization of the Maclaurin Series. Thus, we can argue that anything
can be related and even the differential problem may be solve using power series. This
project was quite interesting because it allowed me to explore and discover more about
MATLAB's capabilities and functions.

Documentation
EcE 224 | Advanced Engineering Mathematics for ECE

References:

BYJU’S (2023). Infinite Series Formula. Retrieved from. Infinite Series Formula | Sum
Of Infinite Series Formula (Algebra) (byjus.com)

Britannica, T. Editors of Encyclopaedia (2012, March 1). infinite series. Encyclopedia


Britannica. https://www.britannica.com/science/infinite-series

Seb (December 21, 2020). Power Series: Understand the Taylor and MacLaurin Series.
Retrived from. https://programmathically.com/power-series-maclaurin-taylor-series/

Statistics Howto (2023). Taylor Series & Maclaurin Series with Examples. Retrieved
from. https://www.statisticshowto.com/sequence-and-series/taylor-series-maclaurin-
series/#google_vignette

Strang, G. S., & Herman, Edwin “Jed”. (2006, March 30). Calculus Volume 2. Retrieved
from https://openstax.org/books/calculus-volume-2/pages/6-1-power-series-and-
functions

Jake L. (January, 15, 2015). What are the applications of power series in mechanical
engineering? Retrieved from. https://socratic.org/questions/what-are-the-applications-of-
power-series-in-mechanical-engineering

Weisstein, Eric W. "Piecewise Function." From MathWorld--A Wolfram Web Retrived


from. https://mathworld.wolfram.com/PiecewiseFunction.html

You might also like