Hi Maite,

On May 3, 11:15 am, Maite Aranes <maite.al...@gmail.com> wrote:
> Does sage use symbolic calculus if it has to compare two symbolic
> expressions inside an "if" clause?

I don't know much about the symbolic part of Sage, but I think that
punch line is that the evaluation of a symbolic expression to a
boolean returns False if it is not guaranteed to be True. In your
case, I could imagine that the symbolic sqrt(...) does not choose one
particular root (could be positive or negative), and so
1/3*sqrt(2/5)==2/3*sqrt(1/10) is indeed not necessarily true.

But you can transform both sides of the equation into algebraic
numbers, and they do compare equal (since the positive square root is
picked):
  sage: QQbar(1/3*sqrt(2/5))==QQbar(2/3*sqrt(1/10))
  True
  sage: QQbar(1/3*sqrt(2/5))
  0.2108185106778920?

Best regards,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to