Question: Question 2 in Assignment 2 shows how to use the area of rectangles to estimate the definite integral of a function. There, one uses the

 Question 2 in Assignment 2 shows how to use the areaof rectangles to estimate the definite integral of a function. There, one

Question 2 in Assignment 2 shows how to use the area of rectangles to estimate the definite integral of a function. There, one uses the midpoints in the subintervals to compute the heights of the rectangle. In this question, we use random points in the subintervals. This is also known as Monte Carlo numerical integration. Consider the definite integral, | f(x) dx. Divide the interval from = a to r = b into n equal subintervals of length Ar = - each. Let ek be a randomly generated point within the k-th subinterval (respectively). Then the definite integral can be approximated again by f(c)Ar = Ar [f(ci) + f(c2) +...+ f(n)). As before, take f(1) = 1 +3 and end points a = 0, b = 10. Approximate L" (2+;) dr. using the above method. Requirement: define a function with name "Approx integral.Q2", ### Solution to Question 2 def Approx integral.Q2 (n): ... Your codes ... The input n to the function is the number of subintervals used to approximated the definite integral. The function should return the above sum E f(c)A.. You should choose the number n such that, p10 / f(G)A.r dx

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!