Calculus - Exercices 4.2 - Number 12

Part 1 - Theoretical answer

1. Setup the problem and most important equations

To get started let’s graph the setup and state the know equations.

The goal is to find dH / dt for X=10 and X=40, which when t=5 and t=20 respectively.

After we calculated dH/dt for the two cases, we will compare the theoretical values againts a simulation

The answer we get is: 0.63 feet/second when distance is 10 feet and 1.6 feet/second when distance is 40 feet

Part 2 - Simulation

Here we will run a simple simulation. What I will do is run time in small increments knowing the speed (2 feet/second). We will record the horizontal distance, calculate the hypotenuse and finally the vertical distance of the weight from the ground. The speed would be a simple calculation of vertical distance traveled within time.

rm(list = ls())
Xprevious <- 0
Xnew <- 0
sim_time <-25 #seconds
t_increments <- 0.001 #seconds
speed <- 2 # feet/second
Yprevious <- 30
Ynew <- 0
results <- list()

for (t in seq(0, sim_time, by = t_increments)) {
  Xnew <- Xprevious +(speed*t_increments)
  H <- sqrt(30^2 + Xnew^2)
  Ynew <- 60 - H
  ySpeed <- (Yprevious-Ynew) / t_increments
  if (t==5 |t==20 ){
    results <- append(results, ySpeed)
  } 
  Xprevious <- Xnew
  Yprevious <- Ynew
}
cat("Vertical speed when distance is 10 feet = ", results[[1]][1], " f/s","\n")
## Vertical speed when distance is 10 feet =  0.6325125  f/s
cat("Vertical speed when distance is 40 feet = ", results[[2]][1], " f/s","\n")
## Vertical speed when distance is 40 feet =  1.600014  f/s

The simulated results are 0.6325 and 1.600014. Very close to the theoretical 0.6324 and 1.6 we obtained manually