Closed GoogleCodeExporter closed 8 years ago
Hi
Thanks for your feedback, you have a very good point. In an earlier version of
qutip we used the analytical formula to generate, but we changed to using the
displacement operator for exactly the reason you point out (it guarantees unit
normalization). But this is not well described in the documentation, and that
should definitely be fixed. Also, it might be a good idea to have an optional
flag to the coherent function that selects which method to use, because in some
cases one might care more about having as accurate coefficient for small photon
numbers than normalization. I'll look into adding this and adjusting the
documentation accordingly.
The matplotlib software is really amazing and in my opinion it produces
graphics of much better quality than matlab, so I think when you get used to it
that alone will keep you away from matlab forever :-) My advice would be to
dive directly into the object-oriented API for matplotlib (and avoiding matlab
combability functions), then you exposed to a really powerful and flexible
plotting API.
The Wigner function implementation in qutip is basically a port of the same
function in the quantum optics toolbox for matlab to python/scipy.
Original comment by jrjohans...@gmail.com
on 20 Aug 2012 at 1:47
Thank you for your nice comments!
I think the main issue here is the representation of a coherent state, which is
naturally defined in the infinite Hilbert space of a harmonic oscillator (HO),
in a truncated Hilbert space. Since we are using the Fock basis in QuTiP, the
displacement operator is naturally defined by exponentiating the linear
combination of raising a lowering operators. As such, the coherent state,
defined as a displaced vacuum state, should be generated in this way. Of
course, this will not be identical to the probabilities obtained from the
analytic formula over the entire HO Hilbert space. We could just use the
analytic values, but then we run into an inconsistency where the displacement
operator gives a different coherent state than the builtin function.
Furthermore, if you want a valid state vector, you would need to normalize the
truncated coherent state that would lead to differences with the analytic
formula as well. If you didn't normalize, then I would expect many things to
give erroneous results.
Plotting the probability distribution over the number states shows that the
results are quite similar for all the cases considered here. Of course the
more states considered the better.
-Paul
Original comment by nonhermitian
on 20 Aug 2012 at 2:35
Attachments:
Thanks for the response guys!
I suppose that in either the analytical expression (after normalization) or the
displacement version in QuTiP, you have errors when truncating the Fock space.
I don't know which is preferable, but I know in practice that I truncate to
pretty low N to speed things up and look for interesting behavior, then crank
up Fock basis when I want to verify and get more accuracy.
EIther way, I think that putting the code up at code.google.com is a great
idea, especially for users like me to ask dumb questions!
Original comment by riotnr...@gmail.com
on 20 Aug 2012 at 4:08
After Robert added the analytic formula to QuTiP I ran the coherent(5,1.0)
function vs. the new coherent(5,1.0,"analytic) and found that, at least for the
number operator expectation value, the analytic way is in fact worse than the
displacement operator method, 0.981 vs 0.997, respectively.
However, my main complaint with using this method is that it breaks logical
consistency in the program. Given the fundamental assumption of a truncated
Hilbert space, one can built up all of the operators assuming this alone. This
consistency is broken when we start to say that one particular function should
be calculated in a different manner. We now run into the issue where
constructing the coherent state from the basic operator definition is no longer
equal to the convenience function coherent(). Assuming an infinite Hilbert
space, normalizing, and then truncating and renormalizing again seems wrong to
me. Sadly, after this discussion came up, I realized that I did the same thing
for the thermal state. I used the infinite state probabilities rather than
using the truncated operator method. I think I will change this to make it
more consistent.
That being said, if people really want to use the analytical values in the
truncated space, then having that available in QuTiP will be done.
Original comment by nonhermitian
on 21 Aug 2012 at 3:07
Original comment by nonhermitian
on 21 Aug 2012 at 3:08
I agree that in most cases it is more useful to use the displacement method so
that the state is normalized and a "real quantum state" in the truncated
Hilbert space, but I can also see use-cases for the analytic formulas. For
example, one might want to do the following:
>> coherent(5, 1.0, 'analytic').norm()
0.9981683992055931
to see how suitable the truncation to 5 Fock states is when one want to
describe a coherent state with alpha=1.0. At least I don't think it hurts to
have the option there (as non-default).
Original comment by jrjohans...@gmail.com
on 21 Aug 2012 at 3:27
Original comment by nonhermitian
on 5 Sep 2012 at 1:58
Original issue reported on code.google.com by
riotnr...@gmail.com
on 19 Aug 2012 at 8:17