Hi all, On 2015-07-13, Nathann Cohen <nathann.co...@gmail.com> wrote: >> PS Testing over QQbar certainly does give False, as it would for m*sqrt(1/2) >> and n for any pair of integers (m,n) not (0,0), since sqrt(2) is irrational! > > Wouldn't it be better to compare 'exact types' in an exact ring? Here > we compare two exact types in a non-exact field.
No, in this example we compare one exact type and one non-exact type! One of the arguments lives in the Symbolic Ring, which is not an exact ring: sage: SR Symbolic Ring sage: SR.is_exact() False By coercion, the comparison of the integer m1 with the symbolic expression m below is done after coercion to the symbolic ring: sage: cm = get_coercion_model() sage: m=540579833922455191419978421211010409605356811833049025*sqrt(1/2) sage: m1=382247666339265723780973363167714496025733124557617743 sage: cm.explain(m.parent(), m1.parent(), operator.eq) Coercion on right operand via Conversion map: From: Integer Ring To: Symbolic Ring Arithmetic performed after coercions. Result lives in Symbolic Ring Symbolic Ring So, if there is anything to fix then it is how the symbolic ring deals with exact algebraic data. Here, there is a natural interpretation of m as an element of QQbar. So, the symbolic ring *could* compare the symbolic data after pushing them to QQbar: sage: QQbar(m) == QQbar(m1) False However, I don't know if there is an easy way to teach the symbolic ring to do so. In other words: If one *can* avoid symbolic expressions, then one *should* avoid symbolic expressions. Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.