-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
forced coercion vs. automatic coercion #813
Comments
comment:3
I will work on this once Robert has added rdef'd functions to Sage (that way I don't have to redo the changes once this occurs) |
comment:5
This now gives a TypeError when doing the last arithmetic:
|
comment:6
I accidentally came accross this stone age ticket. For the record: Current behaviour as of sage-4.7.rc2 is
The question thus is: Should there be a coercion from P3 to the parent of f? Then one should implement it. Otherwise, the ticket should be closed as invalid. Let fP be the parent of f, hence, the polynomial ring in y over the fraction field of the polynomial ring in x over the rationals. There is a coercion to fP from the polyomial ring in y over the polynomial ring in x over the rationals:
However, there is no such coercion from the bivariate polynomial ring in x and y over the rationals:
I think there should be such coercion! What do you think? I guess I'll also ask sage-devel. |
comment:7
For the record: I did post on sage-algebra, not sage-devel. There, I argued that there should be no coercion/pushout between However, even in that case, I could imagine that with a little more effort one could modify the algorithm behind |
comment:8
Meanwhile I believe that this is not invalid. Namely, we have the following:
Hence, arithmetic between
What is the problem? The conversion is fine:
But in fact there is no coercion into the pushout:
That's a bug, I think. |
comment:9
PS: In addition, since there is a coercion from
|
comment:10
Here is my plan for implementing a coercion of Since conversion of P into Q works, we only need to make Let p be an element of P. When converting p into Q, the multivariate polynomial p is transformed into a univeriate polynomial via p. This is done using
That stacked ring coerces into Q:
Conclusion: If we want to test whether a multivariate polynomial ring P coerces into a univariate polynomial ring Q in variable y, then we need to try and transform P into a univariate polynomial ring P' in variable y; here, we have I already have a patch, but "surprisingly" the additional coercion yields some doctest errors in other places. |
comment:11
The problem with my approach is that it would create a bidirectional coercion, namely a coercion from But I think I have an idea that would solve the problem. My original idea was to have a coercion from P to Q if there is a coercion from My modified idea is to have the coercion from P to Q only if The tests in sage/rings/polynomial pass. I am now running all doc tests, and then I can hopefully submit my patch... |
Coercion from multivariate to univariate polynomial rings |
Author: Simon King |
comment:12
Attachment: trac813_univariate_coerce_from_multivariate.patch.gz I think I was able to solve the problem. With my patch applied on top of sage-4.7.1.rc1, all tests seem to pass, and one can do
In order to avoid bidirectional coercions (that would break a lot of tests), I have
The rule is: If |
Dependencies: #9944 |
comment:13
Any reviewer for a time-honoured ticket? |
comment:14
Looking at your patch, was |
comment:15
btw., doctests pass when applied to 4.7.2.alpha2. |
comment:17
Replying to @saraedum:
Good question. I think it was meant as analogy to the method |
comment:18
Ok. In this case it makes sense to have this method. I made some minor changes to the docstrings. Sorry, I created an extra attachment. Apply trac813_univariate_coerce_from_multivariate.patch, trac_813_review.2.patch. |
This comment has been minimized.
This comment has been minimized.
Reviewer: Julian Rueth |
comment:19
Apply trac813_univariate_coerce_from_multivariate.patch, trac_813_review.2.patch. |
comment:20
Apply trac813_univariate_coerce_from_multivariate.patch, trac_813_review.patch Sorry, struggling with the patchbot. |
This comment has been minimized.
This comment has been minimized.
Replying to @nbruin:
? The attachment comment of the second file says "ignore this file", and the "patch" is only 17 bytes in total... So I guess the description should be updated, to apply the "old" reviewer patch. |
comment:22
sure. sorry, only updated the patchbot instructions but not the ticket description. |
This comment has been minimized.
This comment has been minimized.
comment:24
Ok, I've deleted the 17 bytes... |
This comment has been minimized.
This comment has been minimized.
Merged: sage-4.7.2.alpha3 |
Attachment: trac_813_review.patch.gz small changes to docstrings |
This should give similar results, but it is inconsistent:
Apply
to the Sage library repository.
Depends on #9944
Component: coercion
Author: Simon King
Reviewer: Julian Rueth
Merged: sage-4.7.2.alpha3
Issue created by migration from https://trac.sagemath.org/ticket/813
The text was updated successfully, but these errors were encountered: