import numpy as np
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, Aer, IBMQ
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
from qiskit import *
# Loading your IBM Q account(s)
#provider = IBMQ.load_account()

q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)

qc.h(q[0])
qc.cx(q[0], q[1])

qc.draw('mpl')

sim = Aer.get_backend('statevector_simulator')
qobj = assemble(qc)
final_state = sim.run(qobj).result().get_statevector()

final_state

#BLOCH SPHERE
"""
THERE ARE 2 TYPES OF BLOCH SPHERE:- 
1. plot_bloch_multivector
2.plot_bloch_vector 
"""

plot_bloch_multivector(final_state, "Entanglement")

#FOR BLOCH_MULTIVECTOR YOU NEED A STATE
#FOR BLOCH_VECTOR YOU NEED COORDINATE POINTS

coords = [1, 1, 1]
plot_bloch_vector(coords, coord_type='cartesian')

#THERE IS ANOTHER COORD_TYPE THAT IS "SPHERICAL"
coords1 = [1, np.pi, np.pi]
plot_bloch_vector(coords1, coord_type='spherical')

