poly: Polynomial with specified roots

View source: R/poly.R

polyR Documentation

Polynomial with specified roots

Description

Compute the coefficients of a polynomial when the roots are given, or the characteristic polynomial of a matrix.

Usage

poly(x)

Arguments

x

Real or complex vector, or square matrix.

Details

If a vector is passed as an argument, then poly(x) is a vector of the coefficients of the polynomial whose roots are the elements of x.

If an N x N square matrix is given, poly(x) is the row vector of the coefficients of det (z * diag (N) - x), which is the characteristic polynomial of x.

Value

A vector of the coefficients of the polynomial in order from highest to lowest polynomial power.

Author(s)

Kurt Hornik.
Conversion to R by Tom Short,
adapted by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com

See Also

roots

Examples

p <- poly(c(1, -1))
p <- poly(pracma::roots(1:3))
p <- poly(matrix(1:9, 3, 3))


gsignal documentation built on Sept. 12, 2024, 6:27 a.m.