---
title: Parameter (latest version)
description: API reference for qiskit.circuit.Parameter in the latest version of qiskit
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.circuit.Parameter
---

# Parameter

*class* `qiskit.circuit.Parameter(name, uuid=None)`

Bases: [`ParameterExpression`](/docs/api/qiskit/qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression")

A compile-time symbolic parameter.

The value of a [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter") must be entirely determined before a circuit begins execution. Typically this will mean that you should supply values for all [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in a circuit using [`QuantumCircuit.assign_parameters()`](/docs/api/qiskit/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters"), though certain hardware vendors may allow you to give them a circuit in terms of these parameters, provided you also pass the values separately.

This is the atom of [`ParameterExpression`](/docs/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression"), and is itself an expression. The numeric value of a parameter need not be fixed while the circuit is being defined.

**Examples**

Construct a variable-rotation X gate using circuit parameters.

```python
from qiskit.circuit import QuantumCircuit, Parameter

# create the parameter
phi = Parameter("phi")
qc = QuantumCircuit(1)

# parameterize the rotation
qc.rx(phi, 0)
qc.draw("mpl")

# bind the parameters after circuit to create a bound circuit
bc = qc.assign_parameters({phi: 3.14})
bc.measure_all()
bc.draw("mpl")
```

![Circuit diagram output by the previous code.](https://eu-de.quantum.cloud.ibm.com/docs/images/api/qiskit/qiskit-circuit-Parameter-1_00.avif)

![Circuit diagram output by the previous code.](https://eu-de.quantum.cloud.ibm.com/docs/images/api/qiskit/qiskit-circuit-Parameter-1_01.avif)

## Attributes

### name

Returns the name of the [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter").

### num\_parameters

The number of unbound parameters in the expression.

This is equivalent to `len(expr.parameters)` but does not involve the overhead of creating a set and counting its length.

### parameters

Get the parameters present in the expression.

> **Note**
>
> Qiskit guarantees equality (via `==`) of parameters retrieved from an expression with the original [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects used to create this expression, but does **not guarantee** `is` comparisons to succeed.

### uuid

Returns the [`UUID`](https://docs.python.org/3/library/uuid.html#uuid.UUID) of the [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter").

In advanced use cases, this property can be passed to the [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter") constructor to produce an instance that compares equal to another instance.

## Methods

### abs

`abs()`

Take the absolute value of the expression.

### arccos

`arccos()`

Arccosine of the expression.

### arcsin

`arcsin()`

Arcsine of the expression.

### arctan

`arctan()`

Arctangent of the expression.

### assign

`assign(parameter, value)`

Assign one parameter to a value, which can either be numeric or another parameter expression.

**Parameters**

- **parameter** – A parameter in this expression whose value will be updated.
- **value** – The new value to bind to.

**Returns**

A new expression parameterized by any parameters which were not bound by assignment.

### bind

`bind(parameter_values, allow_unknown_parameters=False)`

Binds the provided set of parameters to their corresponding values.

**Parameters**

- **parameter\_values** – Mapping of [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter") instances to the numeric value to which they will be bound.
- **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_values` contains [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored.

**Raises**

- [**CircuitError**](/docs/api/qiskit/circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") –

  - If parameter\_values contains parameters outside those in self. - If a non-numeric value is passed in `parameter_values`.

- [**ZeroDivisionError**](https://docs.python.org/3/library/exceptions.html#ZeroDivisionError) –

  - If binding the provided values requires division by zero.

**Returns**

A new expression parameterized by any parameters which were not bound by `parameter_values`.

### bind\_all

`bind_all(values)`

Bind all of the parameters in `self` to numeric values in the dictionary, returning a numeric value.

This is a special case of [`bind()`](#qiskit.circuit.Parameter.bind "qiskit.circuit.Parameter.bind") which can reach higher performance. It is no problem for the `values` dictionary to contain parameters that are not used in this expression; the expectation is that the same bindings dictionary will be fed to other expressions as well.

It is an error to call this method with a `values` dictionary that does not bind all of the values, or to call this method with non-numeric values, but this is not explicitly checked, since this method is intended for performance-sensitive use. Passing an incorrect dictionary may result in unexpected behavior.

Unlike [`bind()`](#qiskit.circuit.Parameter.bind "qiskit.circuit.Parameter.bind"), this method will not raise an exception if non-finite floating-point values are encountered.

**Parameters**

**values** – mapping of parameters to numeric values.

### conjugate

`conjugate()`

Return the complex conjugate of the expression.

### cos

`cos()`

Cosine of the expression.

### exp

`exp()`

Exponentiate the expression.

### gradient

`gradient(param)`

Return derivative of this expression with respect to the input parameter.

**Parameters**

**param** – The parameter with respect to which the derivative is calculated.

**Returns**

The derivative as either a constant numeric value or a symbolic [`ParameterExpression`](/docs/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression").

### is\_real

`is_real()`

Check whether the expression represents a real number.

Note that this will return `None` if there are unbound parameters, in which case it cannot be determined whether the expression is real.

### is\_symbol

`is_symbol()`

Check if the expression corresponds to a plain symbol.

**Returns**

`True` is this expression corresponds to a symbol, `False` otherwise.

### log

`log()`

Take the natural logarithm of the expression.

### numeric

`numeric(strict=True)`

Cast this expression to a numeric value.

**Parameters**

**strict** – If `True` (default) this function raises an error if there are any unbound symbols in the expression. If `False`, this allows casting if the expression represents a numeric value, regardless of unbound symbols. For example `(0 * Parameter("x"))` is 0 but has the symbol `x` present.

### sign

`sign()`

Return the sign of the expression.

### sin

`sin()`

Sine of the expression.

### subs

`subs(parameter_map, allow_unknown_parameters=False)`

Returns a new expression with replacement parameters.

**Parameters**

- **parameter\_map** – Mapping from [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in `self` to the [`ParameterExpression`](/docs/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") instances with which they should be replaced.
- **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_map` contains [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored.

**Raises**

[**CircuitError**](/docs/api/qiskit/circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") –

- If parameter\_map contains parameters outside those in self. - If the replacement parameters in `parameter_map` would result in a name conflict in the generated expression.

**Returns**

A new expression with the specified parameters replaced.

### sympify

`sympify()`

Return a SymPy equivalent of this expression.

**Returns**

A SymPy equivalent of this expression.

### tan

`tan()`

Tangent of the expression.
