0% found this document useful (0 votes)
58 views21 pages

Mid - Sem Soln

The mid-semester exam for ESO 208A covers computational methods and consists of 4 composite questions worth a total of 100 marks over 135 minutes. Questions involve numerical methods like Newton-Raphson, bisection, LU decomposition, and inverting matrices. Students are instructed to show steps, use only allowed calculators, and report numbers to 4 significant figures.

Uploaded by

yhjkl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views21 pages

Mid - Sem Soln

The mid-semester exam for ESO 208A covers computational methods and consists of 4 composite questions worth a total of 100 marks over 135 minutes. Questions involve numerical methods like Newton-Raphson, bisection, LU decomposition, and inverting matrices. Students are instructed to show steps, use only allowed calculators, and report numbers to 4 significant figures.

Uploaded by

yhjkl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Mid-semester Exam 2019-20-I

ESO 208A: Computational Methods in Engineering

September 19, 2019 Venue: L17-20 Max marks: 100 Duration: 135 min

NOTE: 1. There are FOUR composite questions, each comprising of 3-4 problems. Marks for each
problem are shown in parenthesis in bold. You need to show how you arrived at a number using the
algorithm. Only showing the final numbers will be interpreted as being copied from a neighbour and
no marks will be awarded.
2. No credit will be given for solving by any other method than asked. If you think a method is not
specified, make necessary assumptions and state them appropriately.
3. Only one scientific calculator is allowed. Programmable calculators are NOT allowed. If a
programmable calculator is found in your possession, you will get F grade in the course and the
matter will be reported to SUGC.
4. Report numbers upto 4 significant digits (significance defined as per floating point representation)
for all results and intermediate steps with rounding. However, actual computations can be performed
using infinite precision.

Q1) (a) In Newton-Raphson Method, determine the condition for the switching of roots in
terms of function 𝑓(𝑥) and its derivative 𝑓′(𝑥) at points 𝑥𝑘 and 𝑥𝑘+1 as shown in the figure
below (4)

Sol:

0.5

0.5

1+1
For
calculations
and final
answer
𝑥 2
(b) Find a root of 𝑓 (𝑥 ) = ( ) − sin(𝑥). For this, first use Bisection method and
2
perform 3 iterations. Next, use Secant method with the latest available estimates of x to
find the root of f(x) to an approximate error of 𝜀𝑎 ≤ 0.01 %. Take starting values 1.5
and 2 for the Bisection method and show all steps including errors. (4+6)

Problem 1b .
True Value 1.93375496

Start with Bisection Method


Iteration x f(x)=(x/2)2-sinx ea(% )

1.5 -0.4350 <0 Mid-point


2 0.09070 >0
1 1.75 -0.2184 14.29 1 mark for 1st step with explicit or implict use of formula
(iteration is complete after
2 1.875 -0.07518 6.667 one computes a new x and 0.5*3 marks
3 1.938 0.0050 3.226 the corresponding rel error) 0.5*3 marks
Continue with Secant Method after three iterations
(from 1.875 -0.07518 1 mark for Secant recursive relation
above) 1.938 0.0050
4 1.934 -0.000163 0.200 2 mark
5 1.934 0.00000 0.00638 1 mark for step

1.934 0.006383 (correct final Ans to four sig digits with error) 2 marks
(c) If α is a root of multiplicity m, derive the following relationship for the Newton-Raphson
method taking 𝑓(𝑥) = (𝑥 − 𝛼)𝑚 𝑔(𝑥); 𝑔(𝛼) ≠ 0 and assuming lim 𝑥𝑛 = 𝛼
𝑛→∝
|𝜀𝑛+1 | 1
lim =1− (6)
𝑛→∞ |𝜀𝑛 | 𝑚

0.5 for NR expression

1 for subtracting α on
both sides

0.5
n n

0.5

0.5 for application of


limit

1 for final expression


Find the root of the function, 𝑓(𝑥) = 𝑥 4 − 2𝑥 3 + 2𝑥 − 1, having a multiplicity m = 3
using modified Newton-Raphson method. Take starting value 𝑥0 = 0 and solve up to 5
iterations, computing error at each iteration. (4)

