New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - Dirac Algebra #1635
base: master
Are you sure you want to change the base?
WIP - Dirac Algebra #1635
Conversation
By using the new rewrite rules framework I implement simplification routines for traces of matrices representing the Dirac algebra (concerning 4 spinors).
on the wiki page see directly http://en.wikipedia.org/wiki/Gamma_matrices#Identities |
It would be fantastic to have all of this! I think that everything in |
This would also enable you to easily handle the different representations of these operators. |
@ellisonbg, in most general terms I agree (there are details on which I do not, but those are for another discussion), but for the near future I will continue using the matrix module mostly because I know it better. In order to calm down any fears that it would be too hard to move this from |
It may also be that Don't get me wrong, I love seeing MatrixExprs be used by people and if you prefer them then go for it (I'd also love to see what you do with them). I'm just pointing out that if Brian is excited about this then maybe it's worth thinking about switching to the other side. |
Alas, there are two. |
That may make the switch harder than what I have expected, but at least for the WIP phase I will continue this way. Before ever suggesting a merge I will try to move this to quantum. Anyway, this pull request should never get bigger than 200-300 lines excluding comments Moving the discussion to another technical issue: @ellisonbg, do you have any ideas how to implement the Minkowski metric inside physics. For the moment I think about hardcoding the (-+++) convention in some Function subclass just like KroneckerDelta. However this is ugly. @mrocklin, it would be interesting to extend this to tensors in general, however I do not volunteer for the moment. Another issue: there are gamma^mu and gamma_mu matrices. Do you have any preferred interface for the UP and DOWN indices. |
Some day, when none of us have jobs, we will create the perfect tensor object on which we can all agree and from which we can all inherit....
Everything in MatrixExprs is effectively rank (1, 1). You can have a rank (1, 1) with 1 row or with 1 col. I haven't thought much about which I consider to be which. I suspect that you're probably better equipped to make that decision anyway. |
@Krastanov I just looked at your code and it will be extremely simple to convert this to use the quantum stuff add anti-commutators, etc. For the metric tensor I would just use the simplest thing for now - something like KroneckerDelta. It would be very fun and interesting to think about how to implement all of this using quantum stuff. We have some experience with the spin model handling sets of operators that have algebraic structure. Very interesting stuff and (as you are motivated towards) there is a huge potential for simplifying QFT calculations. |
Well, against my better judgment I started implementing a tensor object. I will provide a pr in a few days. One more thing: one of the rules that I use here is wrong. I will correct it later. |
@ellisonbg, at which classes should I look concerning the quantum module? Do I need to define a new Hilbert space for the 4-spinors before defining the gammas? |
@Krastanov I would start with You could implement From there I would look in One thing though - as we think about creating a solid tensor class, we really need to think carefully about how to do that, because the individual elements of the tensor in quantum mechanics are often operators. That makes things pretty weird. But to be useful we will have to handle that case well. |
SymPy Bot Summary: 🔴 Failed after merging Krastanov/diracalgebra (96e4342) into master (f860de8). |
This is an abuse of notation that I dislike. The compoments of the tensor are not operators, rather the tensor itself is not just Lorentz tensor or Dirac tensor but a tensor living on the product of these two spaces. However, the rewrite rules permit very nicely this abuse of notation, so it will be supported given how widespread it is. At least in the prototype. No updates to this PR yet. Probably during the weekend. |
SymPy Bot Summary: ❗ There were merge conflicts (could not merge Krastanov/diracalgebra (4b1ea97) into master (5d459d5)); could not test the branch. |
Regarding the simplification of contractions of the Gamma matrices, are you aware of this algorithm for the 4-dim case: http://jmp.aip.org/resource/1/jmapaq/v9/i10/p1732_s1?isAuthorized=no the paper does not cover the algorithmic complexity, but I guess it's almost linear over the number of gamma matrices in the expression. And this other one which works in any dimension: |
The code here is nothing fancy. It is just a few rewrite rules applied in succession. It is not optimized for speed in any way (I have not even bothered to think about complexity) because it is not meant for simplification of gigantic expression. So probably it is not something on par with algorithms worthy of a publication. On the other hand it is ridiculously short, simple and easy to extend. However this pull request is not the best way forward. We should "just" fix the issue with the tensor module, and get the rewrite-rules working for it. |
The article in the Kahane paper provides a really simple algorithm, which is very efficient. Have a look at it. |
Well, I think this package can be integrated with the tensor module. The only drawback is that soon valued tensors will become |
Could you send the articles on the mailing list? I am not currently at a campus with access to these publications. |
@Krastanov @Upabjojr @asmeurer Any plans for completing this PR? If no, then can we add this in ideas list for GSoC 2020? |
I would not be able to work on completing this myself, but if any student needs help with implementing it, I would be happy to advise. |
I would recommend using MatchPy for the Dirac algebra. MatchPy was not available a few years ago. It is closely compatible with Mathematica's pattern matcher, therefore allowing to easily translate Mathematica packages into SymPy. |
http://en.wikipedia.org/wiki/Gamma_matrices
Only the simple rules (rule) are implemented in this initial commit.
The new rewrite rules framework is awesome for stuff like this.
This will speed up my QFT homeworks by a factor of 100 when it is done.