class finesse.element.Operation

This is a symbol to represent a mathematical operation. This could be a simple addition, or a more complicated multi-argument function.

It supports creating new mathematical operations:

import math
import cmath

cos   = lambda x: finesse.element.Operation(math.cos, x)
sin   = lambda x: finesse.element.Operation(math.sin, x)
atan2 = lambda y, x: finesse.element.Operation(math.atan2, y, x)

Complex math can also be used:

import numpy as np
angle = lambda x: finesse.element.Operation(np.angle, x)
print(f"{angle(1+1j)} = {angle(1+1j).eval()}")

The equality operator is overridden to provide a very basic symbolic equality test. It only tests whether two symbolic statements are exactly the same, e.g.:

>>> y+x == y+x # True
>>> y+x == x+y # False

This could be fixed by making operators more


Operation.__init__(self, operation, *args)

Operation.eval(self, **kwargs)