Iteration x f(x) f'(x) ea(%)


0 -1 2
1 1.5 0.3125 2 100 0.5
2 1.031 6.199E-05 5.981E-03 45.45 1
3 1.000 8.107E-12 1.525E-07 3.10856 1
4 1.000 0.000000 0.00000 0.015943
0.5

(d) What is the percentage error if 625.483 is approximated to 3 significant digits? (1)

True value = 625.483; Approximate value = 625 (to 3 significant digits)

𝑇𝑟𝑢𝑒 𝑉𝑎𝑙𝑢𝑒 − 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒 𝑉𝑎𝑙𝑢𝑒 625.483 − 625


𝑃𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒 𝐸𝑟𝑟𝑜𝑟 = = 𝑥100
𝑇𝑟𝑢𝑒 𝑉𝑎𝑙𝑢𝑒 625.483
= 𝟎. 𝟎𝟕𝟕𝟐𝟐 (𝑢𝑝𝑡𝑜 4 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠; 𝑖𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛𝑠 𝑓𝑜𝑟 𝑡ℎ𝑒 𝑒𝑛𝑡𝑖𝑟𝑒 𝑝𝑎𝑝𝑒𝑟)

1 mark if shown the ratio calculation in numbers and arrived at the final answer with 4 sig digits
Q2) (a) Perform LU decomposition of the following matrix by using the CROUT algorithm.
Perform operations by using four significant digits with rounding. (7)
9 3 −2
𝐵=[ 3 6 1 ]
−2 1 9

0.5 marks

Pick algorithm 5 to start with first column of L matrix


1.5 marks

= 0.3333

0.5 + 1 + 1
67
marks

222

333
0.5+1+1
marks

3 2

0.25 marks penalty for each number, if only fractions are reported; with a minimum of 0.5 marks
on the total if only one such instance is noted.
(b) Using L and U matrices determined in (a), estimate 𝐵−1 . (10)

1 marks

67
111
1.5 marks

0.04167

1 marks

0.5 marks
0.3333 -0.2222
0.3333

0.04167

-0.04167 1 mark

0.1250
-0.08056

+1

+1
marks

1+1 marks for


using symmetric
A-1 concept
correctly to get
remaining A-1
coeffs and
showing here to
correct sig digits

OR by solving by
0.04167 algebraic
-0.08056 manipulation
-0.04167

-0.08056
0.1250
-0.04167
0.04167

Final answers have to be shown to 4 sig digits; Penalty of 2 overall, if someone only
reports in fractions, even if the fractions are correct as it violates instruction and is
unfair to students who did follow the instruction
(c) For an unknown matrix A, Compute x + 𝐴−1 y, without computing A/A-1/A-2/A2 explicitly,
when the LU factorization of 𝐴 (= 𝐿𝑈) and vectors x and y are given as : (7)
1 0 0 1 0 1 1 −1
𝐿 = [1 1 0], 𝑈 = [0 1 1], 𝑥 = [0], 𝑦=[ 1 ]
0 1 1 0 0 1 1 1

(d) Justify or refute the following statement with proper reasoning: LU decomposition is
efficient for Banded and Sparse Matrices. (1)

This statement is false as banded and sparse matrices have significant zero elements which
makes LU decomposition a computationally and memory-intensive exercise. Thomas
algorithm for banded and Iterative methods for sparse matrices are preferred.
(1 mark only if correct justification is provided, NO marks without justification)
Q3) (a) The sufficient condition of convergence for any two-equation system, say
𝑢(𝑥, 𝑦) = 0 and 𝑣(𝑥, 𝑦) = 0
𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
following a fixed-point iteration scheme is | | + | | < 1 and | | + | | < 1.
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦
For the following set of equations, if Jacobi formulation is treated as a fixed-point scheme, show that the sufficient
condition of convergence reduces to the diagonal dominance condition (i.e. |𝑎11 | > |𝑎12 | and |𝑎22 | > |𝑎21 |). (5)
𝑎11 𝑥 + 𝑎12 𝑦 = 𝑏1
𝑎21 𝑥 + 𝑎22 𝑦 = 𝑏2
b) Certain experiment is performed to estimate the force balance at the two junctions of a large
structure due to external loads. The final system of equations is as given below.
−3 6 𝑥1 35
[ ] [𝑥 ] = [ ]
2 5 2 49
Solve this equation using Gauss Elimination. Determine the maximum value of norm of error
in the solution vector 𝑥 if the errors in measurement of the external loads are, 𝛿𝑏 = [0.1 0.1]𝑇
0.04 0
and the error in the coefficient matrix is 𝛿𝐴 = [ ]. Use 𝐿1 matrix and vector norms
0 0.07
for this problem and Gauss Jordan method for calculating A-1.Report all the steps. (7)

