@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | - $internalScale = $scale + 2; |
|
79 | + $internalScale = $scale+2; |
|
80 | 80 | |
81 | 81 | $cumulative = Numbers::makeZero(); |
82 | 82 | |
83 | - for ($i = 0;$x->isGreaterThanOrEqualTo($i);$i++) { |
|
83 | + for ($i = 0; $x->isGreaterThanOrEqualTo($i); $i++) { |
|
84 | 84 | $cumulative = $cumulative->add($this->pmf($i, $internalScale))->truncateToScale($scale); |
85 | 85 | } |
86 | 86 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @throws IntegrityConstraint |
96 | 96 | * @throws IncompatibleObjectState |
97 | 97 | */ |
98 | - public function pmf(float|int|DecimalInterface $x, int $scale = 10): ImmutableDecimal |
|
98 | + public function pmf(float | int | DecimalInterface $x, int $scale = 10): ImmutableDecimal |
|
99 | 99 | { |
100 | 100 | $x = Numbers::makeOrDont(Numbers::IMMUTABLE, $x); |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ); |
108 | 108 | } |
109 | 109 | |
110 | - $internalScale = $scale + 2; |
|
110 | + $internalScale = $scale+2; |
|
111 | 111 | |
112 | 112 | $e = Numbers::makeE($internalScale); |
113 | 113 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | $cumulative = Numbers::makeZero(); |
151 | 151 | |
152 | - for (;$larger->isGreaterThanOrEqualTo($smaller);$smaller = $smaller->add(1)) { |
|
152 | + for (;$larger->isGreaterThanOrEqualTo($smaller); $smaller = $smaller->add(1)) { |
|
153 | 153 | $cumulative = $cumulative->add($this->pmf($smaller)); |
154 | 154 | } |
155 | 155 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | while (true) { |
239 | 239 | /** @var ImmutableDecimal $u */ |
240 | - $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
240 | + $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
241 | 241 | /** @var ImmutableDecimal $x */ |
242 | 242 | $x = $alpha->subtract($one->subtract($u)->divide($u)->ln(20)->divide($beta)); |
243 | 243 | /** @var ImmutableDecimal $n */ |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | do { |
292 | 292 | $k = $k->add(1); |
293 | 293 | /** @var ImmutableDecimal $u */ |
294 | - $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
294 | + $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
295 | 295 | $p = $p->multiply($u); |
296 | 296 | } while ($p->isGreaterThan($L)); |
297 | 297 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ); |
62 | 62 | } |
63 | 63 | |
64 | - $internalScale = $scale + 2; |
|
64 | + $internalScale = $scale+2; |
|
65 | 65 | |
66 | 66 | /** @var ImmutableDecimal $e */ |
67 | 67 | $e = Numbers::makeE($internalScale); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | } |
94 | 94 | |
95 | - $internalScale = $scale + 2; |
|
95 | + $internalScale = $scale+2; |
|
96 | 96 | |
97 | 97 | /** @var ImmutableDecimal $e */ |
98 | 98 | $e = Numbers::makeE($internalScale); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ); |
125 | 125 | } |
126 | 126 | |
127 | - $internalScale = $scale + 2; |
|
127 | + $internalScale = $scale+2; |
|
128 | 128 | |
129 | 129 | /** @var ImmutableDecimal $rangePdf */ |
130 | 130 | $rangePdf = $this->pdf($x2, $internalScale)->subtract($this->pdf($x1, $internalScale))->abs()->truncateToScale($scale); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | $e = Numbers::makeE($scale); |
81 | 81 | $x = Numbers::makeOrDont(Numbers::IMMUTABLE, $x); |
82 | 82 | |
83 | - $internalScale = (new NumberCollection([$scale, $x]))->selectScale() + 2; |
|
83 | + $internalScale = (new NumberCollection([$scale, $x]))->selectScale()+2; |
|
84 | 84 | |
85 | 85 | // $left = 1 / ( sqrt(2pi * SD^2) ) |
86 | 86 | $left = $one->divide($twoPi->multiply($this->getSD()->pow(2))->sqrt($internalScale), $internalScale); |