Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Formulas: Numerical functions.

Formulas: Numerical functions: Difference between revisions

From MoodleDocs
(Created page with "{{Formulas question type}} ==Numerical functions== The numerical functions available in the Formulas question type are listed in the table below: {| class="nicetable" |- ! F...")
 
Line 55: Line 55:
| expm1(x)
| expm1(x)
|  
|  
|-
| fact(x)
| Factorial of x. Gives the numerical value up to fact(170) and INF thereafter.
|-
|-
| floor(x)
| floor(x)

Revision as of 06:05, 2 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.
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.


Back to top of page

← FORMULAS QUESTION TYPE