ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
ErfC.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
PhpOffice\PhpSpreadsheet\Calculation\Engineering
;
4
5
use
PhpOffice\PhpSpreadsheet\Calculation\Functions
;
6
7
class
ErfC
8
{
26
public
static
function
ERFC
($value)
27
{
28
$value =
Functions::flattenSingleValue
($value);
29
30
if
(is_numeric($value)) {
31
return
self::erfcValue($value);
32
}
33
34
return
Functions::VALUE
();
35
}
36
37
//
38
// Private method to calculate the erfc value
39
//
40
private
static
$oneSqrtPi
= 0.564189583547756287;
41
42
private
static
function
erfcValue
($value)
43
{
44
if
(abs($value) < 2.2) {
45
return
1 -
Erf::erfValue
($value);
46
}
47
if
($value < 0) {
48
return
2 - self::ERFC(-$value);
49
}
50
$a =
$n
= 1;
51
$b =
$c
= $value;
52
$d
= ($value * $value) + 0.5;
53
$q1 = $q2 = $b /
$d
;
54
do
{
55
$t
= $a *
$n
+ $b * $value;
56
$a = $b;
57
$b =
$t
;
58
$t
=
$c
*
$n
+
$d
* $value;
59
$c
=
$d
;
60
$d
=
$t
;
61
$n
+= 0.5;
62
$q1 = $q2;
63
$q2 = $b /
$d
;
64
}
while
((abs($q1 - $q2) / $q2) >
Functions::PRECISION
);
65
66
return
self::$oneSqrtPi * exp(-$value * $value) * $q2;
67
}
68
}
PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC\erfcValue
static erfcValue($value)
Definition:
ErfC.php:42
PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC
Definition:
ErfC.php:7
$c
$c
Definition:
inc.setup_header.php:183
$n
$n
Definition:
RandomTest.php:85
PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC\$oneSqrtPi
static $oneSqrtPi
Definition:
ErfC.php:40
$t
$t
Definition:
authorize_403.php:14
PhpOffice\PhpSpreadsheet\Calculation\Engineering
Definition:
BesselI.php:3
PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC\ERFC
static ERFC($value)
ERFC.
Definition:
ErfC.php:26
Functions
php
PhpOffice\PhpSpreadsheet\Calculation\Functions\VALUE
static VALUE()
VALUE.
Definition:
Functions.php:229
PhpOffice\PhpSpreadsheet\Calculation\Functions\flattenSingleValue
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
Definition:
Functions.php:649
PhpOffice\PhpSpreadsheet\Calculation\Engineering\Erf\erfValue
static erfValue($value)
Definition:
Erf.php:69
$d
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition:
date.php:296
PhpOffice\PhpSpreadsheet\Calculation\Functions\PRECISION
const PRECISION
Definition:
Functions.php:10
libs
composer
vendor
phpoffice
phpspreadsheet
src
PhpSpreadsheet
Calculation
Engineering
ErfC.php
Generated on Thu Jan 16 2025 19:01:45 for ILIAS by
1.8.13 (using
Doxyfile
)