In Exercises 5 – 8, evaluate fx(x, y) and fy(x, y) at the indicated point. 5. f(x, y) = x2y − x + 2y + 3 at (1, 2)
# Define the function
f <- function(x, y) {
return(x^2 * y - x + 2 * y + 3)
}
# Define partial derivatives
fx <- function(x, y) {
return(2 * x * y - 1)
}
fy <- function(x, y) {
return(x^2 + 2)
}
x_value <- 1
y_value <- 2
fx_at_point <- fx(x_value, y_value)
fy_at_point <- fy(x_value, y_value)
# Print the results
cat("f_x(1, 2) =", fx_at_point, "\n")
## f_x(1, 2) = 3
cat("f_y(1, 2) =", fy_at_point, "\n")
## f_y(1, 2) = 3