>> Does it make sense to move Commutator (currently defined in >> sympy/physics/secondquant) to a bit more general place (like >> sympy/physics)? >> >> And is current implementation also good enough for adding it an >> alternative LieBracket name?
The existing Commutator class in secondquant is being replaced by a new one that was developed by Mat Curry this summer. The issue is that all of the quantum classes now inherit from a new QExpr class that defines specialized logic and attributes that only the quantum stuff uses. This includes things like tracking Hilbert spaces and custom QMul, QAdd, QPow classes. It would be nice if the standard Mul, Add, Pow classes were general enough to handle these things, but for now that is not possible. Thus, for the foreseeable future, I don't think it will make sense. The reason we needed to create our own QMul, QAdd and QPow classes is that in quantum mechanics, there are some operations that are invalid (Operator + Ket for example) and Mul/Add/Pow don't have the ability to handle these types of things without putting lots of new code in there. In my opinion, we need to completely rethink how Mul/Add/Pow process, validate and transform arguments. In some ways, we are experimenting with this logic in QMul/QAdd/QPow. But this stuff is super subtle and difficult to get right. > Brian is now finishing/polishing the quantum stuff that was written > over the summer, so they might have moved things a bit. I think Brian > would know how to answer those questions. > > So I can only say that in general I think it's a good idea to start > some feature let's say in some sympy/physics/secondquant.py, then > improve it, see if it works well, and then eventually move it to some > more standard location, where more code (and people) can use it. Yes, I think this is a good plan, but it will take a while beore we are ready for that. As a side note, Commutator is no longer a Function. My understanding is that Functions are designed to be true "functions" in the take a bunch of numbers, return a number sense. A Commutator is much more like Mul, Add, Pow that have other Exprs as arguments. Cheers, Brian -- Brian E. Granger, Ph.D. Assistant Professor of Physics Cal Poly State University, San Luis Obispo bgran...@calpoly.edu elliso...@gmail.com -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.