Math Functions
Math functions provide means for performing complex mathematical calculations.
The examples for each function use the following notation:
- Square brackets (
[]) indicate arrays. - Curly braces (
{}) indicate groups. - Arrows (
==>) separate inputs and outputs. Inputs are shown on the left side of the arrow. Outputs are shown on the right side of the arrow.
Abs
The Abs function returns the absolute value of the input.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: An integer or float.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Integer or float. The output datatype matches the input datatype. |
Examples
abs(-9.6) => 9.6
abs(12) => 12
abs(-1E-6) => -1000000
abs([-1,-2,-3]) ==> [1,2,3]
abs({-1,-2,-3}) ==> {1,2,3}
abs({[-1,-2,-3],[-2,3,4],[-3,-4,-5]}) ==> {[1,2,3],[2,3,4],[3,4,5]}
Cos
The Cos function returns the input's cosine.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: A float.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | unit (Default: rad): The unit of the arg value, either deg (degrees) or rad (radians). |
| Output Datatype(s) | Float |
Examples
cos(pi) ==> 1
cos(pi/2) ==> 0
cos(180, unit=deg) ==> 1
cos(90, unit=deg) ==> 0
cos(null) ==> null
cos([0,pi/2,pi,3pi/2]) ==> [1,0,1,0]
cos([0,90,180,270], unit=deg) ==> [1,0,1,0]
cos([null,pi,null]) ==> [null,1,null]
cos(|0,pi/2,pi,3pi/2|) ==> |0,1,0,1|
cos(|0,90,180,270|, unit=deg) ==> |0,1,0,1|
cos(|null,pi,null|) ==> |null,1,null|
cos(|[0,pi/2,pi,3pi/2],[]) ==> |[1,0,1,0],[],[]|
ln
The ln function returns the natural log of the input.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: An integer or float.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Float |
Examples
ln(-9.6) => null
ln(12) => 2.48490664979
ln(1E-6) => -13.815510558
ln([1,2,3]) ==> [0.0,0.69314718056,1.09861228867]
ln({1,2,3}) ==> {0.0,0.69314718056,1.09861228867}
ln({[1,2,3],[1,2,3],[1,2,3]}) ==> {[0.0,0.69314718056,1.09861228867],[0.0,0.69314718056,1.09861228867],[0.0,0.69314718056,1.09861228867]}
log10
The log10 function returns the common log of the input.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | TBD |
| Mandatory Argument Names and Datatypes | arg: An integer or float.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Float |
Examples
log10(-9.6) => null?
log10(12) => 1.07918124605
log10(1E-6) => -6.0
log10([10,100,1000]) ==> [1.0,2.0,3.0]
log10({10,100,1000}) ==> {1.0,2.0,3.0}
log10({[10,100,1000,3],[10,100,1000],[10,100,1000]}) ==> {[1.0,2.0,3.0],[1.0,2.0,3.0],[1.0,2.0,3.0]}
Power
The Power function calculates exponential values by taking an entered value and raising it to the specified power.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 2 |
| Mandatory Argument Names and Datatypes |
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Integer |
Examples
pow(9,2) ==> 81
pow(2,|2,3,4|) ==> |4,8,16|
pow([1,2,3],2) ==> [1,4,9]
pow({1,2,3},2) ==> {1,4,8}
pow({1,2,3},{1,2,3}) ==> {1,4,27}
pow({[1,2,3],[1,2,3],[1,2,3]},2) ==> pow([1,4,9],[1,4,9],[1,4,9])
Random Int
The Random Int function returns a random integer.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 0 |
| Mandatory Argument Names and Datatypes | N/A |
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Integer |
Examples
rand() ==> 14
Round
The Round function rounds an entered float (floating point number) to the specified number of places.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 2 |
| Mandatory Argument Names and Datatypes |
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Float |
Examples
round(7.859327) ==> 8.0
round(7.859327,2) ==> 7.86
round({103.383,7.863,6.3477},2) ==> {103.38,7.86,6.35}
round({103.383,7.863,6.3477},{2,3,5}) ==> {103.38,7.863,6.3477}
round([103.383,7.863,6.3477],2) ==> [103.38,7.86,6.35]
round({[103.383,7.863,6.3477],[103.383,7.863,6.3477],[103.383,7.863,6.3477]},2) ==> {[103.38,7.86,6.35],[103.38,7.86,6.35],[103.38,7.86,6.35]}
Sin
The Sin function returns the input's sine.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: A float.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | unit (Default: rad): The unit of the arg value, either deg (degrees) or rad (radians). |
| Output Datatype(s) | Float |
Examples
sin(pi) ==> 0
sin(pi/2) ==> 1
sin(180, unit=deg) ==> 0
sin(90, unit=deg) ==> 1
sin(null) ==> null
sin([0,pi/2,pi,3pi/2]) ==> [0,1,0,1]
sin([0,90,180,270], unit=deg) ==> [0,1,0,1]
sin([null,pi,null]) ==> [null,0,null]
sin(|0,pi/2,pi,3pi/2|) ==> |0,1,0,1|
sin(|0,90,180,270|, unit=deg) ==> |0,1,0,1|
sin(|null,pi,null|) ==> |null,0,null|
sin(|[0,pi/2,pi,3pi/2],[]|) ==> |[0,1,0,1],[],[]|
Sqrt
The Sqrt function returns the square root of the entered value.
Note
The input must be positive. Otherwise, the
Sqrtfunction returns an error.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: An integer or float.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Float |
Examples
sqrt(-9.6) => null?
sqrt(16) => 4.0
sqrt(1E-6) => ??
sqrt([4,9,16]) ==> [2.0,3.0,4.0]
sqrt({4,9,16}) ==> {2.0,3.0,4.0}
sqrt({[4,9,16],[4,9,16],[4,9,16]}) ==> {[2.0,3.0,4.0],[2.0,3.0,4.0],[2.0,3.0,4.0]}
Tan
The Tan function returns the input's tangent.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: A float.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | unit (Default: rad): The unit of the arg value, either deg (degrees) or rad (radians). |
| Output Datatype(s) | Float |
Examples
tan(pi) ==> 0
tan(pi/2) ==> null
tan(180, unit=deg) ==> 0
tan(90, unit=deg) ==> null
tan(null) ==> null
tan([0,pi/4,pi/2,pi]) ==> [0,1,null,0]
tan([0,45,90,180], unit=deg) ==> [0,1,null,0]
tan([null,pi,null]) ==> [null,0,null]
tan(|0,pi/4,pi/2,pi|) ==> |0,1,null,0|
tan(|0,45,90,180|, unit=deg) ==> |0,1,null,0|
tan(|null,pi,null|) ==> |null,0,null|
tan(|[0,pi/2,pi,3pi/2],[]) ==> |[1,0,1,0],[],[]|