this is a little complicated. i spent 2 weeks on this, so i'd love ur input or suggestion how to figure it out or where to post.
in short, i have an expression that contains multiplications between p1,p2,q1 and q2, and i'd like to use [qi,pi]=ii*hb, where i={1,2} to get the expression to a symmetric form (pi^a*qi^b+qi^b*pi^a)/2.
so for example, for p2*q2*p2^2 i get (p2*q2^3+q2^3*p2)/2 + 1/2*ii*p2^2*hb using simplification and some replacements. but i cannot simplify q2*q1^2*p2 although i inputed a rule q2*p2-> (p2*q2+q2*p2)/2 +ii/2*hb and that variables with 1s and 2s commute.
in more detail,
here is the mathematica code (i use a package http://homepage.cem.itesm.mx/lgomez/quantum/): http://dl.dropbox.com/u/8916126/post.nb
the code works when the index is either 1 or 2 but doesn't work when both indexes are used: p2*q2*q1*q2 gives p2*q1*q2^2, p2*q2*q2 can further be simplified but since there is q1, mathematica doesn't do it.
in even more detail: in the end, i'm trying to write a mathematica code that can get equations in appendix (eq. A2) in this papaer: http://dl.dropbox.com/u/8916126/Prezhdo02_8704.pdf . and http://dl.dropbox.com/u/8916126/henonHeiles7.nb is the code that i'm using. the code in henonHeiles7.nb is a little different from post.nb because i couldn't get the post.nb to run as well but post.nb would be ideal.
in the end i'd like to use the final code for other kind of hamiltonians upto 4th power or even higher.
I understand that i might not be clear about this so let me know if i can articulate better.
also i'd love an advice how i can learn how to write a package that can do targeted simplifications for me.
thank you,
--Kirill