# new_quadratic_sequence

Source: https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/new_quadratic_sequence

```python
qctrlopencontrols.new_quadratic_sequence(duration, inner_offset_count, outer_offset_count, pre_post_rotation=False, name=None)
```

Creates the quadratic sequence.

### Parameters
* **duration** (*float*) – The total duration of the sequence $\tau$ (in seconds).
* **inner_offset_count** (*int*) – Number of inner $Z_{\pi}$ pulses $n_1$.
* **outer_offset_count** (*int*) – Number of outer $X_{\pi}$ pulses $n_2$.
* **pre_post_rotation** (*bool* *,* *optional*) – If `True`, a $X_{\pi/2}$ rotation is added at the
  start and end of the sequence. Defaults to `False`.
* **name** (*string* *,* *optional*) – Name of the sequence. Defaults to `None`.
### Returns
The quadratic sequence.
### Return type
[DynamicDecouplingSequence](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DynamicDecouplingSequence.md#qctrlopencontrols.DynamicDecouplingSequence)

### SEE ALSO
[`new_uhrig_sequence`](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/new_uhrig_sequence.md#qctrlopencontrols.new_uhrig_sequence)

## Notes

The quadratic sequence <sup>[1](#id2)</sup> is parameterized by duration $\tau$, number of inner offsets
$n_1$, and number of outer offsets $n_2$. The outer sequence consists of
$n_2$ pulses of type $X_{\pi}$, which partition the time-domain into $n_2+1$
sub-intervals on which inner sequences consisting of $n_1$ pulses of type
$Z_{\pi}$ are nested. The total number of offsets is $n = n_1 + n_2(n_1 + 1)$.

The pulse times for outer sequence $(X_{\pi}^1, \cdots, X_{\pi}^{n_2})$ are defined
according to the Uhrig sequence for $t \in [0, \tau]$. The $j$-th
$X_{\pi}$ pulse, therefore has timing offset defined by

$$
t_x^j = \tau \sin^2 \left[ \frac{j \pi}{2(n_2 + 1)}  \right] \;,
$$

where $j = 1, \cdots, n_2$. On each sub-interval defined by the outer sequence,
an inner sequence $(Z_{\pi}^1, \cdots, Z_{\pi}^{n_1})$ is implemented. The pulse times
for the inner sequences are also defined according to the Uhrig sequence. The $k$-th
pulse of the $j$-th inner sequence has timing offset defined by

$$
t_z(k, j) = (t_x^j - t_x^{j - 1}) \sin^2 \left[ \frac{k \pi} {2 (n_1 + 1)} \right]
            + t_{x}^{j - 1} \;,
$$

where $k = 1, \cdots, n_1$ and $j = 1, \cdots, n_2 + 1$.

## References

* <a id='id2'>**[1]**</a> [J. R. West, B. H. Fong, and D. A. Lidar, Physical Review Letters 104, 130501 (2010).](https://doi.org/10.1103/PhysRevLett.104.130501)
