Math functions
OSW includes several basic math functions, which are described below. Each function accepts numerical types (ints, floats, doubles, complex and double complex) as well as audio samples, unless otherwise indicated. When audio samples are used, the result is the same as evaluating the function on each sample individually. Use the supplied help patches to see how a particular function can be used in numerical or signal contexts. (Note: in order to use the linked help patches, OSW must already be running.)
The absolute value of a number. For ints, floats and doubles, this is the non-negative version of the number, and for complex numbers it is the radius (or square root of the norm).
The arccosine, or inverse cosine function.
The arcsine, or inverse sine function.
The arctangent, or inverse tangent function.
The smallest integer larger than the input value. This function only works with floats, doubles, and floating-point audio samples. (It has no mathematical meaning for the other types.)
The cosine function.
The hyperbolic cosine function (ex+e-x)/2.
The natural inverse logarithm (i.e., ex ).
The greatlest integer less than or equal to the input value. This function only works with floats, doubles, and floating-point audio samples. (It has no mathematical meaning for the other types.)
Returns the fractional part of a floating-point number. For example, an input of 2.718281828459 would yield a result of 0.718281828459. This function only works with floats, doubles, and floating-point audio samples.
The natural (base e) logarithm of a number.
The base 10 logarithm of a number.
This function returns 1 if the number is positive, -1 if the number is negative, or zero if the number is zero. This function works with integers, floats and doubles, as well as integer and floating-point audio samples. It has no meaning on complex numbers and therefore does not accept them as input.
The sine function
The hyperbolic sine function (ex-e-x)/2.
The square root function
The tangent function
The hyperbolic tangent function (ex-e-x)/(ex+e-x)
See Also
- OSW Programming Details
- Expr
- Random