# Trotterizing a Pauli sum in Qiskit

In Qiskit, how do I construct a circuit corresponding to the Trotter expansion of a Pauli sum $$A+B+C+\ldots$$ given as a WightedPauliSum object?

\operatorname{e}^{A + B + C + \ldots } \overset{?}{\mapsto} \left\{\begin{alignedat}{9} U &= \operatorname{e}^{A}\operatorname{e}^{B}\operatorname{e}^{C}\ldots \ &&, \quad &&\text{(first order)}\\ U &= \operatorname{e}^{A/2}\operatorname{e}^{B/2}\operatorname{e}^{C/2}\ldots\operatorname{e}^{C/2}\operatorname{e}^{B/2}\operatorname{e}^{A/2} \ &&, \quad &&\text{(second order)}\\ & \ldots \end{alignedat}\right. I guess, PauliTrotterEvolution should do the job, but I have not found a tutorial.

Looks like this works:

qc_trotter = paulistring.evolve( evo_time = 1,
expansion_order = 2)


where qc_trotter is an object of type WeightedPauliOperator, see here.

Be mindful though that using circuits generated in this way may sometimes result in errors, as reported here.

• Please add some details, for example link to used function documentation etc. – Martin Vesely Jun 11 at 9:27