Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

horner.poly

Evaluate Polynomial and Rational Functions using Horner's method


Description

Calculate

Usage

horner.poly(x, P)

horner.rational(x, P, Q)

Arguments

x

a vector

P

the coefficients of the polynomial in the numerator, in increasing order

Q

the coefficients of the polynomial in the denominator

Details

y = (P_1 + P_2*x + P_3*x^2 + ... ) / ( Q_1 + Q_2*x + Q_3*x^2 + ...)

If the coefficients have zeros as highest powers, those are ignored.

Value

a vector

Author(s)

References

Examples

P <- c(1,-2,1)
horner.poly(polyroot(P), P)

stackoverflow

Stack Overflow's Greatest Hits

v0.7.0
CC BY-SA 4.0
Authors
Neal Fultz <nfultz@gmail.com> and the StackOverflow.com community
Initial release
2020-01-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.