Find the equation of the regression line for the given points. Round any final values to the nearest hundredth, if necessary. (5.6,8.8), (6.3,12.4), (7,14.8), (7.7,18.2), (8.4,20.8)

# Create vectors for x and y coordinates
x <- c(5.6, 6.3, 7, 7.7, 8.4)
y <- c(8.8, 12.4, 14.8, 18.2, 20.8)

# Fit linear regression model
model <- lm(y ~ x)

# Summary of the model to view the coefficients
summary(model)
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##     1     2     3     4     5 
## -0.24  0.38 -0.20  0.22 -0.16 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -14.8000     1.0365  -14.28 0.000744 ***
## x             4.2571     0.1466   29.04 8.97e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3246 on 3 degrees of freedom
## Multiple R-squared:  0.9965, Adjusted R-squared:  0.9953 
## F-statistic: 843.1 on 1 and 3 DF,  p-value: 8.971e-05
# Alternatively, you can directly print the coefficients
coefficients(model)
## (Intercept)           x 
##  -14.800000    4.257143

Equation y=4.26x−14.80

Find all local maxima, local minima, and saddle points for the function given below. Write your answer(s) in the form ( x, y, z ). Separate multiple points with a comma. f(x,y)=24x-6xy2-8y3

library(pracma)  

# Define the function
f <- function(x, y) {
  24*x - 6*x*y^2 - 8*y^3
}

# Partial derivatives
f_x <- function(x, y) {
  24 - 6*y^2
}
f_y <- function(x, y) {
  -12*x*y - 24*y^2
}

find_critical_points <- function() {
 
  y_values <- sqrt(24 / 6) * c(1, -1) 
  
  critical_points <- sapply(y_values, function(y) {
    x <- ifelse(y == 0, 0, -24*y^2 / (12*y))
    c(x, y)
  })
  
  matrix(critical_points, nrow = 2, byrow = TRUE)
}

# Calculate critical points
classify_points <- function(critical_points) {
  apply(critical_points, 1, function(point) {
    x <- point[1]
    y <- point[2]
    
    f_xx <- 0
    f_yy <- -12*x - 48*y
    f_xy <- -12*y
    
    H <- matrix(c(f_xx, f_xy, f_xy, f_yy), nrow = 2)
    
    det_H <- det(H)
    tr_H <- sum(diag(H))
    
    list(point = point, det_H = det_H, tr_H = tr_H, Hessian = H)
  })
}

critical_points <- find_critical_points()
classification <- classify_points(critical_points)

print(classification)
## [[1]]
## [[1]]$point
## [1] -4  2
## 
## [[1]]$det_H
## [1] -576
## 
## [[1]]$tr_H
## [1] -48
## 
## [[1]]$Hessian
##      [,1] [,2]
## [1,]    0  -24
## [2,]  -24  -48
## 
## 
## [[2]]
## [[2]]$point
## [1]  4 -2
## 
## [[2]]$det_H
## [1] -576
## 
## [[2]]$tr_H
## [1] 48
## 
## [[2]]$Hessian
##      [,1] [,2]
## [1,]    0   24
## [2,]   24   48

There are no local maxima or minima.

A grocery store sells two brands of a product, the “house” brand and a “name” brand. The manager estimates that if she sells the “house” brand for x dollars and the “name” brand for y dollars, she will be able to sell 81  21x + 17y units of the “house” brand and 40 + 11x  23y units of the “name” brand. Step 1. Find the revenue function R ( x, y ). Step 2. What is the revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10?

R <- function(x, y) {
  -21 * x^2 + 28 * x * y - 23 * y^2 + 81 * x + 40 * y
  
}
# Calculate for x = 2.30 and y = 4.10
revenue <- R(2.30, 4.10)
revenue
## [1] 116.62
C <- function(x) {
  y <- 96 - x
  (1/6)*x^2 + (1/6)*y^2 + 7*x + 25*y + 700
}


result <- optimize(C, c(0, 96), tol = 1e-6) 


optimal_x <- result$minimum
optimal_y <- 96 - optimal_x
min_cost <- result$objective

cat("Optimal x (units in Los Angeles):", optimal_x, "\n")
## Optimal x (units in Los Angeles): 75
cat("Optimal y (units in Denver):", optimal_y, "\n")
## Optimal y (units in Denver): 21
cat("Minimum cost:", min_cost, "\n")
## Minimum cost: 2761

Evaluate the double integral on the given region.

\[ \int_{2}^{4} \int_{2}^{4} e^{8x + 3y} \, dy \, dx \]

\[ \int e^{8x + 3y} \, dy \]

\[ \int e^{8x + 3y} \, dy = e^{8x} \int e^{3y} \, dy = e^{8x} \frac{e^{3y}}{3} \]

  1. \[ e^{8x} \left[\frac{e^{3y}}{3}\right]_{2}^{4} = e^{8x} \left[\frac{e^{12}}{3} - \frac{e^{6}}{3}\right] = e^{8x} \frac{e^{12} - e^{6}}{3} \]

  2. \[ \int_{2}^{4} e^{8x} \frac{e^{12} - e^{6}}{3} \, dx = \frac{e^{12} - e^{6}}{3} \int_{2}^{4} e^{8x} \, dx \] \[ = \frac{e^{12} - e^{6}}{3} \left[\frac{e^{8x}}{8}\right]_{2}^{4} = \frac{e^{12} - e^{6}}{3} \left[\frac{e^{32}}{8} - \frac{e^{16}}{8}\right] \]\[ = \frac{e^{12} - e^{6}}{24} (e^{32} - e^{16}) \]

\[ \int_{2}^{4} e^{8x + 3y} \, dy = \frac{e^{8x + 12} - e^{8x + 6}}{3} \]

\[ \int_{2}^{4} \left(\frac{e^{8x + 12} - e^{8x + 6}}{3}\right) \, dx = \frac{e^{22} - e^{16} + e^{22} - e^{6}}{24} \]

\[ \frac{(-e^{16} - e^{6} + 1 + e^{22})e^{22}}{24} \]

library(pracma)

f <- function(x, y) {
  exp(8*x + 3*y)
}

result <- integral2(f, 2, 4, 2, 4)

print(result)
## $Q
## [1] 5.341559e+17
## 
## $error
## [1] 15214781905