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]}
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]}
Sqrt
The Sqrt
function returns the square root of the entered value.
Note
The input must be positive. Otherwise, the
Sqrt
function 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]}