In this lecture we discussed two standard numerical methods that often need to be applied in sciences, namely the finding of roots and numerical integration.
The former problem essentially boils down to finding values of x satisfying f(x)=0. This is achieved iteratively, starting from one or two values of x and refining these estimates until a certain, predefined accuracy has been reached. We first discussed a method, the Newton-Raphson method, which employs knowledge of the first derivative of the function f to obtain improved estimates. Another method, the secant method has a similar degree of convergence, but it uses the function itself, taken at two positions, to estimate the derivative and refine the value of x. Ultimately we also discussed a more straightforward, brute-force approach, known as bisections, in which an interval is repeatedly divided. To make this method work, the two edges of the interval must lead to different signs of the function.
For the numerical integration we first developed a more pictorial idea about integration, identifying it with summing the approximated size of panels. To this end the integration interval is divided into subintervals of the same size, and panels are reconstructed by identifying the other side with the value of the function at the support positions. The simple most realisation of this is provided with the Newton-Cotes methods, a quick analysis of its accuracy immediately results in an improved algorithm, known as the trapezium rule or trapezoid method. There the panels are rearranged such that, effectively, the sum is not over rectangular panels any more but over trapeziums. A further improvement has been obtained with the Simpson rule. We've checked these methods with a few example functions.
A further way of integrating, which is especially useful for multi-dimensional integrals is provided by Monte-Carlo integration. We exemplified this by determining the value of π from a simple integration using a method also known as hit-or-miss method. We could have used this method also to determine the volume of multi-dimensional hypershperes, but we leave it to the enthusiasm of the students to play with this issue. Nevertheless, we discussed how to determine the volume of hyperspheres in arbitrary dimensions by making the number d of dimensions a continous number.