JuliaAlgebra / MultivariatePolynomials.jl

Multivariate polynomials interface
https://juliaalgebra.github.io/MultivariatePolynomials.jl/stable/
Other
134 stars 27 forks source link

Fix degree_complex #292

Closed projekter closed 3 months ago

projekter commented 4 months ago

Currently, the behavior of degree_complex and halfdegree is inconsistent: degree_complex lumps real variables and declared complex variables together, while halfdegree counts them separately. I would say that the second variant makes much more sense. This PR makes the behavior consistent: the complex degree is the sum of the degree of the real variables plus the maximum of the degrees of the declared complex vs. conjugated variables. Additionally, the methods contained some assertion-related checks; but they are not really assertions as it is perfectly valid for the user to define a monomial that contains both the variable and its real and imaginary parts individually. But for the purpose of complex degrees, this does not make sense, so we forbid it explicitly.

projekter commented 4 months ago

Good point, added some examples.