mth.122.handout.08

# 3 11 midpoint rule given a definite integral z b a f

This preview shows pages 2–5. Sign up to view the full content.

fairly robust numerical methods built in, with loads of options. 3 1.1 Midpoint Rule Given a definite integral Z b a f ( x ) d x, the n th midpoint approximation 4 is: b - a n [ f ( c 1 ) + f ( c 2 ) + · · · + f ( c n )] , where c i = a + (2 i - 1) b - a 2 n . 3 Check out § 17.2.2 of Heikki Ruskeep¨ a’s textbook, Mathematica Navigator (second edition), for more information—yes, the ECC library has a copy. 4 This will be discussed in class. 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Example: Using n = 6 compute the midpoint approximation of Z 4 1 x d x = 2 x x 3 4 1 = 14 3 = 4 2 3 = 4 . ¯ 6 and compare your approximate answer to the exact answer. Work: Z 4 1 x d x 0 . 5 h 1 . 25 + 1 . 75 + 2 . 25 + 2 . 75 + 3 . 25 + 3 . 75 i 4 . 66925 Here’s the Mathematica code for this problem. In[11]:= Integrate @ Sqrt @ x D , 8 x,1, 4 <D Out[11]= 14 ÅÅÅÅÅÅÅ 3 In[12]:= N @ %11, 7 D Out[12]= 4.666667 In[13]:= H 4 - 1 L ê 6 * Sum @ Sqrt @ 1 + H 2 i - 1 L H 4 - 1 L ê H 2 * 6 LD , 8 i,1, 6 <D Out[13]= 1 ÅÅÅÅ 2 i k j j 3 ÅÅÅÅ 2 + è!!! 5 ÅÅÅÅÅÅÅÅÅ 2 + è!!! 7 ÅÅÅÅÅÅÅÅÅ 2 + è!!!!!! 11 ÅÅÅÅÅÅÅÅÅÅÅ 2 + è!!!!!! 13 ÅÅÅÅÅÅÅÅÅÅÅ 2 + è!!!!!! 15 ÅÅÅÅÅÅÅÅÅÅÅ 2 y { z z In[16]:= N @ %13, 7 D Out[16]= 4.669245 In[15]:= NIntegrate @ Sqrt @ x D , 8 x,1,4 <D Out[15]= 4.66667 Untitled-1 1 Figure 3: Mathematica Code 1.2 Trapezoid Rule Given a definite integral Z b a f ( x ) d x, the n th trapezoidal approximation 5 is: b - a 2 n [ f ( a ) + 2 f ( c 1 ) + · · · + 2 f ( c n - 1 ) + f ( b )] , where c i = a + ( b - a ) i n . Example: Using n = 6 compute the trapezoidal approximation of Z 4 1 x d x = 2 x x 3 4 1 = 14 3 = 4 2 3 = 4 . ¯ 6 5 This will be discussed in class. 3
and compare your approximate answer to the exact answer. Work: Z 4 1 x d x 0 . 25 h 1 + 2 1 . 5 + 2 2 + 2 2 . 5 + 2 3 + 2 3 . 5 + 4 i 4 . 66925 Here’s the Mathematica code for this problem. In[11]:= Integrate @ Sqrt @ x D , 8 x,1, 4 <D Out[11]= 14 ÅÅÅÅÅÅÅ 3 In[12]:= N @ %11, 7 D Out[12]= 4.666667 In[13]:= H 4 - 1 L ê 6 * Sum @ Sqrt @ 1 + H 2 i - 1 L H 4 - 1 L ê H 2 * 6 LD , 8 i,1, 6 <D Out[13]= 1 ÅÅÅÅ 2 i k j j 3 ÅÅÅÅ 2 + è!!! 5 ÅÅÅÅÅÅÅÅÅ 2 + è!!! 7 ÅÅÅÅÅÅÅÅÅ 2 + è!!!!!! 11 ÅÅÅÅÅÅÅÅÅÅÅ 2 + è!!!!!! 13 ÅÅÅÅÅÅÅÅÅÅÅ 2 + è!!!!!! 15 ÅÅÅÅÅÅÅÅÅÅÅ 2 y { z z In[16]:= N @ %13, 7 D Out[16]= 4.669245 In[15]:= NIntegrate @ Sqrt @ x D , 8 x,1,4 <D Out[15]= 4.66667 Untitled-1 1 Figure 4: Mathematica Code 1.3 Simpson’s Rule Here, n needs to be even. Given a definite integral Z b a f ( x ) d x, the n th Simpson’s Rule approximation 6 is: b - a 3 n [ f ( a ) + 4 f ( c 1 ) + 2 f ( c 2 ) + · · · + 2 f ( c n - 2 ) + 4 f ( c n - 1 ) + f ( b )] , where c i = a + b - a n i. Example: Using n = 6 compute the Simpson’s Rule approximation of Z 4 1 x d x = 2 x x 3 4 1 = 14 3 = 4 2 3 = 4 . ¯ 6 and compare your approximate answer to the exact answer. Work: Z 4 1 x d x 1 6 h 1 + 4 1 . 5 + 2 2 + 4 2 . 5 + 2 3 + 4 3 . 5 + 2+ i 4 . 66656 6 This will be discussed in class.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern