Ask Your Question

Testing inequalities in sage

asked 2013-07-26 01:22:04 -0500

ensaba gravatar image

updated 2017-04-19 17:55:27 -0500

tmonteil gravatar image

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

So I wrote this in sage:


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


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

rickhg12hs gravatar imagerickhg12hs ( 2013-07-26 09:43:32 -0500 )edit

Also, assume(a<0,b>0) results in false too:

ensaba gravatar imageensaba ( 2013-07-26 10:00:46 -0500 )edit

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

Eviatar Bach gravatar imageEviatar Bach ( 2013-07-26 14:54:52 -0500 )edit

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

rickhg12hs gravatar imagerickhg12hs ( 2013-07-26 15:59:43 -0500 )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

jack77 gravatar imagejack77 ( 2013-07-27 13:49:32 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-31 03:43:47 -0500

tmonteil gravatar image

updated 2017-04-19 17:54:59 -0500

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

edit flag offensive delete link more



but it should!

jack77 gravatar imagejack77 ( 2013-07-31 13:31:28 -0500 )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



Asked: 2013-07-26 01:22:04 -0500

Seen: 302 times

Last updated: Apr 19