(5.6, 8.8), (6.3, 12.4), (7, 14.8), (7.7, 18.2), (8.4, 20.8)
x <- c(5.6, 6.3, 7, 7.7, 8.4)
y <- c(8.8, 12.4, 14.8, 18.2, 20.8)
model <- lm(y ~ x)
coefficients <- coef(model)
print(round(coefficients, 2))
## (Intercept) x
## -14.80 4.26
The regression line \(y = 4.26x - 14.80\) shows a strong positive correlation between \(x\) and \(y\), predicting that as \(x\) increases, \(y\) increases by about 4.26 units.
( x, y, z ). Separate multiple points with a comma.
\(f(x, y) = 24x - 6xy^2 - 8y^3\).
# function and its partial derivatives
f <- function(x, y) 24*x - 6*x*y^2 - 8*y^3
fx <- function(x, y) 24 - 6*y^2 # df/dx
fy <- function(x, y) -12*x*y - 24*y^2 # df/dy
# we anually identified critical points from setting fx and fy to zero
# from fx = 0 -> y = ±2
# from fy = 0 and y ≠ 0 -> x = -2y
critical_points <- matrix(c(0, 0, -4, 2, -4, -2), ncol = 2, byrow = TRUE)
colnames(critical_points) <- c("x", "y")
# we evaluate the original function at given points
evaluate_f <- function(points) {
sapply(1:nrow(points), function(i) f(points[i, "x"], points[i, "y"]))
}
f_values <- evaluate_f(critical_points)
results <- cbind(critical_points, f_values)
colnames(results) <- c("x", "y", "f(x, y)")
results
## x y f(x, y)
## x 0 0 0
## x -4 2 -64
## x -4 -2 64
Step 1. Find the revenue function R ( x, y )
revenue_function <- function(x, y) {
house_units = 81 - 21 * x + 17 * y
name_units = 40 + 11 * x - 23 * y
revenue = x * house_units + y * name_units
return(revenue)
}
Step 2. What is the revenue if she sells the “house” brand for 2.30 dollars and the “name” brand for 4.10 dollars?
revenue_at_given_prices <- revenue_function(2.30, 4.10)
print(revenue_at_given_prices)
## [1] 116.62
# total cost function with substitution of y = 96 - x
cost_function <- function(x) {
y = 96 - x
cost = 1/6 * x^2 + 1/6 * y^2 + 7 * x + 25 * y + 700
return(cost)
}
result <- optim(par = 50, fn = cost_function, method = "L-BFGS-B", lower = 0, upper = 96)
x_optimal <- result$par
y_optimal <- 96 - x_optimal
cat(sprintf("Optimal units in Los Angeles (x): %.2f\n", x_optimal))
## Optimal units in Los Angeles (x): 75.00
cat(sprintf("Optimal units in Denver (y): %.2f\n", y_optimal))
## Optimal units in Denver (y): 21.00
\[ \iint_R e^{8x + 3y} \, dA ; \quad R: 2 \leq x \leq 4 \text{ and } 2 \leq y \leq 4 \]
Answer:
To give the answer in exact form we need to show the derivation of the
antiderivatives and their evaluations.
Inner Integral (over \(y\)): \[ \int_{2}^{4} e^{3y} \, dy = \left. \frac{1}{3} e^{3y} \right|_{2}^{4} = \frac{1}{3} (e^{12} - e^{6}) \]
Outer Integral (over \(x\), incorporating the result from the inner integral): \[ \int_{2}^{4} e^{8x} \cdot \left(\frac{1}{3} (e^{12} - e^{6})\right) \, dx = \frac{1}{3} (e^{12} - e^{6}) \cdot \left. \frac{1}{8} e^{8x} \right|_{2}^{4} = \frac{1}{24} (e^{12} - e^{6}) (e^{32} - e^{16}) \]
Simplifying further: \[ \frac{1}{24} (e^{44} - e^{28} - e^{38} + e^{22}) \]