QDpy
Loading...
Searching...
No Matches
qdpy.symbolic._expression.Expression Class Reference

A safe expression tree whose parameter leaves each hold one free scalar. More...

Public Member Functions

"Expression" variable (cls, int column)
 Build a variable leaf from a zero-based input column.
"Expression" parameter (cls)
 Build a free coefficient leaf.
"Expression" constant (cls, float value)
 Build a fixed, finite numeric leaf.
int node_count (self)
 Count all nodes, including leaves.
int parameter_count (self)
 Count independent parameter slots.
int non_algebraic_count (self)
 Count trigonometric, exponential and logarithmic nodes.

Detailed Description

A safe expression tree whose parameter leaves each hold one free scalar.

Define an immutable equation tree.

Leaves are made with :meth:`variable`, :meth:`constant`, and
:meth:`parameter`. Each parameter leaf occupies a separate slot in
left-to-right traversal order, even if the same leaf object is reused.

For an operation, supply its name and its children. Binary operations
are ``add``, ``sub``, ``mul``, and ``div``. Unary operations are
``neg``, ``square``, ``sqrt``, ``sin``, ``cos``, ``exp``, and ``log``.

Definition at line 29 of file _expression.py.

Member Function Documentation

◆ constant()

"Expression" qdpy.symbolic._expression.Expression.constant ( cls,
float value )

Build a fixed, finite numeric leaf.

Return a fixed real-valued leaf.

Definition at line 82 of file _expression.py.

◆ node_count()

int qdpy.symbolic._expression.Expression.node_count ( self)

Count all nodes, including leaves.

Count all operator and terminal occurrences.

Definition at line 88 of file _expression.py.

◆ non_algebraic_count()

int qdpy.symbolic._expression.Expression.non_algebraic_count ( self)

Count trigonometric, exponential and logarithmic nodes.

Count sine, cosine, exponential, and logarithm occurrences.

Definition at line 100 of file _expression.py.

◆ parameter()

"Expression" qdpy.symbolic._expression.Expression.parameter ( cls)

Build a free coefficient leaf.

Return a free scalar leaf, with a separate coefficient for each occurrence.

Definition at line 76 of file _expression.py.

◆ parameter_count()

int qdpy.symbolic._expression.Expression.parameter_count ( self)

Count independent parameter slots.

Count free coefficient occurrences.

Definition at line 94 of file _expression.py.

◆ variable()

"Expression" qdpy.symbolic._expression.Expression.variable ( cls,
int column )

Build a variable leaf from a zero-based input column.

Return a leaf that reads the given zero-based column of the input.

Definition at line 70 of file _expression.py.


The documentation for this class was generated from the following file: