library(tidyverse)
## Warning: package 'dplyr' was built under R version 4.2.3
## Warning: package 'stringr' was built under R version 4.2.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(calculus)
##
## Attaching package: 'calculus'
##
## The following object is masked from 'package:purrr':
##
## cross
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)
x_value <- c(5.6, 6.3, 7, 7.7, 8.4)
y_value <- c(8.8, 12.4, 14.8, 18.2, 20.8)
reg_lm <- lm(y_value~x_value)
summary(reg_lm)
##
## Call:
## lm(formula = y_value ~ x_value)
##
## 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_value 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
\[\text{The function is } y = 4.26x - 14.8\]
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}\]
The derivative for f(x) is:
\[f(x) = 24x - 6xy^{2}-8y^{3} \\ \frac{df}{dx} = 24 - 6y^{2}\]
The derivative for f(y) is:
\[f(y) = 24x - 6xy^{2}-8y^{3} \\ \frac{df}{dy} = -12xy - 24y^2\]
By setting the x to 0: \[\frac{df}{dx} = 24 - 6y^{2} \\ 0 = 24 - 6y^2 \\ -24 = -6y^2 \\ 24 = 6y^2 \\ 4 =y^2 \\ y = 2 \; or -2\]
Since y is equal to 2 or -2, substituting y with those values and the value of x is:
\[\frac{df}{dy} = -12xy - 24y^2 \\ 0 = -12xy - 24y^2 \\ 0 = -12x(2) - 24(2)^2 \\ 0 = -24x - 96 \\ 96 = -24x \\ x = -4\]
\[\frac{df}{dy} = -12xy - 24y^2 \\ 0 = -12xy - 24y^2 \\ 0 = -12x(-2) - 24(-2)^2 \\ 0 = 24x - 96 \\ 96 = 24x \\ x = 4\]
The saddle points for the function is (-4,2) and (4,-2)
func_df <- data.frame(
x_value_2 <- c(-4, 4),
y_value_2 <- c(2, -2))
# plug in values in function
z_value <- 24 * func_df$x_value_2 - 6 * func_df$y_value_2 * (func_df$x_value_2^2) - 8 * (func_df$y_value_2^3)
z_value
## [1] -352 352
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 ).
\[x(81-21x+17y) + y(40+11x-23y) \\ 81x - 21x^2 + 17xy + 40y + 11xy -23y^2 \\ 81x - 21x^2 + 28xy - 23y^2 + 40y\]
Step 2. What is the revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10?
house_value <- 2.3
name_value <- 4.1
revenue_value <- 81 * house_value- 21 * (house_value^2) + (28 * house_value * name_value) - 23 * (name_value^2) + 40 * name_value
revenue_value
## [1] 116.62
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?
The firm needs to produce 96 units, so the value of y is 96 - x. By substituting the value of y, the function will be:
\[C(x,y) = \frac{1}{6}x^2 + \frac{1}{6}(96-x)^2 + 7x + 25(96-x) + 700 \\ C(x,y) = \frac{1}{6}x^2 + 256 - \frac{1}{6}x^2 + 7x + 25x - 2400 + 700 \\ C(x) = \frac{1}{3}x^2 + 32x - 1444 \\ C'(x) = \frac{2}{3}x + 32 \\ -32 = \frac{2}{3}x \\ x = 48 \\ y = 96 - 48 = 48\]
For both LA and Denver, the firm need to be produce 48 units each.
Evaluate the double integral on the given region.
\[\int \int (e^{8x+3y})dA; R: 2 \le x \le 4 \;\&\; 2 \le y \le 4\]
Write your answer in exact form without decimals.
\[\int_{2}^{4} \int_{2}^{4} (e^{8x+3y})dA \\ \int_{2}^{4} \frac{1}{8}e^{8x}\int_{2}^{4} \frac{1}{3}e^{3y} \\ \frac{1}{24}e^{8x}\int_{2}^{4} e^{3y} \\ \frac{1}{24}(e^{32} - e^{16})(e^{12} - e^{6})\]