Problem 17 Chapter 4 (Page 194)
Compute the differential dy of y = \(x^2\) + 3x − 5
# Given function
y <- function(x) {
return(x^2 + 3*x - 5)
}
# First derivative of the function
dy_dx <- function(x) {
return(2*x + 3)
}
# Illustrate with x =2
x <- 2
# Compute the differential dy using the derivative at the chosen x value
dy_value <- dy_dx(x)
# Print the result
cat("dy =", dy_value, "\n")
## dy = 7