# Ladder (implicit circle): x^2 + y^2 = L^2
# Suppose L = 5, at the instant (x,y) = (4,3) and dx/dt = -1.
# Then dy/dt = -(x/y) dx/dt = (4/3).
g <- function(x, y) x^2 + y^2 - 25
out <- related_rates_grad(
g = g,
x = c(4, 3),
known_rates = c(dx = -1, dy = NA),
solve_for = "dy",
var_names = c("x", "y")
)
out$rate
out$rates
Run the code above in your browser using DataLab