## Math (vuo.math)

Nodes for doing mathematical calculations with numbers.

Many of these nodes can work with various types of numbers — Integers, Reals, 2D Points, 3D Points, 4D Points — because their ports have changeable data types. To change the type of number in the calculation, change the port’s data type. (For example, right-click on the port and select from the Set Data Type submenu.)

In calculations, a difference between Integers and Reals is that the results for Integers are exact, while the results for Reals (numbers with decimal points) involve small rounding errors. For example, the Integer version of Divide says that 4 divided by 3 equals 1 remainder 1, while the Real version of Divide says that 4 divided by 3 equals 1.3333333333 (slightly less than 1 1/3).

### Example compositions:

• Average Random Points: Draws points at random positions (blue) and a crosshair (white) at the average of all the positions so far.
• 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.
• Move Dots with Perlin Noise: Draws a series of dots arranged in a circle, with each dot moving independently toward and away from the center of the circle.
• 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:

• 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 Absolute Value (vuo.math.absolute): Converts the input to a non-negative number.
• Calculate Cosine (vuo.math.cos): Calculates the cosine (cos) of the angle.
• Calculate List (vuo.math.calculate.list): Applies a math expression to each value in a list, and outputs the new list.
• Calculate Sine (vuo.math.sin): Calculates the sine (sin) of the angle.
• Calculate Tangent (vuo.math.tan): Calculates the tangent (tan) of the angle.
• Compare Numbers (vuo.math.compareNumbers): Compares two numbers and returns the result.
• Convert Relative to Absolute (vuo.math.relative.absolute): Converts a list of sequential relative offsets to a list of absolute offsets from 0.
• 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 (vuo.math.divide.VuoReal): Calculates the quotient of A divided by B (A/B).
• Divide with Remainder (vuo.math.divide.VuoInteger): Calculates the quotient and remainder of A divided by B (A/B).
• Exponentiate (vuo.math.exponentiate): Calculates Base raised to the power of Exponent.
• 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.
• 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, Center/Radius) (vuo.math.make.range.center.VuoReal): Creates a real range from a center and radius value.
• Make Range (Real, Min/Max) (vuo.math.make.range.VuoReal): Creates a real range from a minimum and maximum value.
• Multiply (vuo.math.multiply): Calculates the product of the values.
• Multiply Lists (vuo.math.multiply.list.2): Multiplies corresponding items in each list.
• 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.
• 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).