# Calculus

## Question 3

Water flows onto a flat surface at a rate of 5 cm^3/s forming a circular puddle 10mm deep. How fast is the radius growing when the radius is:

volume of puddle = area of circle x depth depth = 10mm = 1cm

$\frac{dV}{dt} = \pi 2r \frac{dr}{dt} h$ $\frac{dr}{dt} = \frac{\frac{dV}{dt}}{2 \pi rh}$

### 1 cm

cyl_radius_change <- function(dv, radius, height){
dr = dv/(2 * pi * radius * height)
return(dr)
}
print('The radius change over time (cm/s) when the radius is 1cm is:')
## [1] "The radius change over time (cm/s) when the radius is 1cm is:"
cyl_radius_change(5, 1, 1)
## [1] 0.7957747

### 10 cm

print('The radius change over time (cm/s) when the radius is 10cm is:')
## [1] "The radius change over time (cm/s) when the radius is 10cm is:"
cyl_radius_change(5, 10, 1)
## [1] 0.07957747

### 100 cm

print('The radius change over time (cm/s) when the radius is 100cm is:')
## [1] "The radius change over time (cm/s) when the radius is 100cm is:"
cyl_radius_change(5, 100, 1)
## [1] 0.007957747

## Question 4

A circular balloon is inflated with air flowing at a rate of 10 cm^3/s. How fast is the radius of the balloon increasing when the radius is:

$V = \frac{4}{3} \pi r^3$ $\frac{dV}{dt} = 4 \pi r ^2 \frac{dr}{dt}$ $\frac{dr}{dt} = \frac{\frac{dV}{dt}}{4 \pi r^2}$

### 1 cm

sph_radius_change <- function(dv, radius){
dr = dv/(4 * pi * (radius^2))
return(dr)
}
print('The radius change over time (cm/s) when the radius is 1cm is:')
## [1] "The radius change over time (cm/s) when the radius is 1cm is:"
sph_radius_change(10, 1)
## [1] 0.7957747

### 10 cm

print('The radius change over time (cm/s) when the radius is 10cm is:')
## [1] "The radius change over time (cm/s) when the radius is 10cm is:"
sph_radius_change(10, 10)
## [1] 0.007957747

### 100 cm

print('The radius change over time (cm/s) when the radius is 100cm is:')
## [1] "The radius change over time (cm/s) when the radius is 100cm is:"
sph_radius_change(10, 100)
## [1] 7.957747e-05