HeldExpression
HeldExpression
HeldExpression()Methods
| Name | Description |
|---|---|
__add__ |
Add this transformer to other, returning the result. |
__call__ |
Execute a bound transformer |
__eq__ |
Compare two transformers. |
__ge__ |
Compare two transformers |
__gt__ |
Compare two transformers |
__le__ |
Compare two transformers |
__lt__ |
Compare two transformers |
__mul__ |
Add this transformer to other, returning the result. |
__neg__ |
Negate the current transformer, returning the result. |
__neq__ |
Compare two transformers. |
__pow__ |
Take self to power exp, returning the result. |
__radd__ |
Add this transformer to other, returning the result. |
__rmul__ |
Add this transformer to other, returning the result. |
__rpow__ |
Take base to power self, returning the result. |
__rsub__ |
Subtract this transformer from other, returning the result. |
__rtruediv__ |
Divide other by this transformer, returning the result. |
__rxor__ |
Returns a warning that ** should be used instead of ^ for taking a power. |
__sub__ |
Subtract other from this transformer, returning the result. |
__truediv__ |
Divide this transformer by other, returning the result. |
__xor__ |
Returns a warning that ** should be used instead of ^ for taking a power. |
contains |
Create a transformer that checks if the expression contains the given element. |
is_type |
Test if the transformed expression is of a certain type. |
matches |
Create a transformer that tests whether the pattern is found in the expression |
__add__
HeldExpression.__add__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionAdd this transformer to other, returning the result.
__call__
HeldExpression.__call__() -> ExpressionExecute a bound transformer. If the transformer is unbound, you can call it with an expression as an argument.
Examples
from symbolica import *
x = S('x')
e = (x+1)**5
e = e.hold(T().expand())()
print(e)__eq__
HeldExpression.__eq__(other: HeldExpression | Expression | int | float | complex | Decimal) -> ConditionCompare two transformers.
__ge__
HeldExpression.__ge__(other: HeldExpression | Expression | int | float | complex | Decimal) -> ConditionCompare two transformers. If any of the two expressions is not a rational number, an interal ordering is used.
__gt__
HeldExpression.__gt__(other: HeldExpression | Expression | int | float | complex | Decimal) -> ConditionCompare two transformers. If any of the two expressions is not a rational number, an interal ordering is used.
__le__
HeldExpression.__le__(other: HeldExpression | Expression | int | float | complex | Decimal) -> ConditionCompare two transformers. If any of the two expressions is not a rational number, an interal ordering is used.
__lt__
HeldExpression.__lt__(other: HeldExpression | Expression | int | float | complex | Decimal) -> ConditionCompare two transformers. If any of the two expressions is not a rational number, an interal ordering is used.
__mul__
HeldExpression.__mul__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionAdd this transformer to other, returning the result.
__neg__
HeldExpression.__neg__() -> HeldExpressionNegate the current transformer, returning the result.
__neq__
HeldExpression.__neq__(other: HeldExpression | Expression | int | float | complex | Decimal) -> ConditionCompare two transformers.
__pow__
HeldExpression.__pow__(exp: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionTake self to power exp, returning the result.
__radd__
HeldExpression.__radd__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionAdd this transformer to other, returning the result.
__rmul__
HeldExpression.__rmul__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionAdd this transformer to other, returning the result.
__rpow__
HeldExpression.__rpow__(base: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionTake base to power self, returning the result.
__rsub__
HeldExpression.__rsub__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionSubtract this transformer from other, returning the result.
__rtruediv__
HeldExpression.__rtruediv__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionDivide other by this transformer, returning the result.
__rxor__
HeldExpression.__rxor__(a: Any) -> HeldExpressionReturns a warning that ** should be used instead of ^ for taking a power.
__sub__
HeldExpression.__sub__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionSubtract other from this transformer, returning the result.
__truediv__
HeldExpression.__truediv__(other: HeldExpression | Expression | int | float | complex | Decimal) -> HeldExpressionDivide this transformer by other, returning the result.
__xor__
HeldExpression.__xor__(a: Any) -> HeldExpressionReturns a warning that ** should be used instead of ^ for taking a power.
contains
HeldExpression.contains(element: HeldExpression | Expression | int | float | complex | Decimal) -> ConditionCreate a transformer that checks if the expression contains the given element.
is_type
HeldExpression.is_type(atom_type: AtomType) -> ConditionTest if the transformed expression is of a certain type.
matches
HeldExpression.matches(
lhs: Expression | int | float | complex | Decimal,
cond: Optional[PatternRestriction | Condition] = None,
min_level: int = 0,
max_level: Optional[int] = None,
level_range: Optional[Tuple[int, Optional[int]]] = None,
level_is_tree_depth: bool = False,
partial: bool = True,
allow_new_wildcards_on_rhs: bool = False,
) -> ConditionCreate a transformer that tests whether the pattern is found in the expression. Restrictions on the pattern can be supplied through cond.