Data 605 HW 13

library(knitr)
library(rmdformats)

## Global options
options(max.print="85")
opts_chunk$set(cache=TRUE,
               prompt=FALSE,
               tidy=TRUE,
               comment=NA,
               message=FALSE,
               warning=FALSE)
opts_knit$set(width=35)

library(stats)

#1

Use integration by substitution to solve the integral below.

\[ \begin{equation*} \begin{split} \int 4e^{-7x}dx \end{split} \end{equation*} \]

Ans:

Let u = -7x. Then du = -7dx. We get dx = \(-\frac{1}{7}\) du.

Now, solving for \(\int e^u du\),

By the exponential rule, \(\int e^u du = e^u\)

\[ \begin{multline*} \begin{split} \int 4e^{-7x}dx & = -\frac{4}{7} \int e^u du \\ & = -\frac{4}{7} e^u \\ & = -\frac{4}{7} e^{-7x} + C\\ \end{split} \end{multline*} \]

where C is a constant.

#2

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 function N(t) to estimate the level of contamination if the level after 1 day was 6530 bacteria per cubic centimeter.

Ans:

dN = \(-\frac{3150}{t^4}-220 \space dt\)

Integrating both sides, we get

\[ \begin{multline*} \begin{split} \int dN &= \int (-\frac{3150}{t^4}- 220) dt \\ N(t) &= \frac{3150}{3t^3} -220t + C \\ N(t) &= \frac{1050}{t^3}-220 t + C \\ When \space t = 1, N(t) = 6530. \\ N(1) &= 1050 - 220 + C = 6530 \\ \therefore C &= 5700 \\ \end{split} \end{multline*} \]

\(N(t) = \frac{1050}{t^3} -220t + 5700\)

#3

Find the total area of the red rectangles in the figure below, where the equation of the line is f(x) = 2x - 9.

Ans:

Total area under the curve is 16.

integrand <- function(x) {
    2 * x - 9
}
tot_area <- integrate(integrand, 4.5, 8.5)
tot_area
16 with absolute error < 1.8e-13

#4

Find the area of the region bounded by the graphs of the given equations.

\[ \begin{equation*} \begin{split} y = x^2 -2x - 2, \quad y = x + 2 \\ \end{split} \end{equation*} \]

Ans:

Solving the equations, we get

X2 - 3x -4 = 0

(x+1)(x-4) = 0

x = -1 and x = 4

Area = \(\int x^2 - 2x -2 - (x + 2) dx\)

$$ \[\begin{multline*} \begin{split} & = \int(x^2 -3x - 4) dx \\ & = \frac{x^3}{3}-\frac{3x^2}{2}-4x + C \end{split} \end{multline*}\] $$

Integrate the equation above, we should get what the constant C is.

func_4 <- function(x) {
    x^3 * 1/3 - 3/2 * x^2 - 4 * x
}
# abs function to correct the sign resulted from the incorrect sequence in the
# subtractions of the two equations in the beginning of this calc
area_4 <- abs(func_4(4) - func_4(-1))
area_4
[1] 20.83333

The area of the region bound by the given equations is 20.83

#5

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.

*Ans*:

Let n be the number of orders per year that attains minimum inventory cost.

Let x be the number of flat irons to order per year and x/2 is the average inventory level.

Storage Cost per year = 3.75 * x/2 = 1.875x

Ordering Cost per year = 8.25 * 110 / x = 907.5 / x

Inventory Cost per year = 1.875x + 907.5 / x

I(x) = 1.875x + 907.5/x

To minimize inventory cost, we take derivative I’(x) and solve for x when I’(x) = 0

\[ 1.875 - 907.5 * x-2 = 0 \\ x = \sqrt(484) \\ x = 22 \]

Orders per year (n) is simply 110 / n = 22. n is then 5. Lot size, which is x, is 22.

#6

Use integration by parts to solve the integral below.

\[ \begin{equation*} \begin{split} \int ln(9x) x^6 dx \end{split} \end{equation*} \]

Ans:

Let u = ln(9x), then du = \(\frac{1}{x}\) dx.

Let v = \(\frac{1}{7}x^7\), then dv = x6 dx

Integration by parts, we get ∫uv’=uv−∫u’v

\[ \begin{multline*} \begin{split} \int ln(9x) x^6 dx & = ln(9x) \frac{1}{7}x^7 - \int\frac{1}{x} \frac{1}{7}x^7dx \\ & = \frac{1}{7}ln(9x)x^7 - \frac{1}{49} x^7 + C \\ & = (\frac{1}{7}ln(9x) - \frac{1}{49})\times x^7 + C \end{split} \end{multline*} \]

#7

Determine whether f(x) is a probability density function on the interval [1,e6]. If not, determine the value of the definite integral.

\[ \begin{multline*} \begin{split} f(x) = \frac{1}{6x} \end{split} \end{multline*} \]

Ans:

To find out if f(x) is a pdf on the interval of [1,e6].

\[ \begin{multline*} \begin{split} \int_{1}^{e^6} \frac{1}{6x}dx &= \frac{1}{6} \int_{1}^{e^6}\frac{1}{x}dx \\ &= \frac{1}{6} (ln (e^6) - ln (1)) \\ &= 1 \end{split} \end{multline*} \]

Apparently, f(x) is a probability density function on the interval [1,e6].