Math
oqd_core.interface.math
¶
MathExprSubtypes = Union[MathNum, MathVar, MathImag, MathFunc, MathAdd, MathSub, MathMul, MathDiv, MathPow]
module-attribute
¶
Alias for the union of concrete MathExpr subtypes
MathExpr
¶
Bases: TypeReflectBaseModel
Class representing the abstract syntax tree (AST) for a mathematical expression
Source code in oqd-core/src/oqd_core/interface/math.py
MathTerminal
¶
MathVar
¶
Bases: MathTerminal
Class representing a variable in a MathExpr
Examples:
Source code in oqd-core/src/oqd_core/interface/math.py
MathNum
¶
MathImag
¶
Bases: MathTerminal
Class representing the imaginary unit in a MathExpr
abstract syntax tree (AST)
Source code in oqd-core/src/oqd_core/interface/math.py
MathUnaryOp
¶
MathFunc
¶
Bases: MathUnaryOp
Class representing a named function applied to a MathExpr
abstract syntax tree (AST)
Attributes:
Name | Type | Description |
---|---|---|
func |
Literal['sin', 'cos', 'tan', 'exp', 'log', 'sinh', 'cosh', 'tanh']
|
Named function to apply |
expr |
MathExpr
|
Argument of the named function |
Source code in oqd-core/src/oqd_core/interface/math.py
MathBinaryOp
¶
MathAdd
¶
Bases: MathBinaryOp
Class representing the addition of MathExprs
Attributes:
Name | Type | Description |
---|---|---|
expr1 |
MathExpr
|
Left hand side |
expr2 |
MathExpr
|
Right hand side |
Source code in oqd-core/src/oqd_core/interface/math.py
MathSub
¶
Bases: MathBinaryOp
Class representing the subtraction of MathExprs
Attributes:
Name | Type | Description |
---|---|---|
expr1 |
MathExpr
|
Left hand side |
expr2 |
MathExpr
|
Right hand side |
Source code in oqd-core/src/oqd_core/interface/math.py
MathMul
¶
Bases: MathBinaryOp
Class representing the multiplication of MathExprs
Attributes:
Name | Type | Description |
---|---|---|
expr1 |
MathExpr
|
Left hand side |
expr2 |
MathExpr
|
Right hand side |
Source code in oqd-core/src/oqd_core/interface/math.py
MathDiv
¶
Bases: MathBinaryOp
Class representing the division of MathExprs
Attributes:
Name | Type | Description |
---|---|---|
expr1 |
MathExpr
|
Left hand side |
expr2 |
MathExpr
|
Right hand side |
Source code in oqd-core/src/oqd_core/interface/math.py
MathPow
¶
Bases: MathBinaryOp
Class representing the exponentiation of MathExprs
Attributes:
Name | Type | Description |
---|---|---|
expr1 |
MathExpr
|
Left hand side |
expr2 |
MathExpr
|
Right hand side |