R: Newton's Root Finding Method for Polynomials.

newtonHorner {pracma} | R Documentation

## Newton's Root Finding Method for Polynomials.

### Description

Finding roots of univariate polynomials.

### Usage

    newtonHorner(p, x0, maxiter = 50, tol = .Machine$double.eps^0.5)

### Arguments

`p` | Numeric vector representing a polynomial.
`x0` | starting value for newtonHorner().
`maxiter` | maximum number of iterations; default 100.
`tol` | absolute tolerance; default `eps^(1/2)`

### Details

Similar to `newtonRahson`, except that the computation of the derivative is done through the Horner scheme in parallel with computing the value of the polynomial. This makes the algorithm significantly faster.

### Value

Return a list with components `root`, `f.root`, the function value at the found root, `iter`, the number of iterations done, and `root`, and the estimated precision `estim.prec`

The estimated precision is given as the difference to the last solution before stop.

### References

Quarteroni, A., R. Sacco, and F. Saleri (2007). Numerical Mathematics. Second Edition, Springer-Verlag, Berlin Heidelberg.

### See Also

`newtonRaphson`

### Examples

    ##  Example: x^3 - 6 x^2 + 11 x - 6  with roots 1, 2, 3
    p <- c(1, -6, 11, -6)
    x0 <- 0
    while (length(p) > 1) {
        N <- newtonHorner(p, x0)
        if (!is.null(N$root)) {
            cat("x0 =", N$root, "\n")
            p <- N$deflate
        } else {
            break
        }
    }
    ##  Try: p <- Poly(c(1:20))

[Package pracma version 2.0.4 Index]