On Friday, February 5, 2016 at 3:29:29 PM UTC-6, Jeroen Demeyer wrote: > > On 2016-02-05 19:59, William Stein wrote: > > Maybe is_prime for field elements should just raise an exception? > > This reminds me very much about the recent discussion we had about floor > division... and which didn't really come to a conclusion. > > It's really the same problem: you have something which makes > mathematical sense but only in a way that people usually don't use it: > If you're working with elements of a field, you normally won't call > is_prime (even though that's well-defined) or do floor division (even > though a field is trivially an Euclidean domain). > > Everything goes well until you have something like 4 / 2 somewhere in your code. For a casual user, you're unknowingly getting your result in QQ, and you have surprising behavior for is_prime as per the OP. So I don't think raising an error is a good approach. Also I think the current behavior makes the most sense. Another option I see is when the base ring is a fraction field construction, try to coerce it to the base ring, and if it succeeds, run is_prime() on that.
Best, Travis -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.