Using R, provide the solution for any exercise in either Chapter 4 or Chapter 7 of the calculus textbook. If you are unsure of your solution, post your concerns.

Find the area of the shaded region in the given graph #5.

Function f is equal to \(\frac{1}{2}x + 3\)

Function g is equal to \(\frac{1}{2}cos(x) + 1\)

The range goes from \(0\) to \(2\pi\) on the x axis

# Define the functions to integrate
f <- function(x){(1/2)*x + 3}
g <- function(x){(1/2)*cos(x) + 1}

# Integrate the function over the range [0, 2pi]
f_area <- integrate(f, lower = 0, upper = 2*pi)

# Integrate the function over the range [0, 2pi]
g_area <- integrate(g, lower = 0, upper = 2*pi)

# Take the difference of the areas
(f_area$value - g_area$value)
## [1] 22.43598