Mathematical Functions

Mathematical functions operate on any numeric data type. They return the appropriate data type, performing any necessary data-type conversion. When using a mathematical function in a value expression, note the following:

In a scalar value expression, each argument must itself be a scalar value expression.

In an array expression, each argument can be either a scalar-value expression or an array value expression.

A scalar value expression is promoted to an appropriately-sized array.

An array expression must resolve to an array of an appropriate size and dimension for the defining object.

AVS/Express supports the following mathematical functions in V code:

Mathematical Function

Description

abs(num)

Returns the absolute value of num, where num is any valid numeric expression.

acos(angle)

Returns the arc cosine of angle, where angle is any valid numeric expression representing an angle measurement in radians.

add( addend1 , addend2 ,...)

Returns sum , where sum is calculated as:

      sum = addend1 + addend2 + ...

In this function, addend1 , addend2 , ... are any valid numeric expressions.

asin(angle)

Returns the arc sine of angle, where angle is any valid numeric expression representing an angle measurement in radians.

atan(angle)

Returns the arc tangent of angle, where angle is any valid numeric expression representing an angle measurement in radians.

cos(angle)

Returns the cosine of angle, where angle is any valid numeric expression representing an angle measurement in radians.

cosh(angle)

Returns the hyperbolic cosine of angle, where angle is any valid numeric expression representing an angle measurement in radians.

deviation( array )

Returns the standard deviation of the elements of the the specified array. The array elements must be numeric types.

divide(dividend,divisor1,divisor2,...)

Returns quotient , where quotient is calculated as:

      quotient =   dividend / divisor / divisor2 / ...

In this function, dividend, divisor1 , divisor2 , ... are any valid numeric expressions.

exp(x)

Returns e x ; that is, e (the natural logarithmic base) raised to the x th power.

log(x)

Returns the natural (base e) logarithm of x.

log10(x)

Returns the common (base 10) logarithm of x.

modulo( num1 , num2 ,...)

Returns the result of the modulus operation, calculated as follows:

      result =   num1 % num2 % ...

In this function, arg1 , arg2 , ... are any valid numeric expressions.

multiply( factor1 , factor2 ,...)

Returns product , where product is calculated as follows:

      product =   factor1 * factor2 * ...

In this function, factor1 , factor2 , ... are any valid numeric expressions.

pow(x, y)

Returns x y ; that is, x raised to the y th power.

rand(range, seed)

Returns a random scalar value or an array of values between 0 and range. If you do not specify a seed argument, the function uses the object ID of the rand object as its seed.

sin(angle)

Returns the sine of angle, where angle is any valid numeric expression representing an angle measurement in radians.

sinh(angle)

Returns the hyperbolic sine of angle, where angle is any valid numeric expression representing an angle measurement in radians.

sqrt(x)

Returns the square root of x, where x is any valid numeric expressions.

strcmp( str1 , str2 )

Returns a value that indicates the result comparing str1 and str2 , where str1, str2 are any string values:

-- Returns 0 if the strings are equivalent.
-- Returns a nonzero value f the strings are not     equivalent.

strlen( str )

Returns the length of str , where str is any string value.

sub(minuend,subtrahend1,subtrahend2,...)

Returns diff , where diff is calculated as follows:

      diff =   minuend - subtrahend1 - subtrahend2 - ...

In this function, minuend , subtrahend1 , subtrahend2 , ... are any valid numeric expressions.

tan(angle)

Returns the tangent of angle, where angle is any valid numeric expression representing an angle measurement in radians.

tanh(angle)

Returns the hyperbolic tangent of angle, where angle is any valid numeric expression representing an angle measurement in radians.