Interactive Calculator · Algorithms and Advantage

Trotter Error and Step Count Calculator

Choose a number of Trotter steps and see how the error of first-order and second-order product formulas shrinks, and how many steps and gates a target accuracy costs.

Intermediate
Presets

Total time for H = 0.7 X⊗X + 0.5 Z⊗I + 0.3 I⊗Z.

More steps give smaller error and more gates.

Operator-norm distance to the exact evolution.

First-order error

0.0288

About 0.460 ÷ r

Second-order error

5.35e-4

About 0.137 ÷ r²

Steps for target (first)

461

1,383 exponentials

Steps for target (second)

12

48 exponentials

How much cheaper is second order?

For the same target, the second-order formula needs about 28.81 times fewer exponentials. The gap grows as the target shrinks, because one error falls like 1/r and the other like 1/r².

First-order error ÷ second-order error

r = 13.36×
r = 26.72×
r = 413.45×
r = 826.90×
r = 1653.80×
r = 32107.6×
r = 64215.2×
r = 128430.4×

Measured table, t = 1 (my own NumPy experiment)

rFirst orderSecond order
10.49360.1475
20.23440.0349
40.11568.60e-3
80.05762.14e-3
160.02885.35e-4
320.01441.34e-4
647.19e-33.34e-5

Where the estimate is accurate

The slider results use the large-r limits, so they are close for r of about 8 or more and slightly off for r = 1 or 2 (see the measured table). For long evolution times, the second-order constant grows fast: at t = 4 it exceeds the first-order one, and many more steps are needed before the 1/r² behaviour takes over.

Explore how the accuracy of Trotter product formulas depends on the number of steps, the order of the formula and the evolution time, using measured errors from a two-qubit example.

What this calculator does

Simulating how a quantum system evolves in time is the oldest motivation for quantum computers. If the Hamiltonian H is a sum of pieces A + B + C that do not commute, you cannot implement e^(−iHt) by exponentiating each piece once, because the order matters. The Trotter method splits the time t into r small steps, and in each step applies the pieces one after another. The result approximates the true evolution, and the error shrinks as r grows.

This calculator shows the error of two formulas: the first-order (Lie–Trotter) formula and the second-order symmetric (Strang) formula. You choose the evolution time and the number of steps r, and you choose a target error. The tool reports the error at your step count, the number of steps each formula needs to reach the target, and the number of exponentials each needs. The exponential count is a rough proxy for circuit size, because each exponential becomes several gates.

The numbers come from my own NumPy experiment, not from a formula in a textbook. I took a two-qubit Hamiltonian H = 0.7 X⊗X + 0.5 Z⊗I + 0.3 I⊗Z, built the exact evolution with a matrix exponential, built both product formulas, and measured the operator-norm distance between them. Because the three terms do not commute, the product formulas are only approximate. I ran this at four evolution times and used the large-r behaviour to get a constant for each order.

How to use it

Leave the evolution time at t = 1 and the target error at 0.001. The first-order formula needs about 461 steps (1,383 exponentials, at three per step). The second-order formula needs 12 steps. If we count four exponentials per step after neighbouring half-steps are merged, that is 48 exponentials, so the second-order formula is about 29 times cheaper for the same accuracy.

Now tighten the target to 0.00001. The first-order formula needs about 46,030 steps, and the second-order formula needs about 118. The gap in cost grows to about 290 times. This is the quantitative reason practical simulation algorithms use higher-order formulas: the saving widens as accuracy demands rise.

Then switch the time to t = 4. The first-order constant grows from 0.46 to 1.89, but the second-order constant jumps from 0.14 to 3.78. For long evolutions, the second-order formula starts from a worse place, and you need many steps before its 1/r² behaviour takes over. The calculator shows both numbers so you can see where the crossover lies for each time.

How accurate is the estimate

