# iterate_expectation

Source: https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.iterate_expectation

```python
fireopal.iterate_expectation(circuits, shot_count, credentials, backend_name, observables, parameters=None, run_options=None)
```

Estimate expectation values of observables for quantum circuits with queue reuse.

Use this function to compute the expectation value of one or more
observables for a batch of quantum circuits executed on a specified
backend. Fire Opal automatically applies error suppression and
mitigation to improve the accuracy of the estimated expectation values.

If permitted by the hardware provider, multiple calls to this function
will re-use the same circuit submission queue position, reducing wait
times for iterative workflows.

This is the recommended approach when you need to obtain expectation values
iteratively (for example, for variational algorithms such as a Variational
Quantum Eigensolver) rather than raw measurement bitstrings.

### Parameters
* **circuits** (*str* *or* *list* *[* *str* *]*) – Quantum circuit(s) as QASM 2.0 or 3.0 strings. Convert Qiskit
  `QuantumCircuit` objects using `qiskit.qasm2.dumps` or
  `qiskit.qasm3.dumps`.
* **shot_count** (*int*) – Number of bitstrings sampled from the final quantum state of each circuit.
* **credentials** (*Credentials*) – Credentials for the target hardware provider, created using the
  appropriate helper from the [`fireopal.credentials`](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.credentials.md#module-fireopal.credentials) module. For
  example, use [`make_credentials_for_ibm_cloud()`](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.credentials.make_credentials_for_ibm_cloud.md#fireopal.credentials.make_credentials_for_ibm_cloud) for
  IBM backends.
* **backend_name** (*str*) – Name of the backend that will execute circuits.
* **observables** ([*PauliOperator*](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.types.PauliOperator.md#fireopal.types.PauliOperator) *or* *list* *[*[*PauliOperator*](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.types.PauliOperator.md#fireopal.types.PauliOperator) *] or* *str* *or* *list* *[* *str* *]          or* *dict* *[* *str* *,* *float* *] or* *list* *[* *tuple* *[* *str* *,* *float* *]* *]*) – Observable(s) for which to compute expectation values. Accepts Pauli
  strings (for example, `"ZZI"`), weighted dictionaries
  (for example, `{"ZZI": 0.5, "IZZ": 0.5}`), or `PauliOperator` instances.
* **parameters** (*dict* *[* *str* *,* *float* *] or* *list* *[* *dict* *[* *str* *,* *float* *]* *] or* *None* *,* *optional*) – Parameter bindings for parametric circuit(s). Each dictionary maps
  parameter names to float values. Provide a list when submitting
  multiple circuits with distinct bindings. Defaults to None.
* **run_options** (*RunOptions* *or* *None* *,* *optional*) – Provider-specific execution options, for example,
  [`IbmRunOptions`](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.run_options.IbmRunOptions.md#fireopal.run_options.IbmRunOptions)).
  See the [`fireopal.run_options`](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.run_options.md#module-fireopal.run_options) module for available classes.
  Defaults to None.
### Returns
[`FireOpalJob`](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.FireOpalJob.md#fireopal.FireOpalJob) – A job object whose [`result()`](https://docs.q-ctrl.com/references/fire-opal/fireopal/fireopal.FireOpalJob.result.md#fireopal.FireOpalJob.result) method returns a dictionary
containing:

  `expectation_values (list[float])`
  : The estimated expectation values of the observables for each circuit.

  `standard_deviations (list[float])`
  : The standard deviations of the estimated expectation values,
    accounting for shot noise.
