Learn R Programming

pracma (version 1.8.8)

roots: Polynomial Roots

Description

Computes the roots of the polynomial p.

Usage

roots(p)

Arguments

p
vector of real numbers representing the polynomial

Value

  • a vector holding the roots of the polynomial

Details

For solution the function computes the eigenvalues of the companion matrix.

At the moment, only real coefficients are allowed.

See Also

polyroot

Examples

Run this code
roots(c(1, 0, 1, 0, 0))       # 0 0 1i -1i
  p <- Poly(c(-2, -1, 0, 1, 2))
  roots(p)

Run the code above in your browser using DataLab