Chapter 4, Exercises 4.1, problem 5

Use 5 iterations of Newton’s Method with the given initial approximation to approximate the root. Compare it to the known value of the root.

\(f(x) = x^{2} + x - 2, x_{0} = 0\)

x = 0
x_start = x
while (abs(x - x_start) < 0.0000000001) {
   x <- x - (x^2 + x - 2) / (2*x + 1)
}
print(x)
## [1] 2