%matplotlib inline
%config InlineBackend.figure_format = 'svg'
from IPython.display import clear_output

from qiskit import QuantumCircuit

circuit = QuantumCircuit(1)
circuit.u3(f"$\\theta$",f"$\\phi$",f"$\\lambda$", 0)
circuit.draw('mpl')

from numpy import pi

circuit = QuantumCircuit(1)
circuit.u3(2*pi/3, pi/2, 0, 0)
circuit.draw('mpl')

from qiskit import execute, Aer
from qiskit.visualization import plot_bloch_multivector

backend = Aer.get_backend("statevector_simulator")
job = execute(circuit,backend=backend)
statevector = job.result().get_statevector()
print(statevector)
plot_bloch_multivector(statevector)

from qiskit.visualization import plot_histogram

results = execute(circuit,backend).result().get_counts()
plot_histogram(results, color='midnightblue')

# initial circuit
from qiskit import QuantumCircuit
from numpy import pi

circuit = QuantumCircuit(2)
circuit.h(0)
circuit.x(1)

circuit.draw('mpl')

# transformed circuit
circuit.cu3(0,3*pi/2, 0, 0, 1)
circuit.draw('mpl')

from qiskit import execute, Aer
from qiskit.visualization import plot_bloch_multivector

backend = Aer.get_backend("statevector_simulator")
job = execute(circuit,backend=backend)
statevector = job.result().get_statevector()
print(statevector)
plot_bloch_multivector(statevector)

from qiskit.visualization import plot_state_qsphere
from qiskit.quantum_info import Statevector

sv = Statevector.from_label('00').evolve(circuit)
plot_state_qsphere(sv.data, show_state_phases=True)

circuit2 = QuantumCircuit(2)
circuit2.h(0)
circuit2.x(1)
circuit2.cu3(0, 0, 3*pi/2, 0, 1)

circuit2.draw('mpl')

job = execute(circuit2,backend=backend)
statevector = job.result().get_statevector()
print(statevector)
plot_bloch_multivector(statevector)

circuit3 = QuantumCircuit(2)
circuit3.h(0)
circuit3.x(1)
circuit3.cu3(0, pi, pi/2, 0, 1)

circuit3.draw('mpl')

job = execute(circuit3,backend=backend)
statevector = job.result().get_statevector()
print(statevector)
plot_bloch_multivector(statevector)

circuit4 = QuantumCircuit(2)
circuit4.h(0)
circuit4.x(1)
circuit4.cu3(0, pi/2, pi, 0, 1)

circuit4.draw('mpl')

job = execute(circuit4,backend=backend)
statevector = job.result().get_statevector()
print(statevector)
plot_bloch_multivector(statevector)

import qiskit
qiskit.__qiskit_version__