import numpy as np
# Importing standard Qiskit libraries
from qiskit.quantum_info import Statevector
from qiskit import QuantumCircuit, transpile, Aer, IBMQ, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *

# Loading your IBM Quantum account(s)
provider = IBMQ.load_account()

## X-gate

# FILL IN YOUR CODE HERE
# Keep theta<=np.pi 

theta = np.pi 
phi = 0
lam = np.pi
#ex1_validation([theta, phi,lam])

## Z-gate

# FILL IN YOUR CODE HERE

theta = 0 
phi = np.pi
lam = 0
#ex2_validation([theta, phi,lam])

## Y-gate

# FILL IN YOUR CODE HERE

theta = np.pi 
phi = np.pi/2
lam = np.pi/2

#ex3_validation([theta, phi,lam])

## Hadamard 

# FILL IN YOUR CODE HERE

theta = np.pi/2
phi = 0
lam = np.pi

#ex4_validation([theta, phi, lam])

## Which rotation corresponds to the gate set H-Y-S-T ?

#Circuit:
qc=QuantumCircuit(1)
qc.h(0)
qc.y(0)
qc.s(0)
qc.t(0)

##FILL IN YOUR ANSWER HERE

theta = np.pi/2
phi = 7*np.pi/4
lam = np.pi


#Check the result with the u3 rotation gate (arbitrary single qubit rotations)
qc2=QuantumCircuit(1)
qc2.u3(theta,phi,lam,0)




#ex5_validation(qc2)

state = Statevector.from_instruction(qc)
plot_bloch_multivector(state)

state2 = Statevector.from_instruction(qc2)
plot_bloch_multivector(state2)



