2014-03-14 14:24 UTC+01:00, mmarco <[email protected]>: > > >> >> >> This is half good, I am happy that RLF wraps symbolic constants. But, >> first of all there can not be any reasonable coercion from SR to RLF >> as SR is much bigger. Secondly, SR is not consistent with evaluation >> >> sage: cos(1.).parent() >> Real Field with 53 bits of precision >> sage: cos(1).parent() >> Symbolic Ring >> >> > I don't see much problem: 1. is a floating point number, and hence an > inexact element. So it makes sense to compute is cosine as an inexact > number too. > On the other hand, 1 is an exact element, so it makes sense to keep its > cosine as an exact number.
I agree with you but it is a real number not any symbolic expression. If you read my previous post "1.2 * pi" behaves badly because it should be coerced into RR and not kept into SR (coercion should be from more precision to less precision). This is the reason why I do not want to keep symbolic constants into the symbolic ring. Am I wrong ? >> I would prefer the second parent to be something like >> RealSymbolicField or RealNumbers or whatever but not symbolic ring. >> >> Thirdly, I would like to be able to compare real numbers built from >> different sources : >> - algebraic numbers (built from QQbar and NumberField) >> - symbolic constants >> - continued fractions >> - binary expansions >> - ... >> >> But currently: >> >> sage: R.<X> = QQ[] >> sage: K.<a> = NumberField(X^4 - 5*X^2 + 5, embedding=1.17) >> sage: RLF(a) >> 1.75570504584947? >> sage: expr = 2 * cos(3*pi/10) >> sage: RLF(expr) >> 1.17557050458946? >> sage: RLF(a) == RLF(expr) # does not work in RLF >> False >> sage: bool(SR(a) == SR(expr)) # does not work in SR >> False >> >> Even if they are equal as real numbers. So what is broken : comparison >> in SR? comparison in RLF? >> >> > IIRC it is not known if that problem is decidable or not. That is, in > practice, comparison in SR or RLF will always be "broken". It could be > improved, but there will always be cases where the computer can not > determine if two expressions are equal or not. Any number cos(rational x pi) is algebraic and equality of algebraic numbers is decidable. Moreover, it is not because something is undecidable that Sage should return a wrong answer. In that case, it would be good to have a third party in comparison (either returning Unknown or raising exception). -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
