Final Solution
Final Solution
1. a) What are the steps of problem-solving in engineering? With a suitable example, briefly ex- 2+1
plain how numerical methods are used to solve an engineering problem. (CO2)
(PO1)
Solution:
The steps of problem-solving in engineering are —
4. Using the solution of the mathematical model to solve the original problem.
e.g. Let’s consider a kinematics problem. Given the initial velocity u and the height h
of a falling body, we can calculate the time t it needs to reach the ground by finding the
1
positive root of the equation ut + gt2 − h = 0 using a root-finding algorithm.
2
Solution:
We know, the Newton-Raphson method formula for solving f (x) = 0 is,
f (xi )
xi+1 = xi − ′
f (xi )
Suppose,
√k
x= R
⇒ xk = R
⇒ xk − R = 0
We take f (x) = xk − R and so f ′ (x) = kxk−1 .
Thus,
xk − R
xi+1 = xi − i k−1
kxi
kx − xki + R
k
= i k−1
kxi
(k − 1)xki + R
=
kxk−1
i
1 (k − 1)xki + R
=
k xik−1
1 R
= (k − 1)xi + k−1 □ Q.E.D.
k xi
Solution:
f1 (x) may look something like,
1.5 y
0.5
xl xroot xu x
3.5 4 4.5 5 5.5 6 6.5
−0.5
0.6 y
0.4
0.2
xl xroot xu x
0.2 0.4 0.6 0.8 1 1.2
−0.2
−0.4
ii. Apply the Secant method to estimate the value of the bronze ratio β. The initial guesses 11
are x−1 = 1.5 and x0 = 2. Demonstrating the step-by-step mathematical procedure, (CO2)
conduct 4 iterations, and find the relative approximate error (|ϵa |%) and the number of (PO1)
significant digits that are at least correct (m) at the end of each iteration. Draw Table 1
on your answer script and fill it out after performing the necessary calculations.
Solution:
After performing the series of calculations, we end up with the following table.
Iteration xi−1 xi xi+1 |ϵa |% m f (xi+1 )
1 1.5 2 8 75 0 39
2 2 8 2.428 229.41 0 −2.387
3 8 2.428 2.75 11.69 0 −1.687
4 2.428 2.75 3.524 21.98 0 0.849
Solution:
The Maclaurin series of a transcendental function is simply a Taylor series around the
point x = 0.
We know, dx d
(cosec(x)) = − cosec(x) cot(x), and cosec(0) = undefined. So we will get
undefined values for f (0) and f i (0).
1
Instead let’s consider, f (x) = cosec(x) = , and find the Maclaurin series of the
sin(x)
denominator g(x) = sin(x). Let’s calculate its derivatives at the point x = 0.
g(x) = sin(x), g(0) = 0
g ′ (x) = cos(x), g ′ (0) = 1
g ′′ (x) = − sin(x), g ′′ (0) = 0
g ′′′ (x) = − cos(x), g ′′′ (0) = −1
g ′′′′ (x) = sin(x), g ′′′′ (0) = 0
Solution:
π π
Let, x = and x + h = 2. This implies, h = 2 − x = 2 − = 0.4292.
2 2
π
Let’s calculate its derivatives at the point x = .
2π
f (x) = sin(x), f =1
2
π
f ′ (x) = cos(x), f ′ =0
2
π
f ′′ (x) = − sin(x), f ′′ = −1
2
π
f ′′′ (x) = − cos(x), f ′′′ =0
π 2
f ′′′′ (x) = sin(x), f ′′′′ =1
2
Using the first 5 terms of the Taylor series,
h h2 h3 h4
f (x + h) = f (x) + f ′ (x) + f ′′ (x) + f ′′′ (x) + f ′′′′ (x) + . . .
1! 2! 3! 4!
π
For x = ,
2
π π 2 3 4
′ π
h
′′ π h ′′′ π h ′′′′ π h
f +h =f +f +f +f +f + ...
2 2 2 1! 2 2! 2 3! 2 4!
π (0.4292)2 (0.4292)4
⇒f + 0.4292 = 1 + 0 − +0+ + ...
2 2! 4!
= 1 + 0 − 0.092106 + 0 + 0.00141393 + . . .
≈ 0.90931
Proof: Let us use proof by contradiction. If the polynomial is not unique, then at least
two polynomials of order n or less pass through the n + 1 data points.
Assume two polynomials Pn (x) and Qn (x) go through n + 1 data points (x0 , y0 ), (x1 , y1 ),
. . . , (xn , yn ). Then,
Rn (x) = Pn (x) − Qn (x)
Since Pn (x) and Qn (x) pass through all the n + 1 data points, we can say,
Pn (xi ) = Qn (xi ) ∀i ∈ {0, . . . , n}
Hence
Rn (xi ) = Pn (xi ) − Qn (xi ) ∀i ∈ {0, . . . , n}
⇒Rn (xi ) = 0
The nth order polynomial Rn (x) has n + 1 zeros. A polynomial of order n can have n + 1
zeros only if it is identical to a zero polynomial, that is,
Rn (x) ≡ 0
⇒Pn (x) ≡ Qn (x)
So, Pn (x) and Qn (x) must be the same unique polynomial, which contradicts our initial
assumption. □ Q.E.D.
Resistance, R Temperature, T
(Ω) (°C)
1101 25.113
911.3 30.131
636 40.12
451.1 50.128
Determine the value of the temperature T when the thermistor resistance is R = 754.8Ω
using the Newton’s Divided Difference method of interpolation and a second order polyno-
mial.
Solution:
The 2nd order NDD interpolant is —
T (R) = b0 + b1 (R − R0 ) + b2 (R − R0 )(R − R1 )
Given, R = 754.8Ω, and the 3 nearest data points that bracket it are, R0 = 911.3, R1 =
636, and R2 = 451.1. The corresponding T values are T (R0 ) = 30.131, T (R1 ) = 40.12,
and T (R2 ) = 50.128 respectively.
Now, let’s calculate the coefficients.
b0 = T (R0 ) = 30.131
T (R1 ) − T (R0 ) 40.12 − 30.131
b1 = = = −0.0362
R1 − R0 636 − 911.3
T (R2 ) − T (R1 ) T (R1 ) − T (R0 ) 50.128 − 40.12 40.12 − 30.131
− −
R2 − R1 R1 − R0
b2 = = 451.1 − 636 636 − 911.3 = 3.877 × 10−5
R2 − R0 451.1 − 911.3
Hence,
T (R) = b0 + b1 (R − R0 ) + b2 (R − R0 )(R − R1 )
= 30.131 − 0.0362(R − 911.3) + 3.877 × 10−5 (R − 911.3)(R − 636); 451.1 ≤ R ≤ 911.3
Now that we have the NDD interpolant, we can obtain the value of T (754.8).
T (754.8) = 30.131 − 0.0362(754.8 − 911.3) + 3.877 × 10−5 (754.8 − 911.3)(754.8 − 636)
≈ 35.075°C
Solution:
The residual error for each given data point is,
E i = y i − a0 − a1 x i
So the sum of the square of the residual errors is,
Xn Xn
2
Sr = Ei = (yi − a0 − a1 xi )2
i=1 i=1
To find the optimal a0 and a1 , we look for the values of a0 and a1 for which Sr is
the absolute minimum. At first, let’s do the first derivative test. Taking the partial
derivatives of Sr with respect to a0 and a1 and set them to zero.
n
∂Sr X
=2 (yi − a0 − a1 xi )(−1) = 0
∂a0 i=1
n
∂Sr X
=2 (yi − a0 − a1 xi )(−xi ) = 0
∂a1 i=1
Dividing both sides by 2 and expanding the summations in the aforementioned
equations,
n n n P P
i yi xi
X X X X X
− yi + a0 + a1 x i = 0 ⇒ − yi + na0 + a1 x i = 0 ⇒ a0 = − a1 i
i=1 i=1 i=1 i i
n n
For the 2nd equation, we perform substitution
n n n P P X
i yi xi
X X X X X
2
− yi xi + a0 x i + a1 x i = 0 ⇒ xi y i − − a1 i x i − a1 x2i = 0
i=1 i=1 i=1 i
n n i i
X P yi 2
P
X ( x
i i ) X
⇒ xi y i − xi i + a1 − a1 x2i = 0
n n
i !2
i
i
X X X
x i xi yi
i X i i
X
⇒ − x2i = − xi y i
n i
n i
X X X X
n xi y i − xi yi xi yi − nx̄ȳ
i i i i
⇒ a1 = !2 = X
X X x2i − nx̄2
n x2i − xi i
i i
Plugging in this expression for a1 to the previous equation,
X X X X
x2i yi − xi xi y i
i i i i
a0 = !2
X X
n x2i − xi
i i
Solution:
Let’s invoke the second derivative for this.
From the 1st-order partial derivatives in the last question, we get,
∂ 2 Sr X
= −2 −1 = 2n > 0; [2nd condition satisfied.]
∂a20 i
∂ 2 Sr X
=2 x2i > 0; [2nd condition satisfied.]
∂a21 i
2
∂ Sr X
=2 xi
∂a0 ∂a1 i
Now, let’s test the 1st condition of the second derivative test.
2 ! !2
∂ 2 Sr ∂ 2 Sr
2
∂ Sr X
2
X
− = (2n) 2 xi − 2 xi
∂a20 ∂a21 ∂a0 ∂a1 i i
!2
X X
= 4 n x2i − xi > 0; [1st condition satisfied.]
i i
So, the critical point (a0 , a1 ) obtained using the formulae corresponds to the absolute
minimum value of Sr .
b) Suppose you are given a set of n data points (x1 , y1 ), (x2 , y2 ), . . . , (xn , yn ) and you want to 5
regress the data to an mth order Polynomial model, where m < n. How would you choose (CO3)
a suitable value of m? (PO1)
Solution:
In order to choose a suitable value of m, we need to maintain a Bias-Variance tradeoff. If
the value of m is too high, the polynomial model will overfit the given n data points and
result in high variance. On the other hand, if the value of m is too small, the polynomial
model will underfit the given n data points and result in high bias.
c) Sodium borohydride (NaBH4 ) is an inorganic compound that can be used as fuel for fuel 8
cells. The Overpotential (η) vs Current (I) data depicted in Table 3 was obtained during a (CO2)
study conducted to assess its electrochemical kinetics. (PO1)
Overpotential, η Current, I
(V ) (A)
−0.29563 0.00226
−0.24346 0.00212
−0.19012 0.00206
−0.18772 0.00202
−0.13407 0.00199
−0.0861 0.00195
The relationship that exists between the overpotential (η) and current (I) can be represented
Solution:
Suppose, x = ln I and y = η. Then we can express the Tafel equation as a straight line
y = a + bx. We can now obtain the value of the parameters a and b using the linear
regression formulae,
X X X
n xi yi − xi yi
i i i
b= !2
X X
n x2i − xi
i i
a = ȳ − bx̄
Using
X the ln I and ηX values in the calculator,
X we find the following
X values,
2
xi = −37.0979, yi = −1.1371, xi = 229.3896, xi yi = 7.0116.
i i i i
Let’s plug these values into the formulae.
6 × 7.0116 − (−37.0979) × (−1.1371)
b= = −1.3601
6 × 229.3896 − (−37.0979)2
−1.1371 −37.0979
a= − (−1.3601) × = −8.5992
6 6
Plugging these values into the given Logarithmic model equation, we get,
η = −8.5992 − 1.3601 × ln I
5. a) i. Using the method of coefficients, derive the formula for the Single-segment Trapezoidal 7+6
rule. (CO3)
(PO1)
Solution:
Let’s consider the integral to be a weighted sum of the functional values at the two
limits a and b.
Z b
f (x)dx ≈ c1 f (a) + c2 f (b)
a
This weighted sum is exactly equal to the integral of the straight line
f1 (x) = a0 + a1 x = 0.
Z b b
x2
2
b − a2
(a0 + a1 x)dx = a0 x + a1 = a0 (b − a) + a1
a 2 a 2
We know that the straight line passes through the points (a, f (a)) and (b, f (b)). So
we can express the functional values as,
f (a) = a0 + a1 a
f (b) = a0 + a1 b
Then we can write the weighted sum as,
c1 (a0 + a1 a) + c2 (a0 + a1 b) =c1 a0 + c1 a1 a + c2 a0 + c2 a1 b
=a0 (c1 + c2 ) + a1 (c1 a + c2 b)
ii. Applying the formula from Question-5.a)(i), derive the formula for the Multi-segment
Trapezoidal rule.
Solution:
b−a
Taking a step size of h = , we break down the integral I into n integrals in the
n
following manner,
Z b
I= f (x)dx
a
Z a+h Z a+2h Z a+(n−1)h Z a+nh=b
= f (x)dx + f (x)dx + · · · + f (x)dx + f (x)dx
a a+h a+(n−2)h a+(n−1)h
f (a) + f (a + h) f (a + (n − 1)h) + f (b)
= [(a + h) − a] + · · · + [b − (a + (n − 1)h)]
2 2
f (a) + 2f (a + h) + · · · + 2f (a + (n − 1)h) + f (b)
=h
2
" ( n−1 ) #
h X
= f (a) + 2 f (a + ih) + f (b)
2 i=1
" ( n−1 ) #
b−a X
= f (a) + 2 f (a + ih) + f (b)
2n i=1
Solution:
The multiple-segment equation for Simpson’s 1/3 rule is
Z b n−1 n−2
b−a X X
f (x)dx ≈ f (x0 ) + 4 f (xi ) + 2 f (xi ) + f (xn )
a 3n i=1, i=2,
i=odd i=even
b−a 9−2
We have, a = 2, b = 9, n = 2, h = = = 3.5. We also know that the
n 2
distance function S(t) is the integration of the velocity function v(t). The distance
covered by the body is, therefore,
Z 9 2−1 2−2
9−2 X X
S= v(t)dt ≈ v(t ) + 4 v(t ) + 2 v(ti ) + v(tn )
0 i
2 3 × 2 i=1, i=2,
i=odd i=even
9−2
= × [v(t0 ) + 4v(t1 ) + v(t2 )]
3×2
= 1.1667 × [2 × 2 + 4 × 5 × 5.52 + 3 + 5 × 92 + 3]
= 1.1667 × [4 + 4 × 154.25 + 408]
= 1200.5 m
ii. Analytically determine the exact value of the covered distance (Sexact ) and use it to cal-
culate the true error (Et ) and the absolute relative true error (|ϵt |%).
Solution:
The exact value of the covered distance is,
Z 5 Z 9
Sexact = 2tdt + (5t2 + 3)dt
2 5
2 5 3 9
2t 5t
= + + 3t
2 2 3 5
= 1039.6667 m
The true error is,
Et = True Value − Approx. Value = 1039.6667 m −1200.5 m = −160.8333 m
The absolute relative true error is,
True Value − Approx. Value
|ϵt | = × 100% = 15.469%
True Value
6. a) Compare and contrast the following numerical algorithms for solving 1st-order ordinary 4
differential equations — Euler’s method, Runge-Kutta 2nd order method, and Runge-Kutta (CO3)
4th order method. (PO1)
Solution:
Any 2 valid comparisons will suffice. Some comparisons can be—
Criteria Euler Runge-Kutta 2nd Order Runge-Kutta 4th Order
yi+1 = yi +(a1 k1 +a2 k2 )h, k1 =
yi+1 = yi+1 = yi + (a1 k1 +
Formula f (xi , yi ), k2 =
yi + f (xi , yi )h a2 k2 + a3 k3 + a4 k4 )h
f (xi + ph, yi + qk1 h)
Terms of the
First 2 terms. First 3 terms. First 5 terms.
Taylor series
1st order — which
4th order — which is why
Order of the is why it’s also 2nd order — which is why it’s
it’s also called the
Taylor called the called the Runge-Kutta 2nd
Runge-Kutta 4th order
polynomial Runge-Kutta 1st order method.
method.
order method.
Local
Truncation O(h2 ) O(h3 ) O(h5 )
Error
Global
Truncation O(h) O(h2 ) O(h4 )
Error
Has 3 different versions – Has 2 different versions –
Variant
None. Heun’s method, Midpoint Runge’s approach and
Approaches
method, and Ralston’s method Kutta’s approach.
Solution:
Let’s rewrite the given integral as the solution of an ODE –
dy
= 6x3 ; y(5) = 0
dx
where y(8) gives us the value of the integral.
The Euler’s method formula is,
yi+1 = yi + f (xi , yi )h
In the 1st step, we have x0 = 5, y0 = 0, and given h = 1.5.
x1 = x0 + h = 5 + 1.5 = 6.5
y1 = y0 + f (x0 , y0 )h = 0 + f (5, 0) × 1.5
= 0 + (6 × 53 ) × 1.5 = 1125 ≈ y(6.5)
In the 2nd step, we have x1 = 6.5, y1 = 1125, and as before h = 1.5.
x2 = x1 + h = 6.5 + 1.5 = 8
y2 = y1 + f (x1 , y1 )h = 1125 + f (6.5, 1125) × 1.5
= 1125 + 6 × 6.53 × 1.5 = 3596.625 ≈ y(8)
Hence,
Z 8
6x3 dx = y(8) − y(5) ≈ 3596.625 − 0 = 3596.625
5
c) i. Determine the minimum number of significant digits in each of these numerical values 3+2
(CO4)
(a) 069420 (b) 6.94200 × 105 (c) 0.069420 (PO1)
(d) 69.00420 (e) 69.0 (f) 69420
Solution:
We need to determine the minimum number of significant digits.
(a) 069420 has 4 significant digits, since leading 0’s are not significant and trailing
0’s in an integer may or may not be significant.
(b) 6.94200 × 105 has 6 significant digits, since all digits of the significand/coeffi-
cient of a number’s representation using Scientific Notation are significant.
(c) 0.069420 has 5 significant digits, since leading 0’s are not significant and trail-
ing 0’s in a number with the decimal point are significant.
(d) 69.00420 has 7 significant digits, since 0’s between two significant non-zero
digits are significant and trailing 0’s in a number with the decimal point are
significant.
(e) 69.0 has 3 significant digits, since 0’s to the right of the decimal point are sig-
nificant.
(f) 69420 has 4 significant digits, since trailing 0’s in an integer may or may not
be significant.
Solution:
The orders and degrees of these higher-order ODEs are,
Solution:
The LU Decomposition can be done as follows,
6 18 3 R =− R1 +R 6 18 3 R =− 2R1 +R 6 18 3 R =− R2 +R 6 18 3
2 12 1 −−2−−−− 3 2 3
−−→ 0 6 0 −−−−−− 3 3 3
−−→ 0 6 0 −−−−−− 2 3
−−→ 0 6 0
E21 E31 E32
4 15 3 4 15 3 0 3 1 0 0 1
where,
1 0 0 1 0 0 1 0 0
Solution:
u3,4 − u1,4 8.4 − 8.1
(a) ux (x2 , y4 ) ≈ = = 0.3.
2h 2 × 0.5
u2,5 − u2,3 8.9 − 7.8
(b) uy (x2 , y4 ) ≈ = = 2.75.
2k 2 × 0.2
u3,4 − 2u2,4 + u1,4 8.4 − 2 × 8.3 + 8.1
(c) uxx (x2 , y4 ) ≈ 2
= = −0.4.
h 0.52
u2,5 − 2u2,4 + u2,3 8.9 − 2 × 8.3 + 7.8
(d) uyy (x2 , y4 ) ≈ 2
= = 2.5.
k 0.22
u3,5 − u3,3 − u1,5 + u1,3 9.1 − 9.0 − 8.4 + 7.5
(e) uxy (x2 , y4 ) ≈ = = −2.
4hk 4 × 0.5 × 0.2