Problems 1-4 (Ish, 4 is done properly below)
Problem 4
I realized that I’d have to do piecewise functions for different pieces, because its not just g(x)-f(x)
f <- function(x) x**2 - 2*x - 2
g <- function(x) x+2
intersection <- uniroot(function(x) g(x) - f(x), c(.1, 5))
x <- intersection$root
area <- integrate(function(x) abs(f(x) - g(x)), -1, 4)$value
print(area)
## [1] 20.83333
Problem 5
There is definetly a way to do this properly with calc, but I’d rather shortcut it a bit:
EOQ = sqrt((2DS)/H)
Yields the optimal order quality
sqrt((2 * 110 * 8.25)/3.75)
## [1] 22
Which implies 5 orders per year.
Problem 6
∫ ln(9x) * x^6 dx = u * v - ∫ v * du/dx dx = ln(9x) * (1/7) x^7 - ∫ (1/7) x^7 * (1/x) dx = (1/7) ln(9x) * x^7 - (1/49) x^7 + C
Problem 7
Determine whether f ( x ) is a probability density function on the interval [1, e^6] . If not, determine the value of the definite integral.
There are two conditions that prove that:
First 1. f(x) is positive for all x in the interval [1, e^6]. This is true, as 1/(6x) is positive for all positive intergers
Second The definite integral of f(x) over the interval [1, e^6] is equal to 1.
area <- integrate(function(x) 1/(6*x), 1, exp(6))$value
print(area)
## [1] 1
Which in this case is true!