Hello all, I am looking for a quick and short way to implement computations with the Virasoro algebra in sympy. What i want to achieve is pretty basic: i want to define symbolic noncommutative objects L(n), where n is an integer, and have sympy handle products of L(n)'s as follows:
* On two-terms products L(n)L(m): * if n<=m, do nothing * otherwise, replace L(n)L(m) by L(m)L(n) + [L(n),L(m)] where [ ] is the commutator of the Virasoro operators (expressed as another L operator plus possibly another term) * On products L(n)L(m)...L(p): recursively apply the two-terms rule, so that n, m, .. p are in increasing order So i started by subclassing Basic and ArithMeths in an L class, with is_commutative=False. Now i'm stuck the the definition of the product rule. I guess this should happen somewhere in Mul.flatten, but what is the proper way of doing it? Subclassing Mul to define my own multiplication? How can then i couple it to the L objects? Another thing i have thought about would be representing the product of L objects as a Basic object itself, with its own rules, but i'm not too sure about it. How would you guys do it? Thanks in advance Tom --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---