72.33

72.33

8.037

4.407

4.407
8.037
0.07407

0.07407
Using L1 norm which is: (i) column-sum norm for a matrix ; (ii) sum of absolute values for a
vector (need to take the same norm for matrix and vector to be consistent for C(A)
calculation)

Depending on the way delA has


0.07 been chosen and explained
clearly by the student, ‖𝛿𝐴‖ will
change

12.44
2 marks
0.5 marks each for A and A-1 norms
Rest 0.25 marks each
c) Solve the following system of equations using Gauss-Seidel iterative scheme. Perform
maximum 4 iterations or until the maximum error is < 0.1% (using max norm of the error vector).
Report errors at each iteration. Perform calculations with infinite precision at every step and report your
results with four significant digit accuracy. Start with an initial guess 𝑥0 = 𝑦0 = 2 and 𝑧0 = 3. (12)
−3𝑥 + 𝑦 + 12𝑧 = 50
6𝑥 − 𝑦 − 𝑧 = 3
6𝑥 + 9𝑦 + 𝑧 = 40
The student has to realize that
the original matrix is NOT
diagonally dominant. Pivoting is
REQUIRED. Solution will not
converge unless pivoting is done

Marks penalty if the k notation is


not used as shown here; this
distinguishes GS from Jacobi
formulation

‖𝑒𝑟𝑟𝑜𝑟%‖∞ = 50 29.10
2.813

4.368 ‖𝑒𝑟𝑟𝑜𝑟%‖∞ = 23.47


Accept variation in answer
in the last decimal place

1.697

‖𝑒𝑟𝑟𝑜𝑟%‖∞ = 2.68
Accept variation in answer in
the last decimal place

‖𝑒𝑟𝑟𝑜𝑟%‖∞ = 0.03 < 0.1, converged

(d) If a matrix A is reduced to L + D + U form using Gauss-Seidel scheme, what is the


expression of the stationery matrix, S, in terms of L, D, and U (1)

S  ( L  D) 1U c  ( L  D) 1 b
Q4) (a)(i) Formulate the characteristic polynomial of the following matrix A using Faddeev-
Leverrier method. (7)
2 1 1
A  1 5 1 
1 1 5

0.5 marks

0.5+0.5

Students can multiply


matrices upto 3*3 using
calculators and show
directly as announced 1
earlier in the class

0.5

0.5

0.5
(ii) Using the characteristic equation, solve for any one of the eigenvalues using
Muller’s method. Choose 0, 1.24 and 3.25 as the initial guesses and show your
calculations until error is < 5%. (6)

Solve 𝑎3 𝑥 3 + 𝑎2 𝑥 2 + 𝑎1 𝑥 + 𝑎0 = 0 . 𝐻𝑒𝑟𝑒 𝑎3 = 1; 𝑎2 = −12; 𝑎1 = 42; 𝑎0 = −40

Using the Algorithm 1 (given)


2𝑐
p(x) = a(x - xk)2 + b(x - xk) + c; 𝑥𝑘+1 = 𝑥𝑘 −
𝑏±√𝑏2 −4𝑎𝑐
where, c = f(xk); b = f[xk, xk-1] + (xk - xk-1)f[xk, xk-1, xk-2]; a = f[xk, xk-1, xk-2]

𝑓[𝑥𝑘 ,𝑥𝑘−1 ,…𝑥𝑖+1 ]−𝑓[𝑥𝑘−1 ,…𝑥𝑖+1 ,𝑥𝑖 ]


