Polynomials
MultiCheb and MultiPower wrap a coefficient tensor so a polynomial can be handed to solve directly, instead of being approximated from a callable.
YRoots.MultiCheb — Type
MultiCheb(coeff; clean_zeros=true)A polynomial in the Chebyshev basis, wrapping its coefficient array so it can be passed straight to solve instead of being approximated from a callable.
coeff[i, j, ...] is the coefficient of T_(i-1)(x) * T_(j-1)(y) * ..., where T_n is the Chebyshev polynomial of the first kind, so coeff[1, 1] is the constant term. The number of axes is the number of variables, available afterwards as the dim field.
clean_zeros=true trims trailing all-zero slices, so a padded array does not inflate the reported degree. Pass false to keep the array's shape as given.
Examples
julia> p = MultiCheb([0.0, 0.0, 1.0]); # T2(x) = 2x^2 - 1
julia> eval_MultiCheb(p, [0.5])
-0.5
julia> q = MultiCheb([1.0 0.0; 0.0 2.0]); # 1 + 2*T1(x)*T1(y)
julia> eval_MultiCheb(q, [0.5, 0.3])
1.3YRoots.MultiPower — Type
MultiPower(coeff; clean_zeros=true)A polynomial in the power basis, wrapping its coefficient array so it can be passed straight to solve instead of being approximated from a callable.
coeff[i, j, ...] is the coefficient of x^(i-1) * y^(j-1) * ..., so coeff[1, 1] is the constant term. The number of axes is the number of variables, available afterwards as the dim field.
clean_zeros=true trims trailing all-zero slices, so a padded array does not inflate the reported degree. Pass false to keep the array's shape as given.
Examples
julia> p = MultiPower([1.0 0.0; 2.0 3.0]); # 1 + 2x + 3xy
julia> p.dim
2
julia> eval_MultiPower(p, [0.5, 0.3])
2.45YRoots.eval_MultiCheb — Function
eval_MultiCheb(multiCheb, points)Evaluate a MultiCheb at one point or at many.
points is either a single point as a length-dim vector, or a dim x npoints matrix whose columns are the points. A single point returns a scalar; several return a vector of values, one per column.
Examples
julia> p = MultiCheb([0.0, 0.0, 1.0]); # T2(x) = 2x^2 - 1
julia> eval_MultiCheb(p, [0.5])
-0.5
julia> eval_MultiCheb(p, [0.5 0.1])
2-element Vector{Float64}:
-0.5
-0.98YRoots.eval_MultiPower — Function
eval_MultiPower(multiPower, points)Evaluate a MultiPower at one point or at many.
points is either a single point as a length-dim vector, or a dim x npoints matrix whose columns are the points. A single point returns a scalar; several return one value per column.
Examples
julia> p = MultiPower([1.0 0.0; 2.0 3.0]); # 1 + 2x + 3xy
julia> eval_MultiPower(p, [0.5, 0.3])
2.45