[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

[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 vbraun.n...@gmail.com 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

[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 unsubscribe

[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 simon.k...@uni-jena.de 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()