ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 08 Sep 2019 15:32:52 -0500simplify not working correctly with conjugate?http://ask.sagemath.org/question/47791/simplify-not-working-correctly-with-conjugate/ In my notebook environment when I do this :
var('v','a')
t=(I*a/2)*(v-conjugate(v))
(t**3).expand()
It gives me the correct result. However when I do :
(t**3).expand().simplify()
The answer I get is zero. Is this a bug, or is there something I don't understand about the simplify function?
Additionally: Is there another, better way to simplify expressions with many conjugates?
Sun, 08 Sep 2019 11:55:07 -0500http://ask.sagemath.org/question/47791/simplify-not-working-correctly-with-conjugate/Answer by eric_g for <p>In my notebook environment when I do this :</p>
<pre><code>var('v','a')
t=(I*a/2)*(v-conjugate(v))
(t**3).expand()
</code></pre>
<p>It gives me the correct result. However when I do :</p>
<pre><code>(t**3).expand().simplify()
</code></pre>
<p>The answer I get is zero. Is this a bug, or is there something I don't understand about the simplify function?
Additionally: Is there another, better way to simplify expressions with many conjugates?</p>
http://ask.sagemath.org/question/47791/simplify-not-working-correctly-with-conjugate/?answer=47795#post-id-47795Well, it seems that when using `conjugate`, you have to specify that the involved symbolic variables are complex. Indeed one has
sage: (x - conjugate(x)).simplify()
0
sage: v = var('v')
sage: (v - conjugate(v)).simplify()
0
(I am a little bit puzzled by this, since I thought Sage's symbolic variables are assumed complex by default)
But
sage: v = var('v', domain='complex')
sage: (v - conjugate(v)).simplify()
v - conjugate(v)
and
sage: v = var('v')
sage: assume(v, 'complex')
sage: (v - conjugate(v)).simplify()
v - conjugate(v)
So, regarding your example, you have to use `var('a', 'v', domain='complex')` in the first line.Sun, 08 Sep 2019 14:52:19 -0500http://ask.sagemath.org/question/47791/simplify-not-working-correctly-with-conjugate/?answer=47795#post-id-47795Comment by Rutger for <p>Well, it seems that when using <code>conjugate</code>, you have to specify that the involved symbolic variables are complex. Indeed one has</p>
<pre><code>sage: (x - conjugate(x)).simplify()
0
sage: v = var('v')
sage: (v - conjugate(v)).simplify()
0
</code></pre>
<p>(I am a little bit puzzled by this, since I thought Sage's symbolic variables are assumed complex by default)</p>
<p>But</p>
<pre><code>sage: v = var('v', domain='complex')
sage: (v - conjugate(v)).simplify()
v - conjugate(v)
</code></pre>
<p>and</p>
<pre><code>sage: v = var('v')
sage: assume(v, 'complex')
sage: (v - conjugate(v)).simplify()
v - conjugate(v)
</code></pre>
<p>So, regarding your example, you have to use <code>var('a', 'v', domain='complex')</code> in the first line.</p>
http://ask.sagemath.org/question/47791/simplify-not-working-correctly-with-conjugate/?comment=47796#post-id-47796Great, Thanks a lot!Sun, 08 Sep 2019 15:32:52 -0500http://ask.sagemath.org/question/47791/simplify-not-working-correctly-with-conjugate/?comment=47796#post-id-47796