Numerical Methods · Unit 5
Numerical Differentiation
Exam-focused notes for Numerical Differentiation (Numerical Methods, BIT203): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.
Numerical Differentiation in short
Many functions are known only as tables of values, or are too hard to differentiate by hand. Numerical differentiation estimates the derivative from function values at nearby points.
What this unit covers
- Derivatives of continuous functions
- Two point forward difference formula
- Two point backward difference formula
- Divided difference table for derivatives
- First and second order derivatives
- Algorithm and program for numerical differentiation
Two point forward difference formula
2082 · 5 marks
Derive the formula for two points forward difference. Derive the formula for two points backward difference. [2.5+2.5]
Divided difference table for derivatives
2082 · 5 marks
Find the first and second derivative at $x = 2.5$ of the following data points.
$$\begin{array}{|c|cccccc|}\hline x & 1.5 & 2 & 2.5 & 3 & 3.5 & 4 \ \hline f(x) & 2.375 & 4.5 & 7.625 & 12 & 17.875 & 23 \ \hline \end{array}$$
[5]
Show solved answerHide answer
Numerical Differentiation at x = 2.5
Given
| $x$ | 1.5 | 2.0 | 2.5 | 3.0 | 3.5 | 4.0 |
|---|---|---|---|---|---|---|
| $f(x)$ | 2.375 | 4.5 | 7.625 | 12 | 17.875 | 23 |
- Step size: $h = 0.5$
- Point of interest: $x = 2.5$
Solution
Forward Difference Table
Take $x_0 = 2.5$ so that $p = 0$. First compute all differences carefully.
| $x$ | $f$ | $\Delta f$ | $\Delta^2 f$ | $\Delta^3 f$ | $\Delta^4 f$ | $\Delta^5 f$ |
|---|---|---|---|---|---|---|
| 1.5 | 2.375 | 2.125 | 1.0 | 0.25 | 0 | -2.5 |
| 2.0 | 4.5 | 3.125 | 1.25 | 0.25 | -2.5 | |
| 2.5 | 7.625 | 4.375 | 1.5 | -2.25 | ||
| 3.0 | 12.0 | 5.875 | -0.75 | |||
| 3.5 | 17.875 | 5.125 | ||||
| 4.0 | 23.0 |
Checks:
- $\Delta f$: $2.125, 3.125, 4.375, 5.875, 5.125$
- $\Delta^2 f$: $1.0, 1.25, 1.5, -0.75$
- $\Delta^3 f$: $0.25, 0.25, -2.25$
- $\Delta^4 f$: $0, -2.5$
- $\Delta^5 f$: $-2.5$
Note: the data comes from $f(x)=x^3+\tfrac{1}{2}x^2-1$ up to $x=3.5$ but the last point $f(4)=23$ breaks the cubic (true cubic value would be $71$). This is why higher differences do not vanish. We proceed with the tabulated data as given.
At $x_0 = 2.5$ (the row starting there): $$\Delta f_0 = 4.375,\ \Delta^2 f_0 = 1.5,\ \Delta^3 f_0 = -2.25,\ \Delta^4 f_0 = -2.5$$
First Derivative (Newton's forward, $p=0$)
$$f'(x_0) = \frac{1}{h}\left[\Delta f_0 - \frac{1}{2}\Delta^2 f_0 + \frac{1}{3}\Delta^3 f_0 - \frac{1}{4}\Delta^4 f_0 + \cdots\right]$$
$$= \frac{1}{0.5}\left[4.375 - \frac{1}{2}(1.5) + \frac{1}{3}(-2.25) - \frac{1}{4}(-2.5)\right]$$
$$= 2\left[4.375 - 0.75 - 0.75 + 0.625\right] = 2(3.5) = 7.0$$
Second Derivative (Newton's forward, $p=0$)
$$f''(x_0) = \frac{1}{h^2}\left[\Delta^2 f_0 - \Delta^3 f_0 + \frac{11}{12}\Delta^4 f_0 - \cdots\right]$$
$$= \frac{1}{(0.5)^2}\left[1.5 - (-2.25) + \frac{11}{12}(-2.5)\right]$$
$$= \frac{1}{0.25}\left[1.5 + 2.25 - 2.2917\right]$$
$$= 4 \times 1.4583 = 5.833$$
Summary
| Derivative | Value |
|---|---|
| $f'(2.5)$ | $7.0$ |
| $f''(2.5)$ | $\approx 5.833$ |
(Interpretation: had the last data point been consistent with a cubic, the $f'=x^2$-related exact values would give $f'(2.5)=21.25$ and $f''(2.5)=15.5$, but working strictly from the tabulated data with truncation at $\Delta^4$ yields the values above.)
2078 · 5 marks
The table below gives the values of distance travelled by a car at various time intervals during the initial running. Estimate the velocity and acceleration at time t = 7 sec.
$$\begin{array}{|c|c|c|c|c|c|}\hline \text{Time (t sec)} & 5 & 6 & 7 & 8 & 9 \ \hline \text{Distance (s m)} & 10.0 & 14.5 & 19.5 & 25.5 & 32.0 \ \hline \end{array}$$
[5]
Algorithm and program for numerical differentiation
0 · 5 marks
How can we calculate derivatives of continuous functions? Write down algorithm and program for differentiating continuous function using two point forward difference formula. [5]
Make Unit 5 stick
Practice BIT203 with flashcards & quizzes