binary tree representation
binary tree representation
2
Q1: Advanced Linear Algebra
(a) Finding Matrix C = P DP −1
Given matrices: " # " #
1 1 1 0
P = , D=
1 2 0 −1
1
" # " #
−1 2 −1 2 −1
P = =
det(P ) −1 1 −1 1
3. Compute C = (P D)P −1 :
" #" # " # " #
1 −1 2 −1 (1)(2) + (−1)(−1) (1)(−1) + (−1)(1) 3 −2
C= = =
1 −2 −1 1 (1)(2) + (−2)(−1) (1)(−1) + (−2)(1) 4 −3
(b) Inverse of C
The determinant is det(C) = (3)(−3) − (−2)(4) = −9 + 8 = −1.
1 1 −3 2
" # " # " #
−1 −3 2 3 −2
C = = =
det(C) −4 3 −1 −4 3 4 −3
(c) Matrix A = B + C
" #
1 4
Given B = , we calculate A:
−3 6
" # " # " # " #
1 4 3 −2 1+3 4−2 4 2
A=B+C = + = =
−3 6 4 −3 −3 + 4 6 − 3 1 3
3
(d) Cayley-Hamilton Theorem for Aπ
We want to compute Aπ using the Cayley-Hamilton theorem.
1. Find the characteristic equation of A:
" #
4−λ 2
det(A − λI) = det
1 3−λ
= (4 − λ)(3 − λ) − (2)(1)
= 12 − 4λ − 3λ + λ2 − 2
= λ2 − 7λ + 10 = 0
The eigenvalues are the roots: (λ − 2)(λ − 5) = 0 =⇒ λ1 = 2, λ2 = 5.
2. Express Aπ using the theorem: Since A satisfies its characteristic equation (A2 −7A+10I =
0), any analytic function f (A) can be expressed as a polynomial in A of degree less than n = 2.
Here, f (λ) = λπ , so we write:
Aπ = αA + βI
The eigenvalues must also satisfy this relationship:
λπ1 = αλ1 + β =⇒ 2π = 2α + β
λπ2 = αλ2 + β =⇒ 5π = 5α + β
3. Solve the system for α and β: Subtracting the first equation from the second:
5π − 2π
5π − 2π = (5α − 2α) + (β − β) = 3α =⇒ α =
3
Substituting α back into the first equation:
5 − 2π 3 · 2π − 2 · 5π + 2 · 2π 5 · 2π − 2 · 5π
π
β = 2 − 2α = 2 − 2
π π
= =
3 3 3
1 (4 · 5π − 2 · 5π ) + (−4 · 2π + 5 · 2π )
" #
2(5π − 2π )
=
3 (5 − 2 )
π π (3 · 5 − 2 · 5π ) + (−3 · 2π + 5 · 2π )
π
1 2 · 5π + 2π 2(5π − 2π )
" #
=
3 5π − 2π 5π + 2 · 2π
1 2 · 5π + 2π 2(5π − 2π )
" # " #
107.60 98.78
A =
π
≈
3 5 −2π π 5 +2·2
π π 49.39 58.21
4
Q2: Numerical Methods Analysis
(a) Finding Extrema Points Using Newton-Raphson Method
Given the function F (x) = x sin x + ex . Extrema occur where F ′ (x) = 0. We need the first and
second derivatives:
d
F ′ (x) = (x sin x + ex ) = (1) sin x + x(cos x) + ex = sin x + x cos x + ex
dx
d
F ′′ (x) = (sin x + x cos x + ex ) = cos x + [(1) cos x + x(− sin x)] + ex = 2 cos x − x sin x + ex
dx
The Newton-Raphson iteration for finding roots of F ′ (x) is:
F ′ (xn )
xn+1 = xn −
F ′′ (xn )
Parameters
5
Function Values at Nodes
The nodes are xi = a + ih for i = 0, 1, . . . , 5.
Trapezoidal Formula
The formula is I ≈ h2 [F (x0 ) + 2(F (x1 ) + F (x2 ) + F (x3 ) + F (x4 )) + F (x5 )].
0.3226
I≈ [1.9549 + 2(1.8408 + 1.5572 + 1.2182 + 0.9380) + 0.8248]
2
= 0.1613[1.9549 + 2(5.5542) + 0.8248]
= 0.1613[1.9549 + 11.1084 + 0.8248]
= 0.1613[13.8881]
≈ 2.2398
The approximate value of the integral using the Trapezoidal rule with n = 5 is:
Z −0.3635
(x sin x + ex ) dx ≈ 2.2398
−1.9765
6
Q3: Fourier Series
Given the function f (t) = t sin t defined for |t| ≤ π and periodic with period T = 2π. The
fundamental frequency is ω0 = 2πT = 1.
We approximate the integral I = 0π t sin t dt using Simpson’s 1/3 rule with n = 4 subintervals.
R
yi = f (ti ) = ti sin ti :
i ti yi = ti sin ti
0 0.0000 0.0000
1 π/4 ≈ 0.7854 0.5554
2 π/2 ≈ 1.5708 1.5708
3 3π/4 ≈ 2.3562 1.6661
4 π ≈ 3.1416 0.0000
a0 ≈ 1.0023
n=1 n=1
Rπ
We already know the exact value a0 = 1
π 0 t sin t dt = 1. The coefficients an for n ≥ 1 are given
by:
2 2 2
Z T /2 Z π Z π
an = f (t) cos(nω0 t) dt = t sin t cos(nt) dt = t sin t cos(nt) dt
T −T /2 2π −π π 0
Using the product-to-sum identity sin A cos B = 12 [sin(A + B) + sin(A − B)] with A = t, B = nt:
2 1
Z π
an = t · [sin((1 + n)t) + sin((1 − n)t)] dt
π 0 2
7
1
Z π
an = [t sin((n + 1)t) − t sin((n − 1)t)] dt
π 0
1 1 1 1
" #
π(−1)2
Z π
π
a1 = t sin(2t) dt = − = − =−
π 0 π 2 π 2 2
n=2
∞
1 −2(−1)n
f (t) = 1 − cos t + cos(nt)
X
2 n=2
n2 − 1
The full Fourier series expansion for f (t) = t sin t over |t| ≤ π is:
∞
1 (−1)n
f (t) = 1 − cos t − 2 cos(nt)
X
2 n=2
n2 − 1
8
Q4: Convolution Using Laplace Transform
A system consists of two subsystems.
The input to the total system is x(t) = u(t) (unit step function). Find the output y(t).
1 3 4 3 3 4 3
Y (s) = − + 2 = − +
s (s + 3) 2 s+3 s +9 s(s + 3) 2 s(s + 3) s(s + 9)
2
• A= 3
(s+3)2 s=0
= 3
9 = 1
3
• C= 3
s s=−3 = 3
−3 = −1
Term 2: 4
− s(s+3) = − As + s+3B
• A= 4
s+3 s=0 = 4
3
9
• B= 4
s s=−3 = 4
−3 = − 43
4/3 4/3
So, − s(s+3)
4
=− s − s+3 = − 4/3
s +
4/3
s+3 .
Term 3: 3
s(s2 +9)
= As + Bs+C
s2 +9
• A= 3
s2 +9 s=0
= 3
9 = 1
3
2/3 1 1 1 s
y(t) = L−1 {− } + L−1 { } − L−1 { } − L−1 { 2 }
s s+3 (s + 3) 2 3s +9
2 1
= − u(t) + e−3t u(t) − te−3t u(t) − cos(3t)u(t)
3 3
2 −3t 1
= − + (1 − t)e − cos(3t) u(t)
3 3
2 1
y(t) = − + (1 − t)e−3t − cos(3t) u(t)
3 3
10
Integral of sin(3t) is − 13 cos(3t). Integral of (3t − 4)e−3t requires integration by parts: u dv =
R
1 1
Z Z
(3t − 4)e−3t dt = (3t − 4)(− e−3t ) − (− e−3t )(3 dt)
3 3
1
Z
= − (3t − 4)e−3t + e−3t dt
3
1 1
= − (3t − 4)e−3t − e−3t
3 3
3t − 4 1 −3t + 4 − 1 3 − 3t
= e−3t − − = e−3t = e−3t = (1 − t)e−3t
3 3 3 3
11
Q5: Fourier Transform
Given the function f (t) for 0 ≤ t ≤ π and f (t) = 0 otherwise:
1
f (t) = 2 exp ln(4 cos2 t + 8t cos t + 4t2 )
2
Z π Z π Z π
−jωt −jωt
F (ω) = 4(cos t + t)e dt = 4 cos t e dt +4 t e−jωt dt
0 0 0
| {z } | {z }
I1 I2
Solving Integral I1
ejt +e−jt
Use Euler’s formula: cos t = 2 .
e + e−jt −jωt 1 π j(1−ω)t
Z π jt Z
I1 = e dt = (e + e−j(1+ω)t ) dt
0 2 2 0
Case ω 2 ̸= 1:
#π
1 ej(1−ω)t e−j(1+ω)t
"
I1 = +
2 j(1 − ω) −j(1 + ω) 0
1 ej(1−ω)π
−1 e −1
" #
−j(1+ω)π
= −
2j 1−ω 1+ω
1 (ejπ e−jωπ ) −1 (e−jπ e−jωπ ) − 1
" #
= − (since e±jπ = −1)
2j 1−ω 1+ω
1 −e−jωπ − 1 −e−jωπ − 1
" #
= −
2j 1−ω 1+ω
−(1 + e−jωπ ) 1 1
= −
2j 1−ω 1+ω
−(1 + e −jωπ ) (1 + ω) − (1 − ω)
=
2j 1 − ω2
−(1 + e−jωπ ) 2ω −ω(1 + e−jωπ ) jω(1 + e−jωπ )
= = =
2j 1 − ω2 j(1 − ω 2 ) 1 − ω2
12
Case ω = 1: I1 = 1 Rπ −2jt ) dt = 1 [π + e−2jπ −1 ]
2 0 (1 + e = 2 [π + 0] =2 . Case ω =
1 π
2 −2j −1:
2jπ jω(1+e−jωπ )
I1 = 12 0π (e2jt + 1) dt = 12 [ e 2j−1 + π] = 12 [0 + π] = π2 . Note that limω→±1 yields
R
1−ω 2
π/2
using L’Hopital’s rule.
Solving Integral I2
Use integration by parts: u dv = uv − v du. Let u = t =⇒ du = dt. Let dv = e−jωt dt =⇒
R R
−jωt
v = e−jω . Case ω ̸= 0:
#π
e−jωt e
" Z π −jωt
I2 = t − dt
−jω 0 0 −jω
1
!
πe−jωπ
Z π
= −0 + e−jωt dt
−jω jω 0
#π
jπe−jωπ 1 e
"
−jωt
= +
ω jω −jω 0
jπe−jωπ 1
= + 2 (e−jωπ − 1)
ω ω
Rπ 2 π2 jπ(1−jωπ+...)
Case ω = 0: I2 = 0 t dt = [ t2 ]π0 =
2 . Note that limω→0 I2 = limω→0 [ ω +
(1−jωπ−ω 2 π 2 /2+...)−1 −jωπ−ω 2 π 2 /2+... π2 π2
ω2
] = jπ
limω→0 [ ω + π + ... +
2
ω2
jπ
] = limω→0 [ ω + π − ω − 2 ] = 2 .
2 jπ
Limit matches.
For ω = 0:
Z π
F (0) = 4 (cos t + t) dt = 4[sin t + t2 /2]π0 = 4[(0 + π 2 /2) − (0 + 0)] = 2π 2
0
(There seems to be a calculation error in the original prompt’s special cases). Let’s recheck
F (0) from the combined formula limit - requires careful L’Hopital. Direct integration is safer.
I1 (ω = 0) = 0π cos tdt = [sin t]π0 = 0. I2 (ω = 0) = π 2 /2. So F (0) = 4(0) + 4(π 2 /2) = 2π 2 .
R
13
Q6: Inverse Laplace Transform
Find g(t) = L−1 {G(s)} where:
(s5 − 16s)(s + 4)
G(s) =
(s5 − 12s3 − 64s)(s3 − 64)
Denominator D(s):
√
12± 144−4(1)(−64)
Factor the quartic s4 − 12s2 − 64. Let u = s2 , then u2 − 12u − 64. Roots are 2 =
√ √
12± 144+256
2 = 12± 400
2 = 12±20
2 . So u = 16 or u = −4. Thus, s 4 − 12s2 − 64 = (s2 − 16)(s2 + 4) =
(s − 4)(s + 4)(s2 + 4). Substitute back into D(s):
Simplify G(s):
s(s − 2)(s + 2)(s2 + 4)(s + 4)
G(s) =
s(s − 4)2 (s + 4)(s2 + 4)(s2 + 4s + 16)
Cancel common factors s, (s + 4), and (s2 + 4) (assuming s ̸= 0, −4 and s2 ̸= −4).
(s − 2)(s + 2) s2 − 4
G(s) = =
(s − 4)2 (s2 + 4s + 16) (s − 4)2 (s2 + 4s + 16)
s2 − 4 A B Cs + D
G(s) = = + + 2
(s − 4) (s + 4s + 16)
2 2 s − 4 (s − 4)2 s + 4s + 16
Multiply by the denominator:
B(s2 + 4s + 16) + (Cs + D)(s2 − 8s + 16) s2 − 4 = A(s3 − 64) + B(s2 + 4s + 16) + (Cs3 − 8Cs2 +
16Cs + Ds2 − 8Ds + 16D) Group by powers of s:
14
• s3 : 0 = A + C
• s2 : 1 = B − 8C + D
• s1 : 0 = 4B + 16C − 8D
From (Eq 1), D = 3/4−8A. Substitute into (Eq 3): −1 = −8A+2(3/4−8A) = −8A+3/2−16A =
−24A + 3/2 −1 − 3/2 = −24A =⇒ −5/2 = −24A =⇒ A = 48 5
. Then C = −A = − 485
. And
D = 3/4 − 8(5/48) = 3/4 − 40/48 = 3/4 − 5/6 = (9 − 10)/12 = −1/12. Check with (Eq 2):
16(5/48) + 8(−1/12) = 5/3 − 8/12 = 5/3 − 2/3 = 3/3 = 1. Correct. So the decomposition is:
√ √
Now match the sine term: 1 1 √
8 (s+2)2 +(2 3)2 = 1 √1 2 3√
8 2 3 (s+2)2 +(2 3)2 = 1√ 2 3√
16 3 (s+2) +(2 3)2
2 =
√ √
48 (s+2)2 +(2 3)2 . The inverse transform of Term 3 is:
3 2 3√
√
−1 5 −2t √ 3 −2t √
L {Term 3} = − e cos(2 3t) + e sin(2 3t)
48 48
15
The inverse Laplace transform is:
1 h √ √ √ i
g(t) = (5 + 12t)e4t + e−2t ( 3 sin(2 3t) − 5 cos(2 3t)) u(t)
48
16
Q7: ODE via Laplace Transforms
Solve the ODE with zero initial conditions (y(0) = 0, y ′ (0) = 0):
1 1
y ′′ + 2y ′ + 2y = e−t sin2 t + sin 2t + u(t)
2 2
1 −(s + 1) + 2 1
= + +
2(s + 1) 2((s + 1)2 + 4) 2s
1 1−s 1
= + +
2(s + 1) 2(s2 + 2s + 5) 2s
17
Term 2: 1−s
2((s+1)2 +1)(s2 +2s+5)
= 2((s+1)2 +1)((s+1)
1−s
2 +4) Let X = (s + 1) . 2(X+1)(X+4) = X+1 + X+4 .
2 1−s A B
A = 2(X+4)
1−s
= 2(3)
1−s
= 1−s
6 . B = 2(X+1) X=−4 = 2(−3) = − 6 . So Term 2 = 6((s+1)2 +1) −
1−s 1−s 1−s 1−s
X=−1
−(s+1)+2 −(s+1)+2
1−s
6((s+1)2 +4)
= −
6((s+1)2 +1) 6((s+1)2 +4)
= − 1 s+1
+ 1 1
6 ((s+1)2 +1) 3 ((s+1)2 +1) − − 1 s+1
6 ((s+1)2 +4) + 1 1
3 ((s+1)2 +4)
= − 16 (s+1)
s+1
2 +1 + 1 1
2 + 1 s+1
6 (s+1)2 +4 − 1 1
3 (s+1)2 +4 Term 3: 1
2s((s+1)2 +1)
= 1
2s(s2 +2s+2)
=
3 (s+1) +1
1 1/2 1/2s+1 (s+1)+1
s − s2 +2s+2 = 4s − 4((s+1)2 +1) = 4s − 4((s+1)2 +1) = 4s − 4 (s+1)2 +1 − 4 (s+1)2 +1
1 s+2 1 1 1 s+1 1 1
2
18
Q8: State-Space Analysis Using Laplace Transforms
Given the LTI system ẋ = Ax + Bu, y = Cx with:
" #−1 " # " #
−1 − 23 1 h i 1
A= , B= , C = 2 −1 , u(t) = e −2t
, x(0) = .
0 − 13 1 −1
1 −1/3 2/3
" # " # " #
−1 −1/3 2/3 −1 2
A=M = =3 =
1/3 0 −1 0 −1 0 −3
1 1 1 + s+2
" # " # " # " #
1 1 s+3
x(0) + BU (s) = + = = s+2
−1 1 s+2 −1 + s+21 −s−1
s+2
1 s+3 2 −(s + 1)
X1 (s) = +
s+1 s+2 (s + 1)(s + 3) s+2
s+3 2
= −
(s + 1)(s + 2) (s + 2)(s + 3)
(s + 3)2 − 2(s + 1) s2 + 6s + 9 − 2s − 2 s2 + 4s + 7
= = =
(s + 1)(s + 2)(s + 3) (s + 1)(s + 2)(s + 3) (s + 1)(s + 2)(s + 3)
19
Step 5: Partial Fraction Decomposition
s2 +4s+7
For X1 (s): (s+1)(s+2)(s+3) = A
s+1 + B
s+2 + C
s+3
s2 +4s+7
• A= (s+2)(s+3) s=−1 = 1−4+7
(1)(2) = 4
2 =2
s2 +4s+7
• B= (s+1)(s+3) s=−2 = 4−8+7
(−1)(1) = 3
−1 = −3
s2 +4s+7
• C= (s+1)(s+2) s=−3 = 9−12+7
(−2)(−1) = 4
2 =2
−(s+1) −(−1)
• D= s+3 s=−2 = 1 =1
−(s+1) −(−2)
• E= s+2 s=−3 = −1 = −2
So, X2 (s) = 1
s+2 − s+3 .
2
The system is asymptotically stable as all eigenvalues (λ = −1, −3) lie in the left half
of the complex plane.
20
Q9: Numerical Methods - RK4
Solve the Initial Value Problem (IVP) using the Runge-Kutta 4th order (RK4) method:
d d 3t2
!
t3
h(t) = s(t) = − e−t = − (−e−t ) = t2 + e−t
dt dt 3 3
y ′ = y sin t + t2 + e−t
So, f (t, y) = y sin t + t2 + e−t . Initial condition: y(0) = 1. Step size h = 0.1. We need 5 steps to
reach t = 0.5.
k1 = hf (tn , yn )
k2 = hf (tn + h/2, yn + k1 /2)
k3 = hf (tn + h/2, yn + k2 /2)
k4 = hf (tn + h, yn + k3 )
1
yn+1 = yn + (k1 + 2k2 + 2k3 + k4 )
6
• Step 1: t0 = 0, y0 = 1 f (0, 1) = 1 sin 0 + 02 + e0 = 1 k1 = 0.1 × 1 = 0.1 f (0.05, 1 + 0.1/2) =
f (0.05, 1.05) = 1.05 sin 0.05 + 0.052 + e−0.05 ≈ 1.05(0.04998) + 0.0025 + 0.95123 ≈ 1.00621
k2 = 0.1 × 1.00621 = 0.100621 f (0.05, 1 + 0.100621/2) = f (0.05, 1.05031) = 1.05031 sin 0.05 +
0.052 + e−0.05 ≈ 1.05031(0.04998) + 0.0025 + 0.95123 ≈ 1.00622 k3 = 0.1 × 1.00622 = 0.100622
f (0.1, 1 + 0.100622) = f (0.1, 1.10062) = 1.10062 sin 0.1 + 0.12 + e−0.1 ≈ 1.10062(0.09983) + 0.01 +
0.90484 ≈ 1.02472 k4 = 0.1 × 1.02472 = 0.102472 y1 = 1 + 16 (0.1 + 2(0.100621) + 2(0.100622) +
0.102472) ≈ 1 + 0.100996 = 1.100996
• Step 2: t1 = 0.1, y1 ≈ 1.10100 (Using rounded value for next step) f (0.1, 1.10100) ≈
1.10100(0.09983) + 0.01 + 0.90484 ≈ 1.02476 k1 = 0.1 × 1.02476 = 0.102476 f (0.15, 1.10100 +
0.102476/2) = f (0.15, 1.15224) = 1.15224 sin 0.15 + 0.152 + e−0.15 ≈ 1.15224(0.14944) +
0.0225 + 0.86071 ≈ 1.05543 k2 = 0.1 × 1.05543 = 0.105543 f (0.15, 1.10100 + 0.105543/2) =
f (0.15, 1.15377) ≈ 1.05566 k3 = 0.1 × 1.05566 = 0.105566 f (0.2, 1.10100 + 0.105566) =
f (0.2, 1.20657) = 1.20657 sin 0.2 + 0.22 + e−0.2 ≈ 1.20657(0.19867) + 0.04 + 0.81873 ≈ 1.09843
k4 = 0.1×1.09843 = 0.109843 y2 = 1.10100+ 16 (0.102476+2(0.105543)+2(0.105566)+0.109843) ≈
1.10100 + 0.105753 = 1.206753
21
• Step 3: t2 = 0.2, y2 ≈ 1.20675 f (0.2, 1.20675) ≈ 1.09847 k1 = 0.109847 f (0.25, 1.20675 +
0.109847/2) = f (0.25, 1.26167) ≈ 1.15348 k2 = 0.115348 f (0.25, 1.20675 + 0.115348/2) =
f (0.25, 1.26442) ≈ 1.15416 k3 = 0.115416 f (0.3, 1.20675 + 0.115416) = f (0.3, 1.32217) ≈ 1.22155
k4 = 0.122155 y3 = 1.20675 + 16 (0.109847 + 2(0.115348) + 2(0.115416) + 0.122155) ≈ 1.20675 +
0.115484 = 1.322234
y(0.5) ≈ 1.6033
22
Q10: Frequency Response
An LTI system has impulse response h(t) = e−8t u(t). The input signal is:
πt
x(t) = 10 − 5 sin + 20 cos(πt)
2
Find the steady-state output y(t).
output is y(t) = k Ak |H(ωk )| cos(ω t + ϕk + ∠H(ωk )). First, express the input x(t) using only
P
k
cosines: x(t) = 10 + 5 cos πt2 + π
2 + 20 cos(πt). The input consists of three components with
frequencies ω0 = 0, ω1 = π/2, and ω2 = π.
1.25.
the original sine form: −5 sin(πt/2). The output is −5|H(π/2)| sin(πt/2 + ∠H(π/2)) ≈
−0.6133 sin(πt/2 − 0.1940).
23
Total System Output
Combine the output components:
πt
y(t) ≈ 1.25 − 0.6133 sin − 0.1940 + 2.327 cos(πt − 0.3745)
2
24
Q11: Fourier Series and Numerical Methods - Interpolation
Interpolate the function f (t) = e1−t through the points P1 (0, e1 ), P2 (0.5, e0.5 ), P3 (1, e0 = 1). Use
√
e ≈ 2.71828, e ≈ 1.64872. Points are (0, 2.71828), (0.5, 1.64872), (1, 1).
Numerical Coefficients
√
Let P2 (t) = At2 +Bt+C. A = 2e−4 e+2 ≈ 2(2.71828)−4(1.64872)+2 = 5.43656−6.59488+2 =
√
0.84168 B = −3e + 4 e − 1 ≈ −3(2.71828) + 4(1.64872) − 1 = −8.15484 + 6.59488 − 1 = −2.55996
C = e ≈ 2.71828
∞
f (t) ≈ a0 + an cos(2nπt)
X
n=1
Wait, the original prompt used cos(nπt), implying T = 2. Let’s assume the function is defined
on [0, 1] and we want its cosine series representation on this interval (implicitly extending it
evenly to [−1, 1]). Period T = 2, ω0 = 2π/2 = π.
∞
f (t) ≈ a0 + an cos(nπt)
X
n=1
25
Fourier Coefficients Calculation
#1
1
"
t3 t2
Z 1 Z 1
A B
a0 = P2 (t) dt = (At + Bt + C) dt = A + B + Ct
2
= + +C
1 0 0 3 2 0
3 2
2 1
Z Z 1
an = P2 (t) cos(nπt) dt = 2 (At2 + Bt + C) cos(nπt) dt
1 0 0
sin(nπt) 1
R1 h i
• 0 cos(nπt) dt = nπ = 0 for n ≥ 1.
0
cos(nπt) 1 (−1)n −1
h i
R1 t sin(nπt) cos(nπ) cos(0)
• 0 t cos(nπt) dt = nπ + (nπ)2 = (0 + (nπ)2
) − (0 + (nπ)2
) = (nπ)2
. This is 0
0
if n is even, and −2/(nπ)2 if n is odd.
2 sin(nπt) 1
h 2 i
t sin(nπt) 2t cos(nπt)
= (0 + 2(1)(nπ)
cos(nπ)
R1 2
• 0 t cos(nπt) dt = nπ + (nπ) 2 − (nπ) 3 2 − 0) − (0 + 0 − 0) =
0
2(−1)n
(nπ)2
.
So, for n ≥ 1:
Z 1 Z 1 Z 1
an = 2 A t cos(nπt) dt + B
2
t cos(nπt) dt + C cos(nπt) dt
0 0 0
2(−1)n (−1)n − 1
=2 A + B + C(0)
(nπ)2 (nπ)2
4A(−1)n + 2B((−1)n − 1)
=
(nπ)2
Numerical Coefficients
a0 = A3 + B2 + C ≈ 0.84168
3 + −2.55996
2 + 2.71828 ≈ 0.28056 − 1.27998 + 2.71828 ≈ 1.71886 For an :
If n is even (n = 2k), (−1)n = 1, (−1)n − 1 = 0.
k=1
k2 π2 k=1
(2k − 1)2 π 2
26
The quadratic interpolating polynomial is:
n=1
0.8417
(n/2)2 π 2
if n is even
where an = Or, written with index k:
6.8731
2 2
n π
if n is odd
∞ ∞
0.8417 6.8731
P2 (t) ≈ 1.7189 + cos(2kπt) + cos((2k − 1)πt)
X X
k=1
k2 π2 k=1
(2k − 1)2 π 2
∞ ∞
cos(2kπt) cos((2k − 1)πt)
P2 (t) ≈ 1.7189 + 0.0853 + 0.6962
X X
k=1
k2 k=1
(2k − 1)2
27