Skip to content

← elementwise_math package

Formula

Evaluate a mathematical formula of n variables.

This node can take in zero or more numeric inputs of mixed types (int, float, array, list, packet, etc.), which are given the variable names 0 to N, and will evaluate the specified mathematical formula using these variables. Standard mathematical operators, functions, and constants are available and resolve to the respective nodes from the elementwise category. Note that, while the syntax is that of Python, the computation represented by the formula is evaluated by the nodes from the elementwise category, and therefore allows mixing numbers, arrays lists, packets and so forth. The result will then be of the highest type of the inputs (Packet, array, list, float, int). Version 0.8.0

Ports/Properties

result

Result.

  • verbose name: Result
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: OUT

name1

Variable name 1.

  • verbose name: Variable Name 1
  • default value: x
  • port type: StringPort
  • value type: str (can be None)

var1

Variable value 1.

  • verbose name: Var1
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name2

Variable name 2.

  • verbose name: Variable Name 2
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var2

Variable value 2.

  • verbose name: Var2
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name3

Variable name 3.

  • verbose name: Variable Name 3
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var3

Variable value 3.

  • verbose name: Var3
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name4

Variable name 4.

  • verbose name: Variable Name 4
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var4

Variable value 4.

  • verbose name: Var4
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name5

Variable name 5.

  • verbose name: Variable Name 5
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var5

Variable value 5.

  • verbose name: Var5
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name6

Variable name 6.

  • verbose name: Variable Name 6
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var6

Variable value 6.

  • verbose name: Var6
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name7

Variable name 7.

  • verbose name: Variable Name 7
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var7

Variable value 7.

  • verbose name: Var7
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name8

Variable name 8.

  • verbose name: Variable Name 8
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var8

Variable value 8.

  • verbose name: Var8
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

name9

Variable name 9.

  • verbose name: Variable Name 9
  • default value:
  • port type: StringPort
  • value type: str (can be None)

var9

Variable value 9.

  • verbose name: Var9
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: IN

nameN

Additional variable names.. .

  • verbose name: Additional Names
  • default value: None
  • port type: ListPort
  • value type: list (can be None)

varN

Additional variable values.. .

  • verbose name: Varn
  • default value: None
  • port type: DataPort
  • value type: list (can be None)
  • data direction: IN

argdict

Additional variable dictionary

  • verbose name: Argdict
  • default value: None
  • port type: DataPort
  • value type: dict (can be None)
  • data direction: IN

formula

The formula to evaluate. The formula can be entered in a notation known from graphing calculators, but follows the syntax of Python expressions (one notable difference is that exponentiation is written as e ** x instead of e^x). The formula can use variables named according to the user-provided listing, and will then reference the wired-in values. The output of the node is then the numeric value of that formula. Most of the operations in the elementwise category are available under their conventional names -- for example, "sqrt(x)2 + y + pi" is allowed. If inputs are arrays, the operation is applied to each element of the inputs and yields an array as the result. When mixing comparison operators and elementwise logical operators (i.e., & | ^), note that the logical operations have higher* precedence, so you will want to use braces when mixing these, as in (A>B)&(C