-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluating tropical polynomials at QQFieldElem
gives promotion error
#4014
Comments
A naive attempt to fix this by manually adding a
gives the expected multiplication
but tropical polynomials are still not evaluated correctly, so I suppose I miss something about how tropical polynomials work in Oscar:
|
I guess the question is what function needs to exist so that conversion from |
I assume one would have to add promotion rules for |
Concretely, if one adds
then the multiplication of a
which I suppose is wrong. This is the "fault" of |
There is working exponentiation for tropical numbers (which is just normal multiplication, as tropical multiplication is normal addition):
Is there a way to make evaluate convert the input point to the coefficient ring of the polynomial before doing any arithmetic with it? |
We could tinker with
The same problem already exists on |
I think evaluate and tropical addition / multiplication are two seperate issues. I believe changing evaluate to conversion first makes sense. It is natural to assume that conversion commutes with arithmetic, i.e., it is a homomorphism, but that need not be the case. As for forbidding operations with tropical and rational numbers because it is not associative, I am strongly against it. I'm open to having a warning (as long as it can be disabled) and a rule that such code shouldn't make it into production, but having to write |
You can overload All the code for commutative rings assumes that the commutative ring has a one element and that |
@YueRen can you confirm that the polynomials we want are the same as implemented here: https://github.com/sagemath/sage/pull/38536/files#diff-fe963133a558d88dbe26710f804ba7682f40f80e7e35b3999543fe13423b8862? |
Yeah, the examples looks about right. Thought that implementation comes with many functions that I wouldn't consider absolutely necessary. Highest priority would be that the type plays well with existing functions. |
My point would be that they disallow |
Ah, I didn't see that. I'm against disallowing |
Suppose we form a simple tropical polynomial in the following way:
If we try to evaluate it at x=4, we get the expected answer 10 if 4 is entered as a an
Int
orRational{Int64}
, but we get a promotion error when it is aQQFieldElem
.The issue seems to be that
*(x::TropicalSemiringElem{typeof(min)}, y::QQFieldElem)
doesn't work, but I haven't been able to figure out if the best way to fix it is to add a new version of*
. It's also not clear to me why this isn't caught by any of the promotion/parent strategies in NCRings.jl.The text was updated successfully, but these errors were encountered: