Hi, I checked out TimeDepState and I believe that I got it now and I will use it for the spins over the weekend.
Stefan On 31 March 2011 18:15, Brian Granger <elliso...@gmail.com> wrote: > Hi, > > > In short: label is used by the printing functions but also it is used > > instead of args in some other functions > > Yes, that is the case. The difference between label and args is > deliberate and important: > > * label == set of things that determine which state you have == > quantum numbers usually. This does not include things like time and > other parameters. > * args == label + time + .... > > In many cases, label == args, but not in general (see TimeDepKet). > > > I'm trying to make the printing in physics.quantum.spin less ambiguous. > > According to the answer I received here > > http://groups.google.com/group/sympy/msg/3f8d4fe139b1884a it will be > useful > > to add subscript (or something else) to the printed expression. Here is > the > > problem: label is used by the printing functions but also it is used > instead > > of args in some other functions. > > This is as it should be. > > > The printing functions for J?Ket are derived all from KetBase which uses > > function derived from StateBase which uses function derived from QExpr. > > > > My understanding is that the self.args of QExpr should be a list (tuple) > of > > the quantum numbers and other useful sympy symbols that define the > > mathematical object and label should be a list (tuple) of things that > must > > be printed to screen. So we have the JzKet(1/2,1/2) with args (1/2,1/2) > and > > label (1/2,1/2) being printed as |1/2,1/2>. The problems are: > > Again, args also has the time, which is not in label. > > > - Some parts of the code use label instead of args to get the quantum > > numbers (j and m in J?Ket). So I can not have the label ("z",1/2,1/2). I > > believe that a stricter distinction should be made. > > - less important and of topic The separator "," for the label must be > > the same for every separation (but can be different from ket to ket). So > if > > I want a better label like |z:1/2,1/2> I can't do it. > > > > As it stands (at least for the spin part) QExpr defines label as property > in > > the function "return self.args" and then the code uses label instead of > > args. I believe it is a bug to use label in this manner because I can not > > override it to have nicer printing. The default for label is ok: just > print > > all quantum numbers. But for the spin for example I would like to have > other > > info printed. > > > > So am I wrong in proposing: > > - Fixing the code where label is used instead of args. > > - Adding a prefix/title/something field to the label so I can have > > |usefull_info : q_number_1, q_number_2, ...> printed to screen. That will > > make the base printing functions more complicated but it will not change > the > > rest of the code. Maybe creating a QuantumLabel class would be useful. > > > > also: All the code in quantum that deals with printing (inner product's > > printer for example) supposes that the rightmost char in the string of > Ket > > will be >. So subscripts are out of the question if they are in the form > > |foo,bar>_subscript. That is not a problem. I am just noting this > assumption > > that does not seem documented. > > You can do what you want be overriding the various _print_contents > methods. I would check out how TimeDepState in state.py handles this. > I think that will answer your questions. > > 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.