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

# ParameterVectorElement

*class* `qiskit.circuit.ParameterVectorElement(vector, index, uuid=None)`

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

An element of a [`ParameterVector`](/docs/api/qiskit/qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector").

> **Note**
>
> There is very little reason to ever construct this class directly. Objects of this type are automatically constructed efficiently as part of creating a [`ParameterVector`](/docs/api/qiskit/qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector").

## Attributes

### index

Get the index of this element in the parent vector.

### name

Returns the name of the [`Parameter`](/docs/api/qiskit/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`](/docs/api/qiskit/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`](/docs/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter").

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

### vector

Get the parent vector 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`](/docs/api/qiskit/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`](/docs/api/qiskit/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/builtins/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.ParameterVectorElement.bind "qiskit.circuit.ParameterVectorElement.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.ParameterVectorElement.bind "qiskit.circuit.ParameterVectorElement.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.

### simplify

`simplify()`

Simplify the expression. This, for example, attempts to cancel variables in the expression.

### sin

`sin()`

Sine of the expression.

### structurally\_equal

`structurally_equal(rhs)`

Are these two expressions exactly structurally equal?

This is a faster and stricter form of the standard `==` relationship, but does not take simplifications into account. Almost all expressions that are [`structurally_equal()`](#qiskit.circuit.ParameterVectorElement.structurally_equal "qiskit.circuit.ParameterVectorElement.structurally_equal") are all `==` to each other, but the reverse is not true. (In the presence of `nan` values, [`structurally_equal()`](#qiskit.circuit.ParameterVectorElement.structurally_equal "qiskit.circuit.ParameterVectorElement.structurally_equal") can sometimes return `True` when `==` compares `False`.)

This function is most useful in internal tests of the [`ParameterExpression`](/docs/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") logic.

> **Note**
>
> Many operations on [`ParameterExpression`](/docs/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") do on-the-fly simplification as they are constructed, so two expressions that appear to have been constructed in different orders can still be internally structurally equal.

**Parameters**

**rhs** – the other object to compare.

**Returns**

Whether the two objects are structurally equal expressions.

**Examples**

Two expressions can simplify to each other when checking for equality, but not use the same internal structure:

```python
from qiskit.circuit import Parameter

x, y = Parameter("x"), Parameter("y")
left = x + y + 1
right = 1 + y + x
assert left == right
assert not left.structurally_equal(right)
```

### subs

`subs(parameter_map, allow_unknown_parameters=False)`

Returns a new expression with replacement parameters.

**Parameters**

- **parameter\_map** – Mapping from [`Parameter`](/docs/api/qiskit/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`](/docs/api/qiskit/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.

> **Note**
>
> This is for interoperability only. Qiskit will not accept or work with raw Sympy or Symengine expressions in its parameters, because they do not contain the tracking information used in circuit-parameter binding and assignment.

> **Warning**
>
> This method will pass strings from the expression to SymPy which is inherently unsafe as SymPy heavily relies on Python’s [`eval()`](https://docs.python.org/3/builtins/functions.html#eval) function for the processing of strings. This method is not safe to use with untrusted input.

**Returns**

A SymPy equivalent of this expression.

### tan

`tan()`

Tangent of the expression.
