[sage-support] Re: Asking whether a number is in QQ or not

2011-09-15 Thread Alex Lara
Thank you to all of you! On Sep 15, 12:59 pm, Simon King wrote: > PS: > > >    sage: cm.explain(QQ, b.parent()) > > I forgot to copy-and-paste the definition of "cm". It was: > >   sage: from sage.structure.element import get_coercion_model >   sage: cm = get_coercion_model() > > Cheers, > Simon

[sage-support] Re: Asking whether a number is in QQ or not

2011-09-15 Thread Simon King
PS: >sage: cm.explain(QQ, b.parent()) I forgot to copy-and-paste the definition of "cm". It was: sage: from sage.structure.element import get_coercion_model sage: cm = get_coercion_model() Cheers, Simon -- To post to this group, send email to sage-support@googlegroups.com To unsubscri

[sage-support] Re: Asking whether a number is in QQ or not

2011-09-15 Thread Simon King
Hi Volker, On 15 Sep., 11:45, Volker Braun wrote: > b in QQ is (or should be) equivalent to QQ(b) not throwing an error. No, that's incorrect. It should be (and is) equivalent to QQ(b)==b returning True. QQ(b) is just a conversion. You can convert any element of a finite prime field into QQ:

[sage-support] Re: Asking whether a number is in QQ or not

2011-09-15 Thread Volker Braun
b in QQ is (or should be) equivalent to QQ(b) not throwing an error. But if that fails, it only means that Sage can't convert it to a rational directly, it is perfectly possible that after a series of (computationally expensive) steps one could transform b into a rational. But if we would always