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.
Currently, the behavior of
degree_complex
andhalfdegree
is inconsistent:degree_complex
lumps real variables and declared complex variables together, whilehalfdegree
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.