Closed NAThompson closed 5 months ago
Thanks for the comment. At one time Polynomial(::OffsetVector)
created a LaurentPolynomial
but that was removed. Now you would use that constructor directly:
julia> LaurentPolynomial(c)
┌ Warning: Using the axis offset of the coefficient vector ...
LaurentPolynomial(1.0 + 2.0*x + 3.0*x²)
This allows for other value dependent offsets:
julia> c = OffsetArray([1,2,3], -1:1);
julia> LaurentPolynomial(c)
┌ Warning: Using the axis offset of the coefficient vector...
LaurentPolynomial(x⁻¹ + 2 + 3*x)
For this c
, Polynomial(c)
would be incorrect.
The LaurentPolynomial
usage should be identical to that of a Polynomial
, though a shade less performant, should that matter.
Wouldn't documentation be strongly preferable to warnings?
I was surprised we had a warning for the Laurent cases. For the Polynomial case I'd suggest the warning is warranted, as the default is an unexpected ignoring of the offset. Let me adjust the Laurent case.
It feels natural to have polynomial coefficients zero-indexed, rather than 1-indexed. However, when I do this, I receive the following warning:
Code to reproduce:
Low priority as it would appear that numerical evaluation is nonetheless correct.