Numerical Differentiation Notes
1. Numerical Differentiation Concept
Numerical differentiation approximates the derivative (slope) of a function f at a specific point x = a using values of f
at nearby points (e.g., a + h or a − h), where h is a small step size.
2. First Derivative Approximations
The derivative is formally defined as the limit of the slope of the chord connecting two points on the curve as the distance
between them approaches zero. In numerical methods, we retain a finite h.
2.1 One-Sided Differences
These methods use the point of interest a and one other adjacent point.
• Forward Difference: Uses the point to the right (a + h).
f (a + h) − f (a)
f ′ (a) ≈
h
• Backward Difference: Uses the point to the left (a − h).
f (a) − f (a − h)
f ′ (a) ≈
h
Note: Both approximations are generally less accurate than central differences for the same step size h. The error
typically reduces linearly with h (order h).
2.2 Central Difference
This method uses points on either side of a, effectively taking the average of the slopes surrounding the point.
f (a + h) − f (a − h)
f ′ (a) ≈
2h
d
Accuracy: The central difference is generally superior. As illustrated in the examples (approximating dx cos(x) at
x = π/3), reducing h by a factor of 10 improves the accuracy of the central difference by a factor of approximately 100
(order h2 ), whereas forward/backward differences only improve by a factor of 10.
3. Application: Velocity from Displacement Data
Numerical differentiation is essential when the function f (x) is not known analytically but is provided as discrete data
points (e.g., experimental measurements).
• Given displacement x at time t, velocity v(t) ≈ x′ (t).
• To calculate velocity at time t, select a step h supported by the data table.
• Example: To find v at t = 0.5 s using data at t = 0.0, 0.5, 1.0:
x(1.0) − x(0.0)
v(0.5) ≈
2 × 0.5
4. Second Derivative Approximation
The second derivative f ′′ (a) represents the rate of change of the slope. It is approximated by applying the central
difference formula to the first derivative.
4.1 Derivation
Starting with the central difference of the first derivative:
f ′ (a + 21 h) − f ′ (a − 12 h)
f ′′ (a) ≈
h
Substituting the central difference approximations for the first derivatives at the half-points:
f (a + h) − f (a) f (a) − f (a − h)
f ′ (a + 12 h) ≈ and f ′ (a − 21 h) ≈
h h
Combining these yields the standard formula.
4.2 Formula
f (a + h) − 2f (a) + f (a − h)
f ′′ (a) ≈
h2
5. Application: Acceleration from Displacement Data
d2 x
Acceleration is the second derivative of position with respect to time (a = dt2
).
• Using the central difference formula for second derivatives allows calculation of acceleration directly from position
data.
• Example: To find acceleration at t = 1.5 s with h = 0.5 s:
x(2.0) − 2x(1.5) + x(1.0)
a(1.5) ≈
0.52
• A negative result indicates the object is slowing down (deceleration).