Data 605 Assignment Week 13

Alexander Ng

11/22/2019

Problem 1: Integration by Substitution

Integrate \[\int 4 e^{-7x}dx\]

Solution:

\[\begin{align} \int 4 e^{-7x}dx & = 4 \int e^{-7x} dx \\ & = 4 \left( \frac{ e^{-7x} }{-7} \right) + C \\ & = -\frac{4}{7}e^{-7x} + C \\ \end{align} \]

Problem 2: Population Growth Of Bacteria

Biologists are treating a pond contaminated with bacteria. The level of contamination is changing at a rate of \[ \frac{dN}{dt} = -\frac{3150}{t^4} - 220 \] bacteria per cubic centimeter per day, where t is the number of days since treatment began. Find a dt t 4

function \(N(t)\) to estimate the level of contamination if the level after 1 day was 6530 bacteria per cubic centimeter. We know \[N(1) = 6530\] is the level of contamination on day 1.

Solution:

\[\begin{align} \int \frac{dN}{dt} dt & = -\int \left( \frac{ 3150}{t^4} + 220 \right) dt \\ N(t)& = - \left( -3150 \frac{t^{-3}}{3} \right) - 220t + C \\ \end{align} \] Since \(N(1) = 6530\), we plug in \(t=1\) to get:

\[\begin{align} N(1 ) = ( 3150 \cdot \frac{1}{3} ) - 220 + C = 6530 \\ C = 6530 + 220 - \frac{3150}{3} = 5260 \\ \end{align} \] This implies \[ N(t) = 1050 t^{-3} - 220 t + 5260 \]

Problem 3: Finite Riemann Sum

The area \(A\) is the sum of 4 rectangles. The geometric shape of the area becomes:

\[ A = \left[ f(5) + f(6) + f(7) + f(8) \right] \Delta w\] where \(\Delta w = 1\) is the width of each rectangle.

Since \(f(x) = 2x-9\) this gives:

\[ A = \left[ 1 + 3 + 5 + 7 \right] \cdot 1 = 16\]

Problem 4: Area Between 2 Curves

The curves \[y = x^2 - 2x -2 , y = x+2 \] intersect at two points and define a curved region between the 2 points.

f1 = function(x){
   x^2 - 2*x - 2
}

f2 = function(x){
   x +2
}

x <- seq(-2, 5, 0.05)

y1 <- f1(x)
y2 <- f2(x)

plot(x,y1, type='l')
lines(x,y2, type='l')

To determine the intersection points of the two curves, we set the two functions equal to each other and solve the resulting quadratic equation:

\[\begin{align} x^2 - 2x -2 & = x + 2 \\ x^2 - 2x -2 - x - 2 & = 0 \\ x^2 - 3x -4 & = 0 \\ (x - 4)(x + 1) & = 0 \\ \end{align} \]

The intercepts occur at \(x=4\) and \(x=-1\) which allows us to integrate the difference of the two functions to get the area of the region.

The area bounded by the two curve is the integral:

\[\begin{align} \int_{-1}^{4} (x+2) - (x^2 -2x -2) dx & = \int_{-1}^{4} -x^2 + 3x + 4 dx \\ & = \left( -\frac{x^3}{3} + \frac{3}{2}x^2 + 4x \right) \bigg\rvert_{-1}^{4} \\ & = (-4^3/3 + (3/2)(4)^2 +4(4))-(-(-1^3)/3 +3/2(-1^2) +4(-1)) \\ & = 20\frac{5}{6} \\ & = 20.8333 \\ \end{align} \]

We can verify this in R using the integrate function to get the same answer.

g <- function(x)
{
    (x + 2) - ( x*x -2 *x -2)
}

(integrate( g, lower=-1, upper=4))  # definite integral of the area function from -2 to 4.
## 20.83333 with absolute error < 2.3e-13

These two answers agree.

Problem 5: Inventory Minimization

A beauty supply store expects to sell 110 flat irons during the next year. It costs \(\$3.75\) to store one flat iron for one year. There is a fixed cost of \(\$8.25\) for each order. Find the lot size and the number of orders per year that will minimize inventory costs.

Solution:

Let \(L\) denote the lot size of a single order of irons.
Let \(G=8.25\) denote the fixed cost of 1 order. Let \(S=3.75\) denote the cost of storage of one flat iron for one year.

\(L\) must be an integer but we will treat the inventory cost function \(f(L)\) as a continuous function of its argument. Clearly, we require the number of orders \(N\) placed to be \(N =\lceil 110/L \rceil\).

We make some assumptions of how the inventory is sold.

  1. we assume all \(L\) irons of one lot are sold at the same time
  2. we assume the time required to sell one lot is proportional to the expected sales rate for one year of \(110/year\).

The storage cost \(S(L)\):

\[S(L) = N \cdot \left[ \text{ holding period per order} \cdot \text{ Lot size} \cdot \text{ storage cost per iron} \right]\]

\[S(L) = N \left( \frac{L}{110} \right) LS = \left( \frac{110}{L} \right) \left( \frac{L}{110} \right) LS = LS\] The ordering cost \(H(L)\) is:

\[H(L) = GN = G \frac{110}{L}\]

This implies the cost function is:

\[f(L) = S(L)+H(L) = LS + G\frac{110}{L}\] Taking the first derivative of \(f\) and solving for \(f'(L) = 0\) should give us the minimum:

\[\frac{\partial f }{\partial L } = S - G \cdot \frac{110}{L^2} = 0 \]

This implies the cost is minimized when \[ L = \sqrt{\frac{110 G}{S}}\]

(L = sqrt(110 * 8.25/3.75) )
## [1] 15.55635

When we test the exact solution at the neighboring integer points L = 15, 16 we get

L = 15
S = 3.75
G = 8.25
(N = ceiling(110/L) )
## [1] 8
(N * (L/110) * L * S + G * N )  # total cost when L = 15
## [1] 127.3636
L = 16
(N = ceiling(110/L))
## [1] 7
(N * (L/110)* L * S + G * N ) # total cost when L = 16
## [1] 118.8409

It appears that a lot size of \(L = 16\) is optimal and yields an inventory cost of 118.8409 dollars.

Problem 6: Integration By Parts

To solve the following indefinite integral by integration by parts, we proceed as follows.

\[u = ln(9x), dv = x^6 dx\] It follows that \[ du = \frac{dx}{x}, \text{ and } v = \frac{x^7}{7}\]

Then we get:

\[\begin{align} \int u dv &= uv - \int v du \\ \int ln(9x)x^6 dx & = ln(9x) \frac{x^7}{7} - \int \frac{x^7}{7} \left( \frac{1}{x} \right)dx \\ & = ln(9x)\frac{x^7}{7} - \frac{1}{7} \frac{x^7}{7} \\ & = ln(9x) \frac{x^7}{7} - \frac{x^7}{49} \\ \end{align}\]

Problem 7: Probability Density

Determine if \(f(x) = 1/6x\) is a probability density function on the interval \([ 1, e^6 ]\).

First, we require that \(f(x) > 0\) on its domain which is the finite interval \([1, e^6]\). Obviously, it is.

Next, we require \[ \int_{1}^{e^6} f(x) dx = 1 \]

\[ \int_{1}^{e^6} f(x) dx = \int_{1}^{e^6} \frac{dx}{6x} = \frac{1}{6} ln(x) \vert_{1}^{e^6} = \frac{1}{6}\left[ ln(e^6) - ln(1) \right] = \frac{1}{6}( 6 - 0 ) = 1\] This confirms \(f(x)\) is a valid probability density function.