Taking numerical derivatives is based on the elementary definition
\[\frac{dy(t)}{dt} := \lim_{h\rightarrow 0} \frac{y(t+h) - y(t)}{h}\]We will then derive different finite difference approximations to the derivative and assess their error.
Class material
You can follow the lecture in the slides 09-differentiation-theory.ipynb.
ActivityError analysis of differentiation algorithms
In this activity you will implement different finite difference algorithms for numerical differentiation. You will then analyze how the algorithmic error depends on the spacing \(dt\) that you use to evaluate the derivative. As you will see, there is a point when numerical (floating point representation) errors limit the achievable accuracy.
Additional resources
- Computational Physics: Ch 5.1 – 5.6
- If you are interested in integration then see the lectures on integration in 2016.