NUMERICAL METHODS COURSEWORK INFORMAL NOTES ON NUMERICAL INTEGRATION COURSEWORK For this piece of coursework studets must use the methods for umerical itegratio they meet i the Numerical Methods module to produce approximatios to a area which caot be calculated exactly usig other techiques they kow. Studets eed good kowledge of the methods themselves ad the way that they behave i relatio to error. By usig a spreadsheet program studets should be able to produce very accurate approximatios to their chose area ad be able to judge how reliable their approximatios are. If studets are doig coursework o a topic other tha umerical itegratio this documet should still prove useful as a guide for how to write the report, as a guide for ideas about error, to give you some idea of the level of detail required i this piece of coursework. IMPORTANT: Studets chose problem should ot have a aalytical solutio. This meas that it should t be somethig that they ca solve usig the techiques they have leart/will lear i pure maths modules. For example, they should/will kow how to evaluate the followig itegrals from stadard A-level pure maths work, so they should t pick aythig similar for your Numerical Methods coursework. π π 8 5 x x dx, ( x + x 1) dx, si( x) dx, ( x cos( x) ) dx, ( e si ) 1 0 0 1 0 x dx MAKE SURE THAT STUDENTS CHECK WITH THEIR TUTOR THAT THEIR PROBLEM IS APPROPRIATE BEFORE THEY EMBARK ON THEIR COURSEWORK This documet cotais details of the report studet should write o their coursework a recap of key ideas from the Numerical Methods module relatig to the behaviour of error i the various methods of umerical itegratio that studets are likely to use i their coursework.
The Report Phase 1 Problem Specificatio Make sure that you tell the reader exactly what you are attemptig to do i your coursework. For example, if you are tryig to approximate a itegral make sure that you tell the reader betwee which values you are itegratig show this o a diagram. You should briefly explai why your problem caot be solved usig ormal aalytical pure maths methods. See above. This phase should be fairly short. Phase Strategy Say what you are goig to do to solve the problem. State which Numerical Methods you will use ad the formulae ivolved i them. Where appropriate, you may wish to iclude a diagram to explai the formulae, but do ot derive ay of the stadard formulae you will ear o marks for derivig stadard results. Phase Formula Applicatio Do this o a spreadsheet. Try to set it out as clearly as you possibly ca, so that the reader ca see how all of the cells relate to oe aother. Remember to iclude the versio of the spreadsheet where formulae are displayed somewhere i your report (perhaps i a appedix or maybe ext to the spreadsheet itself). Label cells where appropriate. Try to stick to a stadard otatio. Phase Use of techology You will probably use Excel to devise your spreadsheets. You should say what its limitatios are (e.g how may decimal places ca it hadle?). You should say how may decimal places your calculatios are beig made to. Phase 5 Error Aalysis This is a very importat sectio. You should try to give a estimate of how much error there is i your solutio to the problem. You may wish to aalyse differeces betwee successive approximatios ad the the ratio of differeces, i order to see how fast your series of approximatios i tedig to the true value; you ca use this to give a estimate of the error ivolved (see otes below). Phase 6 Iterpretatio Relate the solutio you have obtaied back to the origial problem. Maybe you will wat to discuss how you could improve your estimate ad how log this would take i terms the umber of extra iteratios required. If you thik your results are as good as the calculatig power of the spreadsheet will allow, you should say why you thik this. Phase 7 Oral Commuicatio You should be completely familiar with your work ad able to discuss it with your teacher.
A Remider about Error Numerical Itegratio Coursework - Ideas The followig table looks at the midpoit rule, the trapezium law ad Simpso s Law 1 beig used to estimate the itegral 5x dx. The exact value of this itegral ca be easily calculated to be 1. 0 The shaded colums are almost costat. This suggests that the error i the trapezium law ad the midpoit rule is proportioal to h ad the error i Simpso s rule is proportioal to h. I fact it ca be proved that this is the case for most of the fuctios you will ever ecouter (certaily for all the oes you will ecouter i you A-level course). x f(x) 0 0 0.065 7.69E-05 h Error Error /h Error /h Error /h Error /h 0.15 0.00107 M 0.800781 0.5 0.1991875 0.988 0.796875 1.5975.1875 0.1875 0.00617981 M 0.9886 0.5 0.05157 0.06055 0.819.96876 1.1875 0.5 0.019515 M 8 0.987015 0.15 0.019859 0.1088 0.81055 6.68 5.1875 0.15 0.07687 0.75 0.09887695 T 1.065 0.5 0.065 0.815 1.65.5 6.5 0.75 0.1818176 T 1.105 0.5 0.1051565 0.106 1.6565 6.65 6.5 0.5 0.15 T 8 1.06001 0.15 0.06000977 0.08008 1.6606 1.15 106.5 0.565 0.5005658 T 1.006508 0.065 0.00650787 0.10 1.6660 6.6565 6.5 0.65 0.76995 0.6875 1.11701965 S 1.0060 0.5 0.00607 0.00508 0.01017 0.008 0.067 0.75 1.58015 S 1.000 0.5 0.00076 0.000651 0.0060 0.01017 0.067 0.815.179017 S 8 1.00001 0.15 0.00001017 0.000081 0.000651 0.00508 0.067 0.875.90908 0.975.868098 1 5 Thigs to Notice the midpoit rule estimates are uderestimates ad the trapezium rule estimates are overestimates. There is a good reaso for this, although sometimes it ca be the other way aroud. This is very useful because it allows us to say with certaity what the true value of the itegral is to a umber of decimal places. Notice also that the error is a midpoit rule estimate is about half the size of the correspodig trapezium rule estimate.
Error i the Midpoit Rule I the midpoit rule, error is proportioal to h. I other words there is a costat k such that error = kh I geeral, for a give itegral, if error is the absolute error i M, the there is a costat, k, such that error kh (where h is the strip width correspodig to strips). Therefore, if the midpoit rule with strips has a strip width of h, the the midpoit rule with strips has a strip width of h, ad h k error 1 =. error kh This meas that halvig h, or, equivaletly, doublig will reduce the error by a factor of 1 = 0.5. The error multiplier is 0.5. We say that the midpoit rule is a secod order method. Error i the Trapezium Law Similarly, i the trapezium law, error is proportioal to h. I other words there is a costat k such that error = kh This meas that halvig h, or, equivaletly, doublig will reduce the error by a factor of 1 = 0.5. The error multiplier is 0.5. We say that the trapezium law is a secod order method. Error i Simpso s Rule Fially, i Simpso s Rule, error is proportioal to h. I other words there is a costat k such that error = kh This meas that halvig h, or, equivaletly, doublig will reduce the error by a factor of 1 = 0.065. The error multiplier is 0.065. We say that Simpso s Rule is a fourth order method.
Viewig Error i Terms of Differeces ad Ratio of Differeces With doublig values of, the error multiplier i each case above is the same as the ratio of differeces betwee successive estimates. The table below cofirms this for the particular itegral we have bee lookig at. M 0.800781 Differeces Ratio of M 0.9886 0.17705078 Differeces M 8 0.987015 0.0858 0.6087107 T 1.065 T 1.105-0.0775 T 8 1.06001-0.07758 0.560887 T 1.006508-0.019910 0.517678 S 1.0060 S 1.000-0.00106 S 8 1.00001-0.00015588 0.065 Why is this the case? The followig diagram shows why this is i the case of the trapezium law. Each successive approximatio (doublig the umber of strips) is four times as close to the true value X as the previous oe. So the distace betwee T 8 ad X is oe sixteeth of the distace betwee T ad X. The diagram below illustrates this ad also shows that the ratio T 8 - T : T -T is :1 or 1:. So T 8 T = 0.5 (T T ) T T T 8 X 1 1 So the ratio of differeces is the same as the error multiplier.we ca use this to our advatage Let s chage itegral ad look at si xdx. 1
Gettig better estimates by extrapolatio usig the ratio of differeces. Here we have assumed that the ratio of differeces would have cotiued to be 0.5 had we calculated further trapezium or midpoit estimates. We have worked backwards to see what the differeces ad the the estimates themselves would have had to have bee. Ca you see what we have doe? The ormal fot for T ad M represets actual calculated values, the italic fot ad grey backgroud represets extrapolated values. Trapezium Differeces Ratio of x f(x) Estimates T i -T i Differeces 1 0.91717 T 1 = 0.951 0.95571 T = 0.967095 0.0511 T = 0.9750775 0.0079807 0.518769 1 0.91717 T 8 = 0.977078 0.0000085 0.506681 1.5 0.99877 T = 0.9775789 0.00050057 0.5017771 0.95571 "T "= 0.97770 0.000151 0.5 "T 6 "= 0.97775.186E-05 0.5 1 0.91717 "T 18 "= 0.97771 7.81E-06 0.5 1.5 0.97158 "T 56 "= 0.977751 1.955E-06 0.5 1.5 0.99877 "T 51 "= 0.977756.888E-07 0.5 1.75 0.991961 "T 10 "= 0.977757 1.1E-07 0.5 0.95571 Midpoit Differeces Ratio of 1 0.91717 Estimates M i -M i Differeces 1.15 0.99878 M 1 = 0.998767 1.5 0.97158 M = 0.980595-0.015687 1.75 0.990 M = 0.979079-0.00980 0.5799 1.5 0.99877 M 8 = 0.9780795-0.0009997 0.5115 1.65 0.99965 "M "= 0.977895-0.00099 0.5 1.75 0.991961 "M "= 0.977767-6.8E-05 0.5 1.875 0.97677 "M 6 "= 0.977751-1.56E-05 0.5 0.95571 "M 18 "= 0.977775 -.905E-06 0.5 "M 56 "= 0.977765-9.76E-07 0.5 1 0.91717 "M 51 "= 0.97776 -.1E-07 0.5 1.065 0.965 "M 10 "= 0.97776-6.10E-08 0.5 1.15 0.99878 "M 056 "= 0.97776-1.55E-08 0.5 1.1875 0.9605 1.5 0.97158 1.15 0.987 1.75 0.990 1.75 0.995555 1.5 0.99877 1.565 0.99998 1.65 0.99965 1.6875 0.99659 1.75 0.991961 1.815 0.98559 1.875 0.97677 1.975 0.966185 0.95571 Here the midpoit rule ad trapezium rule are beig used to estimate si xdx. 1 Notice The strip width is halvig each time ad the ratio of differeces is close to 0.5. This illustrates further that these are both secod order methods.
The picture below shows some of the formulae etered to geerate the spreadsheet above. Extrapolatio i terms of a diagram ad geometric progressios T 8 T T T 6 X Accordig to the theory derived earlier T T 1 ( - ) + T T 8 This gives us the so called extrapolated value " T " = T 1 + ( T - T8 ). Note, this is exactly how T was calculated o the previous page. Ad the 1 1 1 " T6 " = " T " + ( T - T8 ) = T + ( T - T8 ) + ( T - T8 ) This is exactly how T 6 was calculated o the previous page. We ca obviously cotiue to do this as may times as we like. I fact if we do this several times (ifiitely may times i fact) we are remided of the expressio below which ivolves a geometric progressio.
1 1 1 T + ( T - T8 ) + ( T - T8 ) + ( T - T8 ) +... This a geometric progressio with 1 r =. Its sum is 1- ar T -T8 T -T8 = T -T 8 a = ad which i this case is T -T T -T Therefore the value above is usig midpoit rule ad Simpso s rule estimates. These are all give o the followig page alog with all the other umerical itegratio formulae you ll eed. 8 8 T + =. Similar formulae ca be derived
Formula Midpoit Rule: NUMERICAL METHODS INTEGRATION FORMULAE Whe to use Obvious M = h(f ( m ) + f ( m ) +... + f ( m )), where 1 Trapezium Law: b a h =. Obvious h b a T = [ f0 + (f1+ f + f +... + f 1) + f], where h =. Simpso s Law: M + T S = Simpso s Law: h S = [ f0 + (f1+ f+ f 5 +... + f 1) + (f + f +... + f ) + f] where b a h =. Whe you have M ad T this is the quickest way to get S Not ofte used, this is aother way to get S, but ofte it is quicker to calculate M ad T ad the use the previous formulae T T + M = for example, T + M T8 = A quick way to get T whe you have M ad T S T T =, for example S T = T A quick way to get S whe you have T ad T Best estimate based o calculated values M ad from a G.P. M M M M 8 "Best midpoit" =, e.g. M obtaied Best estimate based o calculated valuest ad T obtaied from a G.P. T T T8 T "Best trapezium" =, e.g. Best estimate based o calculated values S ad from a G.P. S S S8 S "Best Simpso's" =, e.g. 15 15 S obtaied Use this for a quick best estimate whe you have calculated two successive midpoit values like M 8 ad M for example. Use this for a quick best estimate whe you have calculated two successive trapezium values like T 8 ad T for example. Use this for a absolute best estimate whe you have calculated two successive Simpso values like S 8 ad S for example.