Quantum Computing, Quantum Physics, Programming, Physics, Science.
for i in range(len(new_arr)): if new_arr[i] == 'X': qc.h(new_qub[i]) elif new_arr[i] == 'Y': qc.unitary(h_y, [new_qub[i]], r'$H_y$') And finally, we write a small function that takes in a Hamiltonian H as its Trotter decomposition and simulates it in a given quantum circuit. def