# Mathematical Functions

A set of mathematical and trigonometric functions.

Math functions were originally designed to perform relevant operations on scalar values. From this build on, most of the functions can be applied to matrices and vectors. These include MathAbs, MathArccos, MathArcsin, MathArctan, MathCeil, MathCos, MathExp, MathFloor, MathLog, MathLog10, MathMod, MathPow, MathRound, MathSin, MathSqrt, MathTan, MathExpm1, MathLog1p, MathArccosh, MathArcsinh, MathArctanh, MathCosh, MathSinh, and MathTanh. Such operations imply element-wise handling of matrices or vectors. Example:

 //---   matrix a= {{1, 4}, {9, 16}};   Print("matrix a=\n",a);   a=MathSqrt(a);   Print("MatrSqrt(a)=\n",a);   /*    matrix a=    [[1,4]     [9,16]]    MatrSqrt(a)=    [[1,2]     [3,4]]   */

For MathMod and MathPow, the second element can be either a scalar or a matrix/vector of the appropriate size.

Function

Action

MathAbs

Returns absolute value (modulus) of the specified numeric value

MathArccos

Returns the arc cosine of x in radians

MathArcsin

Returns the arc sine of x in radians

MathArctan

Returns the arc tangent of x in radians

MathArctan2

Return the angle (in radians) whose tangent is the quotient of two specified numbers

MathClassify

Returns the type of a real number

MathCeil

Returns integer numeric value closest from above

MathCos

Returns the cosine of a number

MathExp

Returns exponent of a number

MathFloor

Returns integer numeric value closest from below

MathLog

Returns natural logarithm

MathLog10

Returns the logarithm of a number by base 10

MathMax

Returns the maximal value of the two numeric values

MathMin

Returns the minimal value of the two numeric values

MathMod

Returns the real remainder after the division of two numbers

MathPow

Raises the base to the specified power

MathRand

Returns a pseudorandom value within the range of 0 to 32767

MathRound

Rounds of a value to the nearest integer

MathSin

Returns the sine of a number

MathSqrt

Returns a square root

MathSrand

Sets the starting point for generating a series of pseudorandom integers

MathTan

Returns the tangent of a number

MathIsValidNumber

Checks the correctness of a real number

MathExpm1

Returns the value of the expression MathExp(x)-1

MathLog1p

Returns the value of the expression MathLog(1+x)

MathArccosh

Returns the hyperbolic arccosine

MathArcsinh

Returns the hyperbolic arcsine

MathArctanh

Returns the hyperbolic arctangent

MathCosh

Returns the hyperbolic cosine

MathSinh

Returns the hyperbolic sine

MathTanh

Returns the hyperbolic tangent

MathSwap

Change the order of bytes in the ushort/uint/ushort types value