np.sqrt(a.dag()*a) ??

21 views
Skip to first unread message

mehrosadate...@gmail.com

unread,
May 15, 2016, 6:36:37 AM5/15/16
to QuTiP: Quantum Toolbox in Python
Hello,

I want to investigate a system that its Hamiltonian is in the form of
H=np.sqrt(4*np.pi*np.pi+4*(200*200*2*np.pi*2*np.pi*0.000001)*(a.dag()*a+0.5*sz+0.5)).
by writing this, I receive an error, and I do not know what should I do !
Can you please help me?

Regards
Mehrosadat

Andrew M. C. Dawes

unread,
May 15, 2016, 1:39:31 PM5/15/16
to qu...@googlegroups.com
You aren't giving us much info to work with. In general, it's good to include the specific error message. In this case, I suspect the issue is that np.sqrt doesn't know what to do with objects that are the Qobj type (like "a" and "a.dag()") because they are really matrices. There is a sqrtm() method in QuTiP that does what you want:

(a.dag()*a).sqrtm()

It may be helpful to look over the following as you are getting started with QuTiP:
most of the useful things you can do to operators are defined as QuTiP functions or methods.



--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mehrosadate...@gmail.com

unread,
May 16, 2016, 1:13:09 PM5/16/16
to QuTiP: Quantum Toolbox in Python
It was so good, and really helped me.
Thank you very much.

Regards
Mehrosadat
Reply all
Reply to author
Forward
0 new messages