Skip to content

Basic Math

Daryl Stultz edited this page Jun 3, 2016 · 7 revisions

Once you have your nodes you can create more nodes by operating on them. Each operation returns a node that represents the result of the entire chain that precedes it. Here are the basic math operators. Many of these examples use a literal value as the second operand but you can use any other node as well, thus "mixing" signals.

###Addition

n2 = n1.add(2)

###Subtraction

n2 = n1.sub(2)

###Multiplication

n2 = n1.mul(2)

###Division

n2 = n1.div(2)

###Negation

n2 = n1.neg()

Negate will change 2 to -2 or True to False (and vice versa, of course).

###Absolute Value

n2 = n1.abs()

Clone this wiki locally