Math functions
OSW includes several basic and advanced math functions, which are described below. Each function accepts numerical types (Integers, Floats, Doubles, Complex and DoubleComplex) 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 inverse hyperbolic cosine function.
The inverse cotangent function.
The inverse hyperbolic cotangent function.
The inverse cosecent function.
The inverse hyperbolic cosecent function.
The inverse secant function.
The inverse hyperbolic secant function.
The arcsine, or inverse sine function.
The inverse hyperbolic sine function.
The arctangent, or inverse tangent function.
The inverse hyperbolic 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 cotangent (1/tan) function.
The hyperbolic cotangent function.
The cosecant (1/sin) function.
The hyperbolic cosecant function.
The natural inverse logarithm (i.e., ex ).
The factorial function for integers. For the factorial function of real-valued numbers, see Gamma.
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 gamma function, which is similar to the factorial function on real-valued numbers: gamma(x+1) = x!
The greatest-common divisor of two numbers. The greatest-common divisor of two numbers a and b is the largest number g that evenly divides both a and b (i.e., a/g and b/g are both integers.)
The natural (base e) logarithm of a number.
The base 10 logarithm of a number.
The secant (1/cos) function.
The hyperbolic secant function.
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 sinc function: sin(x)/x
The hyperbolic sine function (ex-e-x)/2.
The hyperbolic sinc function: sinh(x)/x
The square root function
The tangent function
The hyperbolic tangent function (ex-e-x)/(ex+e-x)
See Also
- OSW Programming Details
- Complex number functions
- Expr
- Random