The protocols module provides support for mathematical functions and operators commonly used in programming or scripting environments, such as Python, MATLAB, R, Julia, JavaScript, C/C++, and other scientific computing languages like Octave and Scilab. Below is a list of the supported mathematical operators.
Common Operators:
• + -Add
• I - Divide
• * - Multiply
• - - Subtract
Trigonometric Functions:
• sin - sine of a number
• cos - cosine of the specified angle (in radians)
• tan - tangent of a number
• asin - arcsine (in radians) of a number
• acos - arccosine (in radians) of a number
• atan - arctangent (in radians) of a number
• acot - Calculate the inverse cotangent of a value
• ascs - Calculate the inverse cosecant of a value
• asec - Calculate the inverse secant of a value
• cot - Compute the cotangent of x in radians
• csc - Compute the cosecant of x in radians
• sec - Compute the secant of x in radians
• atan2 - Computes the principal value of the arctangent of y/x in radians
Hyperbolic Functions:
• sinh - hyperbolic sine of a number
• cosh - hyperbolic cosine of a number
• tanh - hyperbolic tangent of a number
• asinh - hyperbolic arcsine of a number
• acosh - hyperbolic arc-cosine of a number
• atanh - hyperbolic arctangent of a number
• acoth - Calculate the hyperbolic arccotangent of a value
• ascsh - Calculate the hyperbolic arccosecant of a value
• asech - Calculate the hyperbolic secant of a value
Exponential and Logarithmic Functions:
• exp - ex, where x is the argument, and e is Euler's number
• log - Natural logarithm (base e) of a number
• loglO - Base 10 logarithm of a number Rounding and Absolute Functions:
• ceil - Rounds a number up to the next largest integer
• floor - Round a value down towards the next smallest integer
• round - Value of a number rounded to the nearest integer
• abs -Absolute value of a number
Power and Square Root Functions:
• " - Power/Exponentiation
• square - Square of a value
• sqrt - Square root
• cube - Cube of a value
• nthRoot - nth root of a value
Random Number Functions:
• random - Pseudo-random floating point in the range O to less than 1
• randomlnt - Return a random integer number
Statistical Functions:
• max - Largest of the zero or more numbers given as input parameters
• min - Lowest-valued number passed into it, or NaN if any parameter isn't a number and can't be converted into one
• mean - Compute the arithmetic mean of a list of values
• median - Compute the median of all values
• prod - Compute the product of all values
• std - Compute the standard deviation of all values
• sum - Compute the sum of all values
Other Mathematical Functions:
• sign - Positive or negative+/- 1, indicating the sign of a number passed into the argument
• gcd - Greatest common divisor
• 1cm - Least common multiple
• norm - Norm of a number, vector, or matrix
• xgcd - Extended greatest common divisor for two values
• bitAnd - Bitwise AND operation
• bitNot - Bitwise NOT operation
• bitOr - Bitwise OR operation
• bitXor - Bitwise XOR operation
• bitleftShift [«] - Bitwise left logical shift of a value x by y number of bits
• bitRightArithShift [»] - Bitwise right arithmetic shift of a value x by y number of bits
• bitRightlogShift [»>] - Bitwise right logical shift of a value x by y number of bits
• bigNumber - Big number from a number or string
• boolean - Convert a string or number into a Boolean
• complex - Create a complex number
• string - Converts number to string
• mod [%] - Calculates the remainder of an integer division
• unaryMinus - Inverse the sign of a value. Converts strings to numbers (Booleans not supported)
• unaryPlus - Converts strings to numbers (Booleans not supported)• factorial [!] - Compute the factorial of a value
• gamma - Compute the gamma function
• permutations - number of permutations of n items taken
k at a time
• pickRandom - Pick a random entry from a given array (only one arg supported)
• compare - Compare two values
• deepEqual - Check equality of two matrices element-wise
• equal [==] - Check equality of two objects
• larger[>] - Check if value xis larger than y
• smaller[<] - Check if value xis smaller than y
• largerEq [>=] - Check if value x is larger or equal to y
• smallerEq [ <=] - Check if value xis smaller or equal toy
• unequal[!=] - Check non-equality of two values (works with other equality checks, append ! to reverse the process)
• range - Create a range
• clone - Clone a variable
• format - Format a value of any type as a string
• number - Create a number or convert a string or Boolean into a number (limited to real numbers)
• ternary operator[?] - Sets up a basic If-Else operation
between two values
• combinations - Number of combinations of n items taken
k at a time
Note: Complex numbers are technically supported but need to be wrapped in the complex method.