# simulate

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/superconducting/simulate

```python
boulderopal.superconducting.simulate(transmons, cavities, interactions, gate_duration, sample_count=128, cutoff_frequency=None, initial_state=None)
```

Simulate a system composed of transmons and cavities.

This function builds a graph describing the Hamiltonian (see the note part for details) of a
superconducting system, and calls [`execute_graph`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/execute_graph.md#boulderopal.execute_graph) to simulate its dynamics.

### Parameters
* **transmons** (*list* *[*[*Transmon*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/superconducting/Transmon.md#boulderopal.superconducting.Transmon) *]*) – List of objects containing the physical information about the transmons.
  It must not contain any optimizable coefficients.
  It can be an empty list, but at least one transmon or cavity must be provided.
* **cavities** (*list* *[*[*Cavity*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/superconducting/Cavity.md#boulderopal.superconducting.Cavity) *]*) – List of objects containing the physical information about the cavities.
  They must not contain any optimizable coefficients.
  It can be an empty list, but at least one transmon or cavity must be provided.
* **interactions** (*list* *[*[*TransmonTransmonInteraction*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/superconducting/TransmonTransmonInteraction.md#boulderopal.superconducting.TransmonTransmonInteraction) *or* [*TransmonCavityInteraction*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/superconducting/TransmonCavityInteraction.md#boulderopal.superconducting.TransmonCavityInteraction) *or*             [*CavityCavityInteraction*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/superconducting/CavityCavityInteraction.md#boulderopal.superconducting.CavityCavityInteraction) *]*) – List of objects containing the physical information about the interactions in the system.
  They must not contain any optimizable coefficients.
  It can be an empty list.
* **gate_duration** (*float*) – The duration of the gate to be simulated, $t_\mathrm{gate}$.
  It must be greater than zero.
* **sample_count** (*int* *,* *optional*) – The number of times between 0 and gate_duration (included)
  at which the evolution is sampled.
  Defaults to 128.
* **cutoff_frequency** (*float* *or* *None* *,* *optional*) – The cutoff frequency of a linear sinc filter to be applied to the piecewise-constant
  signals you provide for the coefficients. If not provided, the signals are not filtered.
  If the signals are filtered, a larger sample count leads to a more accurate numerical
  integration. If the signals are not filtered, the sample count has no effect on the
  numerical precision of the integration.
* **initial_state** (*np.ndarray* *or* *None* *,* *optional*) – The initial state of the system, $|\Psi_\mathrm{initial}\rangle$, as a 1D array of
  length `D = np.prod([system.dimension for system in transmons + cavities])`.
  If not provided, the function only returns the system’s unitary time-evolution operators.
### Returns
The result of the execute_graph call.
Its `output` item is a dictionary containing information about
the evolution of the system, with the following keys:
> `sample_times`
> : The times at which the system’s evolution is sampled,
>   as an array of shape `(T,)`.

  > `unitaries`
  > : The system’s unitary time-evolution operators at each sample time,
  >   as an array of shape `(T, D, D)`.

  > `state_evolution`
  > : The time evolution of the initial state at each sample time,
  >   as an array of shape `(T, D)`.
  >   This is only returned if you provide an initial state.
### Return type
dict

### SEE ALSO
[`boulderopal.superconducting.optimize`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/superconducting/optimize.md#boulderopal.superconducting.optimize)
: Find optimal pulses or parameters for a system composed of transmons and cavities.

## Notes

The Hamiltonian of the system is of the form

$$
H = \sum_i H_{\mathrm{transmon}_i}
    + \sum_i H_{\mathrm{cavity}_i}
    + \sum_{i,j} H_{\mathrm{transmon}_i-\mathrm{transmon}_j}
    + \sum_{i,j} H_{\mathrm{transmon}_i-\mathrm{cavity}_j}
    + \sum_{i,j} H_{\mathrm{cavity}_i-\mathrm{cavity}_j}
$$

where i and j mark the i-th and j-th transmon or cavity.
For their definition of each Hamiltonian term, see its respective class.

The Hilbert space of the system is defined as the outer product of all the
transmon Hilbert spaces (in the order they’re provided in transmons) with
the cavity Hilbert spaces (in the order they’re provided in cavities), that is:

$$
\mathcal{H} =
    \mathcal{H}_{\mathrm{transmon}_1} \otimes \mathcal{H}_{\mathrm{transmon}_2}
    \otimes \ldots
    \otimes \mathcal{H}_{\mathrm{cavity}_1} \otimes \mathcal{H}_{\mathrm{cavity}_2}
    \otimes \ldots
$$

The system dimension D is then the product of all transmon and cavity dimensions.
