public static function binomialCoefficient(n:int, k:int):Number
Calculate the binomial coefficient of two integers
Parameters
| n:int — A non-negative integer.
|
| |
| k:int — An integer.
|
Returns
| Number — The binomial coefficient of n and k.
|
public static function factorial(n:int):Number
Calculate the factorial of an integer.
Parameters
| n:int — An integer for which to calculate the factorial.
|
Returns
| Number — The factorial of integer n.
|
public static function gcd(a:Number, b:Number, ... rest):Number
Calculate the greatest common denominator of a set of numbers.
Parameters
| a:Number — A numeric value.
|
| |
| b:Number — Another numeric value.
|
| |
| ... rest |
Returns
| Number — The greatest common denominator of the input numbers.
|
public static function sum(a:Number, b:Number, ... rest):Number
Calculates the sum of an Array of numbers.
Parameters
| a:Number |
| |
| b:Number |
| |
| ... rest |
Returns
Example
The following example shows a fast way to find the sum of
an Array of Numbers.
var numbers:Array = [1, 2, 3, 4, 5];
var sum:Number = MathUtil.sum.apply(null, numbers);