GEOL 5470
Homework/Labwork Humphrey
In last week’s work, we calculated and plotted the derivative and integral of a curve, by either taking differences, or by calculating areas. We start this week by learning to use built-in methods to do both simple and complex numerical work. Numpy is part of a larger science computation package called SciPy, and some of the methods we will be using will come from scipy.
1. Integrate the sine curve using the scipy method ‘quad’. You will need to look up the documentation on quad. Unfortunately, as with most methods, quad can be used in unbelievably complex ways and the documentation is not easy to read or understand. However, at a minimal level quad is fairly easy: the format is quad(name of function you are integrating, the starting point of the independent variable, stopping point). Quad() returns an array [a,b] of two numbers, the first is the value of the integral, the second is an estimate of the size of any error. We will only use the first. Remember, array indexes start at 0, so we want [0].
So modify your integration code to integrate using scipy.integrate.quad.