Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

(no description)

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

Defines 1 class

MathTrig:: (51 methods):
  factors()
  romanCut()
  ATAN2()
  CEILING()
  COMBIN()
  EVEN()
  FACT()
  FACTDOUBLE()
  FLOOR()
  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

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 the inverse tangent of the specified x- and y-coordinates

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 Rounded Number

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 Number of combinations

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 Rounded Number

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 Factorial

FACTDOUBLE($factVal)   X-Ref
FACTDOUBLE.

Returns the double factorial of a number.

Excel Function:
FACTDOUBLE(factVal)

param: float $factVal Factorial Value
return: int Double Factorial

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 Rounded Number

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 Greatest Common Divisor

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 Integer value

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 Lowest Common Multiplier

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

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

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

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

param: array $matrixData1 A matrix of values
param: array $matrixData2 A matrix of values
return: array

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

param: int $a Dividend
param: int $b Divisor
return: int Remainder

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 Rounded Number

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

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

param: array of mixed Data Series
return: float

ODD($number)   X-Ref
ODD.

Returns number rounded up to the nearest odd integer.

param: float $number Number to round
return: int Rounded Number

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

Computes x raised to the power y.

param: float $x
param: float $y
return: float

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 Rounded Number

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 Rounded Number

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

Returns the sum of a power series

param: float $x Input value to the power series
param: float $n Initial power to which you want to raise $x
param: float $m Step by which to increase $n for each term in the series
param: array of mixed Data Series
return: float

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 sign value

SQRTPI($number)   X-Ref
SQRTPI.

Returns the square root of (number * pi).

param: float $number Number
return: float Square Root of Number * Pi

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

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

SUBTOTAL(...$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
param: string $condition the criteria that defines which cells will be summed
return: float

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

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

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

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 Truncated value

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