Here is a first go that uses the quantum stuff in sympy.physics.quantum

https://github.com/ellisonbg/sympy/commit/096da85aedc256203643a69b88e30e9ad3859683

I will add tests and the anticommutator equivalent and submit a pull
request soon.

Cheers,

Brian

On Thu, May 26, 2011 at 1:24 PM, Brian Granger <[email protected]> wrote:
> Rajeev,
>
> Hi, great question.  Just to understand the context.  What are x and
> y?  Are they a creation/annihilation operator pair?  As you may know,
> we have quite a bit of code in sympy.physics.quantum for handling
> various things from quantum mechanics in a symbolic manner, include
> commutation relationships.  One thing that we have is a
> commutator/anticommutator aware bubble sort algorithm that could
> probably be adapted to do what you want.
>
> But, before we dive into that can you say a bit more about what
> exactly you are trying to do?
>
> Thanks,
>
> Brian
>
> On Mon, May 23, 2011 at 9:55 PM, Rajeev Singh <[email protected]> wrote:
>> Hi,
>> I asked this question on sage mailing list already and it seems appropriate
>> to ask here as well. I wish to simplify some calculation that appear in
>> quantum mechanics. To begin we use non-commutative variables as -
>> sage: x, y = sympy.symbols('xy', commutative=False)
>> sage: sympy.expand((x+y)**3)
>> x**2*y + y**2*x + x*y**2 + y*x**2 + x**3 + y**3 + x*y*x + y*x*y
>> I want to impose the commutation relation [x,y]=1 and bring the expression
>> to normal form (i.e. in all terms y appears before x, e.g. x*y gets replaced
>> by y*x + 1). Is it possible to do this?
>> If not then can I get the expression such that x*y**2 appears as x*y*y?
>> Thanks in advance.
>> Regards,
>> Rajeev
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>
>
>
> --
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> [email protected] and [email protected]
>



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
[email protected] and [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to