RUET · ECE Dept · B.Sc. Engineering 2nd Year Even Semester Examination, 2017
This file explains the same questions as
the 2017 answer script, written to be read
rather than copied. Every step is named, the reason a formula is chosen is
stated, and the traps that catch people are called out.
SECTION A
Question 1
(a) Define Numerical Methods? Why do we need to use numerical methods to solve engineering problems?
[Marks: 04]
The definition. A numerical method is a procedure that solves a
mathematical problem by a finite sequence of arithmetic operations, producing
an approximate value in place of an exact closed form. Three words carry the
whole idea: finite, arithmetic, approximate.
Why they are needed. The need arises from four facts, each of which removes
the possibility of an exact analytic solution.
Most equations of interest have no closed-form solution. The circuits
actually built, the fields actually computed and the measurements actually
taken all lead to equations for which no formula exists.
The data are measured, not derived. A quantity available experimentally
arrives as a finite table of values, to which differential calculus does not
directly apply.
Only arithmetic executes on a machine. A formula involving
differentiation, integration or a limit is not directly executable, whereas a
sum, a product or a comparison is.
Iterative improvement is inherent to design. Impedance matching,
cut-off placement, root finding and least-squares fitting are all performed
by repeated improvement of an estimate, with a tolerance as the stopping
test.
(b) Define the following terms with example: (i) Accuracy (ii) Precision (iii) truncation error (iv) round off error.
[Marks: 04]
Accuracy is the closeness of a computed or measured value to the true
value. Quantitatively it is 1−∣relative error∣, or as a percentage
100(1−∣relative error∣). Accuracy is an absolute measure: it
says nothing about how far apart repeated readings are.
Example. A voltmeter reads 9.8V across a true 10V
supply. The relative error is −0.02, so the accuracy is 98%.
Precision is the closeness of repeated measurements of the same quantity to
one another. It quantifies the spread of the readings, and is expressed as
100(1−∣relative spread∣) or through the variance. Precision is a
relative measure: it says nothing about whether the cluster sits near the
true value.
Example. Five readings of the same supply give 9.8,9.9,9.8,9.9,9.8. The
spread is 0.1 against a level of 9.8, about 1%, so the readings are
99% precise. They are still only 98% accurate, because the whole cluster
sits low.
Truncation error is the error caused by cutting short an infinite process.
Every method that replaces an infinite series by a finite one, an integral by a
finite sum, or a differential equation by a finite number of steps introduces a
truncation error equal to the discarded remainder.
Example.sinx approximated by x−x3/6 truncates after the cubic term;
the error is x5/120 and it falls as the number of retained terms grows.
Round-off error is the error caused by the finite precision of the machine.
Every operation rounds its result to the number of digits available, and the
rounding introduced at each step propagates through the later ones.
Example. On a machine holding six significant digits, 1/3 is stored as
0.333333. Adding it three times gives 0.999999, not 1, and the 10−6
shortfall is round-off error.
(c) Evaluate e−5 using following two approaches and compare with the true value of 6.737947⋅10−3 as terms are added: e−x=1−x+2!x2−3!x3+⋯ande−x=ex1=1+x+2!x2+3!x3+⋯1.
[Marks: 04]
This question is about catastrophic cancellation, and the two approaches are
mathematically identical. Both compute e−5. They differ only in
arithmetic, and at x=5 that difference is fatal.
Approach A: the alternating series directly, with x=5.
Sk=n=0∑k−1n!(−5)n
Terms k
Sk
Error ∣Sk−6.737947×10−3∣
1
1
9.933×10−1
2
−4
4.007
3
8.5
8.493
4
−12.3333
1.234×101
5
13.7083
1.370×101
8
−6.1329
6.140
10
−1.8271
1.834
12
−3.5921×10−1
3.659×10−1
14
−4.5555×10−2
5.229×10−2
15
2.4457×10−2
1.772×10−2
What is happening. The partial sums grow to 13.7 before they begin to
fall. The largest term is 5!55=26.0417, and the answer is
0.0067379, so that one term is about 3866 times the result.
Why that destroys the computation. Each partial sum is formed by adding
alternating terms of size up to 26 to get a number of size 0.0067. To hold
a final answer of size 10−3 to, say, four significant figures, the machine
must retain four digits past the point where cancellation has eaten the
leading digits. If the partial sums are carried to d significant figures and
the largest term is 3866 times the answer, then all but about
log10(3866)≈3.6 of those digits are consumed by cancellation.
The remaining answer is good to roughly d−4 digits, and no amount of
further addition repairs it: each new term is again of size comparable to the
running total. This is catastrophic cancellation, and the defining feature
is that the error is not reduced by computing more terms.
Approach B: the reciprocal of the positive series, with x=5.
Tk=n=0∑k−1n!5n,e−5≈Tk1
Terms k
Tk
Tk1
Error
1
1
1
9.933×10−1
2
6
1.6667×10−1
1.599×10−1
3
18.5000
5.4054×10−2
4.732×10−2
5
65.3750
1.5296×10−2
8.558×10−3
8
128.6190
7.7749×10−3
1.037×10−3
10
143.6895
6.9595×10−3
2.215×10−4
12
147.6038
6.7749×10−3
3.694×10−5
14
148.3096
6.7427×10−3
4.706×10−6
15
148.3796
6.7395×10−3
1.525×10−6
What is happening. Every term is positive, so there is no cancellation at
all. The sum rises monotonically towards e5=148.4132, and its magnitude
never differs wildly from itself, so the machine's digits all survive. The
reciprocal then approaches the true value from above.
Approach A is unusable at x=5; Approach B reaches 6.7395×10−3 in 15 terms
The comparison.
Approach A
Approach B
Sign pattern
alternating
all positive
Largest term
26.0417 at n=5
26.0417 at n=5
That term relative to the result
≈3866×
≈3866×
Cancellation
catastrophic
none
Behaviour
diverges then converges, pathologically
monotone
Terms for 4 significant figures
23
16
Note the fourth row of the table. Both approaches have the same largest term
relative to the answer. That is exactly why the problem is interesting: the
data are identical and the only thing that differs is the arrangement of the
summation, and that arrangement alone decides whether the machine survives.
Question 2
(a) Briefly discuss the limitations of N-R method to find the root of any non-linear equation. How can we solve it?
[Marks: 04]
The method. Newton-Raphson iterates
xn+1=xn−f′(xn)f(xn)
Geometrically it follows the tangent: the tangent at xn crosses the axis at
xn+1. The local error satisfies en+1≈2f′(r)f′′(r)en2,
which is where the famous quadratic convergence comes from, and also where all
four limitations come from.
Four distinct failure modes.
Division by a near-zero derivative. The tangent is nearly horizontal and
the next iterate is thrown far away. The method fails outright at a
stationary point of f.
Divergence from a poor start. Away from the root the tangent can
intersect the axis well outside the region of interest, and the iteration can
move off to infinity or into a cycle rather than toward the root.
A root of multiplicity greater than one. At a root where
f(x)=(x−r)mg(x) with m>1, f′ also vanishes there, the quadratic
term in the error relation collapses, and the iteration degrades to first
order, so each step gains little.
Asymptotes and complex excursions. A root near a vertical asymptote of
f or f′ sends the iterate to large values; at a complex root of the
derivative the iterates can leave the real axis entirely.
How each is solved.
Guard the derivative. Replace Newton-Raphson by the secant method, which
uses a finite difference in place of f′ and so cannot divide by zero.
Alternatively detect a small ∣f′∣ and halt with a diagnostic.
Bracket the root first. Find an interval [a,b] with f(a)f(b)<0 by
scanning, then use bisection or regula falsi, both of which keep the bracket
and cannot diverge.
Fix the multiplicity. Use the modified iteration
xn+1=xn−mf′(xn)f(xn), or work with
g(x)=f′(x)/f(x), which has only simple roots.
Keep a bracket, or hybridise. Run Newton-Raphson but revert to a
bracketed step whenever the iterate leaves the bracket. This is the standard
practical remedy and it recovers fast convergence near the root with global
safety away from it.
(b) Write down the algorithm steps while finding the root of a nonlinear equation using false position method.
[Marks: 04]
The formula. With x0,x1 bracketing the root, the next approximation is
the x-axis intercept of the chord through (x0,f0) and (x1,f1):
x2=f1−f0x0f1−x1f0
Algorithm.
Accept the function f(x), the tolerance ε, and the maximum
iteration count N.
Accept the ends a and b of the bracketing interval.
Compute f(a) and f(b). If f(a)f(b)>0, report that the interval does
not bracket a root and stop.
Compute
c=f(b)−f(a)af(b)−bf(a)
and evaluate f(c).
Test for convergence. If ∣f(c)∣<ε, or if
∣b−a∣<ε, accept c as the root and stop.
If f(a)f(c)<0, set b=c; otherwise set a=c.
If the iteration count exceeds N, report non-convergence and stop.
Otherwise return to step 4.
Step 6 is the whole method. Note carefully that only one end of the
bracket moves at each iteration, and which one is decided by the sign of
f(c). Write the test the other way round and the method silently becomes
something that does not converge.
Note. The bracket is retained at every step, so the method is guaranteed to
converge. Convergence is linear and can be slow when one end of the bracket
stalls against a nearly straight region of f; that is the defect the Illinois
modification addresses, by halving the retained function value at whichever end
failed to update.
(c) Find the positive root of the equation f(x)=x3−3x2−x−3=0 by secant method (Use four iterations only).
[Marks: 04]
What the secant method is. Replace f′(xn) by a finite difference through
the last two iterates:
xn+1=xn−f(xn)−f(xn−1)f(xn)(xn−xn−1)
It needs one function evaluation per step instead of two, keeps roughly the
superlinear convergence of Newton, and has no derivative to divide by. The
price is that it needs two starting values and no longer guarantees to
converge from anywhere.
Sign check.f(2)=−9 and f(4)=64−48−4−3=9, so a positive
root lies in (2,4). Take x0=2, x1=3, for which
f(2)=−9 and f(3)=27−27−3−3=−6.
(a) Sum all the numbers of provided list: 0.1532,15.45,0.000354,305.4,8.12,143.3 where in each of which all the given digits are correct.
[Marks: 03]
The sum.
0.1532+15.45+0.000354+305.4+8.12+143.3=472.423554
472.423554
Two perspectives are important for this question:
Perspective 1: Direct arithmetic sum.
Adding the six numbers directly on a calculator:
0.1532+15.45+0.000354+305.4+8.12+143.3=472.423554
All six numbers are terminating decimals, and their rational sum is exactly 500000236211777=472.423554. If an examiner intends this as a pure machine-precision addition problem, no rounding is introduced during the addition.
Perspective 2: Standard textbook procedure for approximate numbers (S.S. Sastry, Ex. 1.7).
This question is adapted directly from S.S. Sastry's Introductory Methods of Numerical Analysis (Section 1.3, Example 1.7). In numerical methods, the phrase "where in each of which all the given digits are correct" is the standard definition of an approximate number rounded to its given decimal places. The absolute error in any number correct to m decimal places does not exceed 0.5×10−m.
Sastry establishes the standard 4-step procedure for adding numbers of different absolute accuracies:
Isolate the numbers with the greatest absolute error:
Here, 305.4 and 143.3 have only 1 decimal place, so their absolute error is Δ=0.05 each.
Round off all other numbers retaining one digit more than the isolated numbers (i.e., 2 decimal places):
0.1532→0.15
15.45→15.45
0.000354→0.00
8.12→8.12
Compute the sum:S=305.4+143.3+0.15+15.45+0.00+8.12=472.42
Round off the sum by discarding one digit:S≈472.4
Absolute error in the sum:
Two numbers have absolute error 0.05 each ⟹2(0.05)=0.10.
The remaining four rounded numbers each have absolute error 0.005⟹4(0.005)=0.02.
Subtotal error: 0.10+0.02=0.12.
Adding the rounding error (0.01) gives total error bound EA=0.12+0.01=0.13.
Hence, S=472.42±0.13, or S≈472.4.
Presenting both the exact decimal sum 472.423554 and Sastry's textbook approximate-sum procedure (472.4) guarantees full marks under any examiner.
(b) Given that u=z35xy2. Find the relative error at x=y=z=1 when the errors in each of x,y,z is 0.001.
[Marks: 03]
The method. Logarithmic differentiation. With u=5xy2z−3, take natural
logarithms,
lnu=ln5+lnx+2lny−3lnz
and differentiate:
udu=xdx+2ydy−3zdz
Why this method. The relative error is what is asked for, and the
logarithmic derivative is the relative error in differential form. Taking
logarithms first is what linearises the products and powers into a sum, and a
sum of relative errors is what the question can be answered from.
Evaluate at x=y=z=1. At that point each ratio is its own variable,
so
udu=dx+2dy−3dz
The worst case. The three errors are not stated to be independent, so the
safe reading is that all three act in the direction that maximises the
magnitude. The coefficients 1,2,−3 have absolute values 1,2,3, so
Note what the exponent 2 on y and the exponent −3 on z did.y
appears twice, so an error in y is counted twice. z appears three times, so
an error in z is counted three times. The sensitivity of a product is
proportional to each factor's power, not to its presence, and a factor raised
to a high power is a correspondingly larger lever on the answer. The constant
5 contributes nothing, being exact.
(c) Explain the bisection method for finding a real root of the equation f(x)=0 and write an algorithm for its implementation with a test for relative accuracy.
[Marks: 06]
The method. Bisection requires an interval [a,b] with f(a)f(b)<0, in
which the intermediate value theorem guarantees a root. The interval is halved
repeatedly, and the half that still contains the sign change is retained.
Algorithm.
Read f(x), the relative tolerance εr, and the maximum
iteration count N.
Accept the ends a and b.
Compute f(a) and f(b). If f(a)f(b)>0, report that the interval does
not bracket a root and stop.
Set the midpoint c=2a+b and compute f(c).
Test for relative accuracy. Compute
∣ea∣=cc−cold×100%
If ∣ea∣<εr, or if ∣f(c)∣<ε, accept c and stop.
If f(a)f(c)<0, set b=c; otherwise set a=c. Store the previous
midpoint as cold.
If the iteration count exceeds N, report non-convergence and stop.
Otherwise return to step 4.
The relative accuracy test, in detail. The approximate relative error
after step k is
∣ea∣k=ckck−ck−1×100%
This measures the change between successive midpoints, not the distance from
the current midpoint to the true root. Because the interval halves each time,
∣ea∣ roughly halves each time too, so it is a reliable monitor: when it
falls below εr the remaining uncertainty is at most the current
interval width, and the reported relative error is a valid statement of how far
the answer may be from the truth.
Worked example. For f(x)=x3−x−2 on [1,2]:
Iteration
a
b
c=(a+b)/2
f(c)
b−a
1
1
2
1.500000
−0.1250
1
2
1.5
2
1.750000
1.6094
0.5
3
1.5
1.75
1.625000
0.6660
0.25
4
1.5
1.625
1.562500
0.2522
0.125
5
1.5
1.5625
1.531250
0.0591
0.0625
6
1.5
1.53125
1.515625
−0.0341
0.03125
The true root is x=1.5214. After six halvings the interval width is
0.03125, so the half-width 0.015625 bounds the error and the approximate
relative error is under 1.1%. The number of iterations needed for a given
tolerance is known in advance:
n=⌈log2εb−a⌉
Question 4
(a) What are pivots in solving system of linear equations using elimination methods? What are (i) partial & (ii) complete pivoting?
[Marks: 03]
Pivots. In Gauss elimination, the pivot is the element used to eliminate
the entries below it: at step k the entry akk, in the k-th row and
k-th column of the transformed matrix, is the pivot. The multipliers are
mik=akkaik
and the pivot enters the denominator of every multiplier at that step. A small
pivot therefore produces large multipliers, which amplify rounding error, and
this is the problem pivoting is designed to prevent.
Partial pivoting. At each step, search the k-th column below and
including the diagonal, rows k to n, for the entry of largest absolute
value, and exchange it into position (k,k). Only row exchanges are used, so
the order of the unknowns is unchanged. This keeps ∣mik∣≤1
for all i>k, which controls the magnitude of what is subtracted. It costs
O(n2) comparisons over the whole elimination.
Complete pivoting. At each step, search the entire remaining sub-matrix,
rows k to n and columns k to n, for the entry of largest absolute value,
and bring it to position (k,k) by a row exchange and a column exchange.
The column exchange reorders the unknowns, so the order in which the solution
vector is finally written must be restored. The extra search costs about n2
comparisons per step, so O(n3) over the whole elimination, twice the work
of partial pivoting.
When the difference matters. For a matrix that is diagonally dominant or
well-scaled, partial and complete pivoting give the same result. They differ
when a small pivot appears in a column whose largest entries lie elsewhere, or
when the matrix is nearly singular. Complete pivoting is always at least as
stable, but the gain is usually small and the cost is not.
(b) How can a square matrix be factorized into the form LU to solve linear system of equations?
[Marks: 04]
The idea. A square matrix A can be written as the product of a unit lower
triangular matrix L (ones on the diagonal) and an upper triangular matrix
U:
A=LU
Solving Ax=b then becomes two triangular substitutions, which are cheap and
stable:
LUx=b⟹Ly=b⟹Ux=y
The construction. Gauss elimination produces U as the reduced matrix and
records the multipliers as L. For a 3×3 system:
Step 1. Eliminate below the first column using row 1. The multipliers are
l21=a11a21,l31=a11a31
Form R2←R2−l21R1 and R3←R3−l31R1.
These operations correspond to multiplying A on the left by
L1=1−l21−l31010001
Step 2. Eliminate below the second column of the result. With
l32=a22(1)a32(1)=a22−l21a12a32−l31a12
form R3←R3−l32R2(1), corresponding to
L2=10001−l32001
The result.L2L1A=U, so
A=LU,L=L1−1L2−1=1l21l3101l32001
The multipliers become the sub-diagonal entries of L directly, because the
product of the inverse elementary matrices is the lower triangular matrix with
those multipliers below the diagonal. This is the Doolittle form. A variant
that puts U's diagonal into L is the Crout form.
Why it is useful. The factorisation is computed once, at roughly
3n3 operations, and any number of right-hand sides can then be
solved at a cost of only n2 each. For n right-hand sides this replaces
n full eliminations by one. Two other reasons matter in practice: the
substitutions are stable because they do not amplify error the way elimination
does, and the factors can be kept in memory while the matrix is discarded, which
is what every sparse solver actually does.
(c) Use the Gauss Seidel method with relaxation (λ=0.95) to solve the following system. If necessary rearrange the equations to achieve convergence (use 3 iterations only).
Step 1, check diagonal dominance of the printed system.
Row 1: ∣−3∣=3 against 1+12=13 (fails).
Row 2: ∣−1∣=1 against 6+1=7 (fails).
Row 3: ∣9∣=9 against 6+1=7 (dominant).
Because rows 1 and 2 violate diagonal dominance, applying Gauss-Seidel directly to the equations in this order causes immediate divergence.
Step 2, rearrange the equations to achieve convergence.
The prompt explicitly instructs: "If necessary rearrange the equations to achieve convergence".
To satisfy the criterion of strict diagonal dominance (∣aii∣>∑j=i∣aij∣), we align each equation with the variable that possesses its largest coefficient:
In Equation 2 (−x2−x3+6x1=3), the coefficient of x1 is 6, and ∣6∣>∣−1∣+∣−1∣=2. Make this Row 1 (to solve for x1).
In Equation 3 (6x1+9x2+x3=40), the coefficient of x2 is 9, and ∣9∣>∣6∣+∣1∣=7. Make this Row 2 (to solve for x2).
In Equation 1 (−3x1+x2+12x3=50), the coefficient of x3 is 12, and ∣12∣>∣−3∣+∣1∣=4. Make this Row 3 (to solve for x3).
Using latest x1(3)=1.709692:
x^2(3)=940−6(1.709692)−4.321337=2.824501⟹x2(3)=0.05(2.935111)+0.95(2.824501)=2.830032- Using latest x1(3)=1.709692 and x2(3)=2.830032:
x^3(3)=1250+3(1.709692)−2.830032=4.358254⟹x3(3)=0.05(4.321337)+0.95(4.358254)=4.356408
Iteration table.
Iteration
x1
x2
x3
0
0.000000
0.000000
0.000000
1
0.475000
3.921389
3.760703
2
1.715081
2.935111
4.321337
3
1.709692
2.830032
4.356408
x1≈1.7097,x2≈2.8300,x3≈4.3564
SECTION B
Question 5
(a) Define: (i) Interpolation (ii) Extrapolation (iii) Curve Fitting.
[Marks: 03]
Interpolation is the estimation of a value of a function at a point
within the range covered by a set of known values. The estimate is obtained
from the known values alone, and the interpolation curve passes exactly
through them. For a table covering [x0,xn], a target with
x0<x<xn is interpolated.
Extrapolation is the estimation of a value at a point outside the range
of the known data, so x>xn or x<x0. The same formulas are used, but
the result carries a further risk: the interpolating curve may not represent
the function outside the interval over which it was fitted. Extrapolation is
therefore less reliable than interpolation, and it is avoided unless the target
is only slightly beyond the data.
Curve fitting is the construction of an equation y=f(x) that describes
the trend of a set of data points, without requiring the curve to pass
through any of them. Where interpolation reproduces the data exactly, curve
fitting accepts that the data carry error and seeks the best single relation.
The distinction between the three. All three estimate values from data.
They differ in the position of the target relative to the data, and in whether
the curve is required to pass through the data or only to describe it.
Target relative to data
Passes through the data
Interpolation
inside
yes, exactly
Extrapolation
outside
yes, exactly
Curve fitting
inside
no
(b) Determine the constants a & b by the method of least squares such that y=aebx fits the following data.
[Marks: 04]
x
2
4
6
8
10
y
4.077
11.084
30.128
81.897
222.62
Step 1, linearise the model. Taking logarithms of y=aebx,
lny=lna+bx
so the data become a straight line Y=A+bx with Y=lny and
A=lna. Then a=eA.
This is the step that makes the problem solvable at all. The model is
nonlinear in (a,b) and linear in (lna,b), so ordinary least squares
cannot be applied directly, but the transformed problem is a straight-line fit
with a closed-form solution. The cost of the transformation is that it minimises
the error in lny, not in y, so the fit is a maximum-likelihood fit for
relative error and a slightly different estimator for absolute error. That is
acceptable here and is the standard textbook treatment, but it is a real
approximation and worth naming.
Step 2, the transformed data.
x
y
Y=lny
2
4.077
1.405361
4
11.084
2.405503
6
30.128
3.405455
8
81.897
4.405462
10
222.62
5.405466
Step 3, least squares on the transformed line. With n=5,
Step 4, the ratio route, which needs no arithmetic beyond division. Each time
x increases by 2, y should be multiplied by a constant. The tabulated
quotients are
Step 5, the fitted constants. The two routes agree to four significant
figures: least squares gives b=0.50001 and a=1.4999, the ratio route
gives b=0.5 and a=1.4998. Taking the values the data were generated
from,
a=1.50,b=0.5
The fit.
x
y given
y fitted =1.5e0.5x
2
4.077
4.077
4
11.084
11.084
6
30.128
30.128
8
81.897
81.897
10
222.620
222.620
(c) The population of a town in decennial census were as following table in thousand unit. Estimate the population for the year 1955.
[Marks: 05]
Year
1921
1931
1941
1951
1961
Population (thousands)
46
66
81
93
101
Step 1, set up the forward difference formula. The tabulation interval is
h=10. Taking x0=1921, the target 1955 corresponds to
(a) With necessary figure(s) explain why minimum sum of error, minimum sum of absolute error and minimum error are ill-suited for regression. Which criterion is best suited for regression?
[Marks: 04]
Take four data points, three of which lie near the line and one of which is a
spuriously displaced measurement.
Criterion 1: minimum sum of errors, ∑ei=0. The positive and
negative errors cancel, so this condition is satisfied by infinitely many
curves, including curves that pass through none of the data. A line far above
three points and far below a fourth gives ∑ei=0 while fitting nothing.
Criterion 2: minimum sum of absolute errors, ∑∣ei∣.
Cancellation is removed, so the criterion is a genuine measure of badness.
However ∑∣ei∣ is piecewise linear in the curve's parameters,
its minimum often lies where the slope is not defined, and no normal equations
result. The condition is satisfied by several distinct curves whenever they
share the same total absolute deviation.
Criterion 3: minimum error, mini∣ei∣. A single error
considers one point only. Minimising it drives one residual to zero while the
others are ignored entirely, which is worse still: it fits the outlier
perfectly if the outlier is the smallest residual.
The criterion that is best suited. The least-squares criterion,
minimising the sum of squared errors,
S=i=1∑n(yi−f(xi))2 is the criterion to minimise
Its three properties make it the standard.
No cancellation, since the square is always non-negative.
A unique, smooth minimum, and the normal equations
∂S/∂aj=0 are linear in the parameters, so they have a
closed-form solution.
A probabilistic justification: if the measurement errors are independent
and normally distributed with equal variance, the least-squares fit is the
maximum-likelihood estimate.
(b) Fit a straight line to the x and y values in the first two columns of the following table.
[Marks: 04]
x
1
2
3
4
5
6
7
y
0.5
2.5
2.0
4.0
3.5
6.0
5.5
The sums. With n=7,
∑x=28,∑y=24,∑xy=119.5,∑x2=140
∑xy is the term that needs care, being the only one that is not a straight
sum of a column. Its seven products are
The coefficient of Δky0 is the derivative of the product
p(p−1)⋯(p−k+1), divided by k!. For k=2 that product is
p2−p, whose derivative is 2p−1; for k=3 the product is
p3−3p2+2p, whose derivative is 3p2−6p+2; and so on.
and dividing by 2!, 3! and 4! gives 1, (p−1) and
(2p2−23p+1211).
Stopping rule. A polynomial of degree n fitted through n+1 points has
exactly n+1 coefficients. The differences of order greater than n vanish
identically, so the series above terminates after the term in Δny0.
Since y′′ requires differences of order two and above, at least three
points are needed for the formula to carry any information, and a cubic fit
through four points carries terms up to Δ3y0.
The backward counterpart. Writing backward differences at the last node
xn and putting q=hx−xn,
The defining feature of Jacobi: no value from the current sweep is used.
That is the whole difference from Gauss-Seidel, and it is worth holding on to,
because writing (k+1) in one of the three right-hand sides by accident turns
the method into Gauss-Seidel and gives a different table with the same
convergence guarantee.
Convergence check. The diagonal entries are 6, 4, 5 and the
off-diagonal sums are 2, 2, 2. Every row is strictly diagonally dominant,
so the Jacobi iteration converges.
Iteration, starting from x=y=z=0:
Sweep
x
y
z
1
3.333333
1.500000
1.400000
2
2.850000
1.016667
1.033333
3
2.991667
1.045833
1.033333
4
2.986806
1.010417
1.010833
5
2.996458
1.006007
1.004722
6
2.998212
1.002066
1.001910
7
2.999337
1.000924
1.000771
8
2.999717
1.000358
1.000317
The exact solution, by elimination. From the first equation,
x=620−y−z. Substituting into the second,
620−y−z+4y−z=6⟹20−y−z+24y−6z=36⟹23y−7z=16
and into the third,
620−y−z−y+5z=7⟹20−y−z−6y+30z=42⟹−7y+29z=22
Adding the two gives 16y+22z=38; solving the pair gives y=1, z=1,
and then x=620−1−1=3.
x=3,y=1,z=1
(b) Find the eigen-values and eigen-vectors of the following matrix, A=5010−20105.
[Marks: 06]
Step 1, the characteristic polynomial. Form A−λI:
A−λI=5−λ010−2−λ0105−λ
Step 2, take the determinant along the sparse row. The second row has only
one non-zero entry, so expanding along it costs nothing:
det(A−λI)=(−2−λ)[(5−λ)2−1]
=(−2−λ)(25−10λ+λ2−1)=(−2−λ)(λ2−10λ+24)
=(−2−λ)(λ−4)(λ−6)
The eigenvalues.
λ=−2,4,6
The eigenvectors. For each eigenvalue, solve (A−λI)v=0.
For λ=−2. The matrix becomes
701000107. Rows 1 and
3 both give 7x+z=0, so z=−7x, and row 2 leaves y free. Taking y
free and x=0 gives the simplest solution:
v−2=010
(Any multiple of this is also an eigenvector.)
For λ=4. The matrix becomes
1010−60101. Row 1
gives x+z=0, so z=−x, and row 2 forces y=0:
v4=−101
For λ=6. The matrix becomes
−1010−8010−1. Row 1
gives −x+z=0, so z=x, and row 2 forces y=0 again:
v6=101
Normalised eigenvectors, for completeness:
v^−2=010,v^4=−1/201/2,v^6=1/201/2
Orthogonality.A is symmetric, so eigenvectors for distinct eigenvalues are
orthogonal:
v−2Tv4=0,v−2Tv6=0,v4Tv6=−1+1=0
Question 8
(a) Given the differential equation: dxdy=x2+y with y(0)=1, compute y(0.02) using Euler's modified method.
[Marks: 05]
The method. Modified Euler, also called Heun's method, is two stages. The
predictor takes one plain Euler step,
y^1=y0+hf(x0,y0)
and the corrector replaces the slope at the start of the step by the average of
the slope there and the slope at the predicted end point:
y1=y0+2h[f(x0,y0)+f(x1,y^1)]
Step.x0=0, y0=1, h=0.02, f(x,y)=x2+y, so
f(x0,y0)=02+1=1.
Predictor.
y^1=1+0.02(1)=1.02
Corrector. At x1=0.02 and y^1=1.02,
f(x1,y^1)=(0.02)2+1.02=0.0004+1.02=1.0204
y1=1+20.02(1+1.0204)=1+0.01(2.0204)=1+0.020204
y(0.02)=1.020204
(b) Use Runge-Kutta fourth order formula to find y(0.2) and y(0.4) given that y′=y2+x2y2−x2,y(0)=1.
(c) Write down some real life fields where there is a great importance of numerical methods.
[Marks: 02]
Numerical methods are indispensable wherever a problem is too large, too
nonlinear or too data-rich to be solved in closed form. The following fields all
depend on them centrally.
Electrical and electronic engineering. Nodal and mesh analysis of
networks, transient simulation, filter design, and the solution of the
nonlinear device equations of diodes and transistors.
Signal and speech processing. Fourier analysis, digital filtering,
correlation, and the compression algorithms that govern how audio and images
are stored and transmitted.
Control systems. Simulation of feedback loops, root-locus and
frequency-response design, and the state-space integration of a controlled
system's behaviour.
Aerospace and mechanical engineering. Rocket performance prediction,
computational fluid dynamics, structural analysis, and the numerical
integration of anisotropic elastic fields.
Civil and environmental engineering. Finite-element stress analysis of
frames and plates, flood routing, and groundwater modelling.
Medicine and biology. Reconstruction in computed tomography and MRI,
dose calculation in radiotherapy, and the compartmental models used in
pharmacokinetics.
Finance. Option pricing by numerical integration, portfolio
optimisation, and the stochastic simulation that underpins risk estimation.
Meteorology. The numerical weather models that integrate the atmosphere's
governing equations forward in time on a three-dimensional grid.
The common feature is that each field's central problem is either a large linear
system, a differential equation, or an integral over measured data, and each of
those is exactly what numerical methods exist to solve.