RUET · ECE Dept · B.Sc. Engineering 2nd Year Even Semester Examination, 2021
This file explains the same questions as
the 2021 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) Differentiate between numerical methods and analytical methods. Why do ECE engineers require numerical methods?
[Marks: 04, CO: 1]
Analytical method. Manipulates symbols to reduce the problem to a closed form.
The answer is exact and valid at every point of the domain.
Numerical method. Approximates the problem by a form that can be evaluated
digit by digit. The answer is a pair of numbers, valid near the point computed.
Analytical
Numerical
Result
Closed form, exact
Approximate
Domain of validity
Whole domain
Local, near one point
Problem size it can handle
Small
Grows nearly linearly with effort
Round off error
None
Present at every operation
Effect of changing data
Instant re-evaluation
Full recomputation
Structure it reveals
Conservation laws, invariants
Hides them
Analytical is exact and closed-form; numerical is approximate but reaches problems no closed form can
Why ECE engineers need them.
Most real systems have no closed form. A coupled circuit, a heat exchanger,
a transmission line, a semiconductor device: none has an analytic solution.
The scale is far beyond hand algebra. Thousands of unknowns from a
discretised PDE, or a million from a mesh. No symbolic route exists.
An experiment costs real money and real time. A finite element run or a
circuit simulation costs nothing to repeat and can be run at any parameter
value, long before hardware exists.
The data are irregular. Measurements arrive unevenly spaced and noisy.
Interpolation and least squares accept them without demanding a form.
Design needs iteration. An optimiser calls the solver hundreds of times
while searching.
The accuracy is quantifiable. Every method carries an error bound, so the
engineer knows how far to trust the answer rather than having to hope.
(b) Derive the formula for root finding using Newton-Raphson method. Also, discuss the problems of it and how this problem can be solved.
[Marks: 04, CO: 2]
Derivation. Let x∗ be the root of f(x)=0. Start at x0 and follow the
tangent to the curve at that point.
For small h the tangent meets the x-axis at x0+h. By the first-order mean
value form of the Taylor series,
0=f(x∗)=f(x0+h)≈f(x0)+hf′(x0)
Solving for h and writing x1=x0+h,
x1=x0−f′(x0)f(x0)
Iterating,
xn+1=xn−f′(xn)f(xn)
Second order accuracy. Taking the Taylor expansion to second order,
0=f(xn)+f′(xn)Δx+2f′′(ξ)Δx2
Substituting Δx=−f/f′ shows
en+1≈2f′(x∗)f′′(x∗)en2. The error is squared each step,
so the last iteration typically delivers every digit the machine can hold.
Problems and fixes.
Problem
Cause
Fix
Diverges or oscillates
Start too far from the root
Bracket first, start inside, or switch to bisection
Division by zero
f′(xn)=0
Choose another start, or use the secant method
Cycles between two points
Overshoot from a poor start
Damp the step, or fall back to bisection on repeat
False convergence
f(xn)=0 but f′(xn)≈0
Test ∣f(xn)∣, not only ∣xn+1−xn∣
Slow at a repeated root
Squaring needs a simple root
Use xn+1=xn−mf′(xn)f(xn) with m the multiplicity
No tangent information
Step-like function such as signum
Bisection, which needs only a sign change
f′ unavailable
Only f is given
Secant method, or finite-difference derivative
(c) Compute the value of ln3 correct to five decimal places using Taylor's series expansion.
[Marks: 04, CO: 2]
Step 1. Choose a series that converges. The familiar expansion
ln(1+x)=x−2x2+3x3−⋯
converges only for ∣x∣<1. Here 3=1+2, so x=2 and the
series diverges.
Step 4. Add terms until the error is below 21×10−5.
Terms
Partial sum
Error
5
1.0984995040
1.13×10−4
6
1.0985882824
2.40×10−5
7
1.0986070624
5.23×10−6
8
1.0986111314
1.16×10−6
Seven terms give an error of 5.23×10−6, still above
2110−5. Eight terms give 1.16×10−6, comfortably inside, so
eight terms are required.
Step 5. Round.
ln3=1.09861
Question 2
(a) Define bracketing methods with example.
[Marks: 02, CO: 1]
Definition. A bracketing method is an iterative root finder that begins
with an interval [a,b] in which the function changes sign,
f(a)⋅f(b)<0
By the intermediate value theorem a continuous f must have at least one root in
(a,b). Each iteration picks a new point inside the current interval and retains
the half that still shows a sign change, so the root is never lost.
Properties.
Convergence is guaranteed, from any valid bracket, for any continuous f.
Only the sign of f is needed, never f′. That is the big practical
advantage, since a derivative is often harder to obtain than a function value.
The interval halves each step for bisection, so the error bound after n steps
is 2n+1b0−a0.
Convergence is slow, linear for bisection, because no curvature
information is used.
Examples.
Method
New point
Rate
Bisection
Midpoint, 2a+b
Linear
Regula falsi
Chord, f(b)−f(a)af(b)−bf(a)
Superlinear, often
Illinois method
Regula falsi with a halved stale value
Superlinear, robust
Enclose the root in a sign-changing interval and keep halving it; convergence is guaranteed
(b) Given that the equation x2.2=69 has a root between 5 and 8. Use the method of regula-falsi to determine it.
[Marks: 04, CO: 3]
Step 1. Define the function and check the bracket.
(a) When should we use interpolation instead of curve fitting?
[Marks: 02, CO: 2]
Apply interpolation when the data are exact and the target lies between
the given points.
Two conditions must both hold.
The data are exact. Interpolation forces the curve through every point, so
any measurement error is copied faithfully into the answer. Noise in, noise
out, amplified.
The target lies inside the data range. Outside it the method is
extrapolation, which is far less trustworthy.
Typical situations: a value read off a mathematical function, a quantity defined
by interpolation in a standard, a small number of exact tabulated constants.
Apply curve fitting when the data carry measurement error, when the underlying
trend is the object of interest rather than reproduction of every point, or when a
lower-degree form is wanted from many noisy points.
Exact data and a target between the points: interpolate. Noisy data: fit.
(b) Differentiate between Newton's interpolation and Lagrange's interpolation.
[Marks: 02, CO: 2]
Newton's interpolation
Lagrange's interpolation
Form
Successive approximation, applied one point at a time
Single polynomial, all points at once
Basis
Divided differences or forward/backward differences
Products ∏j=ixi−xjx−xj
Adding a new point
Old result is retained; only a new term is added
Whole polynomial must be rebuilt
Equally spaced points
Forward/backward difference form is fastest
Works but ignores the equal spacing
Unequal spacing
Needs divided differences
Natural, no change needed
Cost per evaluation
O(n) after setup
O(n2) directly, O(n) with Neville
Near the table ends
Forward at the start, backward at the end
One formula for everywhere
Numerical stability
Better with the Neville form
Degrades with many points
Newton updates and reuses; Lagrange rebuilds once and is spacing-agnostic
(c) Derive the Newton's forward interpolation formula: yn(x)=y0+pΔy0+2!p(p−1)Δ2y0+3!p(p−1)(p−2)Δ3y0+⋯
[Marks: 04, CO: 2]
Set up. Let the function y=f(x) take values y0,y1,y2,…,yn at n+1 equidistant points x0,x1,x2,…,xn with constant step size h, such that xi=x0+ih.
Assume the interpolating polynomial Pn(x) of degree n in the form:
Step 1. Determine the coefficients a0,a1,a2,… successively.
At x=x0:
y0=Pn(x0)=a0⟹a0=y0
At x=x1=x0+h:
y1=Pn(x1)=a0+a1(x1−x0)=y0+a1ha1=hy1−y0=1!hΔy0
At x=x2=x0+2h:
y2=Pn(x2)=a0+a1(x2−x0)+a2(x2−x0)(x2−x1)=y0+a1(2h)+a2(2h)(h)y2=y0+2Δy0+2h2a2
Since Δ2y0=y2−2y1+y0=y2−2(y0+Δy0)+y0=y2−y0−2Δy0:
2h2a2=Δ2y0⟹a2=2!h2Δ2y0
By induction, the general coefficient is:
ak=k!hkΔky0,k=0,1,2,…,n
Step 2. Express in terms of the dimensionless variable p.
Let x=x0+ph, so that p=hx−x0. Then:
x−x0=phx−x1=x0+ph−(x0+h)=(p−1)hx−x2=(p−2)h,…,x−xk−1=(p−k+1)h
The product of factors becomes:
(x−x0)(x−x1)⋯(x−xk−1)=(ph)((p−1)h)⋯((p−k+1)h)=p(p−1)⋯(p−k+1)hk
Step 3. Substitute ak and product factors into Pn(x).
Validity range. The formula is accurate for 0≤p≤1, primarily near the beginning of equidistant tables. For values near the end, backward differences are used.
(d) Find y(2) from the following data using Lagrange's formula.
[Marks: 04, CO: 2]
x
0
1
3
4
5
y
0
1
81
256
625
Step 1. The formula. With five points x0=0,x1=1,x2=3,x3=4,x4=5,
y(2)=i=0∑4yiLi(2),Li(2)=j=i∏xi−xj2−xj
Step 2. Compute each weight, keeping numerator and denominator factors
separate.
A calibration certificate lists certified reference temperatures and the
corresponding indicated voltages:
Reference (∘C)
Indicated (mV)
0
0.00
100
4.09
200
7.33
400
12.45
The readings carry thermal drift and instrument noise, so no curve passes exactly
through all four. Fitting a polynomial by least squares finds the one that
comes closest, and the fitted curve then calibrates the instrument: a raw reading
of 9.20 mV converts to a temperature through the fit.
Second example: a load-extension test, where the raw data scatter because the
specimen is not perfectly uniform, and the fitted line gives the engineering
stress and stiffness.
Sensor calibration: noisy readings in, a best-fit law out, and predictions follow
(b) From the following table, calculate the value of e1.17 using Gauss' forward formula.
[Marks: 05, CO: 2]
x
1.00
1.05
1.10
1.15
1.20
1.25
1.30
ex
2.7183
2.8577
3.0042
3.1582
3.3201
3.4903
3.6693
Step 1. Choose origin x0 and compute p.
The target is x=1.17 and step size h=0.05.
Gauss' forward formula is a central-difference formula designed for 0≤p≤1 (ideally 0≤p≤0.5).
Choose origin x0=1.15. Then:
p=hx−x0=0.051.17−1.15=0.050.02=0.4
Step 2. Difference table.
x
1.00
1.05
1.10
1.15
1.20
1.25
1.30
y
2.7183
2.8577
3.0042
3.1582
3.3201
3.4903
3.6693
Δy
0.1394
0.1465
0.1540
0.1619
0.1702
0.1790
Δ2y
0.0071
0.0075
0.0079
0.0083
0.0088
Δ3y
0.0004
0.0004
0.0004
0.0005
Δ4y
0.0000
0.0000
0.0001
Δ5y
0.0000
0.0001
Δ6y
0.0001
Step 3. Collect the central path differences.
The central difference path traverses in a zigzag pattern:
y0→Δy0→Δ2y−1→Δ3y−1→Δ4y−2:
(c) You have a gas sensor. It sends a value in 2 seconds. The table of received values is t=1,3,5,7,9 with values 24,120,336,720,1200. What will be the sensor's reading at 10 s?
[Marks: 05, CO: 2]
t (s)
1
3
5
7
9
Value
24
120
336
720
1200
Step 1. Difference table. Here h=2.
t
1
3
5
7
9
y
24
120
336
720
1200
Δy
96
216
384
480
Δ2y
120
168
96
Δ3y
48
−72
Δ4y
−120
Step 2. Observe what the data really are. The first three differences of r3
are 3r2+3r+1, 6r+6, 6. Here Δy=96,216,384,480 grows by
120,168,96, not by a constant, so this is not a pure cubic in t.
Check the natural candidate: (t+1)(t+2)(t+3) gives 24,120,336,720 for
t=1,3,5,7, exactly matching, but gives 1320 at t=9, not 1200.
The fifth point does not lie on the cubic that the first four define. This
single fact determines which polynomial the question requires, and it is stated
explicitly rather than resolved by silently choosing one interpretation.
Step 3(a). Using all five points. The unique quartic through all five points,
evaluated by Newton's forward formula with p=210−1=4.5:
Term
Working
Value
y0
24
pΔy0
4.5(96)
432
2p(p−1)Δ2y0
24.5(3.5)(120)=7.875(120)
945
6p(p−1)(p−2)Δ3y0
64.5(3.5)(2.5)(48)=6.5625(48)
315
24p(p−1)(p−2)(p−3)Δ4y0
244.5(3.5)(2.5)(1.5)(−120)=2.4609375(−120)
−295.3125
24+432+945+315−295.3125=1420.6875
Step 3(b). Using the four points that lie on a clean cubic. Newton's forward
with the first four rows truncated at Δ3, p=4.5:
24+432+945+315=1716
and the cubic through those four points is exactly
y=t3+6t2+11t+6=(t+1)(t+2)(t+3)
which gives 1716 at t=10.
Five points (quartic): y(10)=1420.6875Four points (cubic): y(10)=1716
Question 5
(a) Define boundary value and initial value problem.
[Marks: 02, CO: 2]
Initial value problem (IVP). A differential equation together with conditions
given at a single point, for example y(0)=1. The solution can be marched
forward from that point because each new value depends only on the values already
computed.
Boundary value problem (BVP). A differential equation together with conditions
given at both ends of the interval, for example y(0)=0 and y(1)=1. No
starting value is known, so the whole interval must be solved at once.
IVP
BVP
Conditions
At one end
At both ends
How it is solved
March forward step by step
Solve the full algebraic system
Resulting system
Lower triangular
Tridiagonal for a second-order ODE
Cost
Very low per step
Full linear solve
Sensitivity
Local; errors stay near the start
Global; a change anywhere moves the whole solution
Shooting method
Not applicable
Reduces it to an IVP by tuning the unknown start value
IVP: conditions at one end, march forward. BVP: conditions at both ends, solve together.
Finite difference form for a second-order BVP. Discretise the interval into
n+1 points, replace y′′ by the centred difference, and use the boundary
conditions to replace the two unavailable end rows:
Step 3. Refine. Halving h should cut the error by about 4, since the scheme is
second order.
h
Interior nodes
Largest error
1
1
0.03375
0.5
3
0.00908
0.25
7
0.00249
0.125
15
0.00063
The ratio 0.00908/0.00249=3.65 is close to the expected 4, confirming
second-order accuracy.
(c) A capacitor loses 4% of its remaining charge every second. It is fully charged with 100 Coulomb of charge. What will be the remaining charge after 10 sec. Develop the ODE and also determine the solution.
[Marks: 05, CO: 2]
Step 1. Set up the rate equation. Losing 4% of the remaining charge each
second means the loss is proportional to the charge present, not a constant
4 C per second. If Q is the charge and t the time,
dtdQ=−0.04Q,Q(0)=100
The negative sign is essential: the charge is decreasing.
Step 2. Solve by separation of variables.
QdQ=−0.04dt
Integrating,
lnQ=−0.04t+C
At t=0, ln100=C, so
Q(t)=100e−0.04t
Step 3. Evaluate at t=10 s.
Q(10)=100e−0.4=100(0.670320046)=67.0320
Q(10)=67.03 Coulomb
SECTION B
Question 6
(a) Write down a real-life application of numerical differentiation.
[Marks: 02, CO: 2]
Velocity and acceleration from position data.
A vehicle's position x(t) is logged by GPS, or a vibrating mass's displacement
is recorded by an accelerometer. Neither instrument measures velocity directly,
yet both are needed for control. The derivative is obtained from the finite
difference
v(t)=2hx(t+h)−x(t−h)
GPS or accelerometer data gives position; the numerical derivative gives velocity and acceleration
Second application: finding the peak of a sampled signal, such as the peak
acceleration in a crash test, where the maximum of the numerical derivative locates
the maximum of the original.
(b) Use Newton's method to find the maximum of f(x)=2sinx−10x2 with an initial guess of x0=2.5.
[Marks: 03, CO: 2]
Step 1. Reduce to a root problem. An interior maximum of a smooth f satisfies
f′(x)=0, so apply Newton to the derivative. Since
Step 5. Exploit symmetry, then solve. The domain and the source
−10(x2+y2+10) are symmetric under x↔y, and (2,1) maps to
(1,2), so u2=u3. Let u2=u3=w. Then
⎩⎨⎧−4u1+2w=−120u1−4w+u4=−1502w−4u4=−180
From the first, u1=42w+120=2w+30. From the third,
u4=42w+180=2w+45. Substituting into the second,
(d) Differentiate between constrained and unconstrained optimization.
[Marks: 02, CO: 2]
Unconstrained optimization. No restrictions. Choose x freely in the whole
domain to maximise or minimise f(x).
minimise f(x1,x2,…,xn),x∈Rn
Example: fit y=a+bx to data by least squares. Nothing forbids any a or b,
hence it is unconstrained.
Constrained optimization. Extra conditions must hold. Each restriction is
written as g(x)≤0 or h(x)=0.
minimise f(x)subject togi(x)≤0,i=1…m,hj(x)=0
Example: minimise the weight of a truss subject to every member carrying at most
its rated load, or maximise a portfolio return subject to total risk staying under
a limit.
Unconstrained
Constrained
Restrictions
None
Equality and inequality conditions
Stationarity test
∇f=0
KKT multipliers: ∇f+∑μi∇gi+∑λj∇hj=0
Lagrange multipliers
Not needed
Essential
Optimum may be at
An interior point
A point on the boundary
Feasible region
Whole space
A subset
Harder
Easier
Harder; more constraints mean more cases
Unconstrained: choose freely. Constrained: obey rules, solved with multipliers
Question 7
(a) Why is pivoting important?
[Marks: 02, CO: 1]
Every elimination step divides by the pivot, the element chosen as divisor.
Pivoting reorders rows or columns so that pivot is as large in magnitude as
possible.
Two reasons.
A zero pivot stops the method. If akk=0, the step is undefined. Row
interchange usually fixes it.
A tiny pivot destroys accuracy. If akk=10−9 while other entries are
of order 1, then the multiplier akkaik is of order 109, and
subtracting such numbers loses most of the significant digits. The computation
still runs and returns a wrong answer.
Partial pivoting, the usual choice, selects the largest ∣aik∣ in
column k below the diagonal and swaps it up. It costs one comparison per
candidate and no extra arithmetic.
Pivoting avoids a zero or tiny divisor, which is where elimination accuracy is lost
(b) Determine the value of I0 in the given circuit using Gauss-Seidel method.
[Marks: 06, CO: 2]
Figure 2021 Q7(b): DC circuit with independent 30 V source, four resistors, and dependent voltage source 5I0 (Source: Page 2, Q7(b))
Step 1. Name the nodes. Take the bottom rail as reference, 0 V.
Node
Voltage
Top rail
VT=30 V, held by the ideal source
Centre node C
VC
Right node R
VR
Step 2. Express the controlling current.
I0=10VT−VC=1030−VC
Step 3. Apply the dependent source. The 5I0 source sets the right node:
VR=5I0=5(1030−VC)=15−0.5VC
Rearranged, that is one equation ready for iteration:
VC+2VR=30
Step 4. KCL at node C. Three branches leave it, toward the top rail, toward
ground, and toward node R:
The central form is both more accurate and symmetric, and it is therefore
preferred. The true value is e1.2=3.3201169, giving errors of +0.0221 and
−0.0514 respectively.
The central form is again much better: error +0.0124 against +0.7474.
dxdy1.2≈3.3423,dx2d2y1.2≈3.3325
Question 8
(a) Derive the following numerical integration formula: ∫x0xnydx=2h[y0+2(y1+y2+⋯+yn−1)+yn]
[Marks: 04, CO: 1]
The formula is the composite trapezoidal rule.h=nxn−x0, and
yi=f(xi) at xi=x0+ih.
Step 1. Start from the trapezoidal rule on one interval. On [xi,xi+1], the
trapezoid of area 21h(yi+yi+1),
∫xixi+1ydx=2h(yi+yi+1)−12h3y′′(ξi)+⋯
Step 2. Sum over all n intervals.
∫x0xnydx=i=0∑n−1[2h(yi+yi+1)+error]
Step 3. Collect the interior terms. Every y1,y2,…,yn−1 appears in
two adjacent trapezoids, once from each side, so each collects a factor of
2h×2=h. Only y0 and yn appear once, each with factor
2h. Hence
Taken literally at the six decimals the table prints, this gives
0.287682−1510−6=0.2876819. Carried unrounded, which is what the
answer below uses, the same line gives 0.2876820735, since the unrounded entries
are R2,1=0.2876832 and R3,1=0.2876821.
I≈0.2876821
(c) Using Euler's method, determine dxdy=53x3y; Consider y(0)=1.
[Marks: 04, CO: 3]
The method.
yn+1=yn+hf(xn,yn)=yn+h⋅53xn3yn
Step 1. At x0=0, y0=1: slope 53(0)3(1)=0, so
y1=1+0.25(0)=1.0000000.
Step 2. At x1=0.25, y1=1: slope
53(0.25)3(1)=53(0.015625)=0.0093750, so
y2=1+0.25(0.009375)=1.0023438.
Step 3. At x2=0.5, y2=1.0023438: slope
53(0.5)3(1.0023438)=53(0.125)(1.0023438)=0.0751758, so
y3=1.0023438+0.25(0.0751758)=1.0211377.
Step 4. At x3=0.75, y3=1.0211377: slope
53(0.75)3(1.0211377)=53(0.421875)(1.0211377)=0.2584755, so
y4=1.0211377+0.25(0.2584755)=1.0857566.
Step
xn
yn
Slope 53xn3yn
yn+1
1
0.00
1.0000000
0.0000000
1.0000000
2
0.25
1.0000000
0.0093750
1.0023438
3
0.50
1.0023438
0.0751758
1.0211377
4
0.75
1.0211377
0.2584755
1.0857566
y(1)≈1.08576(h=0.25)
Other step sizes, to show the choice is not arbitrary: