Ask Your Question

(Unexpanded) symbolic inequalities yield erroneous results

asked 2015-08-20 18:39:48 +0200

DrNick gravatar image

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 flag offensive close merge delete


No ideas off hand, but I've reported this as

kcrisman gravatar imagekcrisman ( 2015-08-20 19:12:43 +0200 )edit

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

kcrisman gravatar imagekcrisman ( 2015-08-20 19:13:17 +0200 )edit

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.

DrNick gravatar imageDrNick ( 2015-08-21 02:26:41 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-21 08:28:29 +0200

rws gravatar image

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

edit flag offensive delete link 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!

DrNick gravatar imageDrNick ( 2015-08-21 20:32:15 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-08-20 18:39:48 +0200

Seen: 335 times

Last updated: Aug 20 '15