import qiskit as qk
import qiskit_aer as qaer

import numpy as np
import math

sSimulator = qaer.Aer.backends(name="statevector_simulator")[0]
mSimulator = qaer.Aer.backends(name="qasm_simulator")[0]

qr = qk.QuantumRegister(1, name="qr")
qc = qk.QuantumCircuit(qr, name="qc")

qc.h(qr[0])

sSimulator.run(qc).result().get_statevector()

qc.draw("mpl")

qc.p(math.pi/4, qr[0])

sSimulator.run(qc).result().get_statevector()

qc.draw("mpl")

qr = qk.QuantumRegister(1, name="qr")
qc = qk.QuantumCircuit(qr, name="qc")

qc.rx(math.pi/2, qr[0])

sSimulator.run(qc).result().get_statevector()

qc.draw("mpl")

qr = qk.QuantumRegister(3, name="qr")
qc = qk.QuantumCircuit(qr, name="qc")

qc.h(qr[0])
qc.x(qr[1])
qc.id(qr[2])

qc.cswap(qr[0], qr[1], qr[2])

sSimulator.run(qc).result().get_statevector()

qc.draw("mpl")

