sqrt and conjugate are not commuting!!!!

51 views
Skip to first unread message

Titas Chanda

unread,
Sep 3, 2015, 12:12:27 PM9/3/15
to sympy

####  I have already posted it on github.   #######



Hi,


sympy sqrt and conjuagte are not commuting for symbols....




import sympy as sm
a = sm.Symbol('a')
sm.sqrt(sm.conjugate(a)) == sm.conjugate(sm.sqrt(a))
False



They are not even cancelling each other....


Thanks....

Ondřej Čertík

unread,
Sep 8, 2015, 4:36:13 PM9/8/15
to sympy
On Thu, Sep 3, 2015 at 8:41 AM, Titas Chanda <titas....@gmail.com> wrote:
> #### I have already posted it on github. #######

Please post a link, so that people don't need to search for it.

>
>
>
> Hi,
>
>
> sympy sqrt and conjuagte are not commuting for symbols....
>
>
>
>
> import sympy as sm
> a = sm.Symbol('a')
> sm.sqrt(sm.conjugate(a)) == sm.conjugate(sm.sqrt(a))
> False
>
>
>
> They are not even cancelling each other....

That's because they are not equal to each other. Just try some numbers:

In [1]: from cmath import sqrt

In [2]: a = -1

In [3]: sqrt(a.conjugate())
Out[3]: 1j

In [4]: sqrt(a).conjugate()
Out[4]: -1j

If you want to understand why, I have thorough notes here:

http://www.theoretical-physics.net/dev/math/complex.html

Let me know if you have any questions.

Ondrej

>
>
> Thanks....
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/4f16f8f3-c32e-4d00-989c-e914a2923793%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ondřej Čertík

unread,
Sep 9, 2015, 4:05:22 PM9/9/15
to sympy
On Tue, Sep 8, 2015 at 2:36 PM, Ondřej Čertík <ondrej...@gmail.com> wrote:
> On Thu, Sep 3, 2015 at 8:41 AM, Titas Chanda <titas....@gmail.com> wrote:
>> #### I have already posted it on github. #######
>
> Please post a link, so that people don't need to search for it.
>
>>
>>
>>
>> Hi,
>>
>>
>> sympy sqrt and conjuagte are not commuting for symbols....
>>
>>
>>
>>
>> import sympy as sm
>> a = sm.Symbol('a')
>> sm.sqrt(sm.conjugate(a)) == sm.conjugate(sm.sqrt(a))
>> False
>>
>>
>>
>> They are not even cancelling each other....
>
> That's because they are not equal to each other. Just try some numbers:
>
> In [1]: from cmath import sqrt
>
> In [2]: a = -1
>
> In [3]: sqrt(a.conjugate())
> Out[3]: 1j
>
> In [4]: sqrt(a).conjugate()
> Out[4]: -1j
>
> If you want to understand why, I have thorough notes here:
>
> http://www.theoretical-physics.net/dev/math/complex.html
>
> Let me know if you have any questions.

I've added your example into this section:

http://www.theoretical-physics.net/dev/math/complex.html#id1

As you can see, there is an extra minus factor when "a" is on the
negative real axis (like -1, -2, ...).

Ondrej
Reply all
Reply to author
Forward
0 new messages