#3. Find the total area of the red rectangles in teh figure below, wherre the equation of the line is f(x) = 2x -9
Get_Area = function(x) {
(2 * x) - 9
}
round(as.numeric(integrate(Get_Area, 4.5, 8.5)$value))
## [1] 16
#4. Find the area of the region boudned by the graphs of the given equations. y = x^2 - 2x - 2, y = x+ 2
func_1 = function(x) {
x^2 -2*x -2
}
func_2 = function(x) {
x + 2
}
#Find the difference between areas under the curve
area_1 = integrate(func_1, -1, 4)
area_2 = integrate(func_2, -1, 4)
round((area_2$value - area_1$value),4)
## [1] 20.8333