heyoka.expression

heyoka.expression#

class heyoka.expression#

Class to represent symbolic expressions.

Note

A tutorial explaining the use of this class is available.

This is the main class used to represent mathematical expressions in heyoka. It is a union of several node types:

  • symbolic variables,

  • mathematical constants,

  • runtime parameters,

  • n-ary functions.

Expressions can be created in a variety of ways, and after construction they can be combined via arithmetic operators and mathematical functions to form new expressions of arbitrary complexity.

Methods

__init__(self[, x])

Constructor.

__init__(self, x: int | numpy.single | float | numpy.longdouble | str | expression = 0.)#

Constructor.

The constructor will initialise the expression as a numerical constant (if x is of a numerical type) or as a variable (if x is a str). If x is an expression, a copy is performed.

Note

Integral values are converted to double precision, which may result in a loss of precision for large integers.

Parameters:

x – the construction argument.