Public Functions
double | poly_val( |
int | poly_fit( |
int | poly_fit_lagrange( |
double | poly_interp_lagrange( |
int | poly_fit_lagrange_barycentric( |
double | poly_val_lagrange_barycentric( |
int | poly_expandbinomial( |
int | poly_expandbinomial_pm( |
int | poly_expandroots( |
int | poly_expandroots2( |
int | poly_findroots( |
int | poly_findroots_durandkerner( |
int | poly_findroots_bairstow( |
int | poly_mul( |
Interfaces
double poly_val(
Evaluate polynomial _p at value _x
- _p : polynomial coefficients, shape: (_k, 1)
- _k : polynomial coefficients length
- _x : input to evaluate polynomial
int poly_fit(
Perform least-squares polynomial fit on data set
- _x : x-value sample set, shape: (_n, 1)
- _y : y-value sample set, shape: (_n, 1)
- _n : number of samples in _x and _y
- _p : polynomial coefficients output, shape: (_k, 1)
- _k : polynomial coefficients length
int poly_fit_lagrange(
Perform Lagrange polynomial exact fit on data set
- _x : x-value sample set, size [_n x 1]
- _y : y-value sample set, size [_n x 1]
- _n : number of samples in _x and _y
- _p : polynomial coefficients output, shape: (_n, 1)
double poly_interp_lagrange(
Perform Lagrange polynomial interpolation on data set without computing coefficients as an intermediate step.
- _x : x-value sample set, shape: (_n, 1)
- _y : y-value sample set, shape: (_n, 1)
- _n : number of samples in _x and _y
- _x0 : x-value to evaluate and compute interpolant
int poly_fit_lagrange_barycentric(
Compute Lagrange polynomial fit in the barycentric form.
- _x : x-value sample set, size [_n x 1]
- _n : number of samples in _x
- _w : barycentric weights normalized so _w [0]=1, size [_n x 1]
double poly_val_lagrange_barycentric(
Perform Lagrange polynomial interpolation using the barycentric form of the weights.
- _x : x-value sample set, shape: (_n, 1)
- _y : y-value sample set, shape: (_n, 1)
- _w : barycentric weights, shape: (_n, 1)
- _x0 : x-value to evaluate and compute interpolant
- _n : number of samples in _x, _y, and _w
int poly_expandbinomial(
Perform binomial expansion on the polynomial \( P_n(x) = (1+x)^n \) as \( P_n(x) = p[0] + p[1]x + p[2]x^2 + ... + p[n]x^n \) NOTE: _p has order n (coefficients has length n+1)
- _n : polynomial order
- _p : polynomial coefficients, shape: (_n+1, 1)
int poly_expandbinomial_pm(
Perform positive/negative binomial expansion on the polynomial \( P_n(x) = (1+x)^m (1-x)^k \) as \( P_n(x) = p[0] + p[1]x + p[2]x^2 + ... + p[n]x^n \) NOTE: _p has order n=m+k (array is length n+1)
- _m : number of '1+x' terms
- _k : number of '1-x' terms
- _p : polynomial coefficients, shape: (_m+_k+1, 1)
int poly_expandroots(
Perform root expansion on the polynomial \( P_n(x) = (x-r[0]) (x-r[1]) ... (x-r[n-1]) \) as \( P_n(x) = p[0] + p[1]x + ... + p[n]x^n \) where \( r[0],r[1],...,r[n-1]\) are the roots of \( P_n(x) \). NOTE: _p has order _n (array is length _n+1)
- _r : roots of polynomial, shape: (_n, 1)
- _n : number of roots in polynomial
- _p : polynomial coefficients, shape: (_n+1, 1)
int poly_expandroots2(
Perform root expansion on the polynomial \( P_n(x) = (xb[0]-a[0]) (xb[1]-a[1])...(xb[n-1]-a[n-1]) \) as \( P_n(x) = p[0] + p[1]x + ... + p[n]x^n \) NOTE: _p has order _n (array is length _n+1)
- _a : subtractant of polynomial rotos, shape: (_n, 1)
- _b : multiplicant of polynomial roots, shape: (_n, 1)
- _n : number of roots in polynomial
- _p : polynomial coefficients, shape: (_n+1, 1)
int poly_findroots(
Find the complex roots of a polynomial.
- _poly :
- _n :
- _roots : resulting complex roots, shape: (_k-1, 1)
int poly_findroots_durandkerner(
Find the complex roots of the polynomial using the Durand-Kerner method
- _p : polynomial coefficients, shape: (_n, 1)
- _k : polynomial length
- _roots : resulting complex roots, shape: (_k-1, 1)
int poly_findroots_bairstow(
Find the complex roots of the polynomial using Bairstow's method.
- _p : polynomial coefficients, shape: (_n, 1)
- _k : polynomial length
- _roots : resulting complex roots, shape: (_k-1, 1)
int poly_mul(
Expand the multiplication of two polynomials \( ( a[0] + a[1]x + a[2]x^2 + ...) (b[0] + b[1]x + b[]x^2 + ...) \) as \( c[0] + c[1]x + c[2]x^2 + ... + c[n]x^n \) where order(c) = order(a) + order(b) + 1 and therefore length(c) = length(a) + length(b) - 1
- _a : 1st polynomial coefficients (length is _order_a+1)
- _order_a : 1st polynomial order
- _b : 2nd polynomial coefficients (length is _order_b+1)
- _order_b : 2nd polynomial order
- _c : output polynomial, shape: (_order_a+_order_b+1, 1)