# Testing inequalities in sage

I wanted to show if: $$|a+b| \leq |a| + |b|$$

So I wrote this in sage:

var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)


The result is False.

I had expected the result to be True. What is the correct way to test this in sage?

Thank you in advance for any help provided.

edit retag close merge delete

Interesting, $bool(abs(a) >= a)$ is $True$, but $bool(abs(a+b) >= (a+b))$ is $False$. Weird.

( 2013-07-26 09:43:32 -0600 )edit

Also, assume(a<0,b>0) results in false too: http://pastebin.com/7Gg5xMA8

( 2013-07-26 10:00:46 -0600 )edit

If it can't be determined whether a relation holds, False will be returned.

( 2013-07-26 14:54:52 -0600 )edit

This is disturbing: $$assume(a, 'real')$$ $$assume(b, 'real')$$ $$bool(sqrt((a+b)^2) == sqrt(a^2) + sqrt(b^2))$$ is $$True$$ ????

( 2013-07-26 15:59:43 -0600 )edit

@eviatar-bach returning False in case can't be determined whether a relation holds seems to me unwise ; This should be changed to a tristate-answer, whatever the third state is

( 2013-07-27 13:49:32 -0600 )edit

Sort by ยป oldest newest most voted

As explained in this answer, there is currently no way for Sage to say "I do not know the result", hence the answer 'False', which means 'False or Unknown'.

EDIT See trac ticket 17700

more

2

but it should!

( 2013-07-31 13:31:28 -0600 )edit