4. Monte Carlo Integration
For this problem, you are to determine the approximate integral of a function on an interval two different ways using probabilities.
o Dart throwing: Construct a rectangular region around the function. Pick random points in the rectangle. Find the percentage of these that are in the area under the function. The area under the function (the function's integral on this region) can be found by multiplying this percentage by the rectangle's area.
o Mean of values at random locations: Compute the mean value of the function at random locations in the interval and multiply this value by the interval's width.
Compare these two methods to the trapezoid method. Compare both acccuracy and running times. Make sure to use interesting functions for your tests.
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions

Consult our trusted tutors.