0

ket.draw() must give |00> as result but I get:

Statevector([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
               dims=(2, 2))

what can I change to get the desired result?

This is my code:

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

qc = QuantumCircuit(2)

# This calculates what the state vector of our qubits would be
# after passing through the circuit 'qc'
ket = Statevector(qc)

# The code below writes down the state vector.
# Since it's the last line in the cell, the cell will display it as output
ket.draw()
MSpiller
  • 3,500
  • 2
  • 12
  • 24
Maria
  • 1
  • 3

1 Answers1

0

You can pass the keyword argument output='latex' to the .draw method.

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

qc = QuantumCircuit(2)

# This calculates what the state vector of our qubits would be
# after passing through the circuit 'qc'
ket = Statevector(qc)

# The code below writes down the state vector.
# Since it's the last line in the cell, the cell will display it as output
ket.draw(output='latex')
Joooeey
  • 3,394
  • 1
  • 35
  • 49
Maria
  • 1
  • 3