Exercise 4.1: Use Newton’s Method to approximate all roots of the given functions accurate to 3 places after the decimal. If an interval is given, find only the roots that lie in that interval. Use technology to obtain good initial approximations.

9. f(x) = x^3 + 5x^2 - x - 1

To apply Newton’s method, we need to find the derivative of the function: f(x) = x^3 + 5x^2 - x - 1 f’(x) = 3x^2 + 10x - 1

# Define the function and its derivative
f <- function(x) x^3 + 5*x^2 - x - 1
f_prime <- function(x) 3*x^2 + 10*x - 1

# Set the tolerance and maximum number of iterations
tol <- 0.0001
max_iter <- 100

# Find the roots
x <- c(-5, -2, 0, 2)  # Initial approximations
for (i in seq_along(x)) {
  n <- 0
  while (abs(f(x[i])) > tol && n < max_iter) {
    x[i] <- x[i] - f(x[i]) / f_prime(x[i])
    n <- n + 1
  }
  if (abs(f(x[i])) <= tol) {
    cat("Root found:", round(x[i], 3), "\n")
  } else {
    cat("No root found for initial approximation:", round(x[i], 3), "\n")
  }
}
## Root found: -5.156 
## Root found: -0.369 
## Root found: -0.369 
## Root found: 0.525

In this case, we use initial approximations of -5, -2, 0, and 2, which we obtained from a graph of the function.

Therefore, the approximate roots of the function accurate to 3 decimal places are -5.156 , -0.369, -0.369 and 0.525.