ECE 1574 Week7 Lab.pdf

ECE 1574 Week7 Lab.pdf - ECE1574 Problem Solving for...

Info icon This preview shows page 1. Sign up to view the full content.

Your Assignment: Approximate the value of pi to 12 decimal places by integrating the function f(x)=(4/(1+x^2)) over the interval (0,1). Use the trapezoidal method, which is illustrated at the end of the lecture slides. Report your calculated approximation of pi and the number of sub-intervals (n) that you used to get the answer. You can use cout statements to have the program display the information on the screen. Hint: How many sub-intervals will you need to get the precision that you want? You can start with few intervals (say two) and increase (to four, eight, etc.) until the solution has the desired precision. Each sub-interval will form a trapezoid. The width of the trapezoid is the width of the sub-interval. Each sub-interval will have the same width because you are going to divide the (0,1) interval into n equal widths. If you follow the hint, you will first set n equal to 2, then increase n to 4, 8, etc. The width of each sub-interval will be the same (1/n).
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '08
  • RPBroadwater
  • Equals sign, boundary points

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern