1. Engineering
  2. Computer Science
  3. 123 pm fri jan 25 52 5 numerical integration write...

Question: 123 pm fri jan 25 52 5 numerical integration write...

Question details

1:23 PM Fri Jan 25 52% (5) Numerical integration Write a program that reads in values double a and double b, the boundaries of the inter- val [a, b, and the number of subintervals unsigned int n and then computes approrimately the value for the definite integral 3x2 + 5r4 dz which is equal to (b3 + bs)-(a3 + as), using the left Riemann sum. The program must print out the numerically computed value and the error of the numerical integration; see the explanation below. Explanation: Recall that the integral Jo f(r) dz is the area under the graph of the function f(r) on the interval a, b , whenever the function f(z) is nonnegative. Inr) takes both positive and negative values, then the integral represents a signed area, comprising of the difference of the areas above and below the graph of f(). The integral can be computed approximately using a numerical procedure. Given an integer n >0, defineh and let be a grid of points on the interval (a, b. Then the integral can be approximated as follows f(x)dr L-ro) f(ro)+(-)f)(n-I-1)f(-) The sum Ln is called the left Riemann sum, it is the sum of the areas of n rectangles. The error of numerical integration is then defined by Other instructions: You can assume that the the users input is always valid Implement a loop in which the above actions are repeated until the user requests to quit
1:28 PM Fri Jan 25 令51% . Implement a loop in which the above actions are repeated until the user requests to quit . Submit the solution as hmw.2.5.cpp. Sample input-output: HOMEWORK #2-DEADLINE JANUARY 30, 11:59 PM boundarie nter a nunber of suhintervals: 18 18. area is approxinately33.921658. error 4.878358 nte the interval boundaries [a.b1: 1.@ 2.ล nter a nunber of subintervalst 18 188. area is approxinately37 581217. error8.118783 nter the interval boundaries a.bl: 1.8 2.8 nter a nunber of ubintervals: 1000 ont inueT (ya) y nter the interval boundaries a.bl: 1.8 2.0 nte a nunber of stab intervals : 1800 18688. area is approxinately-37.995888. error 8.884288 tinue? (yn n ress any key to centinue
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution