Use integration by substitution to solve the integral below.
\[ \int 4e^{-7x} \, dx \]
SOLUTION:
Let \(u = -7x\). Then we find the differential \(du\): \[ du = -7 \, dx \quad \Rightarrow \quad dx = \frac{du}{-7} \]
Substitute \(dx\) with \(\frac{du}{-7}\) and \(-7x\) with \(u\): \[ \int 4e^{-7x} \, dx = \int 4e^{u} \left(\frac{du}{-7}\right) = -\frac{4}{7} \int e^{u} \, du \]
The integral of \(e^{u}\) with respect to \(u\) is \(e^{u}\), so we have: \[ -\frac{4}{7} \int e^{u} \, du = -\frac{4}{7} e^{u} + C \]
Substitute back \(u = -7x\) to get the final answer in terms of \(x\): \[ -\frac{4}{7} e^{u} + C = -\frac{4}{7} e^{-7x} + C \]
But in R, I can do this:
# integrand function
integrand <- function(x) {
4 * exp(-7 * x)
}
result <- integrate(integrand, lower = 0, upper = Inf)
result
## 0.5714286 with absolute error < 2e-07
Biologists are treating a pond contaminated with bacteria. The level of contamination is changing at a rate of
\[ \frac{dN}{dt} = -\frac{3150}{4t} - 220 \] bacteria per cubic centimeter per day, where \(t\) is the number of days since treatment began. If the level of contamination after 1 day was 6530 bacteria per cubic centimeter, find a function \(N(t)\) to estimate the level of contamination.
SOLUTION:
Given the rate of change of bacteria level in a pond: \[ \frac{dN}{dt} = -\frac{3150}{t} - 220 \]
with initial condition \(N(1) = 6530\) bacteria per cubic centimeter.
The integral of the rate of change with respect to \(t\) is: \[ \int \left(-\frac{3150}{t} - 220\right) dt = -3150 \ln(t) - 220t + C \]
Using \(N(1) = 6530\), we find \(C\): \[ 6530 = -3150 \ln(1) - 220(1) + C \] Since \(\ln(1) = 0\), we have: \[ 6530 = -220 + C \] Therefore: \[ C = 6530 + 220 = 6750 \]
So the function \(N(t)\) is: \[ N(t) = -3150 \ln(t) - 220t + 6750 \]
In R I can do this:
library(deSolve)
# N is the state variable, t is time
# The function returns the rate of change of N
ode_function <- function(t, N, parameters) {
with(as.list(c(N, parameters)), {
dNdt <- -(3150/(4*t)) - 220
list(dNdt)
})
}
# initial state values
N0 <- 6530 # initial number of bacteria per cubic centimeter
# the time sequence over which to solve the differential equation
times <- seq(from = 1, to = 10, by = 0.1)
# Solve the ODE using 'lsoda' method
solution <- ode(y = N0, times = times, func = ode_function, parms = NULL, method = "lsoda")
# solution is a matrix with time and N(t), so converting it to a data frame:
solution_df <- as.data.frame(solution)
# Ploting
plot(solution_df$time, solution_df$N, type = 'l', xlab = "Time (days)", ylab = "Number of Bacteria",
main = "Bacteria Level Over Time")
Find the total area of the red rectangles in the figure below, where the 3. equation of the line is f ( x ) = 2x - 9.
Find the total area of the red rectangles in the figure below, where the equation of the line is \(f(x) = 2x - 9\)
SOLUTION:
I am going to evaluate the function at each x-coordinate corresponding to the left side of each rectangle, then sum up the areas.
\[ \text{Area} = \sum_{i=1}^{n} f(x_i) \Delta x \] where \(\Delta x\) is the width of each rectangle, \(f(x_i)\) is the function value at the left edge of each rectangle, and \(n\) is the total number of rectangles.
# function
f <- function(x) {
2 * x - 9
}
# width of each rectangle
delta_x <- 1
# the x-coordinates of the left side of each rectangle, considering the rectangles start at x = 4 and continue to the right
x_left <- seq(from = 4, by = delta_x, length.out = 6) # 6 rectangles from 4 to 9
# the height of each rectangle using the function f
heights <- f(x_left)
# the area of each rectangle (height * width)
areas <- heights * delta_x
# total area under the curve
total_area <- sum(areas)
total_area
## [1] 24
Find the area of the region bounded by the graphs of the given equations.
\[ y = x^2 - 2x - 2, \quad y = x + 2 \]
SOLUTION:
we find the points of intersection by setting the equations equal to each other: \[ x^2 - 2x - 2 = x + 2 \] Solving for \(x\), we get: \[ x^2 - 3x - 4 = 0 \] Factoring the quadratic equation, we have: \[ (x - 4)(x + 1) = 0 \] Hence, the points of intersection are \(x = 4\) and \(x = -1\).
Next, we set up the integral of the difference of the two functions from \(x = -1\) to \(x = 4\): \[ \int_{-1}^{4} \left[ (x + 2) - (x^2 - 2x - 2) \right] \, dx \] \[ = \int_{-1}^{4} \left[ -x^2 + 3x + 4 \right] \, dx \] \[ = \left[ -\frac{x^3}{3} + \frac{3x^2}{2} + 4x \right]_{-1}^{4} \]
Evaluating this definite integral gives us the area of the region bounded by the two curves. Let’s calculate this step by step:
The integral of the function is: \[ -\frac{x^3}{3} + \frac{3x^2}{2} + 4x \]
Evaluating from \(x = -1\) to \(x = 4\): \[ \left[ -\frac{4^3}{3} + \frac{3(4)^2}{2} + 4(4) \right] - \left[ -\frac{(-1)^3}{3} + \frac{3(-1)^2}{2} + 4(-1) \right] \]
Simplifying: \[ \left[ -\frac{64}{3} + \frac{48}{2} + 16 \right] - \left[ \frac{1}{3} + \frac{3}{2} - 4 \right] \]
\[ = \left[ -\frac{64}{3} + 24 + 16 \right] - \left[ \frac{1}{3} + \frac{3}{2} - 4 \right] \]
\[ = \left[ -\frac{64}{3} + \frac{120}{3} \right] - \left[ \frac{1}{3} + \frac{9}{6} - \frac{24}{6} \right] \]
\[ = \frac{56}{3} - \left[ \frac{1}{3} + \frac{3}{2} - 4 \right] \]
\[ = \frac{56}{3} - \left[ \frac{1}{3} + \frac{9}{6} - \frac{24}{6} \right] \]
\[ = \frac{56}{3} - \left[ \frac{1}{3} + \frac{9}{6} - \frac{24}{6} \right] \]
\[ = \frac{56}{3} - \frac{-14}{6} \]
\[ = \frac{56}{3} + \frac{14}{6} \]
\[ = \frac{56}{3} + \frac{7}{3} \]
\[ = \frac{63}{3} \]
\[ = 21 \]
Therefore, the area of the region bounded by the two curves is 21 square units.
I can also do this using R:
# the functions
f1 <- function(x) { x^2 - 2*x - 2 }
f2 <- function(x) { x + 2 }
# the area between the two functions from x = -1 to x = 4
area <- integrate(function(x) { f2(x) - f1(x) }, lower = -1, upper = 4)$value
area
## [1] 20.83333
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:
To minimize the inventory costs, we can use the Economic Order Quantity (EOQ) model. The EOQ is given by the formula: \[ EOQ = \sqrt{\frac{2DS}{H}} \] where:
\(D\) is the annual demand in units, \(S\) is the ordering cost per order, \(H\) is the holding cost per unit per year.
For the given values:
\(D = 110\) flat irons, \(S = \$8.25\) per order, \(H = \$3.75\) per flat iron per year,
we then can calculate the EOQ: \[ EOQ = \sqrt{\frac{2 \cdot 110 \cdot 8.25}{3.75}} \]
Solving this, we find the EOQ, which is the lot size that minimizes the inventory costs.
We can also calculate the number of orders per year by dividing the annual demand \(D\) by the EOQ: \[ \text{Number of Orders} = \frac{D}{EOQ} \]
D <- 110 # demand
S <- 8.25 # cost per order
H <- 3.75 # holding cost
# Economic Order Quantity (EOQ)
EOQ <- sqrt((2 * D * S) / H)
# the number of orders per year
num_orders <- D / EOQ
EOQ
## [1] 22
num_orders
## [1] 5
Use integration by parts to solve the integral below.
\[ \int \ln(9x) \cdot x^6 \, dx \]
SOLUTION:
To solve the integral, we let: \[ u = \ln(9x), \quad dv = x^6 \, dx \] \[ du = \frac{1}{x} \, dx, \quad v = \frac{x^7}{7} \]
Now, applying the integration by parts formula: \[ \int u \, dv = uv - \int v \, du \] \[ \int \ln(9x) \cdot x^6 \, dx = \ln(9x) \cdot \frac{x^7}{7} - \int \frac{x^7}{7} \cdot \frac{1}{x} \, dx \] \[ = \ln(9x) \cdot \frac{x^7}{7} - \frac{1}{7} \int x^6 \, dx \] \[ = \ln(9x) \cdot \frac{x^7}{7} - \frac{1}{7} \cdot \frac{x^7}{7} + C \] \[ = \frac{x^7}{7} \ln(9x) - \frac{x^7}{49} + C \]
Where \(C\) is the constant of integration.
library(pracma)
##
## Attaching package: 'pracma'
## The following object is masked from 'package:deSolve':
##
## rk4
# function to integrate
f <- function(x) log(9 * x) * x^6
# Since this is a definite integral, we would need to specify the limits of integration
# For example, let's integrate from 1 to 2
result <- integrate(f, lower = 1, upper = 2)
result
## 49.94679 with absolute error < 5.5e-13
Determine whether \(f(x)\) is a probability density function on the interval \([1, e^6]\) If not, determine the value of the definite integral
\[ f(x) = \frac{1}{6x} \]
SOLUTION:
To determine whether \(f(x) = \frac{1}{6x}\) is a probability density function on the interval \([1, e^6]\), we must check if the integral of \(f(x)\) over that interval is equal to 1.
The integral to solve is: \[ \int_1^{e^6} \frac{1}{6x} \, dx \]
This is a straightforward logarithmic integral. Integrating, we get: \[ \frac{1}{6} \int_1^{e^6} \frac{1}{x} \, dx = \frac{1}{6} [\ln|x|]_1^{e^6} \]
Evaluating the integral from 1 to \(e^6\), we find: \[ \frac{1}{6} [\ln(e^6) - \ln(1)] = \frac{1}{6} [6 - 0] = 1 \]
Since the result of the integral is 1, \(f(x)\) is a probability density function on \([1, e^6]\).
To do ths in R:
# function
f <- function(x) { 1/(6*x) }
# the definite integral from 1 to exp(6)
result <- integrate(f, lower = 1, upper = exp(6))
result$value
## [1] 1