Here is a prototype for the tricky part of the coercion (recursive base extension). It seems to catch all the examples I came up with. Please test, and add more examples if needed. I will be rewriting this in py
Note that this doesn't work for multivariate polynomials (the tests use recursive univariate polys), but it should work as soon as canonical coercions from ZZ[x] to ZZ[x,y] are implemented and ZZ[x,y].has_coerce_map_from(ZZ[x]) returns true. I've also got bin_op_c mostly worked out for add/sub/mul/div, this recursive base extend is a requirement, so I'll be having a patch soon. The patch essentially adds a step of trying recursive base extension in both directions, and use the result if exactly one of the two work. There is some other stuff with division as well (try "ZZ[x](x) / Mod(2,5)" to see what I mean), but I think I also have this sorted out. Best, Gonzalo --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---
bext.py
Description: Binary data