ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 31 Jul 2013 20:31:28 +0200Testing inequalities in sagehttps://ask.sagemath.org/question/10388/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.Fri, 26 Jul 2013 08:22:04 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/Comment by ensaba for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17224#post-id-17224Since there is enough information to determine the truth value of the triangle inequality, should I file a big report?Sun, 28 Jul 2013 23:13:39 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17224#post-id-17224Comment by rickhg12hs for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17223#post-id-17223Perhaps this will get more attention if you post it to the Google Group sage-support. If you do, put a link to this AskSage post so they can read the discussion. https://groups.google.com/forum/m/#!forum/sage-supportMon, 29 Jul 2013 00:22:13 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17223#post-id-17223Comment by Eviatar Bach for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17222#post-id-17222jack77, I agree. This is something I've thought about changing. You can see an old discussion at https://groups.google.com/forum/#!topic/sage-devel/vNxnHSeRBW4. I think reopening the issue on sage-devel is a good idea.Mon, 29 Jul 2013 02:58:06 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17222#post-id-17222Comment by rickhg12hs for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17234#post-id-17234This is disturbing: $$assume(a, 'real')$$ $$assume(b, 'real')$$ $$bool(sqrt((a+b)^2) == sqrt(a^2) + sqrt(b^2))$$ is $$True$$ ????Fri, 26 Jul 2013 22:59:43 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17234#post-id-17234Comment by Eviatar Bach for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17235#post-id-17235If it can't be determined whether a relation holds, `False` will be returned.Fri, 26 Jul 2013 21:54:52 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17235#post-id-17235Comment by ensaba for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17236#post-id-17236Also, assume(a<0,b>0) results in false too: http://pastebin.com/7Gg5xMA8Fri, 26 Jul 2013 17:00:46 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17236#post-id-17236Comment by rickhg12hs for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17237#post-id-17237Interesting, $bool(abs(a) >= a)$ is $True$, but $bool(abs(a+b) >= (a+b))$ is $False$. Weird.Fri, 26 Jul 2013 16:43:32 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17237#post-id-17237Comment by jack77 for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17230#post-id-17230@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 Sat, 27 Jul 2013 20:49:32 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17230#post-id-17230Answer by tmonteil for <p>I wanted to show if:
$$ |a+b| \leq |a| + |b|$$</p>
<p>So I wrote this in sage:</p>
<pre><code>var('a','b')
eqn1=abs(a+b)
eqn2=abs(a)+abs(b)
bool(eqn1<=eqn2)
</code></pre>
<p>The result is False.</p>
<p>I had expected the result to be True. What is the correct way to test this in sage?</p>
<p>Thank you in advance for any help provided.</p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?answer=15289#post-id-15289As explained in [this answer](http://ask.sagemath.org/question/2641/compare-symbolic-expressions?answer=3636#3636), 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](https://trac.sagemath.org/ticket/17700)Wed, 31 Jul 2013 10:43:47 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?answer=15289#post-id-15289Comment by jack77 for <p>As explained in <a href="http://ask.sagemath.org/question/2641/compare-symbolic-expressions?answer=3636#3636">this answer</a>, there is currently no way for Sage to say "I do not know the result", hence the answer 'False', which means 'False or Unknown'.</p>
<p><strong>EDIT</strong> See <a href="https://trac.sagemath.org/ticket/17700">trac ticket 17700</a></p>
https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17209#post-id-17209but it should! Wed, 31 Jul 2013 20:31:28 +0200https://ask.sagemath.org/question/10388/testing-inequalities-in-sage/?comment=17209#post-id-17209