Hi Julien, I agree that in this case the product of each of the separate parts is not what we expect for the representation, and I also agree on what you think the expected result should be. The current represent is written to simply return the product of the representations of A and B, but I think was written with discrete bases in mind (i.e. representations that were matrices). Maybe Brian can comment?
I do have a followup question, then. If the expected output for represent(x_op*x_ket) is the x_ket*DiracDelta(x_ket-x_dummy), then what should the output of just represent(x_op) be? Should it in fact be the same, since when we ask for the representation of an operator in a given basis what we're really computing is something like <x' | X | x>? On Mon, Jun 6, 2011 at 5:55 PM, Julien Rioux <[email protected]> wrote: > On Jun 6, 6:12 pm, Tomo Lazovich <[email protected]> wrote: > > Hi everyone, > > > Hi, > > > I've been working on representations of operators and kets in the > position > > and momentum bases. So far, from what I can tell, the desired behavior is > to > > return something like DiracDelta(x_1-x_2) for a representation of |x_1> > > (position ket), and something like x_1*DiracDelta(x_1-x_2) for the > > representation of the X operator (position operator). > > > > My question, then, is what should the representation of a full expression > > look like. Lets say we execute the following lines: > > > > >> x_ket = XKet() > > >> x_op = XOp() > > >> represent(x_op*x_ket, basis=XOp()) > > > > With the current behavior (well, once that desired behavior is fully > > implemented), it would return > > > > >> x_1*DiracDelta(x_1-x_2)**2 > > > > because it simply returns the representations of each QExpr individually, > so > > we get two delta functions out. > > > > Is this what we actually expect the output of representing an expression > > like that to be? > > No that's not what's expected. Whatever the representation of A and B > are, the representation of A*B is definitely not equal to the product > of the representations of A and of B. > > In your case the x_op*x_ket is just a new ket, call it psi_ket. The > representation of psi_ket in the position basis would be <x_dummy| > psi_ket>. So that's what I would expect to get in general. Whether it > should reduce to something simple is a different story. You need to do > some more manipulation to get <x_dummy|psi_ket> in terms of the > representations of x_op and x_ket themselves. If you do it you get > x_ket*DiracDelta(x_ket-x_dummy). You can look up the manipulation in a > quantum mechanics text. It involves inserting a resolution of unity > between x_op and x_ket and evaluating the integral over position, > which is trivial in this case because of the delta function. > > > Comments are greatly appreciated! Thanks > > > > Tomo > > Cheers, > Julien > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > -- Tomo Lazovich Harvard College '11 278 Winthrop House Mail Center Cambridge, MA 02138 -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
