Hi, > I would like to know what is the agreed upon way to treat spin 1/2 systems > in physics.quantum? > > I would like to write a shorthand class for those states (a subclass of > J?Ket maybe), but: > - If it is just a subclass what stops me from writing my_spin_state.j = > "something different than 1/2" (maybe I can write a setter that sends and > error on such requests)?
I think that j is a read only property, so you couldn't do that. But, you could modify the args (which has j and mj in it). But the general approach in sympy and python is..."sure you could, but don't" > - More generally - is subclassing from J?Ket the right solution here? I think so. > - What about any type of two state systems that are not necessarily spin > states. Should a special class be created for those? Probably so. We already have done this in sympy.physics.quantum.qubit. But in the long run, we may want to implement a set of base classes for two state systems. > On a similar topic - I started tinkering with that code because I needed > nice printing for those states. That led to this pull request: > https://github.com/sympy/sympy/pull/186. I think it is ready, but I am not > aware if in your project is considered impolite to poke developers for a > review, that is why I have not raised a question about it. Should I poke you > in the future ;) ? It is not impolite and it is on my list of things to get done soon. Cheers, Brian > Regards > Stefan > > -- > 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. > -- Brian E. Granger Cal Poly State University, San Luis Obispo bgran...@calpoly.edu and 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 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.