The slider results use constants measured at large step counts, where the error follows c/r for the first order and c/r² for the second. At small r the real error is somewhat different. For example at t = 1 and r = 1, the measured first-order error is 0.4936, while the large-r constant gives 0.4603. The measured table at the bottom of the tool shows the actual values for t = 1 from r = 1 to 64. The earlier lesson on this site quotes the r = 1 numbers (0.4936 and 0.1475) as rough constants, so its step counts (494 and 13) differ slightly from the 461 and 12 you get here. Both are estimates from one small example.

Please keep in mind what the example shows and what it does not. The constants belong to this specific Hamiltonian. Other Hamiltonians have other constants, and the error bounds in the research literature for large systems are different in form, because they depend on the norms of nested commutators and the system size. I did not open those bounds for this page. Treat this tool as a way to see the scaling in a worked case.

Why gate counts matter

Every exponential compiles into entangling gates, and the circuit depth sets how much noise accumulates. A better product formula can matter as much as a better qubit, because it reaches the same accuracy with a shallower circuit. The exponential counts in this tool are a coarse measure. Real compilation depends on the hardware's native gates and on how terms can be grouped, and I did not model that.

The formulas behind it

First-order (Lie–Trotter) step

U₁(t/r) = e^(−iA t/r) · e^(−iB t/r) · e^(−iC t/r)

Repeated r times. Error falls roughly like 1/r.

Second-order (Strang) step

U₂(t/r) = e^(−iA t/2r) e^(−iB t/2r) e^(−iC t/r) e^(−iB t/2r) e^(−iA t/2r)

A symmetric product. Error falls roughly like 1/r².

Fitted errors

ε₁ ≈ c₁ ÷ r, ε₂ ≈ c₂ ÷ r²

Constants c₁ and c₂ come from my own experiment and depend on the Hamiltonian and on t.

Steps for a target

r₁ = ⌈ c₁ ÷ ε ⌉, r₂ = ⌈ √(c₂ ÷ ε) ⌉

Steps needed for target error ε.

Worked examples

Target error 0.001 at t = 1

  1. c₁ = 0.4603, so r₁ = ⌈460.3⌉ = 461 steps, with 3 exponentials per step: 1,383.
  2. c₂ = 0.1369, so r₂ = ⌈√136.9⌉ = 12 steps, with 4 exponentials per step after merging: 48.

ResultThe second-order formula uses about 29 times fewer exponentials.

Doubling the steps

  1. From the measured table: r = 8 gives 0.0576 (first order) and 0.00214 (second order).
  2. At r = 16 the errors are 0.0288 and 0.000535.

ResultFirst order halves (factor 2.0). Second order quarters (factor 4.0).

A long evolution

  1. At t = 4 the constants are c₁ = 1.889 and c₂ = 3.782.
  2. For target 0.001: r₁ = 1,889 and r₂ = 62.

ResultLonger evolutions cost far more steps, even with the better formula.

Frequently asked questions

Why does the error depend on the order of the terms?

Because the pieces of the Hamiltonian do not commute, so e^(A+B) differs from e^A e^B. The difference involves the commutator of A and B, and splitting time into smaller steps shrinks it.

Is second order always better?

Not for very few steps or long times, where its constant can be larger. For tight targets it wins by a wide margin.

Do these constants apply to any Hamiltonian?

No. They belong to the two-qubit example here. The scaling with r is general for these formulas, but the constants change.

Does this include hardware noise?

No. It measures only the mathematical error of the approximation. Noise adds to it, and more steps mean more gates and more noise.

References

  1. Lloyd, S. (1996). Universal quantum simulators. Science, 273, 1073-1078. (Cited from memory; I did not open it for this page.)
  2. Experiment data: my own NumPy calculation of operator-norm errors for H = 0.7 X⊗X + 0.5 Z⊗I + 0.3 I⊗Z at t = 0.5, 1, 2 and 4.

Keep exploring

These calculators use simplified, published models for education and planning. Real devices and systems differ, so treat results as estimates. They are not engineering, investment, legal, or security advice.