ratRoot | R Documentation |
.
ratRoot(Anum, Adenom = rep(1,times=length(Anum)) )
Anum |
A vector of the polynomial coefficients' numerators, starting with the highest power. Values can be numeric or bigz. |
Adenom |
A vector of the polynomial coefficients' denominators, starting with the highest power. Values can be numeric or bigz. Default is all ones, indicating that all input coefficients are integers. |
The code makes use of the 'Rational Root Theorem,' which states that all real, rational roots p/q meet two criteria. Given a polynomial of the form An *x^n + A_(n-1) * x^(n-1) + ... + A0 = 0
, all coefficients adjusted to be integers, 'p' must be a factor of the zero-power polynomial coefficient A0, and 'q' must be a factor of the maximum-power polynomial coefficient An.
If any of the input Adenom
are not '1', the function will make this adjustment.
A vector of bigq
fractions representing all real rational roots found. If empty, all roots are irrational (or perhaps complex).
Carl Witthoft, carl@witthoft.com
https://en.wikipedia.org/wiki/Rational_root_theorem
ratRoot(c(6, -15, 261), c(1,1,49))
ratRoot(c(1,0,0,0,-1))
ratRoot(c(1,-2,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.