## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Building our framework

Our framework is a very simple framework used to calculate the area under the curve in the given axis-parallel rectangle. We will use a numerical method that is the simplification of the Monte Carlo method to calculate the integral of a function. The following image illustrates the idea. To calculate the area under the curve in a given rectangle, we will take a lot of points from the rectangle and evaluate the curve equation at those points using the x coordinate. If the evaluation is less than the y coordinates of the point, the point is below the curve at that x coordinate. We will count all such points. The area under the curve can be calculated as,

Area under curve = Area of the rectangle * (pointsBelowCurve/totalPoints) ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required