x <- c(5.6,6.3,7,7.7,8.4)
y <- c(8.8,12.4,14.8,18.2,20.8)
coefs <- coef(lm(y~x))
intercept <- coefs[[1]]
slope <- coefs[[2]]
print(paste("Intercept:",intercept))
## [1] "Intercept: -14.8"
print(paste("Slope:",slope))
## [1] "Slope: 4.25714285714285"
\(\hat{y} = 4.26x - 14.8\)
Find the critical points,
\(\frac{d}{dx} = -6y^2 + 24\)
\(\frac{d}{dy} = -24y^2 - 12xy\)
Solve, \((-6y^2 + 24, -24y^2 - 12xy) = (0,0) \Longrightarrow (4,-2),(-4,2)\)
Find the saddle points,
\(-6y^2 + 24 = 0 \Longrightarrow y =2,
y=-2\)
\(-24y^2 - 12xy = 0 \Longrightarrow\)
\(-24(-2)^2 - 12x(-2) = 0 \Longrightarrow x
= 4 \Longrightarrow\)
\(-24(2)^2 - 12x(2) = 0 \Longrightarrow x =
-4\Longrightarrow\)
\((4,-2), (-4, 2)\)
x <- 2.3 # house brand
y <- 4.1 # name brand
revenue <- function(x,y) {
x*(81-21*x+17*y) + y*(40+11*x-23*y)
}
revenue(x, y)
## [1] 116.62
\(x + y = 96 \Longrightarrow x = 96
-y\)
\(C(x,y) = C(96-y, y)
\Longrightarrow\)
\(= \frac{1}{6}(96-y)^2 + \frac{1}{6}y^2 +
7(96-y) + 25y + 700\)
\(= \frac{1}{3}y^2 -14y + 2908\)
\(C'(y) = \frac{2}{3}y - 14\)
Minimum = \(C'(y) = \frac{2}{3}y - 14 = 0 \Longrightarrow y = 21\)
Given \(x = 96 - y \Longrightarrow x = 75\)
Los Angeles, 75
Denver, 21
\(= \int_2^4\int_2^4e^{8x + 3y}dxdy\)
Apply u substitution
\(u = 3y + 8x \Longrightarrow\)
\(\frac{du}{dx} = 8\)
\(du = 8dx\)
\(dx = \frac{1}{8}du\)
\(x = 2 \Longrightarrow u = 3y +
16\)
\(x = 4 \Longrightarrow u = 3y +
32\)
\(= \int_2^4\frac{1}{8}(e^{3y + 32} -
e^{3y+16})dy\)
$= $
(exp(1)^44-exp(1)^38-exp(1)^28+exp(1)^22)/24
## [1] 5.341559e+17
integrand <- function(y){
(1/8) * (exp(1)^(3*y +32) - exp(1)^(3*y + 16))
}
print(integrate(integrand, lower = 2, upper = 4), digits=17)
## 534155947497084416 with absolute error < 5930