Formulas: Numerical functions: Difference between revisions
From MoodleDocs
Line 135: | Line 135: | ||
===In other languages=== | ===In other languages=== | ||
[https://docs.moodle.org/all/es/ | [https://docs.moodle.org/all/es/F%C3%B3rmulas:_Funciones_num%C3%A9ricas Español]<br> | ||
[https://docs.moodle.org/3x/fr/Formules:_Fonctions_numériques Français] | [https://docs.moodle.org/3x/fr/Formules:_Fonctions_numériques Français] |
Revision as of 05:11, 8 January 2018
Numerical functions
The numerical functions available in the Formulas question type are listed in the table below:
Function | Definition |
---|---|
No argument | |
pi() | Value of π (=3.14159...) |
One argument | |
abs(x) | Absolute value |
acos(x) | Arccosine (in radians) acos(x) returns a numeric value between 0 and π radians for x between -1 and 1, otherwise NAN Examples: acos(-2) = NAN acos(-1) = 3.1415926535898 acos(0) = 1.5707963267949 acos(0.5) = 1.0471975511966 acos(1) = 0 acos(2) = NAN |
acosh(x) | Inverse hyperbolic cosine |
asin(x) | Arcsine (in radians) |
asinh(x) | Inverse hyperbolic sine |
atan(x) | Arctangent (in radians) |
atanh(x) | Inverse hyperbolic tangent |
ceil(x) | Ceiling function ceil(x) = ⌈x⌉ is the smallest integer greater or equal to x |
cos(x) | Cosine of a value given in radians |
cosh() | Hyperbolic cosine |
deg2rad() | Converts a degree value to a radian value |
exp(x) | Exponential function exp(x) = ex where (= 2.71828...) is the base of the natural logarithm |
expm1(x) | |
fact(x) | Factorial of x. Gives the numerical value up to fact(170) and INF thereafter. See examples. |
floor(x) | Floor function floor(x) = ⌊x⌋ is the largest integer less than or equal to x |
is_finite(x) | |
is_infinite(x) | |
is_nan(x) | |
log(x) | |
log10x() | |
log1px() | |
rad2deg(x) | Converts a radian value to a degree value |
round(x) | Rounds a value to the nearest integer |
sin(x) | Sine of a value given in radians |
sinh(x) | Hyperbolic sine |
sqrt(x) | Square root |
tan(x) | Tangent of a value given in radians |
tanh(x) | Hyperbolic tangent |
Two arguments | |
atan2(y,x) | |
fmod(x,y) | |
log(x,base) | |
pow(x,y) | The base x taken to the exponent y pow(x,y) = xy |
round(x,precision) | |
Several arguments | |
min(x1,x2,...) | Returns the lowest value |
max(x1,x2,...) | Returns the highest value |
Note that the functions used in the variable assignments is (almost) a superset of the functions used in the algebraic formulas.