Polynomials
- Newton's Method
- Horner's Method
- Appendix
Newton's Method (Root Finding)Starting with a value of x close to the root, Repeat until |
Horner's Method (Evaluation)Express Evaluated in |
Rational Root Theorem (Root Finding)If the roots for a polynomial Therefore trying all combinations of these numbers will produce all rational roots for a polynomial. |
Newton-Horner Method (Root Finding)Newton's Method can be used in tandem with Horner's method with the following steps:
|
Ruffini's Rule (Polynomial Division)Any polynomial where Example $\begin{aligned} p(x)&=x^5-8x^4-72x^3+382x^2+727x-2310\ &=q(2)(x-2) + p(2)\ &=(0+1)x^4+(12-8)x^3+(-62-72)x^2+(-842+382)x\ &\ \ + (2142+727) + 0\ &=(x^4-6x^3-84x^2+214x+1155)(x-2) + 0 \end{aligned}$ This can be used to "deflate" a polynomial (eliminate a root) Furthermore, since: $\begin{aligned} p'(x)&=\frac{d}{dx}(q(x)(x-a) + p(a))\ &=q(x)(x-a)' + q'(x)(x-a)\ &=q(x) + q'(x)(x-a) \end{aligned}$ We have: $\begin{aligned} p'(a)&=q(a) + q'(a)(a-a)\ &=q(a) \end{aligned}$ In other words, this can also be used to evaluate the derivative of a polynomial without the power rule and can be used together with the Newton-Horner method.
|
Polynomial Expansion (Brute Force)
/*
/ deg represents the degree of the polynomial
/ Assume s[] is 1-based and stores all (sorted) roots
*/
int deg, p;
const int N = 110;
ll s[N], dp[2][N];
ll expand_polynomial() {
memset(dp[0], 0, sizeof(dp[p]));
dp[0][1] = 1; p =1;
for (int i=1;i<=deg;i++, p^=1) {
memset(dp[p], 0, sizeof(dp[p]));
for (int j=i;j>=0;j--)
dp[p][j+1] += dp[p^1][j+1]*s[i] + dp[p^1][j];
}
return p^1;
}