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
(Redirected page to Formulas question type)
 
Line 1: Line 1:
{{Formulas question type}}
#REDIRECT [[Formulas_question_type]]
 
==Numerical functions==
The numerical functions available in the Formulas question type are listed in the table below:
 
{| class="nicetable"
|-
! Function
! Definition
|-
| colspan="2" | ''No argument''
|-
|-
| pi()
| Value of π (=3.14159...)
|-
| colspan="2" | ''One argument''
|-
| abs(x)
| Absolute value
|-
| acos(x)
| Arccosine (in radians)<br>acos(x) returns a numeric value between 0 and π radians for x between -1 and 1, otherwise NAN<br>Examples:<br>acos(-2) = NAN<br>acos(-1) = 3.1415926535898<br>acos(0) = 1.5707963267949<br>acos(0.5) = 1.0471975511966<br>acos(1) = 0<br>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<br>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<br>exp(x) = e<sup>x</sup> 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 [[Formulas:_More_examples#Factorial|these examples ↗]].
|-
| floor(x)
| Floor function<br>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
|-
| colspan="2" | ''Two arguments''
|-
| atan2(y,x)
|
|-
| fmod(x,y)
|
|-
| log(x,base)
|
|-
| pow(x,y)
| The base x taken to the exponent y<br>pow(x,y) = x<sup>y</sup>
|-
| round(x,precision)
|
|-
| colspan="2" | ''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.
 
 
[[#top|Back to top of page]]
 
[[Formulas_question_type|← FORMULAS QUESTION TYPE]]
 
===In other languages===
[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]

Latest revision as of 00:59, 1 February 2018