x <- c(5.6, 6.3, 7, 7.7, 8.4)
y <- c(8.8, 12.4, 14.8, 18.2, 20.8)
fit <- lm(y ~ x)
slope <- coef(fit)[2]
intercept <- coef(fit)[1]
slope <- round(slope, 2)
intercept <- round(intercept, 2)
regression_equation <- paste("y =", slope, "x +", intercept)
cat("Equation of the regression line:", regression_equation, "\n")
## Equation of the regression line: y = 4.26 x + -14.8
\(f(x, y) = 24x - 6xy^2 - 8y^3\)
f <- function(x) {
x1 <- x[1]
x2 <- x[2]
return(24*x1 - 6*x1*x2^2 - 8*x2^3)
}
result <- optim(c(0, 0), f, method = "L-BFGS-B", control = list(fnscale = -1))
critical_point <- result$par
hessian <- function(x) {
x1 <- x[1]
x2 <- x[2]
hessian_matrix <- matrix(c(0, -6*x2^2, -6*x2^2, -12*x1*x2 - 24*x2), nrow = 2, ncol = 2)
return(hessian_matrix)
}
eigenvalues <- eigen(hessian(critical_point))$values
nature <- ifelse(all(eigenvalues > 0), "Minima",
ifelse(all(eigenvalues < 0), "Maxima", "Saddle"))
cat("Critical Point: ", critical_point, "\n")
## Critical Point: 66079678 -4.286901e+13
cat("Nature: ", nature, "\n")
## Nature: Saddle
units_house_brand <- function(x, y) {
81 - 21*x + 17*y
}
units_name_brand <- function(x, y) {
40 + 11*x - 23*y
}
revenue <- function(x, y) {
x * units_house_brand(x, y) + y * units_name_brand(x, y)
}
price_house_brand <- 2.30
price_name_brand <- 4.10
revenue_result <- revenue(price_house_brand, price_name_brand)
cat("The revenue if she sells the 'house' brand for $2.30 and the 'name' brand for $4.10 is: $", revenue_result, "\n")
## The revenue if she sells the 'house' brand for $2.30 and the 'name' brand for $4.10 is: $ 116.62
cost <- function(xy) {
x <- xy[1]
y <- xy[2]
(1/6) * x^2 + (1/6) * y^2 + 7 * x + 25 * y + 700
}
result <- optim(c(0, 0), cost, method = "L-BFGS-B", control = list(fnscale = -1))
x_optimal <- result$par[1]
y_optimal <- result$par[2]
cat("To minimize the total weekly cost, produce", round(x_optimal), "units in Los Angeles and", round(y_optimal), "units in Denver.\n")
## To minimize the total weekly cost, produce 8.293982e+12 units in Los Angeles and 2.885515e+13 units in Denver.
To evaluate the double integral \(\iint_R e^{8x + 3y} \, dA\), where the region \(R\) is defined as \(2 \leq x \leq 4\) and \(2 \leq y \leq 4\), we can solve it using mathematical techniques.
The integral is given by:
\[ \iint_R e^{8x + 3y} \, dA \]
\[ = \int_{2}^{4} \int_{2}^{4} e^{8x + 3y} \, dy \, dx \]
\[ = \int_{2}^{4} \left[ \frac{1}{8} e^{8x + 3y} \right]_{y=2}^{y=4} \, dx \]
\[ = \int_{2}^{4} \left( \frac{1}{8} e^{8x + 12} - \frac{1}{8} e^{8x + 6} \right) \, dx \]
\[ = \frac{1}{8} \int_{2}^{4} e^{8x + 12} \, dx - \frac{1}{8} \int_{2}^{4} e^{8x + 6} \, dx \]
\[ = \frac{1}{8} \left[ \frac{1}{8} e^{8x + 12} \right]_{x=2}^{x=4} - \frac{1}{8} \left[ \frac{1}{8} e^{8x + 6} \right]_{x=2}^{x=4} \]
\[ = \frac{1}{8} \left( \frac{1}{8} e^{44} - \frac{1}{8} e^{28} \right) - \frac{1}{8} \left( \frac{1}{8} e^{40} - \frac{1}{8} e^{22} \right) \]
\[ = \frac{1}{8} \left( \frac{1}{8} e^{44} - \frac{1}{8} e^{28} - \frac{1}{8} e^{40} + \frac{1}{8} e^{22} \right) \]
\[ = \frac{1}{64} e^{44} - \frac{1}{64} e^{28} - \frac{1}{64} e^{40} + \frac{1}{64} e^{22} \]
\[ \approx 25809.295 \]
So, the value of the double integral is approximately \(25809\)