2

I try to define a bra of a ket using qutip. A bra is a row vector and a ket is a column vector. A bra can be defined as a ket conjugate transpose. However, if I specify a bra directly using this definition in qutip a warning always raised, and the bra vector is failed to be formed.

Here's my code:

import qutip
from math import sqrt
import numpy as np

#probability amplitude of two dice rolled 12 times
probability_amplitudes = np.array(
    [[1/6],
    [sqrt(2)/6],
    [sqrt(3)/6],
    [2/6],
    [sqrt(5)/6],
    [sqrt(6)/6],
    [sqrt(5)/6],
    [2/6],
    [sqrt(3)/6],
    [sqrt(2)/6],
    [1/6],
    ])

#ket is column vector
ket_psi = qutip.Qobj(probability_amplitudes)

#bra is conjugate transpose of ket so, it's a row vectorA
row_vector = probability_amplitudes.transpose
bra_psi = qutip.Qobj(row_vector).conj()

print(ket_psi)
print(bra_psi)

And Here's my output: enter image description here

My question is, Why this happen? and what is the best practice to specify a bra from a specified ket in qutip?

Willy satrio nugroho
  • 908
  • 1
  • 16
  • 27

1 Answers1

0

It turnouts that I forget to specify the NumPy array transpose as a method. Adding "()" behind transpose has solved this. I'm sorry to post such an annoying question but it takes 3 hours to realize this.

Here's my result after adding "()".

enter image description here

But I still want to learn the best practice to specify a bra in qutip so, this question still open to anyone who tries to answer. I'm open to any suggestion that leads to an improvement. Thank You

Willy satrio nugroho
  • 908
  • 1
  • 16
  • 27