1

Very simple. I define a Qutip state object

import qutip as qt
import numpy as np

state = qt.Qobj(1/2*np.array([np.sqrt(3),-1])) # This is my quantum state vector (normalized)

What I want is plotting this state in Bloch sphere, but if I just do:

b = qt.Bloch()
b.add_vectors(state)
b.show()

It gives me an error

IndexError: index 1 is out of bounds for axis 0 with size 1

I suppose this is due to the interpretation of my state as a normal 3D vector. So, there exists a simple way to go with this kind of plot?

Dani
  • 473
  • 3
  • 21

1 Answers1

1

You just need to change b.add_vectors(state) by b.add_states(state) because you're adding a state (a Qobj object) not a vector (coordinates on the x, y and z axis as a sequence).

See the the qutip documentation for more

TomiOck
  • 21
  • 4