{"issue":{"user":{"id":681093,"login":"flacjacket","url":"https://api.github.com/users/flacjacket","avatar_url":"https://secure.gravatar.com/avatar/a899db0eec7bf28f68ca108ef91c1716?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"a899db0eec7bf28f68ca108ef91c1716"},"milestone":null,"title":"Arbitrary angular momentum coupling","created_at":"2011-12-16T05:33:26Z","labels":[],"updated_at":"2011-12-16T07:27:05Z","state":"open","id":2576545,"html_url":"https://github.com/sympy/sympy/issues/848","closed_at":null,"pull_request":{"patch_url":"https://github.com/sympy/sympy/pull/848.patch","html_url":"https://github.com/sympy/sympy/pull/848","diff_url":"https://github.com/sympy/sympy/pull/848.diff"},"body":"This pull is primarily finishing up the coupled spin states and the coupling/uncoupling between states. In addition to this, this pull includes Wigner6j and Wigner9j symbols (similar in implementation to Wigner3j and CG) and some minor fixes to the test_args for physics classes.\r\n\r\nWith the coupled states, the primary change in the handling of states is a jcoupling option that allows one to define the order in which states are coupled. I wasn't sure the best way to do this, as for coupling 2 spaces it is not necessary and having to pass an empty list for this case every time seemed bad, but I remember being told not to use default parameter values in __new__ methods, so this was the best I could come up with.\r\n\r\nThe couple and uncouple methods are re-done with the ability to handle an arbitrary number of spin spaces, in addition to adding parameters, like jcoupling, to define how the states are coupled in the case a normal state is used to uncouple or a specific coupling is desired for coupling a tensor product state. I try to describe the algorithm I use, but I'll explain it briefly, since it's not very apparent. Basically, it uses the fact for both coupling and uncoupling, there is some maximum value for some quantum number and the actual value it takes, and in the total number of couplings, the value drops from this maximum to the actual value. For example, when coupling a tensor product state, the maximum coupled j is j1+...+jn, but it attains some j<=j1+...jn; uncoupling has a similar case for m values. Then, the heart of the algorithm is this is treated as a n balls in m boxes to distribute the drop from the max value to the actual value, which is a simple combinatorial computation. Each of these cases is then iterated over.\r\n\r\nOf note with this is the _huge_ number of coupling and uncoupling tests implemented. I will note I only hand checked these calculations for a few (selectively chosen) cases, however, should any change arise, this will definitely trigger a failure, forcing a closer look. In generating the tests, I did run the script and check that all of the states are normalized, and they all are, which is very promising for how accurate the methods are.\r\n\r\nAny feedback would be greatly appreciated.","number":848,"url":"https://api.github.com/repos/sympy/sympy/issues/848","comments":3,"assignee":null},"comment":{"user":{"id":27600,"login":"ellisonbg","url":"https://api.github.com/users/ellisonbg","avatar_url":"https://secure.gravatar.com/avatar/cae6da8d1ad0014fe4ac1d1e5acec7a3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"cae6da8d1ad0014fe4ac1d1e5acec7a3"},"created_at":"2011-12-16T07:27:05Z","updated_at":"2011-12-16T07:27:05Z","id":3174296,"body":"The jcoupling argument is sequence of tuples.  Are you converting this to sympy's Tuple class before storing in self.args?  We need to make sure that the self.args of all classes contains only Tuples and not native python tuples.  Does this comment make sense?  @asmeurer does sympify do this automatically now?","url":"https://api.github.com/repos/sympy/sympy/issues/comments/3174296"},"action":"created"}