Hi everyone, Since finishing up my GSoC project, I've put in a bit of time to finish some of the project up, namely, extending the coupling of spin spaces to an arbitrary number of spaces (I only finished the coupling of 2 spaces during the project run). The working branch is here [0]. I have what I think is a working implementation, I still need to implement tests before I'm willing to say for sure it works, and some of the functions are pretty messy. Nevertheless, I figured I'd get some input on the changes, especially the syntax for defining these couplings, before I started polishing it up.
To make sure everyone is on the same page, I'll outline what exactly I'm trying to do. With anyone with experience with coupled spin states will know, when you define a coupled state, you must not only define the quantum numbers of the state, but also the angular momentum numbers of the states that are being coupled together. Currently, in the master, the additional j-values are added as options when creating the state, e.g. |1,1,j1=1/2,j2=1/2> is given by JzCoupledKet(1,1,1/2,1/2). For coupling two spaces, this coupling is trivial, but for more than two spaces, the order in which the spaces are coupled matters. For example, if you have a j1, j2 and j3, you can couple j1 and j2 to j12, then j12 and j3 to j, which is different from coupling j1 and j3 to j13 then j13 and j2 to j. Defining this order is what I'm working to define in the current states. The current implementation changes the __new__ method to take not only the jvals list as before, but also has an option to define a jcoupling parameter. This parameter is an array of lists, the lists being length 3. For these inner lists, the first and second parameters give the j values of the states to be coupled and the third parameter gives the angular momentum j-value of the coupled space, so if you were to couple j1 and j2 to j12, the corresponding list element would be (1,2,j12). Thus, if one wanted to define a coupled spin state, coupling 3 spaces and coupling j1 and j2 to j12, i.e. |j,m,j1,j2,(j12),j3>, in would be defined as JzCoupledKet(j,m,(j1,j2,j3),jcoupling=((1,2,j12),)). If jcoupling isn't defined, it currently defaults to coupling j1 and j2 to j12, then j12 and j3 to j123, etc, where j1...n=j1+...+jn. Note that jcoupling must have n-2 couplings defined for coupling n spaces, as the last coupling is made implicitly to the final j value of the state, so to couple 4 spaces, would need 2 couplings defined, e.g. jcoupling=((1,2,j12),(3,4,j34)). To anyone who plays with it, if you want to couple a space that is already coupled, for example coupling some j34 to another spin space, you must use the smallest value, in this example 3, to define which space is being coupled in the jcoupling parameter. While this implementation allows for full generality in defining spin states, it seems to me to be quite messy. If anyone has any suggestions or would be willing to look at some of the code, I'd greatly appreciate it. If anything isn't clear or something isn't working right, please let me know. Thanks to anyone for any feedback on this, Sean [0] https://github.com/flacjacket/sympy/tree/multi_coupled -- 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 sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.