3.1.NUMERICAL INTEGRATION TECHNIQUES553.1.2Midpoint RuleQuite a bit can happen between endpoints. Let’s try to improve our approx-imation by picking the midpoints instead. For this method, we have to firstdo a little arithmetic to find our points. In our previous example, we wouldhavex1=0 +142=18, x2=14+122=38, x3=12+342=58, x4=34+ 12=78.Our new approximation would be1√2πZ10e-x2/2dx≈1√2π4Xk=1e-x2k/2Δxk=1√2π14(e-1128+e-9128+e-25128+e-49128)≈0.342In general, we have an interval [a, b] and a functionf(x). We break theinterval intoNequal pieces. Leth=b-aN= Δxk. Then our midpoints arex1=a+h2, x2=a+3h2, . . . , xN=b-h2.and our approximation can again be written asZbaf(x)dx≈NXk=1f(xk)h:=Mn.We will not have time in this class to carefully analyze the pros andcons of these various techniques. It turns out that the midpoint rule offersa substantial improvement over the endpoint rules.However, it should benoted that if you were to take an actual numerical analysis class (which is notas hard as it sounds), then you would learn about far superior techniques thatare still quite simple to implement on a computer. Here is the error estimatefor the midpoint method:Zbaf(x)dx-Mn≤K(b-a)324n2(3.1)whereK= max|f00(x)|forx∈[a, b].For the example we just did, on the interval [0,1], we have|f00(x)|=1√2πe-x2/2(1-x2)≤1.