## vuo.math

These nodes are for doing mathematical calculations with numbers.

Many of these nodes have an integer version and a real number version. The integer version is for working with numbers without decimal points, such as 1, 99, 0, or -200. The real number version is for working with numbers with decimal points, such as 1.5 or -0.01. Because of the way that numbers are stored on a computer, the integer version gives exact results whereas the real number version is subject to (usually tiny) rounding errors. For example, the integer version of `Divide` (`vuo.math.divide.integer`) says that 4 divided by 3 equals 1 remainder 1, while the real number version of `Divide` (`vuo.math.divide.real`) says that 4 divided by 3 equals 1.333…3 (slightly less than 1 1/3).

Real numbers in Vuo are limited in their precision and range. Currently, when entering numbers in an input editor, or when live-coding, Vuo will round numbers with more than 6 significant digits, and numbers greater than 999,999 or less than 0.000001.

### Example compositions:

• Average Random Points: Draws points at random positions (blue) and a point at the average of all the positions so far (white).
• Follow Midpoint: Draws two points that randomly move around (blue) and the midpoint between them (orange).
• Graph Functions: Plots several mathematical functions on a coordinate plane.
• Scale Audio Input: Graphs the current audio loudness (on the far right) relative to the range of loudnesses observed so far (moving from right to left). When the composition starts, the graph takes up the whole vertical range. As the composition runs, background noise fades into the lower part of the vertical range, and only the loudest sounds reach the top of the range.
• Spread Bars: Moves two vertical bars to the leftmost and rightmost point that the mouse has hovered. Resets the vertical bars to the current mouse position when the mouse is clicked.

### Nodes:

• Calculate Absolute Value (vuo.math.absolute): Converts the input to a non-negative number.
• Are Equal (Number) (vuo.math.areEqual): Outputs true if all values are close to equal.
• Are Not Equal (vuo.math.areNotEqual): Outputs false if all values are close to equal, and true otherwise.
• Average (vuo.math.average): Calculates the average (mean) of the values.
• Calculate (vuo.math.calculate): Calculates the value of a math expression or formula.
• Calculate List (vuo.math.calculate.list): Applies a math expression to each value in a list, and outputs the new list.
• Compare Numbers (vuo.math.compareNumbers): Compares two numbers and returns the result.
• Calculate Cosine (vuo.math.cos): Calculates the cosine (cos) of the angle.
• Count (vuo.math.count): Keeps track of a count that can be incremented and decremented.
• Count within Range (vuo.math.countWithinRange): Keeps track of a count that can be incremented and decremented and always stays within a given range.
• Divide with Remainder (vuo.math.divide.VuoInteger): Calculates the quotient and remainder of A divided by B (A/B).
• Divide (vuo.math.divide.VuoReal): Calculates the quotient of A divided by B (A/B).
• Exponentiate (vuo.math.exponentiate): Calculates Base raised to the power of Exponent.
• Fit in Range (vuo.math.fit): Scales a value so that it’s always within the specified range.
• Get Range Values (Integer) (vuo.math.get.range.VuoInteger): Gives the minimum and maximum values of an integer range.
• Get Range Values (Real) (vuo.math.get.range.VuoReal): Gives the minimum and maximum values of a real range.
• Is within Range (vuo.math.isWithinRange): Outputs true if the value is within a given range.
• Keep Average (vuo.math.keep.average): Outputs the average of the values received by this node so far.
• Keep Maximum (vuo.math.keep.max): Outputs the largest value received by this node so far.
• Keep Minimum (vuo.math.keep.min): Outputs the smallest value received by this node so far.
• Limit to Range (vuo.math.limitToRange): Restricts a value to fall within a given range.
• Make Range (Integer) (vuo.math.make.range.VuoInteger): Creates an integer range from a minimum and maximum value.
• Make Range (Real, Min/Max) (vuo.math.make.range.VuoReal): Creates a real range from a minimum and maximum value.
• Make Range (Real, Center/Radius) (vuo.math.make.range.center.VuoReal): Creates a real range from a center and radius value.
• Find Maximum (vuo.math.max): Selects the value that is greater than or equal to all the other values.
• Find Minimum (vuo.math.min): Selects the value that is less than or equal to all the other values.
• Multiply (vuo.math.multiply): Calculates the product of the values.
• Multiply Lists (vuo.math.multiply.list.2): Multiplies corresponding items in each list.
• Convert Relative to Absolute (vuo.math.relative.absolute): Converts a list of sequential relative offsets to a list of absolute offsets from 0.
• Round (vuo.math.round): Rounds the number to the nearest integer.
• Round Down (vuo.math.roundDown): Rounds the number downward to the nearest integer below it.
• Round Up (vuo.math.roundUp): Rounds the number upward to the nearest integer above it.
• Scale (vuo.math.scale): Converts a number or point from one unit of measure to another.
• Scale List (vuo.math.scale.list): Multiplies each item in a list by a scale factor.
• Calculate Sine (vuo.math.sin): Calculates the sine (sin) of the angle.
• Snap Value (vuo.math.snap): Rounds a number or point to the nearest position on an imaginary grid.
• Subtract (vuo.math.subtract): Calculates A minus B (A-B).
• Calculate Tangent (vuo.math.tan): Calculates the tangent (tan) of the angle.