Algorithm 2 (given) 𝑓[𝑥𝑘 , 𝑥𝑘−1 , … 𝑥𝑖 ] = (𝑥𝑘 −𝑥𝑖 )

x0 x1 x2 f(x0) f(x1) f(x2) h0= x1- h1=x2- δ0 = δ1==


x0 x1 f[x1, x0] f[x2, x1]
0 1.25 3.25 -40 -4.297 4.078 1.25 2 28.56 4.188
1.25 3.25 3.560 -4.297 4.078 2.553 2 0.3104 4.188 -4.914
3.25 3.560 3.902 4.078 2.553 0.590 0.3104 0.3412 -4.914 -5.754

a = f[x2, x1, x0] b= f[x2, x1]+ δ1a c= f(x2) x3 Ea(%)


-7.5 -10.81 4.078 3.560 - 2 marks if most steps and error are
computed
-3.940 -6.137 2.553 3.902 8.746 2 marks if most steps and error are
computed
-1.288 -6.193 0.5895 3.995 2.337 2 marks if most steps and error are
computed

(b) A function of the form y = a + b x + c logx has to be fitted to the following data.
x 1 2 3 4
y 1.000 10.00 20.00 37.00

(i) Starting with the generalized form of function approximation in terms of the basis
functions for discrete data, derive a set of normal equations in terms of data pairs
using least squares approximation. (5)
OR, the proof discussed in class for continuous case modified to
discrete data
1

1
1

(ii) Specify whether the system – is over-determined, has a unique solution or is under-
determined and why? (1)
(iii) Determine all the coefficients of the design matrix for this system but DO NOT
SOLVE for the coefficients. (6)

Perform calculations using infinite precision but report your intermediate and final calculations
upto 4 significant digits with rounding.

Identify basis
functions here: 1

Reproducing eqs
from part A; no
additional mark

0.5
0.5

0.5

0.5
4.442

0.5
0.5

0.5

0.5

1 mark for
determining rest of
the coefficients due
4.442 to symmetry of
34.83
inner product
4.442
Following algorithms are given which may/ may not be useful:
2𝑐
Algorithm 1 p(x) = a(x - xk)2 + b(x - xk) + c; 𝑥𝑘+1 = 𝑥𝑘 −
𝑏±√𝑏2 −4𝑎𝑐
where, c = f(xk); b = f[xk, xk-1] + (xk - xk-1)f[xk, xk-1, xk-2]; a = f[xk, xk-1, xk-2]

𝑓[𝑥𝑘 ,𝑥𝑘−1 ,…𝑥𝑖+1 ]−𝑓[𝑥𝑘−1 ,…𝑥𝑖+1 ,𝑥𝑖 ]


Algorithm 2 𝑓[𝑥𝑘 , 𝑥𝑘−1 , … 𝑥𝑖 ] = (𝑥𝑘 −𝑥𝑖 )

Algorithm 3
i 1 n
bi   aij x (jk 1)   aij x (jk )
j 1 j i 1
xi( k 1)  , i  1, 2,     n
aii
𝑗−1
𝑎𝑖𝑗 −∑𝑘=1 𝑙𝑖𝑘 𝑢𝑘𝑗
Algorithm 4: 𝑢𝑖𝑗 = 𝑎𝑖𝑗 − ∑𝑖−1
𝑘=1 𝑙𝑖𝑘 𝑢𝑘𝑗 ; 𝑙𝑖𝑗 =
𝑢𝑗𝑗
𝑖−1
𝑗−1 𝑎𝑖𝑗 −∑𝑘=1 𝑙𝑖𝑘 𝑢𝑘𝑗
Algorithm 5: 𝑙𝑖𝑗 = 𝑎𝑖𝑗 − ∑𝑘=1 𝑙𝑖𝑘 𝑢𝑘𝑗 ; 𝑢𝑖𝑗 =
𝑙𝑖𝑖

trace(𝑨𝑖 )
Algorithm 6 𝑨𝑛−1 = 𝑨; 𝑎𝑛−1 = trace(𝑨𝑛−1 ); 𝑨𝑖 = 𝑨(𝑨𝑖+1 − 𝑎𝑖+1 𝑰); 𝑎𝑖 =
𝑛−𝑖

You might also like