We need to create a dataframe with all these data points.
x1 <- c(5.6, 6.3, 7, 7.7, 8.4)
y1 <- c(8.8, 12.4, 14.8, 18.2, 20.8)
df1 <- data.frame(x1, y1)
ggplot(df1, aes(x=x1, y=y1)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
ggtitle("y = f(x)= ax + b") +
xlab("x") + ylab("y") +
# Change the color, the size and the face of salary~YearsExperience, data = salary_df
# the main title, x and y axis labels
theme(
plot.title = element_text(color="red", size=14, face="bold.italic"),
axis.title.x = element_text(color="blue", size=12, face="bold"),
axis.title.y = element_text(color="#993333", size=12, face="bold"))
## `geom_smooth()` using formula 'y ~ x'
df1_lm <- lm(y1~x1, data = df1)
summary(df1_lm)
##
## Call:
## lm(formula = y1 ~ x1, data = df1)
##
## 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 ***
## x1 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
The equation of the regression line is : y = 4.26*x1 - 14.80
###Problem 2: 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 - 6xy^2 - 8y^3
$$ local maxima, local minima ( x, y, z ) = { (4,-2), (-4,2)} Saddle point (-4,2)
$$
from (1)y = 2 or -2 \
Using (1) in (2), then y = 2 , x = -4, y = -2, x = 4\ ( x, y, z ) = { (4,-2), (-4,2)} \ f(4,-2) = 64 >0, f(-4,2) = -64 < 0 \ Saddle point: (-4,2)
$$
###Problem 3: 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(x,y) = x(81 - 21x + 17y) + y(40 + 11x - 23y) = 81x - 21x^2 +17xy +40y +11xy -23y^2 \\ R(x,y) = 81x - 21x^2 +28xy + 40y - 23y^2 \\ R(2.3, 4.1) = ? \]
R <- 81*2.3 - 21*(2.3)^2 +28*2.3*4.1 + 40*4.1 - 23*(4.1)^2
cat("The revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10 is R(2.3, 4.1) = ", R)
## The revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10 is R(2.3, 4.1) = 116.62
###Problem 4: A company has a plant in Los Angeles and a plant in Denver. The firm is committed to produce a total of 96 units of a product each week. The total weekly cost is given by \[C(x, y) = \frac{1}{6}x^2 + \frac{1}{6}y^2 + 7x + 25y + 700\] ### where x is the number of units produced in Los Angeles and y is the number of units produced in Denver. How many units should be produced in each plant to minimize the total weekly cost?
to minimize the total weekly cost , we need to find the local minima of C(x,y). We know x+y = 96 , thus
\[C(x, y) = \frac{1}{6}(96-y)^2 + \frac{1}{6}y^2 + 7(96-y) + 25y + 700\\ = \frac{9216-192y +y^2}{6} + \frac{y^2}{6}+ 672 - 7y +25y + 700\\ = \frac{y^2}{3} -14y +2908 \\ C(x,y)' = \frac{2y}{3} - 14\\ C(x,y)' = 0 \Longrightarrow \frac{2y}{3} - 14 = 9 , y = 21, then \quad x = 96-21 = 75. \] 75 units should be produced in Los Angeles and 21 units produced in Denver.
###Problem 5: Evaluate the double integral on the given region.
$$ D = {}{}{R}{}(e{8x+3y})dA; R: 2≤x≤4 and ≤y≤4 \ {}{}{R}{}(e{8x+3y})dA = {2}{4}{2}{4}(e{8x+3y})dydx\ = {2}{4}(e{8x+3y})|{(2,4)} dx\ = {2}{4}(e^{8x+12} - e^{8x+6}) dx \ = ({2}{4}(e{8x+12})dx - _{2}{4}(e{8x+6})dx )\ D = (e{44}-e{28} - e^{38}+ e^{22} )
$$