3.1.2. qupulse.expressions.sympy¶
This module defines the class Expression to represent mathematical expression as well as corresponding exception classes.
Classes
|
Base class for expressions. |
|
A scalar mathematical expression instantiated from a string representation. |
|
N-dimensional expression. |
- class Expression(*args, **kwargs)[source]¶
Bases:
AnonymousSerializableBase class for expressions.
- evaluate_in_scope(scope: Mapping) Number | ndarray[source]¶
Evaluate the expression by taking the variables from the given scope (typically of type Scope but it can be any mapping.) :param scope:
Returns:
- classmethod make(expression_or_dict, numpy_evaluation=None) ExpressionScalar | ExpressionVector | _ExpressionType[source]¶
Backward compatible expression generation
- class ExpressionScalar(*args, **kwargs)[source]¶
Bases:
ExpressionA scalar mathematical expression instantiated from a string representation. TODO: update doc! TODO: write tests!
Create an Expression object.
Receives the mathematical expression which shall be represented by the object as a string which will be parsed using py_expression_eval. For available operators, functions and constants see SymPy documentation
- Parameters:
ex (string) – The mathematical expression represented as a string
- evaluate_in_scope(scope: Mapping) Number | ndarray[source]¶
Evaluate the expression by taking the variables from the given scope (typically of type Scope but it can be any mapping.) :param scope:
Returns:
- class ExpressionVector(*args, **kwargs)[source]¶
Bases:
ExpressionN-dimensional expression. TODO: write doc! TODO: write tests!
- evaluate_in_scope(scope: Mapping) ndarray[source]¶
Evaluate the expression by taking the variables from the given scope (typically of type Scope but it can be any mapping.) :param scope:
Returns:
- get_serialization_data() Sequence[str][source]¶
Return all data relevant for serialization as a JSON compatible type that is accepted as constructor argument
- Returns:
A JSON compatible type that can be used to construct an equal object.
- sympify_vector = <numpy.vectorize object>¶