# (Unexpanded) symbolic inequalities yield erroneous results

I'm a SAGE novice, but have at least looked around this forum a bit on this matter. Apologies if this is a FAQ that I missed.

I am working with pretty simple symbolic expressions (type 'sage.symbolic.expression.Expression') involving rational numbers and some square roots. I have encountered several instances in which SAGE returns incorrect booleans when asking about inequalities between these things. For what it's worth, SAGE seems to get the answer right when I expand the expressions (simply by appending a .expand() to the end of them).

In particular, SAGE sometimes returns True when given "A < B" where A and B are symbolic expressions that are (not-obviously) equal. Here's an example that actually came up.

bool((1/8*sqrt(2)*(sqrt(2)*(sqrt(2) - 2) + 4*sqrt(2)) + 1/4*sqrt(2)*(sqrt(2) - 2) + 3/4*sqrt(2) - 1/2) < (1/8*sqrt(2)*(sqrt(2) + 2) + 1/4*sqrt(2) + 1/4))

SAGE returns True to this strict inequality. It also returns True when < is replaced by ==, as it should since these are equal. As mentioned, appending an .expand() to each side causes SAGE to return False to the strict inequality, which it should.

Any idea what's going wrong here?

edit retag close merge delete

In particular, if Sage can't verify something, it should return False - so that False is "not True", not a proved falsity.

For what it's worth, I appear to be running version 6.2. Someone has commented on the ticket kcrisman started that they cannot reproduce this on 6.9beta. I'll update and check.

Sort by » oldest newest most voted

This was fixed in one of the 6.8 betas so 6.8 or 6.9 should be fine.

more

It looks like I need to update, and probably should have done so first. That said, with something so basic going wrong, I just assumed that I was doing something wrong. Thanks!