Numerical integration coursework
Numerical integration coursework
For this coursework, I am going to use my knowledge of numerical methods to produce an approximation to an area which does not have an analytic solution. I will be finding the approximation, to an appropriate degree of accuracy, of the integral shown above. On the graph below is the area that I will be approximating underneath the curve of y=
from x=0 to x=2. Note that throughout my method I worked in radians.
This problem is appropriate for numerical solution as I chose my graph to be a polynomial curve involving a square root so that there would be no analytical solution. Due to the fact that I cannot yet integrate functions like this approximating methods will have to be used. According to the numerical methods module the three approximation methods to be used are:
Mid-point rule- this method was adopted because it is used to approximate the area underneath the graph by dividing it up into individual rectangles.
Trapezium rule- this method was adopted because it is used to approximate the area underneath the graph, this is done so by dividing it up into individual trapeziums.
Simpson’s rule- I have realised that out of the two, the mid-point rule and the trapezium rule, the mid-point rule is more accurate, Simpson’s rule is therefore just an average that uses this fact by weighting the average towards the mid-point rule to give a more accurate answer.
Use of technology
I used Microsoft Excel throughout my method along with many algorithms, these algorithms allowed me to reach a more accurate approximation thanks to the fact that there were no rounding errors usually gained through using a calculator that gives answers to fewer decimal places. Overall then Excel is more accurate than the use of a calculator due to being able to work to more decimal places, it is also easier to use and saves a lot of time.
This is a preview of the whole essay
The first step is to use the mid-point rule; this will be done by splitting the area under the curve into rectangular strips as shown by the diagram.
Thus far using the mid-point rule only gives a good estimate, however obviously as you increase the amount of strips the accuracy of the area increases. To estimate the area you first need to find the area of each rectangle. You can do this by thinking logically; to get the width of each rectangle you need to do the range between the limits of the integral divided by the number of rectangles. You then multiply this by the height, which you can get by doing the function of the mid-point of each rectangle, and finally add up the area found of them.
Hence you get this formula: Mn= h (f(m₁)+f(m₂)+…+f(mn))
I used this formula and many algorithms when working on Excel to make an approximation from M₁ up to M₆₄, these algorithms made it much easier and quicker to come to a final answer thanks to the ability to just simply pull down the box with the algorithm in to transfer it to other boxes.
The trapezium rule is very similar to the mid-point rule in that it also divides the area up into strips; however the difference is that instead of using rectangles trapeziums are used, as shown.
Summing the areas of the trapezium gives an approximation to the integral; again as in the mid-point rule the formula for the area of the trapeziums is very logical:
The last of the methods suggested to be used by the numerical methods module is Simpson’s rule. By combining the other two it works like an average to provide a more accurate answer; this works by using the fact that the mid-point rule is more accurate than the trapezium rule so the average is weighted towards the mid-point rule to allow for this. Hence the following formula to calculate Sⁿ:
Sn= 2(Mn) +Tn
Extrapolating my answers to the Simpson’s rule to infinity will be the most accurate answer that I can give.
Formula view of my method for approximations
Here I will briefly show how I used algorithms on Microsoft Excel to reach my approximations:
As all three rules are actually only approximations there is always error involved, they are all gradually converging towards the actual solution. In reference to my graph the integral section is concave which means that the trapezium rule gives an overestimate and the mid-point rule gives an underestimate. As the number of strips increases the trapezium rule will tend to the solution from above and the mid-point rule will tend from below.
Error in the mid-point rule
In the mid-point rule the error is proportional to the width of the rectangle squared, or in mathematical terms, absolute error Mn= kh2, where k is the constant. If the mid-point rule with n strips has a strip width of h, then the mid-point rule with 2n strips has a strip width of h/2.
Therefore when you double the amount of strips (n) the error decreases by about a factor of 4, the error multiplier is therefore 0.25.
Error in the trapezium rule
The error connected to the trapezium rule is the same as the error in the mid-point rule. That means that when you double the amount of strips (n) the error decreases by about a factor of 4, the error multiplier is therefore 0.25.
Error in Simpson’s rule
Finally, in Simpson’s rule the error is proportional to h4, this means there is a constant, again k, such that absolute error Sn= kh2, where k is the constant. Again, if the Simpson’s rule with n strips has a strip width of h, then the Simpson’s rule with 2n strips has a strip width of h/2.
That shows that doubling n will reduce the error by a factor of 16, therefore the error multiplier is 0.0625.
Ratio of differences
The ‘error multiplier’ mentioned above is the same as the ratio of differences as shown by the image of my data below, the ratio of differences is tending towards 1/4 for the mid-point and trapezium rule and 1/16 for Simpson’s rule.
Extrapolating to infinity
We know that the error is decreasing by a factor of 4 as the number of strips doubles; this means that the error is tending towards 0, using this fact we can work towards extrapolating our approximations to infinity with zero error.
The ratio of differences can be expressed as a formula as:
This means that
And finally this cancels down to
Using this formula we can now extrapolate our answers of Mⁿ to infinity.
Similarly you can use the formula for
in the same way, just replacing M with T due to the error multiplier being the same.
If you follow through the same steps as we did for the mid-point you similarly reach a formula for extrapolating Simpson’s rule to infinity:
So in conclusion I can confidently quote my solution to the integral
to 8 significant figures:
This is due to the three approximations that I reached (17 sig figs):
There was however some limitation. The software, Microsoft Excel, only calculated to 15 decimal places inevitably producing minimal amounts of error with each calculation done. To further improve my results I could have used better mathematical software which worked to more decimal places, but for a problem like this Excel was more than sufficient.
The fact that the trapezium rule and the mid-point rule give the same solution up to 8 significant figures guarantees that my solution is valid to this many significant figures. This is because, as I have indicated in the paragraphs dealing with error analysis, in the integral section of my graph the trapezium rule tends towards the solution from above and the mid-point rule from below meaning the solution is between the two. Simpson’s rule, being a weighted average, is more accurate and therefore likewise proves the solution.
Overall then my solution is proved by 3 different rules.