MSDS Summer Bridge 2018 Data Science Math - HW 1
Jeff Littlejohn, 7/12/2018
Cost: $10 per doll Sale price: $x dollars per doll Demand: 80 - 2x dolls per week
Profit: \(f(x) = x(80-2x) - 10(80-2x)\) \(= 80x - 2x^2 - 800 + 20x\) \(= -2x^2 + 100x -800\)
\(f (x) = 8x^3 + 7x^2 - 5\)
Step 1. Find f (3).
8 * 3 ^ 3 + 7 * 3 ^ 2 - 5
## [1] 274
Step 2. Find f (-2).
8 * (-2) ^ 3 + 7 * (-2) ^ 2 - 5
## [1] -41
Step 3. Find f (x + c).
\(f (x) = 8(x+c)^3 + 7(x+c)^2 - 5\)
Step 1. Find \[\lim_{x\to 1^{-}} f(x) = 2\]
Step 2. Find \[\lim_{x\to 1^{+}} f(x) = 5\]
Step 3. Find \[\lim_{x\to 1} f(x) =\] General limit does not exist
\[f'(x) =\]
library(Deriv)
myf4=function(x)(-2 * x^3)
Deriv(myf4)
## function (x)
## -(6 * x^2)
\[f'(x) =\]
myf5=function(x)((-8)/x^2)
Deriv(myf5)
## function (x)
## 16/x^3
myf6=function(x)(5 * x^(1/3))
Deriv(myf6)
## function (x)
## 1.66666666666667/x^0.666666666666667
More precisely: \[g'(x) = 5/3x^{2/3}\]
myf7=function(x)(2 * x^(9/8))
Deriv(myf7)
## function (x)
## 2.25 * x^0.125
Average rate of change for function f from \(x_1\) to \(x_2\): \[(f(x_2) - f(x_1))/(x_2 - x_1)\]
In R:
(35-40)/(4-0)
## [1] -1.25
In Latex: \[(35-40)/(4-0) = -5/4\]
Total cost: \(C(x) = 630 + 2.4x\)
Average cost: \(c(x) = \frac{630 + 2.4x}{x}\)
myf10=function(x)(-2* x ^ 2 + 1)*(-5 * x + 9)
Deriv(myf10)
## function (x)
## -(4 * (x * (9 - 5 * x)) + 5 * (1 - 2 * x^2))
In Latex manually:
In Latex manually: Let \(f(x) = F(x)\) \[F(x) = \frac{5x^{1/2} + 7}{-x^3 + 1}\] \[f(x) = 5x^{1/2} + 7\] \[f'(x) = \frac{5}{2 * x^{1/2}}\] \[g(x) = -x^3 + 1\] \[g'(x) = -3x^2\] \[F'(x) = \frac{(\frac{5}{2 * x^{1/2}}) * (-x^3 + 1) - (-3x^2) * (5x^{1/2} + 7)}{(-x^3 + 1)^2}\] \[F'(x) = \frac{(\frac{5(-x^3 + 1) }{2\sqrt{x}}) + (3x^2) * (5\sqrt{x} + 7)}{(-x^3 + 1)^2}\]
In R:
myf11=function(x)(5*x^(1/2) + 7)/(-x^3 + 1)
Deriv(myf11)
## function (x)
## {
## .e1 <- 1 - x^3
## .e2 <- sqrt(x)
## (2.5/.e2 + 3 * (x^2 * (5 * .e2 + 7)/.e1))/.e1
## }
myf12=function(x)(3*x^-3 - 8*x + 6)^(4/3)
Deriv(myf12)
## function (x)
## -(1.33333333333333 * ((3/x^3 + 6 - 8 * x)^0.333333333333333 *
## (8 + 9/x^4)))
Let \(f(t) = F(t)\)
Quotient rule: \[F(x) = \frac{f(x)}{g(x)}\] \[F'(x) = \frac{f'(x)*g(x)-g'(x)*f(x)}{[g(x)]^2}\]
\[f(t) = 550t^2\] \[f'(t) = 1100t\] \[g(t) = \sqrt{t^2 + 15}\] \[g'(t) = \frac{t}{(t^2 + 15)^{1/2}}\] \[F'(t) = \frac{1100t(\sqrt{t^2 + 15}) - \frac{t}{(t^2 + 15)^{1/2}}(550t^2)}{\sqrt{t^2 + 15}^{2}}\] \[F'(t) = \frac{550((2t\sqrt{t^2 + 15}) - \frac{t^3}{(t^2 + 15)^{1/2}})}{t^2 + 15}\] \[F'(3) = 547.30786 \approx 547\]
In r:
library(numDeriv)
myf13=function(x)(550*x^2)/(sqrt(x^2+15))
grad(myf13,3)
## [1] 547.3079
Step 1. What was the attendance during the third week into the season? Round your answer to the nearest whole number. \[N(t) = 1000(6 + 0.1t)^{1/2}\] \[N(3) = 1000(6 + 0.1(3))^{1/2}\]
1000 * (6 + .1 * 3)^(1/2)
## [1] 2509.98
Step 2. Determine \(N´(5)\) and interpret its meaning. Round your answer to the nearest whole number.
In Latex manually using chain rule: \[N'(t) = 500(6+0.1t)^{1/2}*.1\] \[= 50(6+.01t)^{1/2}\] \[N'(5) = 50(6+0.1(5))^{1/2} = 19.6116 \approx 20\] Interpretation: At week 5, weekly attendance is increasing at a rate of 20 attendees per week.
Verifying in r:
myf14=function(t)(1000 * (6 + .1 * t)^(1/2))
grad(myf14,5)
## [1] 19.61161
15. Consider the following function: \[3x^3 + 4y^3 = 77\]
Step 1. Use implicit differentiation to find dy/dx.
\[\frac{d}{dx}(3x^3 + 4y^3 = 77)\] \[\frac{d}{dx}(3x^3 + 4y^3) = \frac{d}{dx}(77)\] \[9x^2 + 12y^2y' = 0\] Solving for y’: \[y' = \frac{-3x^2}{4y^2}\]
Step 2. Find the slope of the tangent line at (3,-1). \[y' = \frac{-3(3)^2}{4(-1)^2} = -\frac{27}{4}\]
16. Find the intervals on which the following function is increasing and on which it is decreasing. \[f(x) = \frac{x + 3}{x - 8}\]
In r:
eq = function(x){(x+3)/(x-8)}
plot(eq(1:100), type='b', main="Intervals on which function is increasing and decreasing")
\(X\) never increases. x is decreasing from \(-\infty\) to \(8\) (non-inclusive) and decreasing from \(8\) (non-inclusive) to \(\infty\).
Derivative, just for fun, in r:
myf16=function(x){(x+3)/(x-8)}
Deriv(myf16)
## function (x)
## {
## .e1 <- x - 8
## (1 - (3 + x)/.e1)/.e1
## }
Or \(f'(x)=-\frac{11}{(x-8)^2}\), which is always negative other than at 8, where it does not exist.
\[F(t) = 14 + \frac{367t^2}{t^2 + 100}\]
Step 1. Determine the interval for which the temperature is increasing and the interval for which it is decreasing. Please express your answers as open intervals.
In r:
eq = function(t){14+(367*t^(2))/(t^(2)+100)}
curve(eq,from=0,to=100,xlab="Oven Time",ylab="Temp (F)",main="Temperature in F over time in oven")
Using quotient rule, \[F'(t) = \frac{73,400t}{(t^2+100)^2}\] \(F'(t)\) is increasing over all positive values of \(t\). Negative values are not possible in this case, as \(t \geq 0\), as \(t\) is time.
Step 2. Over time, what temperature is the pizza approaching? \[\lim_{x\to\infty}14 + \frac{367t^2}{t^2 + 100}\] \[\lim_{x\to\infty}14 + 367*\lim_{x\to\infty}\frac{t^2}{t^2 + 100}\] \[14 + 367 * 1 = 381\]
18. A study says that the package flow in the East during the month of November follows \(f(x) = x^3/3340000 - (7x^2)/9475 + 42417727x/1265860000 + 1/33\), where \(1 £ x £ 30\) is the day of the month and \(f(x)\) is in millions of packages. What is the maximum number of packages delivered in November? On which day are the most packages delivered? Round your final answer to the nearest hundredth. \[f(x) = \frac{x^3}{3340000} - \frac{7x^2}{9475} + \frac{42417727x}{1265860000} + \frac{1}{33}\]
library(Matrix)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(RevoScaleR)
library(stats)
library(mosaic)
## Loading required package: ggformula
## Loading required package: ggplot2
##
## New to ggformula? Try the tutorials:
## learnr::run_tutorial("introduction", package = "ggformula")
## learnr::run_tutorial("refining", package = "ggformula")
## Loading required package: mosaicData
##
## The 'mosaic' package masks several functions from core packages in order to add
## additional features. The original behavior of these functions should not be affected by this.
##
## Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.
##
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following object is masked from 'package:Matrix':
##
## mean
## The following object is masked from 'package:RevoScaleR':
##
## as.xtabs
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cor.test, cov, fivenum, IQR, median,
## prop.test, quantile, sd, t.test, var
## The following objects are masked from 'package:base':
##
## max, mean, min, prod, range, sample, sum
library(rootSolve)
##
## Attaching package: 'rootSolve'
## The following object is masked from 'package:numDeriv':
##
## hessian
library(numDeriv)
f18=function(x){x^3/3340000 - (7*x^2)/9475 + (42417727*x)/1265860000 + 1/33}
f18s=seq(1,30,by=1)
a=f18(f18s)
data=cbind(f18s,a)
plot(data,type="l",main="Looking for maximum packages on a day in November",xlab="Day of November",ylab="Packages shipped (in millions)")
Most packages on a day in November:
max(a) * 1000000
## [1] 413835.3
Number day in November when these packages were sent:
fd=Deriv(f18)
uniroot.all(fd,c(1,30))
## [1] 23.00001
Round to 23.
19. Use the Second Derivative Test to find all local extrema, if the test applies. Otherwise, use the First Derivative Test. Write any local extrema as an ordered pair. \[f(x) = 7x^2 + 28x - 35\]
eq = function(x){7*x^2 + 28*x - 35}
curve(eq,from=-20,to=20,xlab="x",ylab="f(x)",main="Extrema Problem")
First derivative test for extremes \[f'(x) = 14x + 28\] \(f'(x) = 0\) at \(x = -2\) Critical point: \((-2,0)\), with \(f(x)\) decreasing before \(x=2\) and increasing after \(f'(x)\) changes from negative to positive at \(x=2\), so f has a local minium at \((2,0)\).
Second derivative test for extremes \[f''(x) = 14\] As \(f''(2) = 14 > 0\), f is concave up and has a local minimum at \(x = 2\) or \((2,0)\), the critical point.
20. Use the Second Derivative Test to find all local extrema, if the test applies. Otherwise, use the First Derivative Test. Write any local extrema as an ordered pair. \[f(x) = -6x^3 + 27x^2 + 180x\]
f20=function(x){-6*x^3 + 27 * x^2 + 180 * x}
curve(f20,from=-10,to=10,xlab="x",ylab="f(x)",main="Extrema Problem 2")
\[f'(x) = -18x^2 + 54x + 180\] \[0 = -18x^2 + 54x + 180\] \[0 = -x^2 + 3x + 10\] \[0 = (x+2)(-x+5)\] \(x = -2\) or \(x = 5\)
In r:
f20d1=Deriv(f20)
uniroot.all(f20d1,c(-200,200))
## [1] -2.000000 4.999993
So critical points to check are -2 and 5.
\[f''(x) = -36x + 54\] \[f''(-2) =\]
-36*-2 + 54
## [1] 126
As \(f''(-2) > 0\) then f is concave up and has a local mnimum at \(x = -2\) or \((-2,-204)\).
\[f''(5) =\]
-36*5 + 54
## [1] -126
As \(f''(5) < 0\) then f is concave down and has a local maximum at \(x = 5\) or \((5,825)\).
21. A beauty supply store expects to sell 120 flat irons during the next year. It costs $1.60 to store one flat iron for one year. To reorder, there is a fixed cost of $6 , plus $4.50 for each flat iron ordered. In what lot size and how many times per year should an order be placed to minimize inventory costs? Let \(x\) = lot size Annual storage cost = \(1.60 * x/2 = .8x\) Annual reordering cost = \((6.00 + 4.50x)(120/x)\) Inventory cost function - below \[f(x) = .8x + (\frac{720}{x} + 540)\] \[f'(x) = \frac{4}{5}-720x^{-2}\] \[0 = \frac{4}{5}-720x^{-2}\] \[\frac{4}{5} = 720x^{-2}\] \[\frac{1}{900} = \frac{1}{x^2}\] \(f'(x) = 0\) at \(x = -30\) and \(x = 30\) Negative orders are not possible, so critical point for lot size is \(x = 30\), or \((30,588)\).
Orders of 30 should be placed 4x per year to save dollars.
22. A shipping company must design a closed rectangular shipping crate with a square base. The volume is \(18432 ft^3\). The material for the top and sides costs \(\$3 per square foot\) and the material for the bottom costs \(\$5 per square foot\). Find the dimensions of the crate that will minimize the total cost of material.
\[Volume = l * w * h = 18432 ft^3\] \[Surface area = 2wl + 2lh + 2hw\]
We want to minimize the cost, so we’ll use surface area (SA) equation in conjunction with cost. Volume we know, will be (V). Set \(l = x\) and \(w = x\). \(H = y\). So \(V = x^2*y = 18432ft^3\) \[y = \frac{18432ft^3}{x^2}\] \[SA = X^2 (bottom) + X^2 (top) + 4xy (sides)\] Adding cost: \(C = (5)x^2 + (3)x^2 + (3)4Xy\) \[8x^2 + 12x(\frac{18432ft^3}{x^2})\] \[C = 8x^2 + \frac{221184}{x}\]
f22=function(x){8*x^2 + 221184/x}
s22=seq(0,1000,by=1)
a22=f22(s22)
data=cbind(s22,a22)
plot(data, type = "l", main="Minimize materials costs")
m22=min(a22)
m22
## [1] 13824
max(a22)
## [1] Inf
f22d=Deriv(f22)
f22d
## function (x)
## 16 * x - 221184/x^2
f22da=uniroot.all(f22d,c(0,100000))
f22da
## [1] 24.00001
f22d2=Deriv(f22d)
f22d2
## function (x)
## 16 + 442368/x^3
f22d2(f22da)
## [1] 47.99994
\(S''(24) > 0\), so minimized
18432/24^2
## [1] 32
\(x = 24 ft\), so \(y = \frac{18432ft^3}{24^2}\) or \(y = 32 ft\) Box is \(24 x 24 x 32\), which will cost \(\$13,824\).
23. A farmer wants to build a rectangular pen and then divide it with two interior fences. The total area inside of the pen will be 1056 square yards. The exterior fencing costs $14.40 per yard and the interior fencing costs $12.00 per yard . Find the dimensions of the pen that will minimize the cost.
Perimeter of rectange = Exterior fence = \(2x + 2y\)
Area of rectangle = Area inside pen = \(x * y = 1056\) so \(y = 1056/x\)
Length of interior fencing = \(2x\)
Cost - c: \[14.40*2x + 14.40*2(\frac{1056}{x}) + 12.00*2x = 52.8x + \frac{30412.8}{x}\] $
f23=function(x){52.8*x + 30412.8/x}
s23=seq(0,1000,by=1)
a23=f23(s23)
data=cbind(s23,a23)
plot(data, type = "l", main="Minimize materials costs")
m23=min(a23)
#Should be min total cost
m23
## [1] 2534.4
max(a23)
## [1] Inf
f23d=Deriv(f23)
f23d
## function (x)
## 52.8 - 30412.8/x^2
f23da=uniroot.all(f23d,c(0,100000))
#Should be x that gives min
f23da
## [1] 24
f23(f23da)
## [1] 2534.4
f23d2=Deriv(f23d)
f23d2
## function (x)
## 60825.6/x^3
f23d2(f23da)
## [1] 4.399999
Costs minimized at \(x = 24\), which would put y at \(y = 44\). Total cost would then be $c = \(\$2534.40\).
24. It is determined that the value of a piece of machinery declines exponentially. A machine that was purchased 7 years ago for $67000 is worth $37000 today. What will be the value of the machine 9 years from now? Round your answer to the nearest cent. \[X_{t}=X_{0}e^{rt}\] With \(X_{0}\) being initial value, \(r\) being decay rate, and \(t\) being interval/years passed.
\[X'_{t}=X_{0}e^{rt}\]
\[37000 = 67000e^{7r}\] Solve for \(r\), then figure out what value is for \(t = 9\).
\[37000/67000 = e^{7r}\] \[ln(37/67) = ln(e^{7r)}\] \[ln(37/67) = 7r*ln(e)\] \[ln(36/67) = 7r\] \[r = \frac{ln\frac{37}{67}}{7}\]
\[X_{9} = 67000 * e^{9*(\frac{ln\frac{37}{67}}{7})} = 31226.53\]
25. The demand function for a television is given by \(p = D(x) = 23.2 - 0.4x\) dollars. Find the level of production for which the revenue is maximized.
Revenue is given by \(R = pq.\) For this example, we’ll make \(R(evenue) = x (price) * D(x) (demand)\) \[R = x*D(x)\] \[R = 23.2*x - 0.4x^2\]
f25=function(x){23.2*x - 0.4*x^2}
s25=seq(0,100,by=.1)
a25=f25(s25)
data=cbind(s25,a25)
plot(data, type = "l", main="Revenue based on cost")
m25=min(a25)
#Should be min total revenue over range
m25
## [1] -1680
#Should be max total revenue over range - GOAL here
max(a25)
## [1] 336.4
f25d=Deriv(f25)
f25d
## function (x)
## 23.2 - 0.8 * x
f25da=uniroot.all(f25d,c(0,100))
#Should be x that gives max total revenue
f25da
## [1] 29
#Should be max revenue
f25(f25da)
## [1] 336.4
Maximum revenue at 29 days.
26. The amount of goods and services that costs $400 on January 1, 1995 costs $426.80 on January 1, 2006 . Estimate the cost of the same goods and services on January 1, 2017. Assume the cost is growing exponentially. Round your answer to the nearest cent. \[X_{t}=X_{0}e^{rt}\] With \(X_{0}\) being initial value, \(r\) being decay rate, and \(t\) being interval/years passed.
\[X'_{t}=X_{0}e^{rt}\] \[400 = 426.80e^{11r}\] Solve for \(r\), then figure out what value is for \(t = 9\).
\[ln(400/426.80) = ln(e^{11r)}\] \[ln(400/426.80) = 11r\] \[r = \frac{ln\frac{400}{426.80}}{11}\]
\[X_{9} = 67000 * e^{9*(\frac{ln\frac{400}{426.80}}{11})} = 31226.53\]
27. A manufacturer has determined that the marginal profit from the production and sale of x clock radios is approximately \(380 - 4x dollars\) per clock radio.
\[P'(x) = 380 - 4x dollars\]
Step 1. Find the profit function if the profit from the production and sale of 38 clock radios is $1700. Taking the integral, \[P(x) = 380x - 2x^2 + c\] \[1700 = 380(38)-2(38)^2 + c\] \[c = -9852\] \[P(x) = 380(x)-2(x)^2 - 9852\]
Step 2. What is the profit from the sale of 56 clock radios? \[P(56) = 380(56)-2(56)^2 - 9852 = 5156\]
##Integration
Use integration by substitution to solve the integral below.
\[\int\frac{-5(ln(y))^3}{y}dy\] Let \(u = ln(y)\) Then $du = 1/y*dy \[-5\int u^3du\] \[\frac{-5u^4}{4} + C\] \[\frac{-5}{4}(ln(y))^4+C\]
29. It was discovered that after t years a certain population of wild animals will increase at a rate of \(P´(t) = 75 - 9t^(1/2)\) animals per year. Find the increase in the population during the first 9 years after the rate was discovered. Round your answer to the nearest whole animal. \[\int_{1}^{9} 75 - 9t^{1/2}dt\] \[75t-9*\frac{2}{3}*t^3/2+C\] \[(75(9)- 9 6(9))^{3/2}-(75(1) + 6(1)^{3/2})\]
(75*(9)-6*(9)^(3/2))-(75*(1)-6*(1)^(3/2))
## [1] 444
30. Find the area of the region bounded by the graphs of the given equations. \[y = 6x^2,y = 6\sqrt{x}\]
plot
Enter your answer below.
31. Solve the differential equation given below. \[dy/dx = x^3 y\] \[x^{3}dx = dy/y\] \[\int x^{3}dx = \int dy/y\] \[ln(y) = \frac{x^4}{4}+C\]
32. Use integration by parts to evaluate the definite integral below.
\[\int_{-7}^{2} x\sqrt{x + 7}dx\] \[\int u*dv = u * v - \int v*du\] Write your answer as a fraction. Let \(dv = x\) \[u = \sqrt{x+7}\] \[du = \frac{3x+14}{2*\sqrt{x+7}}*dx\] \[v = \frac{x^2}{2}\] \[\sqrt{x+7}*\frac{x^2}{2}-\int \frac{x^2}{2}*\frac{3x+14}{2*\sqrt{x+7}}*dx \] -144/5
33. The following can be answered by finding the sum of a finite or infinite geometric sequence. Round the solution to 2 decimal places. A rubber ball is dropped from a height of 46 meters, and on each bounce it rebounds up 22 % of its previous height. \[46+2*46(.78)^t\]
Step 1. How far has it traveled vertically at the moment when it hits the ground for the 20^th time?
\[46+ 92\int_{1}^{20}(1-.22)^t = 46+92(3.111) m = 332.21m \]
Step 2. If we assume it bounces indefinitely, what is the total vertical distance traveled?
34. Find the Taylor polynomial of degree 5 near x = 4 for the following function. \[y = 3e^(5x - 3)\]
Ran out of time. Sorry! Will review this last one.