32.5 KB · commit a9602da
← Previous: NM-6 Optimization | 🏠 Index | Next: NM-8.2 Euler's Method →
Section: A (Numerical Methods) | Priority: 🟠 | Exam Frequency: 5/8 years | Subtopics: NM-7.1, NM-7.2, NM-7.3, NM-7.4 Sources: Jain Ch.6 §6.1–§6.2, Shishir Notes §03 pp.36–52
Numerical differentiation shows up whenever a physical quantity must be recovered from a table of measurements. Velocity from GPS logs, voltage across an inductor from a current table, angular velocity from displacement data. The topic carries two distinct question types: formula recall (state four difference equations, 2019) and tabulated-data computation (2017, 2018, 2019, 2020, 2021, 2022). The second-derivative derivation question is the one to fear most, so it gets its own section below.
Basis of numerical differentiation: "The general method for deriving the numerical differentiation formulae is to differentiate the interpolating polynomial. Hence, corresponding to each of the formulae derived in Chapter 3, we may derive a formula for the derivative." — Jain, §6.2 (p. 207)
Numerical differentiation problem: "given the set of values of x and y, as above, we shall derive formulae to compute (i) dxdy,dx2d2y,… for any value of x in [x0,xn]" — Jain, §6.1 (p. 207)
Why it is unreliable: "although the tabulated function and its approximating polynomial would agree at the set of data points, their slopes at these points may vary considerably. Numerical differentiation, is, therefore, an unsatisfactory process and should be used only in 'rare cases.'" — Jain, §6.2 (p. 212)
Order of accuracy: O(h) for two-point formulas, O(h2) for three-point formulas, O(h4) for the five-point central formula. The symbol O(hp) means the error shrinks by a factor of 2p when h is halved.
The basis is simple. A function known only at discrete points is replaced by a polynomial that passes through those points, and the derivative of that polynomial is used for the derivative of the function.
Everything follows from the Taylor series at a neighbouring point:
f(x+h)=f(x)+hf′(x)+2h2f′′(x)+6h3f′′′(x)+⋯Combinations of the series at neighbouring points cancel the terms that are not wanted. Since the first omitted term is proportional to a power of h, the result is an approximation with an error O(h) or O(h2).
With h the tabular spacing and fn=f(xn):
| Formula | Expression | Nodes needed | Order |
|---|---|---|---|
| Two-point forward | f′(xn)=hfn+1−fn | n,n+1 | O(h) |
| Two-point backward | f′(xn)=hfn−fn−1 | n−1,n | O(h) |
| Three-point central | f′(xn)=2hfn+1−fn−1 | n−1,n+1 | O(h2) |
| Three-point forward | f′(xn)=2h−3fn+4fn+1−fn+2 | n,n+1,n+2 | O(h2) |
| Three-point backward | f′(xn)=2h3fn−4fn−1+fn−2 | n−2,n−1,n | O(h2) |
| Five-point central | f′(xn)=12hfn−2−8fn−1+8fn+1−fn+2 | n−2,…,n+2 | O(h4) |
The central formulas are preferred where data exist on both sides, since their error is O(h2) and above rather than O(h), and their error constants are smaller by the same factor.
| Direction | First derivative | Second derivative |
|---|---|---|
| Forward | y′(xi)=hyi+1−yi | y′′(xi)=h2yi−2yi+1+yi+2 |
| Forward (3-pt) | y′(xi)=2h−yi+2+4yi+1−3yi | y′′(xi)=h2−yi+3+4yi+2−5yi+1+2yi |
| Backward | y′(xi)=hyi−yi−1 | y′′(xi)=h2yi−2yi−1+yi−2 |
| Backward (3-pt) | y′(xi)=2h3yi−4yi−1+yi−2 | y′′(xi)=h22yi−5yi−1+4yi−2−yi−3 |
| Central | y′(xi)=2hyi+1−yi−1 | y′′(xi)=h2yi−1−2yi+yi+1 |
| Central (5-pt) | y′(xi)=12h−yi+2+8yi+1−8yi−1+yi−2 | y′′(xi)=12h2−yi+2+16yi+1−30yi+16yi−1−yi−2 |
Appeared: 2019 Q.6(a) — (04 marks)
Full Answer:
The basis. A function known only at discrete points is replaced by a polynomial that passes through those points, and the derivative of that polynomial is used for the derivative of the function. Starting from the Taylor series
f(x+h)=f(x)+hf′(x)+2h2f′′(x)+6h3f′′′(x)+⋯combinations of the series at neighbouring points cancel the terms that are not wanted. Since the first omitted term is proportional to a power of h, the result is an approximation with an error O(h) or O(h2).
Four difference equations. With h the tabular spacing and fn=f(xn):
Forward difference (two-point).
f′(xn)=hfn+1−fn,error O(h)Backward difference (two-point).
f′(xn)=hfn−fn−1,error O(h)Central difference (three-point).
f′(xn)=2hfn+1−fn−1,error O(h2)Forward difference (three-point).
f′(xn)=2h−3fn+4fn+1−fn+2,error O(h2)Central difference (five-point).
f′(xn)=12hfn−2−8fn−1+8fn+1−fn+2,error O(h4)The central formulas are preferred where data exist on both sides, since their error is O(h2) and above rather than O(h), and their error constants are smaller by the same factor.
Given a table of f at equally spaced nodes, the derivative at a node comes straight from the difference formula. The whole difficulty is choosing the right formula.
The decision procedure, in order:
Source: 2021 Q.7(c) [Marks: 05]
Question. From the values of x and y in the following table, determine dxdy and dx2d2y for x=1.2.
| x | 1.0 | 1.2 | 1.4 | 1.6 | 1.8 | 2.0 | 2.2 |
|---|---|---|---|---|---|---|---|
| y | 2.7183 | 3.3201 | 4.0552 | 4.9530 | 6.0496 | 7.3891 | 9.0250 |
The nodes are equally spaced with h=0.2, and the values are ex rounded to four decimals.
First derivative, three-point central. Uses x=1.0,1.2,1.4:
dxdy1.2≈2hy1.4−y1.0=0.44.0552−2.7183=0.41.3369=3.34225First derivative, three-point forward. Uses x=1.2,1.4,1.6:
dxdy1.2≈2h−3y1.2+4y1.4−y1.6=0.4−3(3.3201)+4(4.0552)−4.9530=0.4−9.9603+16.2208−4.9530=0.41.3075=3.26875The 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.
Second derivative, three-point central.
dx2d2y1.2≈h2y1.4−2y1.2+y1.0=0.044.0552−2(3.3201)+2.7183=0.040.1333=3.3325Second derivative, three-point forward.
dx2d2y1.2≈h2y1.6−2y1.4+y1.2=0.044.9530−2(4.0552)+3.3201=0.040.1627=4.0675The central form is again much better: error +0.0124 against +0.7474.
dxdy1.2≈3.3423,dx2d2y1.2≈3.3325Appeared: 2019 Q.6(b) — (05 marks)
Full Answer:
| t (sec) | 0.25 | 0.26 | 0.27 | 0.28 | 0.29 |
|---|---|---|---|---|---|
| I (amp) | 0.2474 | 0.2571 | 0.2667 | 0.2764 | 0.2860 |
The tabular spacing is h=0.01. The target t=0.27 has two points on each side, so the five-point central formula is available and is the most accurate.
Five-point central difference.
f′(xn)=12hfn−2−8fn−1+8fn+1−fn+2With fn−2=0.2474, fn−1=0.2571, fn+1=0.2764, fn+2=0.2860:
dtdIt=0.27=12(0.01)0.2474−8(0.2571)+8(0.2764)−0.2860 dtdI=0.120.2474−2.0568+2.2112−0.2860=0.120.1158=0.965Voltage across the inductor. For L=1 H, v=LdtdI:
v=1×0.965=0.965 V v(0.27)=0.965 VAppeared: 2020 Q.6(c) — (04 marks)
Full Answer:
| t | 0 | 0.02 | 0.04 | 0.06 | 0.08 | 0.10 | 0.12 |
|---|---|---|---|---|---|---|---|
| θ | 0.052 | 0.105 | 0.168 | 0.242 | 0.327 | 0.408 | 0.489 |
Step 1. Angular velocity is the derivative. ω=dtdθ, so this is numerical differentiation of a table with h=0.02 s.
Step 2. t=0.06 is an interior node. Data exist on both sides, at 0.04 and 0.08, so the three-point central formula applies and is both the most accurate of the three-point formulas and the natural one here.
dtdθ0.06≈2hθ0.08−θ0.04=2(0.02)0.327−0.168=0.040.159=3.975 dtdθt=0.06≈3.975 rad/sStep 3. The other available formulas, for comparison.
| Formula | Nodes needed | Value at t=0.06 |
|---|---|---|
| Three-point central | 0.04,0.06,0.08 | 3.975 |
| Five-point central | 0.02 to 0.10 | 4.0375 |
| Three-point forward | 0.06,0.08,0.10 | 4.350 |
| Three-point backward | 0.02,0.04,0.06 | 3.975 |
The five-point central formula is available here, because 0.06−2h=0.02 is in the table:
dtdθ0.06≈12hθ0.02−8θ0.04+8θ0.08−θ0.10=0.240.105−8(0.168)+8(0.327)−0.408 =0.240.105−1.344+2.616−0.408=0.240.969=4.0375Appeared: 2022 Q.3(b) — (04 marks)
Full Answer:
Step 1. Newton's divided difference form, on the sorted nodes.
| Order | Values | How each entry is computed |
|---|---|---|
| y | 1, 4, 17, 40, 85 | given |
| 1st | 3, 13, 23, 45 | (4−1)/1, (17−4)/1, (40−17)/1, (85−40)/1 |
| 2nd | 5, 5, 11 | (13−3)/2=5, (23−13)/2=5, (45−23)/2=11 |
| 3rd | 0, 2 | (5−5)/3=0, (11−5)/3=2 |
| 4th | 21 | (2−0)/4=21 |
The fourth divided difference is 21, not zero. For any cubic in x the third divided difference is constant and the fourth is zero, so this table is the proof that the data lie on a quartic, not a cubic.
The leading diagonal is 1,3,5,0,21, giving
f(x)=1+3x+5x(x−1)+0⋅x(x−1)(x−2)+21x(x−1)(x−2)(x−3)The third divided difference is zero, so that term vanishes entirely.
Step 2. Expand. Using x(x−1)(x−2)(x−3)=x4−6x3+11x2−6x:
f(x)=1+3x+5x2−5x+21(x4−6x3+11x2−6x) f(x)=2x4−3x3+221x2−5x+1Step 3. Verify all five points before differentiating anything.
| x | 2x4 | −3x3 | 221x2 | −5x | 1 | Total | Given | |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | ✓ |
| 1 | 0.5 | −3 | 10.5 | −5 | 1 | 4 | 4 | ✓ |
| 2 | 8 | −24 | 42 | −10 | 1 | 17 | 17 | ✓ |
| 3 | 40.5 | −81 | 94.5 | −15 | 1 | 40 | 40 | ✓ |
| 4 | 128 | −192 | 168 | −20 | 1 | 85 | 85 | ✓ |
All five are reproduced exactly, with no rounding anywhere.
Step 4. Differentiate and evaluate.
f′(x)=2x3−9x2+21x−5 f′(4)=2(64)−9(16)+21(4)−5=128−144+84−5=68−5 f′(4)=63Set-up. Let y=f(x) be tabulated at equally spaced nodes with interval h, and write p=hx−x0. Newton's forward interpolation formula is
y=y0+pΔy0+2!p(p−1)Δ2y0+3!p(p−1)(p−2)Δ3y0+4!p(p−1)(p−2)(p−3)Δ4y0+⋯The chain rule is the whole method. Since x enters only through p,
dxd=h1dpd,dx2d2y=h21dp2d2ySo 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.
First derivative. Differentiating term by term:
dxdy=h1[Δy0+2!2p−1Δ2y0+3!3p2−6p+2Δ3y0+4!4p3−18p2+22p−6Δ4y0+⋯]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.
Second derivative. Differentiating a second time:
dx2d2y=h21[Δ2y0+3!6p−6Δ3y0+4!12p2−36p+22Δ4y0+⋯]Each coefficient is the second derivative of the corresponding product, divided by k!:
dp2d2(p2−p)=2,dp2d2(p3−3p2+2p)=6p−6,dp2d2(p4−6p3+11p2−6p)=12p2−36p+22and dividing by 2!, 3! and 4! gives 1, (p−1) and (2p2−23p+1211).
dx2d2y=h21[Δ2y0+(p−1)Δ3y0+(2p2−23p+1211)Δ4y0+⋯]At the nodes (p=0), the formula collapses to the simpler forms:
[dxdy]x=x0=h1(Δy0−21Δ2y0+31Δ3y0−41Δ4y0+⋯) [dx2d2y]x=x0=h21(Δ2y0−Δ3y0+1211Δ4y0+⋯)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 terminates after the term in Δny0. Since y′′ requires differences of order two and above, at least three points are needed, 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,
dx2d2y=h21[∇2yn+(q+1)∇3yn+(2q2+23q+1211)∇4yn+⋯]Validity. The formula reproduces dx2d2y exactly for any polynomial of degree four or lower, because every term from Δ5y0 onward then vanishes. For a table of noisy experimental data the higher differences are not zero, and they are also the noisiest entries in the difference table, so the terms beyond the data's smoothness are not worth retaining.
Appeared: 2017 Q.6(c) — (04 marks)
Full Answer:
Set-up. Let y=f(x) be tabulated at equally spaced nodes with interval h, and write p=hx−x0. Newton's forward interpolation formula is
y=y0+pΔy0+2!p(p−1)Δ2y0+3!p(p−1)(p−2)Δ3y0+4!p(p−1)(p−2)(p−3)Δ4y0+⋯First derivative. Since dx=hdp, differentiation with respect to x is (1/h) times differentiation with respect to p:
dxdy=h1[Δy0+2!2p−1Δ2y0+3!3p2−6p+2Δ3y0+4!4p3−18p2+22p−6Δ4y0+⋯]Second derivative. Differentiating a second time:
dx2d2y=h21[Δ2y0+(p−1)Δ3y0+(2p2−23p+1211)Δ4y0+⋯]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 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.
Appeared: 2018 Q.5(a) — (06 marks)
Full Answer:
Newton's forward formula. For a tabular spacing h, the forward difference interpolation polynomial through n+1 points is
y=y0+pΔy0+2!p(p−1)Δ2y0+3!p(p−1)(p−2)Δ3y0+4!p(p−1)(p−2)(p−3)Δ4y0+⋯with
p=hx−x0First derivative. Differentiating term by term, dxd=h1dpd:
dxdy=h1[Δy0+2!2p−1Δ2y0+3!3p2−6p+2Δ3y0+4!4p3−18p2+22p−6Δ4y0+⋯]Second derivative. Differentiating a second time:
dx2d2y=h21[Δ2y0+3!6p−6Δ3y0+4!12p2−36p+22Δ4y0+⋯]which simplifies to
dx2d2y=h21[Δ2y0+(p−1)Δ3y0+(2p2−23p+1211)Δ4y0+⋯]Validity. The formula reproduces dx2d2y exactly for any polynomial of degree four or lower, because every term from Δ5y0 onward then vanishes.
Terms retained. 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 exist, and so on. Since y′′ requires 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)Δ5y0Real applications of numerical differentiation come down to two ideas. First, a physical quantity that no instrument measures directly is recovered from one that does. Second, an extremum of a signal is located by differentiating it.
Appeared: 2021 Q.6(a) — (03 marks)
Full Answer:
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)Accuracy is O(h2), and halving h cuts the truncation error by 4 while multiplying the round off error by 2, so the optimal h sits where the two cross, usually near the cube root of the machine epsilon.
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.
GPS or accelerometer data gives position; the numerical derivative gives velocity and acceleration| Year | Question | Data | Key Answer |
|---|---|---|---|
| 2017 Q.6(c) | Derive formula for 2nd derivative | Theory | dx2d2y=h21[Δ2y0+(p−1)Δ3y0+(2p2−23p+1211)Δ4y0+⋯] |
| 2018 Q.5(a) | State Newton's forward formula for d2y/dx2 | Theory | same boxed formula |
| 2019 Q.6(a) | Basis + 4 difference equations | Theory | 5 formulas with orders O(h), O(h2), O(h4) |
| 2019 Q.6(b) | Inductor voltage at t=0.27 s | L=1 H, 5 points | v(0.27)=0.965 V |
| 2020 Q.6(c) | Angular velocity at t=0.06 s | 7 points, h=0.02 | $\boxed{\left.\frac{d\theta}{dt}\right |
| 2021 Q.6(a) | Real-life application | Theory | GPS or accelerometer data gives position; the numerical derivative gives velocity and acceleration |
| 2021 Q.7(c) | dy/dx and d2y/dx2 at x=1.2 | ex table, h=0.2 | $\boxed{\frac{dy}{dx}\bigg |
| 2022 Q.3(b) | f′(4) from 5 points | Out-of-order x column | f(x)=2x4−3x3+221x2−5x+1 and f′(4)=63 |
← Previous: NM-6 Optimization | 🏠 Index | Next: NM-8.2 Euler's Method →