Learn R Programming

PolynomF (version 0.94)

solve.polynom: Find roots of polynomial equations

Description

Method functions for the solve generic function to find the roots of a single polynomial equation or the roots of a list of polynomial equations

Usage

# S3 method for polynom
solve(a, b, …)
# S3 method for polylist
solve(a, b, …)

Arguments

a

A polynom or polylist object

b

A polynom or scalar numeric object. The polynomial equation(s) to be solved is a - b = 0.

Not used.

Value

A vector of roots, or a list of such vectors.

Details

The roots of the equation will in general be complex. In the case of polylist the same equation, a - b = 0, is solved for all polynomials in the list. In this case the result is a list of root vectors.

References

None

Examples

Run this code
# NOT RUN {
x <- polynom()
H <- polylist(1, x)
for(n in 2:10)
    H[[n+1]] <- x * H[[n]] - (n-1)*H[[n-1]]
solve(H)
solve(deriv(H))

# }

Run the code above in your browser using DataLab