expressions#

class wrenfold.expressions.Variable#

Concrete expression for a symbolic variable.

__eq__(self: wrenfold.expressions.Variable, other: wrenfold.expressions.Variable) bool#

Check for strict equality. This is not the same as mathematical equivalence.

__hash__(self: wrenfold.expressions.Variable) int#

Compute hash.

__init__(self: wrenfold.expressions.Variable, name: str, number_set: wrenfold.enumerations.NumberSet = <NumberSet.Unknown: 4>) None#

Construct a concrete Variable expression.

Parameters:
  • name – String name of the variable.

  • number_set – What numeric set to assume for this variable.

Examples

>>> from wrenfold import expressions, enumerations, sym
>>> x = expressions.Variable('x', number_set=enumerations.NumberSet.RealPositive)
>>> type(x)
wrenfold.expressions.Variable
>>> sym.cos(x.to_expression())
cos(x)
is_identical_to(self: wrenfold.expressions.Variable, other: wrenfold.expressions.Variable) bool#

Check for strict equality. This is not the same as mathematical equivalence.

property is_unique_variable#

True if the variable is a unique_variable.

property name#

Name of the variable.

property set#

Numeric set the variable belongs to.

to_expression(self: wrenfold.expressions.Variable) wrenfold.sym.Expr#

Convert the variable back to a wrenfold.sym.Expr.