-
Notifications
You must be signed in to change notification settings - Fork 0
math.PolyReal
Christian d'Heureuse edited this page Jun 6, 2026
·
1 revision
dsp-collection / math/PolyReal
Utility routines for real polynomials and fractions of real polynomials.
Polynomial coefficients are stored in arrays ordered in ascending powers.
The associated polynomial has the form:
a[0] + a[1] * x + a[2] * x^2 + ... + a[n-1] * x^(n-1) + a[n] * x^n
An empty array is not allowed. The real number zero ist represented by [0].
For rational algebraic fractions, the coefficients are stored in nested arrays:
[top, bottom]
The associated rational fraction has the form:
( top[0] + top[1] * x + top[2] * x^2 + ... top[n-1] * x^(n-1) + top[n] * x^n ) /
( bottom[0] + bottom[1] * x + bottom[2] * x^2 + ... bottom[m-1] * x^(m-1) + bottom[m] * x^m )
| Function | Description |
|---|---|
| add | Adds two real polynomials. |
| addFractions | Adds two fractions. |
| compareEqual | Returns true if two polynomials are equal. |
| divide | Divides two real polynomials. Returns [quotient, remainder] = [a1 / a2, a1 % a2]. |
| evaluateComplex | Evaluates a real polynomial with a complex argument. |
| evaluateFractionComplex | Evaluates a rational fraction with a complex argument. |
| evaluateReal | Evaluates a real polynomial with a real argument. |
| expand | Computes the coefficients of a polynomial from it's real zeros. |
| gcd | Returns the monic GCD (greatest common divisor) of two polynomials. |
| multiply | Multiplies two real polynomials. |
| multiplyFractions | Multiplies two fractions. |
| normalizeFraction | Normalizes the coefficients of a rational fraction so that the denominator polynomial is monic. |