# quantum gates hamiltonian [closed]

How could we construct a circuit with quantum gates for desired time-dependent hamiltonian?

For example I think we can have 3 steps :

1. a simple hamiltonian :$$2\sigma_x+ 3 \sigma_z$$
2. a time dependent hamiltonian : $$2\sigma_x+ 3t \sigma_z$$
3. time dependent hamiltonian with dissipation

Is there a general solution ?

Given an initial state $$\vert \psi_0 \rangle$$ and a Hamiltonian $$H$$ for the system, the system evolves (in the non-relativistic limit) from time $$t_0$$ to $$t_1$$ by $$\vert \psi_1 \rangle = e^{-iH(t_1-t_0)}\vert \psi_0 \rangle = U_t \vert \psi_0 \rangle,$$ where $$H$$ is Hermitian resulting in $$U_{t}$$ being unitary. The time evolution described by this equation can be represented in a quantum circuit by preparing the state $$\vert \psi_0 \rangle$$ and then applying a $$U_{t}$$ gate.

Setting $$\vert \psi_0 \rangle = \vert 0 \rangle$$ and $$t = t_1-t_0$$ a quantum circuit representing the equation above is nothing more than For the Hamiltonian in your question, $$H=2 \sigma_x+3 \sigma_z$$, you can calculate $$U(t)$$ for any given $$t$$. For an easy example, consider $$t=\frac{\pi}{2\sqrt{13}}$$, $$U \left(\frac{\pi}{2\sqrt{13}} \right) = \begin{bmatrix} -\frac{3}{\sqrt{13}}i & -\frac{2}{\sqrt{13}}i \\-\frac{2}{\sqrt{13}}i & \frac{3}{\sqrt{13}}i \end{bmatrix}.$$

To actually run this on a quantum chip, we would need to decompose the general unitary transformation (the pseudo-gate $$U(t)$$) from the equations describing the system into some combination of transformations available in the set of available universal quantum gates (up to global phase).

If we wanted to perform the transformation above in IBM's environment (Qiskit), for example, the eigendecomposition is all we need. This is not generally true, but in this particularly simple example $$U$$ decomposes into two $$SO(2)$$ rotations and a $$Z$$ transformation. Define the rotation

$$R_y = \begin{bmatrix} \sqrt{\frac{1}{2}+\frac{3}{2 \sqrt{13}}} & -\sqrt{\frac{1}{2}-\frac{3}{2 \sqrt{13}}} \\ \sqrt{\frac{1}{2}-\frac{3}{2 \sqrt{13}}} & \sqrt{\frac{1}{2}+\frac{3}{2 \sqrt{13}}} \end{bmatrix},$$ then $$U \left(\frac{\pi}{2\sqrt{13}} \right) = -i R_y \sigma_z R_y^\dagger.$$ Noting that the leading $$-i$$ is a global phase factor and can be disregarded, we can turn this into actual Qiskit code to generate this transformation on actual IBM hardware.

qc=QuantumCircuit(1)
qc.ry(2*acos(sqrt(1/2+3/(2*sqrt(13)))),0)
qc.z(0)
qc.ry(-2*acos(sqrt(1/2+3/(2*sqrt(13)))),0) There are any number of other possible ways to implement this transformation in Qiskit, this is just one possible approach.