# Documentation

## Binomial Uses ArrayEnabled

\$arrayArgumentHelper
distribution()  : array<string|int, mixed>|float|string
BINOMDIST.
inverse()  : array<string|int, mixed>|int|string
BINOM.INV.
negative()  : array<string|int, mixed>|float|string
NEGBINOMDIST.
range()  : array<string|int, mixed>|float|string
BINOM.DIST.RANGE.
evaluateArrayArguments()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
evaluateArrayArgumentsIgnore()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
evaluateArrayArgumentsSubset()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
evaluateArrayArgumentsSubsetFrom()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
evaluateSingleArgumentArray()  : array<string|int, mixed>
Handles array argument processing when the function accepts a single argument that can be an array argument.
calculateCumulativeBinomial()  : float|int
initialiseHelper()  : void
testFalse()  : bool

### Properties

#### \$arrayArgumentHelper

``` private static ArrayArgumentHelper \$arrayArgumentHelper ```

### Methods

#### distribution()

BINOMDIST.

``` public static distribution(mixed \$value, mixed \$trials, mixed \$probability, mixed \$cumulative) : array<string|int, mixed>|float|string```

Returns the individual term binomial distribution probability. Use BINOMDIST in problems with a fixed number of tests or trials, when the outcomes of any trial are only success or failure, when trials are independent, and when the probability of success is constant throughout the experiment. For example, BINOMDIST can calculate the probability that two of the next three babies born are male.

##### Parameters
\$value : mixed

Integer number of successes in trials Or can be an array of values

\$trials : mixed

Integer umber of trials Or can be an array of values

\$probability : mixed

Probability of success on each trial as a float Or can be an array of values

\$cumulative : mixed

Boolean value indicating if we want the cdf (true) or the pdf (false) Or can be an array of values

##### Return values
array<string|int, mixed>|float|string

If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

#### inverse()

BINOM.INV.

``` public static inverse(mixed \$trials, mixed \$probability, mixed \$alpha) : array<string|int, mixed>|int|string```

Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value

##### Parameters
\$trials : mixed

number of Bernoulli trials as an integer Or can be an array of values

\$probability : mixed

probability of a success on each trial as a float Or can be an array of values

\$alpha : mixed

criterion value as a float Or can be an array of values

##### Return values
array<string|int, mixed>|int|string

If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

#### negative()

NEGBINOMDIST.

``` public static negative(mixed \$failures, mixed \$successes, mixed \$probability) : array<string|int, mixed>|float|string```

Returns the negative binomial distribution. NEGBINOMDIST returns the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s. This function is similar to the binomial distribution, except that the number of successes is fixed, and the number of trials is variable. Like the binomial, trials are assumed to be independent.

##### Parameters
\$failures : mixed

Number of Failures as an integer Or can be an array of values

\$successes : mixed

Threshold number of Successes as an integer Or can be an array of values

\$probability : mixed

Probability of success on each trial as a float Or can be an array of values

##### Return values
array<string|int, mixed>|float|string

The result, or a string containing an error If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

TODO Add support for the cumulative flag not present for NEGBINOMDIST, but introduced for NEGBINOM.DIST The cumulative default should be false to reflect the behaviour of NEGBINOMDIST

#### range()

BINOM.DIST.RANGE.

``` public static range(mixed \$trials, mixed \$probability, mixed \$successes[, mixed \$limit = null ]) : array<string|int, mixed>|float|string```

Returns returns the Binomial Distribution probability for the number of successes from a specified number of trials falling into a specified range.

##### Parameters
\$trials : mixed

Integer number of trials Or can be an array of values

\$probability : mixed

Probability of success on each trial as a float Or can be an array of values

\$successes : mixed

The integer number of successes in trials Or can be an array of values

\$limit : mixed = null

Upper limit for successes in trials as null, or an integer If null, then this will indicate the same as the number of Successes Or can be an array of values

##### Return values
array<string|int, mixed>|float|string

If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

#### evaluateArrayArguments()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.

``` protected static evaluateArrayArguments(callable \$method, mixed ...\$arguments) : array<string|int, mixed>```

Example use for: ROUND() or DATE().

##### Parameters
\$method : callable
\$arguments : mixed
##### Return values
array<string|int, mixed>

#### evaluateArrayArgumentsIgnore()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.

``` protected static evaluateArrayArgumentsIgnore(callable \$method, int \$ignore, mixed ...\$arguments) : array<string|int, mixed>```

Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.

##### Parameters
\$method : callable
\$ignore : int
\$arguments : mixed
##### Return values
array<string|int, mixed>

#### evaluateArrayArgumentsSubset()

Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.

``` protected static evaluateArrayArgumentsSubset(callable \$method, int \$limit, mixed ...\$arguments) : array<string|int, mixed>```

Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.

##### Parameters
\$method : callable
\$limit : int
\$arguments : mixed
##### Return values
array<string|int, mixed>

#### evaluateArrayArgumentsSubsetFrom()

Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.

``` protected static evaluateArrayArgumentsSubsetFrom(callable \$method, int \$start, mixed ...\$arguments) : array<string|int, mixed>```

Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.

##### Parameters
\$method : callable
\$start : int
\$arguments : mixed
##### Return values
array<string|int, mixed>

#### evaluateSingleArgumentArray()

Handles array argument processing when the function accepts a single argument that can be an array argument.

``` protected static evaluateSingleArgumentArray(callable \$method, array<string|int, mixed> \$values) : array<string|int, mixed>```

Example use for: DAYOFMONTH() or FACT().

##### Parameters
\$method : callable
\$values : array<string|int, mixed>
##### Return values
array<string|int, mixed>

#### calculateCumulativeBinomial()

``` private static calculateCumulativeBinomial(int \$value, int \$trials, float \$probability) : float|int```
##### Parameters
\$value : int
\$trials : int
\$probability : float
float|int

#### initialiseHelper()

``` private static initialiseHelper(array<string|int, mixed>|false \$arguments) : void```
##### Parameters
\$arguments : array<string|int, mixed>|false

Can be changed to array for Php8.1+

void

#### testFalse()

``` private static testFalse(mixed \$value) : bool```
\$value : mixed
bool