Let’s take the cone’s height to be \(h(t)\), and the diameter of the conde to be \(d = 2r(t)\), where \(r\) is the radius of the cone. Finally, let the time-dependent volume \(V(t)\) of the cone equal:
\[\begin{aligned} V(t) = \frac{\pi}{3}hr^2 \end{aligned}\]Where we know
\[\begin{aligned} \frac{dV}{dt} = 5 \end{aligned}\]First, let’s write a function to calculate the volumne of a cone,
based on its radius r and height h
# First, define a function for the volume of the cone, V(t)
V <- function(r, h){
return((pi /3) * (r^2) * h)
}
# Test call of volumne function
261.7994 == round(V(5, 10), 4)
## [1] TRUE
Now, to solve this related rates problem, we’ll need to evaluate the rate of change (wrt time \(t\)) of the sand pile’s height, when \(h(t) = 30\). In other words, we need to evaluate the following expression:
\[\begin{aligned} \frac{dh}{dt} \rvert_{h=30} \end{aligned}\]As a simplifying assumption, let’s assume \(h(t)\) is a monotonically increasing function of \(t\), meaning sand is not taken away from the pile over our timeframe of interest.
Knowing the relation between our conical height and radius: \(h = \frac{2}{3}d = \frac{4}{3}r\), we can substitute to get \(V\) as an expression of just \(h\):
\[\begin{aligned} V(t) = \frac{\pi}{3}hr^2 \newline = \frac{1}{3}\pi(\frac{3}{4}h)h \newline = \frac{\pi}{4}h^2 \end{aligned}\]Alternatively, we can write R functions to compute \(V\) and \(h\) as functions of each other
# rewritten function of volume as a function of height h
V_h <- function(h){
return(pi * (1/16) * h^3)
}
h_V <- function(V){
# Height as a function of volume (both wrt to t)
(V * 16 / pi)^(1/3)
}
We don’t know \(h\) as a function of time explicitly, but can manipulate differentials to get to where we want to go, much like
\[\begin{aligned} \frac{dh}{dt} = \frac{dV}{dt} \cdot \frac{dh}{dV} \newline = 5 \cdot \frac{dh}{dV} \end{aligned}\]Now we can differentiate our expression for \(h\) with respect to \(V\):
\[\begin{aligned} \frac{dh}{dV} = \frac{d}{dV}\left ( \frac{4V^{\frac{1}{3}}}{\sqrt{\pi}} \right )\newline = \frac{4}{3\sqrt{\pi}V^{\frac{2}{3}}} \end{aligned}\]Now we just need to evaluate when \(h(t) = 30\), using our relations for \(h, r, V\) from above
\[\begin{aligned} \frac{dh}{dt}\rvert_{h=30} = \frac{5 \cdot 2}{\sqrt{\pi V\rvert_{h=30}}} \end{aligned}\]Let’s calculate the volume when the height of our conical pile is \(30ft\) and plug in:
\[\begin{aligned} V\rvert_{h=30}(t) = \frac{\pi h}{3}(\frac{90}{4})^{2}\newline \approx 15904.31 \end{aligned}\]Let’s verify our volume calculation in R:
r <- 90/4
h <- 30
(v30 = V(r, h))
## [1] 15904.31
Plugging into our above expression yields:
\[\begin{aligned} \frac{dh}{dt}\rvert_{h=30} = \frac{5 \cdot 2}{\sqrt{\pi V\rvert_{h=30}}} \newline = \frac{10}{3 \sqrt{\pi}(12904.31)^{\frac{2}{3}}}\newline \approx 0.003 \end{aligned}\]We can verify the above calculation in R
(dhdV <- (10 / (3 * sqrt(pi) * (v30^(2/3)))))
## [1] 0.002973678
In plain english, the height of our conical pile is changing at about \(0.003 ft/s\) when the height of the cone is 30ft.
We can use the base R functions deriv to calculate the
derivative, then evaluate this expression at \(h(t) = 30\) to ensure we did the math
right
# function for height with volume as a param
v_exp <- (10 / (3 * sqrt(pi) * (v30^(2/3))))
# Call derivative to find dh/dt at h(t) = 30ft
dh_dV <- deriv(h ~v_exp, c("V","h"), func=TRUE)
# Call our derivative function with our volume value at h=30 as a param
dh_dV(v30)[1] == dhdV
## [1] TRUE