Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

(no description)

File Size: 1823 lines (53 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MathTrig:: (56 methods):
  factors()
  romanCut()
  ARABIC()
  calculateArabic()
  ATAN2()
  BASE()
  CEILING()
  COMBIN()
  EVEN()
  FACT()
  FACTDOUBLE()
  FLOOR()
  FLOORMATH()
  FLOORPRECISE()
  evaluateGCD()
  GCD()
  INT()
  LCM()
  logBase()
  MDETERM()
  MINVERSE()
  MMULT()
  MOD()
  MROUND()
  MULTINOMIAL()
  ODD()
  POWER()
  PRODUCT()
  QUOTIENT()
  RAND()
  ROMAN()
  ROUNDUP()
  ROUNDDOWN()
  SERIESSUM()
  SIGN()
  SQRTPI()
  filterHiddenArgs()
  filterFormulaArgs()
  SUBTOTAL()
  SUM()
  SUMIF()
  SUMIFS()
  SUMPRODUCT()
  SUMSQ()
  SUMX2MY2()
  SUMX2PY2()
  SUMXMY2()
  TRUNC()
  SEC()
  SECH()
  CSC()
  CSCH()
  COT()
  COTH()
  ACOT()
  ACOTH()


Class: MathTrig  - X-Ref

factors($value)   X-Ref
No description

romanCut($num, $n)   X-Ref
No description

ARABIC($roman)   X-Ref
ARABIC.

Converts a Roman numeral to an Arabic numeral.

Excel Function:
ARABIC(text)

param: string $roman
return: int|string the arabic numberal contrived from the roman numeral

calculateArabic(array $roman, &$sum = 0, $subtract = 0)   X-Ref
Recursively calculate the arabic value of a roman numeral.

param: int $sum
param: int $subtract
return: int

ATAN2($xCoordinate = null, $yCoordinate = null)   X-Ref
ATAN2.

This function calculates the arc tangent of the two variables x and y. It is similar to
calculating the arc tangent of y รท x, except that the signs of both arguments are used
to determine the quadrant of the result.
The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
-pi and pi, excluding -pi.

Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard
PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.

Excel Function:
ATAN2(xCoordinate,yCoordinate)

param: float $xCoordinate the x-coordinate of the point
param: float $yCoordinate the y-coordinate of the point
return: float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error

BASE($number, $radix, $minLength = null)   X-Ref
BASE.

Converts a number into a text representation with the given radix (base).

Excel Function:
BASE(Number, Radix [Min_length])

param: float $number
param: float $radix
param: int $minLength
return: string the text representation with the given radix (base)

CEILING($number, $significance = null)   X-Ref
CEILING.

Returns number rounded up, away from zero, to the nearest multiple of significance.
For example, if you want to avoid using pennies in your prices and your product is
priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the
nearest nickel.

Excel Function:
CEILING(number[,significance])

param: float $number the number you want to round
param: float $significance the multiple to which you want to round
return: float|string Rounded Number, or a string containing an error

COMBIN($numObjs, $numInSet)   X-Ref
COMBIN.

Returns the number of combinations for a given number of items. Use COMBIN to
determine the total possible number of groups for a given number of items.

Excel Function:
COMBIN(numObjs,numInSet)

param: int $numObjs Number of different objects
param: int $numInSet Number of objects in each combination
return: int|string Number of combinations, or a string containing an error

EVEN($number)   X-Ref
EVEN.

Returns number rounded up to the nearest even integer.
You can use this function for processing items that come in twos. For example,
a packing crate accepts rows of one or two items. The crate is full when
the number of items, rounded up to the nearest two, matches the crate's
capacity.

Excel Function:
EVEN(number)

param: float $number Number to round
return: int|string Rounded Number, or a string containing an error

FACT($factVal)   X-Ref
FACT.

Returns the factorial of a number.
The factorial of a number is equal to 1*2*3*...* number.

Excel Function:
FACT(factVal)

param: float $factVal Factorial Value
return: int|string Factorial, or a string containing an error

FACTDOUBLE($factVal)   X-Ref
FACTDOUBLE.

Returns the double factorial of a number.

Excel Function:
FACTDOUBLE(factVal)

param: float $factVal Factorial Value
return: int|string Double Factorial, or a string containing an error

FLOOR($number, $significance = null)   X-Ref
FLOOR.

Rounds number down, toward zero, to the nearest multiple of significance.

Excel Function:
FLOOR(number[,significance])

param: float $number Number to round
param: float $significance Significance
return: float|string Rounded Number, or a string containing an error

FLOORMATH($number, $significance = null, $mode = 0)   X-Ref
FLOOR.MATH.

Round a number down to the nearest integer or to the nearest multiple of significance.

Excel Function:
FLOOR.MATH(number[,significance[,mode]])

param: float $number Number to round
param: float $significance Significance
param: int $mode direction to round negative numbers
return: float|string Rounded Number, or a string containing an error

FLOORPRECISE($number, $significance = 1)   X-Ref
FLOOR.PRECISE.

Rounds number down, toward zero, to the nearest multiple of significance.

Excel Function:
FLOOR.PRECISE(number[,significance])

param: float $number Number to round
param: float $significance Significance
return: float|string Rounded Number, or a string containing an error

evaluateGCD($a, $b)   X-Ref
No description

GCD(...$args)   X-Ref
GCD.

Returns the greatest common divisor of a series of numbers.
The greatest common divisor is the largest integer that divides both
number1 and number2 without a remainder.

Excel Function:
GCD(number1[,number2[, ...]])

param: mixed ...$args Data values
return: int|mixed|string Greatest Common Divisor, or a string containing an error

INT($number)   X-Ref
INT.

Casts a floating point value to an integer

Excel Function:
INT(number)

param: float $number Number to cast to an integer
return: int|string Integer value, or a string containing an error

LCM(...$args)   X-Ref
LCM.

Returns the lowest common multiplier of a series of numbers
The least common multiple is the smallest positive integer that is a multiple
of all integer arguments number1, number2, and so on. Use LCM to add fractions
with different denominators.

Excel Function:
LCM(number1[,number2[, ...]])

param: mixed ...$args Data values
return: int|string Lowest Common Multiplier, or a string containing an error

logBase($number = null, $base = 10)   X-Ref
LOG_BASE.

Returns the logarithm of a number to a specified base. The default base is 10.

Excel Function:
LOG(number[,base])

param: float $number The positive real number for which you want the logarithm
param: float $base The base of the logarithm. If base is omitted, it is assumed to be 10.
return: float|string The result, or a string containing an error

MDETERM($matrixValues)   X-Ref
MDETERM.

Returns the matrix determinant of an array.

Excel Function:
MDETERM(array)

param: array $matrixValues A matrix of values
return: float|string The result, or a string containing an error

MINVERSE($matrixValues)   X-Ref
MINVERSE.

Returns the inverse matrix for the matrix stored in an array.

Excel Function:
MINVERSE(array)

param: array $matrixValues A matrix of values
return: array|string The result, or a string containing an error

MMULT($matrixData1, $matrixData2)   X-Ref
MMULT.

param: array $matrixData1 A matrix of values
param: array $matrixData2 A matrix of values
return: array|string The result, or a string containing an error

MOD($a = 1, $b = 1)   X-Ref
MOD.

param: int $a Dividend
param: int $b Divisor
return: int|string Remainder, or a string containing an error

MROUND($number, $multiple)   X-Ref
MROUND.

Rounds a number to the nearest multiple of a specified value

param: float $number Number to round
param: int $multiple Multiple to which you want to round $number
return: float|string Rounded Number, or a string containing an error

MULTINOMIAL(...$args)   X-Ref
MULTINOMIAL.

Returns the ratio of the factorial of a sum of values to the product of factorials.

param: mixed[] $args An array of mixed values for the Data Series
return: float|string The result, or a string containing an error

ODD($number)   X-Ref
ODD.

Returns number rounded up to the nearest odd integer.

param: float $number Number to round
return: int|string Rounded Number, or a string containing an error

POWER($x = 0, $y = 2)   X-Ref
POWER.

Computes x raised to the power y.

param: float $x
param: float $y
return: float|string The result, or a string containing an error

PRODUCT(...$args)   X-Ref
PRODUCT.

PRODUCT returns the product of all the values and cells referenced in the argument list.

Excel Function:
PRODUCT(value1[,value2[, ...]])

param: mixed ...$args Data values
return: float

QUOTIENT(...$args)   X-Ref
QUOTIENT.

QUOTIENT function returns the integer portion of a division. Numerator is the divided number
and denominator is the divisor.

Excel Function:
QUOTIENT(value1[,value2[, ...]])

param: mixed ...$args Data values
return: float

RAND($min = 0, $max = 0)   X-Ref
RAND.

param: int $min Minimal value
param: int $max Maximal value
return: int Random number

ROMAN($aValue, $style = 0)   X-Ref
No description

ROUNDUP($number, $digits)   X-Ref
ROUNDUP.

Rounds a number up to a specified number of decimal places

param: float $number Number to round
param: int $digits Number of digits to which you want to round $number
return: float|string Rounded Number, or a string containing an error

ROUNDDOWN($number, $digits)   X-Ref
ROUNDDOWN.

Rounds a number down to a specified number of decimal places

param: float $number Number to round
param: int $digits Number of digits to which you want to round $number
return: float|string Rounded Number, or a string containing an error

SERIESSUM(...$args)   X-Ref
SERIESSUM.

Returns the sum of a power series

param: mixed[] $args An array of mixed values for the Data Series
return: float|string The result, or a string containing an error

SIGN($number)   X-Ref
SIGN.

Determines the sign of a number. Returns 1 if the number is positive, zero (0)
if the number is 0, and -1 if the number is negative.

param: float $number Number to round
return: int|string sign value, or a string containing an error

SQRTPI($number)   X-Ref
SQRTPI.

Returns the square root of (number * pi).

param: float $number Number
return: float|string Square Root of Number * Pi, or a string containing an error

filterHiddenArgs($cellReference, $args)   X-Ref
No description

filterFormulaArgs($cellReference, $args)   X-Ref
No description

SUBTOTAL($functionType, ...$args)   X-Ref
No description

SUM(...$args)   X-Ref
SUM.

SUM computes the sum of all the values and cells referenced in the argument list.

Excel Function:
SUM(value1[,value2[, ...]])

param: mixed ...$args Data values
return: float

SUMIF($aArgs, $condition, $sumArgs = [])   X-Ref
SUMIF.

Counts the number of cells that contain numbers within the list of arguments

Excel Function:
SUMIF(value1[,value2[, ...]],condition)

param: mixed $aArgs Data values
param: string $condition the criteria that defines which cells will be summed
param: mixed $sumArgs
return: float

SUMIFS(...$args)   X-Ref
SUMIFS.

Counts the number of cells that contain numbers within the list of arguments

Excel Function:
SUMIFS(value1[,value2[, ...]],condition)

param: mixed $args Data values
return: float

SUMPRODUCT(...$args)   X-Ref
SUMPRODUCT.

Excel Function:
SUMPRODUCT(value1[,value2[, ...]])

param: mixed ...$args Data values
return: float|string The result, or a string containing an error

SUMSQ(...$args)   X-Ref
SUMSQ.

SUMSQ returns the sum of the squares of the arguments

Excel Function:
SUMSQ(value1[,value2[, ...]])

param: mixed ...$args Data values
return: float

SUMX2MY2($matrixData1, $matrixData2)   X-Ref
SUMX2MY2.

param: mixed[] $matrixData1 Matrix #1
param: mixed[] $matrixData2 Matrix #2
return: float

SUMX2PY2($matrixData1, $matrixData2)   X-Ref
SUMX2PY2.

param: mixed[] $matrixData1 Matrix #1
param: mixed[] $matrixData2 Matrix #2
return: float

SUMXMY2($matrixData1, $matrixData2)   X-Ref
SUMXMY2.

param: mixed[] $matrixData1 Matrix #1
param: mixed[] $matrixData2 Matrix #2
return: float

TRUNC($value = 0, $digits = 0)   X-Ref
TRUNC.

Truncates value to the number of fractional digits by number_digits.

param: float $value
param: int $digits
return: float|string Truncated value, or a string containing an error

SEC($angle)   X-Ref
SEC.

Returns the secant of an angle.

param: float $angle Number
return: float|string The secant of the angle

SECH($angle)   X-Ref
SECH.

Returns the hyperbolic secant of an angle.

param: float $angle Number
return: float|string The hyperbolic secant of the angle

CSC($angle)   X-Ref
CSC.

Returns the cosecant of an angle.

param: float $angle Number
return: float|string The cosecant of the angle

CSCH($angle)   X-Ref
CSCH.

Returns the hyperbolic cosecant of an angle.

param: float $angle Number
return: float|string The hyperbolic cosecant of the angle

COT($angle)   X-Ref
COT.

Returns the cotangent of an angle.

param: float $angle Number
return: float|string The cotangent of the angle

COTH($angle)   X-Ref
COTH.

Returns the hyperbolic cotangent of an angle.

param: float $angle Number
return: float|string The hyperbolic cotangent of the angle

ACOT($number)   X-Ref
ACOT.

Returns the arccotangent of a number.

param: float $number Number
return: float|string The arccotangent of the number

ACOTH($number)   X-Ref
ACOTH.

Returns the hyperbolic arccotangent of a number.

param: float $number Number
return: float|string The hyperbolic arccotangent of the number