Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started