RUET · ECE Dept · B.Sc. Engineering 2nd Year Even Semester Examination, 2018
This file explains the same questions as
the 2018 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) What are the importances of numerical techniques in engineering? Briefly discuss.
[Marks: 04]
What a numerical technique is. A numerical technique obtains the answer of a
mathematical problem as a finite sequence of arithmetic operations. Nothing
more clever than that: add, subtract, multiply, divide, compare, repeat. If you
can write the steps down so that someone else gets the same digits, it is a
numerical technique.
Why it matters, in four points.
Most engineering problems have no closed form. The integral
∫e−x2dx, the potential inside a transistor region, and the motion
of three bodies under mutual gravity all lack an elementary answer, and all
three come up in practice. Where a closed form does exist it is often so long
that evaluating it numerically is faster and more accurate.
Only arithmetic runs on a machine. A numerical technique turns a problem
into additions, multiplications, comparisons and divisions, which is exactly
what a CPU does. This is what converts an analytic method into something that
can be implemented.
Measured data arrive as discrete samples. Anything derived from a data
sheet, whether a derivative, an integral, a regression line or a filter
output, is a numerical result. An engineer working from measurements is doing
numerical analysis whether or not the phrase appears.
Design and optimisation are iterative. Matching, bias-point selection,
cut-off placement and root finding are all repeated improvement of an
estimate. The numerical technique supplies the estimate rule, the stopping
test and the error estimate.
(b) What are the algorithmic errors that may occur in numerical calculation?
[Marks: 04]
Algorithmic error is the error introduced by the computation itself, as
distinct from error already present in the data you started with.
1. Truncation error. Every numerical method replaces an infinite process by
a finite one. An infinite series is cut after n terms, an interval is cut into
n panels, a differential equation is stepped with finite h. The discarded
remainder is the truncation error, and it is the error that shrinks when the
approximation is refined.
2. Round-off error. A machine holds finitely many digits. Every operation
rounds its result to that precision, and the rounding introduced at one step
propagates into every later step. Round-off error grows with the number of
operations, which is why a method can become worse when you refine too far.
3. Propagation of error. The two above do not simply add. A method is
unstable if an error introduced early is amplified downstream, and
well-conditioned if it is damped. The amplification factor belongs to the
algorithm, not to the arithmetic precision: a stable method stays accurate at
high precision, an unstable one does not.
The two errors oppose. For a method with step size h, truncation error
falls as a power of h while round-off error grows like 1/h (and worse if the
recurrence is unstable). The total therefore has a minimum at some optimal
h, and below that h further refinement makes the answer worse. This is the
central practical fact of numerical computation, and it is why the choice of
h, the stopping test and the stability of the recurrence are all part of the
method rather than details of implementation.
(c) Find the number of terms in the exponential series such that their sum gives the value of ex correct to five decimal places for all values of x in the range 0≤x≤1.
[Marks: 04]
The phrase that decides the answer is "for all values of x". You are not
being asked for a term count that works at one particular x. You are being
asked for one that works everywhere on [0,1]. So the first job is to find
the worst point on that interval and work there.
The series and its remainder.
ex=1+x+2!x2+3!x3+⋯+n!xn+⋯
After k terms the remainder is, by Taylor's theorem in Lagrange form,
Rk=k!eξxk,0<ξ<x
Now bound each factor. On [0,1] we have xk≤1, and since ξ<x≤1
we have eξ≤e. So
∣Rk∣≤k!e=k!2.718282
Where is the worst case? The bound k!e is attained at x=1,
and at x=1 the error really is its largest, since every term xn grows with
x on [0,1]. So x=1 is the point to test and no other point can be worse.
"Correct to five decimal places" means an error below 0.5×10−5.
Not below 10−5. Getting this factor of two wrong doubles your term count
and is the single most common error in this question.
Test k.
k
Tail bound k!1kk+1
Verdict
8
403201(89)=2.786×10−5
too large
9
3628801(910)=3.062×10−6
below 5×10−6
Hence the remainder tail is bounded by
R9≤3.062×10−6<0.5×10−5, which certifies nine terms.
Direct check at the worst point. Summing the first nine terms,
against e=2.71828183, so the actual error is 3.06×10−6, about
half the bound. With eight terms S8=2.71825397 and ∣e−S8∣=2.79×10−5, far too large.
9terms
Question 2
(a) Develop an algorithm to calculate the root of any non-linear equation by bisection method.
[Marks: 04]
The idea in one sentence.f is continuous and changes sign on [a,b], so
halve the interval, keep the half that still changes sign, and repeat. The
error halves every step, so the method cannot stall.
Algorithm.
Read f(x), the tolerance ε, and a maximum iteration count N.
Accept the bracket a, 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 c=2a+b and compute f(c).
If ∣f(c)∣<ε, or ∣b−a∣<ε, accept c 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.
Why the iteration count is known in advance. After n halvings the
interval has width 2nb−a, and c is its midpoint, so the error in
c is at most half the width:
n=⌈log2εb−a⌉
That closed form is the reason bisection is worth writing an algorithm for at
all. Newton is faster but you cannot predict how long it will take.
Merits. Guaranteed convergence whenever the initial interval brackets a
root and f is continuous, and exactly one evaluation of f per step.
Demerits. Slow compared with Newton or regula falsi, because halving throws
away half the information each time. The count is fixed by the tolerance rather
than by the shape of f. And you must find a bracketing interval first, which
for an even-multiplicity root can be impossible.
(b) Derive the expression of the next approximation of a root of the non-linear function f(x)=0 using regula-falsi method.
[Marks: 04]
Setup. Let x0 and x1 satisfy f(x0)f(x1)<0, so a root lies
between them. Write f0=f(x0) and f1=f(x1).
The idea. Replace f on [x0,x1] by the straight line through the two
known points, and take where that line crosses the x-axis. Because the line
joins f0 and f1, which have opposite signs, it must cross.
Derivation. The chord has equation
f1−f0y−f0=x1−x0x−x0
Set y=0 and call the resulting x the next approximation x2:
f1−f0−f0=x1−x0x2−x0
x2−x0=f1−f0−f0(x1−x0)
x2=x0−f1−f0f0(x1−x0)
The same formula, written another way. Combining over a common denominator,
which is the form most textbooks print. The two forms are identical, and the
second one shows immediately that x2 is a weighted average of x0 and
x1 with weights f1 and −f0. A weighted average of two numbers stays
between them, which is why regula falsi never leaves the bracket, exactly like
bisection.
Continuing. Evaluate f(x2), replace whichever of x0, x1 has the
same sign as f(x2), and apply the same formula again.
Convergence and the one weakness. The sign change is always preserved, so
the method converges whenever the initial pair brackets a root. Convergence is
linear, and faster than bisection because a chord is a better model of f than
a midpoint. The weakness is that one end of the bracket can stall: if the
function is strongly curved near the root, one function value stays much larger
in magnitude than the other for many iterations and that endpoint never moves
appreciably. The Illinois modification, which halves the retained function
value once an endpoint fails to update, exists to repair exactly this.
(c) Find the real root of the equation xsinx+cosx=0 using N-R method.
[Marks: 04]
Write the function and differentiate it, carefully.
Choose a starting value, and justify it by a sign check.
x
f(x)=xsinx+cosx
2.0
2(0.90930)+(−0.41615)=1.40245
2.5
2.5(0.59847)+(−0.80114)=0.69504
3.0
3(0.14112)+(−0.98999)=−0.56663
f changes sign between 2.5 and 3.0, so a root lies there. Take x0=3.
Iterate.
xn+1=xn−xncosxnxnsinxn+cosxn
n
xn
f(xn)
f′(xn)=xncosxn
xn+1
0
3.0000000
−0.56663
−2.96998
2.8092132
1
2.8092132
−0.02864
−2.65546
2.7984273
2
2.7984273
−1.087×10−4
−2.63526
2.7983860
The correction at the last step is 4.1×10−5, already below 10−4,
so the value is accepted.
x=2.7984
What the root means. The equation rearranges to x=−cotx, so the root
is where the line y=x meets the curve y=−cotx. There is one such
crossing near 2.80, and that is the value found.
Question 3
(a) Explain the use of Lagrange's interpolation formula.
[Marks: 02]
The use. Given a tabulated set (xi,fi), estimate f(x) at a point x
lying inside the range of the table, without assuming the abscissae are equally
spaced.
The formula. For n+1 points,
f(x)≈i=0∑nfij=0j=i∏nxi−xjx−xj
Four reasons it is used.
Unequal spacing is allowed. This is the principal advantage over
Newton's forward and backward formulas, which both need a common tabular
spacing h. Experimental data with a varying interval can be used directly.
The tabulated order is irrelevant. The formula is symmetric in the
points; permuting them leaves the result unchanged. Worth knowing when a
printed table lists its entries out of order.
One expression gives the value. The whole formula is written once and
evaluated at any x in range, with no successive-difference table to build.
The error is available. With n+1 points,
Rn=(n+1)!f(n+1)(ξ)∏i=0n(x−xi), so the
accuracy of a chosen set can be judged before any arithmetic is done.
Limitations. Adding a point means recomputing every coefficient, unlike
Newton's divided-difference form where earlier work is retained. And it is
inefficient for repeated evaluation at many points, where writing the single
interpolating polynomial out once and evaluating it is cheaper.
(b) The upward velocity of a rocket is given as a function of time in table below. Determine the value of the velocity at t=16 seconds using 1st order polynomial.
[Marks: 06]
t (sec)
0
10
15
20
22.5
30
v(t) (m/s)
0
227.04
362.78
517.35
602.97
901.67
"First order polynomial" means a straight line, and this is the trap in the
question. Read the table and notice that t=16 is not a tabulated value,
and the intervals are irregular: 10, 5, 5, 2.5, 7.5. That rules out
every Newton's forward and backward formula, because there is no common h.
So the only tool that fits both the order requested and the spacing given is
the two-point linear form.
Find the bracketing pair.16 lies between 15 and 20, so use
(t0,v0)=(15,362.78) and (t1,v1)=(20,517.35). Using any other
pair would be extrapolation dressed up as interpolation.
(c) Find f(2.5) from the given data, x: 1, 2, 3 and f(x): 0, 1, 8.
[Marks: 04]
x
1
2
3
f(x)
0
1
8
The method. Three points, so a quadratic, so Lagrange's formula. Here the
spacing is uniform, but Lagrange is still the shortest route because there is
no difference table to build and only three basis polynomials to evaluate.
(a) What is meant by over-relaxation and under-relaxation?
[Marks: 02]
Both terms describe a modification of the Gauss-Seidel iteration that inserts a
relaxation parameterω:
xi(k+1)=(1−ω)xi(k)+ωx^i(k)
where x^i(k) is the value the ordinary Gauss-Seidel recursion would
have produced from iteration k.
Under-relaxation, 0<ω<1. Each new iterate is a blend of the old
value and the Gauss-Seidel value, so the sequence advances by a fraction of
the full step. This damps oscillation and is what you reach for when the plain
iteration oscillates or diverges: the effective step is smaller, so the spectral
radius of the iteration matrix comes down, at the cost of more iterations.
Over-relaxation, 1<ω<2. Each new iterate overshoots the plain
Gauss-Seidel value, so the sequence covers the distance faster. The method is
then called Successive Over-Relaxation, SOR, and an optimal ω can cut
the iteration count substantially.
The two regimes are separated by ω=1. At ω=1 the formula
reduces to ordinary Gauss-Seidel. Above 1 it is accelerated, below 1 it is
stabilised. The purpose in both cases is the same: to control the rate at which
error is carried from one iteration to the next.
(b) Solve the following circuit by using Gauss-Seidel method.
[Marks: 05]
The circuit. A planar four-mesh network in a 2×2 arrangement, with
both a voltage source and a current source.
Reading the four meshes off the drawing:
Mesh
Boundary
I1 top-left
10Ω top, shared 20Ω right, shared 25Ω bottom, wire left
Step 1, and this is the idea the question is built to test: the current
source removes an unknown. The 10A source sits alone in the top
branch of mesh 2; no other mesh touches that branch. So the branch current is
I2 exactly. Taking mesh currents clockwise, the source drives current
anticlockwise through it, so
I2=−10A
You now have three equations and three unknowns. Writing four mesh equations
plus the source equation would be five equations in four unknowns.
Step 2, the three remaining mesh equations. A shared branch carries the
difference of the two mesh currents, with the sign fixed by which way each mesh
walks it.
Mesh 1, clockwise: 10I1 across the top, 20(I1−I2) down the shared
20Ω, 25(I1−I4) back along the shared 25Ω, and nothing
across the left wire:
Mesh 4, clockwise: the 100V source is entered against the
traversal, so it contributes −100 as a drop; the two shared branches give
25(I4−I1) and 4(I4−I3):
25(I4−I1)+4(I4−I3)=100⟹−25I1−4I3+29I4=100
Step 3, put each equation in Gauss-Seidel form, solving for its own
diagonal unknown:
Note the ordering. I1 and I3 are computed from the oldI4, then I4
is computed from the two values just obtained. That is what distinguishes
Gauss-Seidel from Jacobi, in which every update uses only values from the
previous sweep. Start from I1=I3=I4=0.
Iteration
I1
I3
I4
1
−3.636364
−6.756757
−0.618487
2
−3.917494
−6.823620
−0.870063
3
−4.031847
−6.850818
−0.972395
4
−4.078361
−6.861880
−1.014019
5
−4.097281
−6.866380
−1.030950
6
−4.104977
−6.868211
−1.037837
7
−4.108108
−6.868955
−1.040638
8
−4.109381
−6.869258
−1.041778
Step 4, the limit. The iteration is converging, and eliminating the same
three equations gives the exact values
(c) The following data was taken from an experiment that measured the current in a wire for various imposed voltages. On the basis of a linier regression of this data, determine current for a voltage of 3.5 V. Plot the line to evaluate the fit.
[Marks: 05]
v (V)
2
3
4
5
7
10
i (A)
5.2
7.8
10.7
13
19.3
27.5
The method. Fit i=a+bv by least squares, meaning the line that
minimises the sum of squared vertical residuals. With n=6 the quantities
you need are
Plotting the fit, and reading the quality off the plot. The six measured points (v,i) and the fitted line i=−0.5922+2.8082v:
The measured values and residuals against the line are:
v
measured i
fitted i
residual
2
5.2
5.0241
+0.1759
3
7.8
7.8323
−0.0323
4
10.7
10.6405
+0.0595
5
13
13.4486
−0.4486
7
19.3
19.0650
+0.2350
10
27.5
27.4895
+0.0105
The residuals are small beside the values themselves, the largest in magnitude
being 0.4486 against 13, so a straight line is a reasonable model for a
wire at constant temperature.
SECTION B
Question 5
(a) State Newton's forward formula to evaluate dx2d2y for any value x∈[x0,xn].
[Marks: 06]
Start from the interpolation polynomial. For a table of common spacing h,
Newton's forward formula is
The chain rule is the whole method. Since x enters only through p,
dxd=h1dpd,dx2d2y=h21dp2d2y
So you differentiate the falling-factorial products with respect to p, not
with respect to x. That is why every coefficient in the answer is a
polynomial in p.
How many points are needed. A polynomial of degree n through n+1 points
has exactly n+1 coefficients, so for n=1 only the Δy0 term
exists, for n=2 the terms up to Δ2y0, and so on. Since y′′
needs differences of order two and above, the formula needs at least three
points for a quadratic fit, four for a cubic. The next term, omitted above,
carries the coefficient
6p3−p2+47p−65
on Δ5y0.
(b) From the following table find x, correct to two decimal places for which y is maximum and find this value of y.
[Marks: 06]
x
1.2
1.3
1.4
1.5
1.6
y
0.9320
0.9636
0.9855
0.9975
0.9996
Step 1, find the direction of the answer before computing anything. Build
the difference table.
0.9320
0.9636
0.9855
0.9975
0.9996
Δ
0.0316
0.0219
0.0120
0.0021
Δ2
−0.0097
−0.0099
−0.0099
Δ3
−0.0002
0.0000
Δ4
0.0002
All four first differences are positive, so y is still rising at x=1.5.
But the last of them, 0.0021, is small and the second differences are all
negative, so y is levelling off and the peak lies just inside the end of the
table, close to but before x=1.6. If you read that last 0.0021 as having
"already changed sign" and go looking beyond 1.6, you will extrapolate
outside the data and get a different answer.
Step 2, use the backward form, because the maximum is at the far end. At
x4=1.6 with q=(x−x4)/h,
x=1.57 (correct to two decimal places),ymax=1.0000
Question 6
(a) The vertical distance covered by a rocket from t=8 to t=30 seconds is given by: x=∫830(2000ln[140000−2100t140000]−9.8t)dt. (i) Use eight-segment Simpson's 31 rule to find the distance covered. (ii) Find the true error of part (i). (iii) Find the absolute relative error for part (i).
[Marks: 08]
(i) Eight-segment Simpson's 31 rule.
Simpson's 31 rule needs an even number of segments, because it
consumes nodes in pairs. Eight is even, so there are nine nodes. With n=8,
h=830−8=2.75,ti=8+2.75i,i=0,…,8
which gives t=8,10.75,13.5,16.25,19,21.75,24.5,27.25,30.
Evaluate f(t)=2000ln[140000−2100t140000]−9.8t at each
node:
i
ti
f(ti)
weight
0
8.00000
177.2667430
1
1
10.75000
246.3351814
4
2
13.50000
320.2468886
2
3
16.25000
399.5165393
4
4
19.00000
484.7454726
2
5
21.75000
576.6423135
4
6
24.50000
676.0501168
2
7
27.25000
783.9826784
4
8
30.00000
901.6740015
1
The weights are 1,4,2,4,…,4,1: the odd-indexed interior nodes get
4 and the even-indexed ones get 2, with both endpoints getting 1.
x≈3h[f0+f8+4(f1+f3+f5+f7)+2(f2+f4+f6)]
Grouping the sums first keeps the arithmetic honest:
(ii) The true error. "True error" is the exact value minus the
approximation, and it has a sign; the absolute error does not. The exact
integral is obtainable here, which is what makes the question possible:
The sign says the Simpson estimate lies above the true distance. For a
positive integrand that is convex over the whole interval, which this one is,
that is the expected direction.
Steps 2 to 4, the same procedure applied successively:
Step
xn
yn
k1
k2
k3
k4
yn+1
1
0.0
1.0000000
−0.1000000
−0.0987525
−0.0987649
−0.0970345
0.9901322
2
0.1
0.9901322
−0.0970362
−0.0948277
−0.0948495
−0.0921669
0.9806562
3
0.2
0.9806562
−0.0921687
−0.0890169
−0.0890477
−0.0854301
0.9717608
4
0.3
0.9717608
−0.0854319
−0.0813535
−0.0813930
−0.0768566
0.9636311
y(0.4)=0.9636
Full tabulation.
x
y
0.1
0.9901322
0.2
0.9806562
0.3
0.9717608
0.4
0.9636311
Question 8
(a) Find the potential distribution at the interior nodes using Leibmann's method.
[Marks: 06]
The mesh.
The governing equation. With no charge or source inside the region, the
potential satisfies Laplace's equation, whose five-point finite-difference form
on a uniform square mesh is
ui,j=41(ui+1,j+ui−1,j+ui,j+1+ui,j−1)
Four neighbours, four weights, all 1/4. That symmetry is why this is called
the five-point stencil: the centre plus its four edge neighbours.
Leibmann's method is Gauss-Seidel on this system. Update each node from the
most recent values of its neighbours, as soon as those are available, rather
than from the previous sweep.
The four node equations. This is where the question is won or lost. Read
each node's four neighbours off the diagram, boundary values included: