ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Exponential.php
Go to the documentation of this file.
1<?php
2
4
7
9{
23 public static function distribution($value, $lambda, $cumulative)
24 {
25 $value = Functions::flattenSingleValue($value);
26 $lambda = Functions::flattenSingleValue($lambda);
27 $cumulative = Functions::flattenSingleValue($cumulative);
28
29 try {
32 $cumulative = DistributionValidations::validateBool($cumulative);
33 } catch (Exception $e) {
34 return $e->getMessage();
35 }
36
37 if (($value < 0) || ($lambda < 0)) {
38 return Functions::NAN();
39 }
40
41 if ($cumulative === true) {
42 return 1 - exp(0 - $value * $lambda);
43 }
44
45 return $lambda * exp(0 - $value * $lambda);
46 }
47}
An exception for terminatinating execution or to throw for unit testing.
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
Definition: Functions.php:649
static distribution($value, $lambda, $cumulative)
EXPONDIST.
Definition: Exponential.php:23