@@ -25,6 +25,6 @@ |
||
25 | 25 | return $sample; |
26 | 26 | } |
27 | 27 | |
28 | - abstract public function rangeRandom($min = 0, $max = PHP_INT_MAX, int $maxIterations = 20): ImmutableDecimal; |
|
28 | + abstract public function rangeRandom($min = 0, $max = PHP_INT_MAX, int $maxIterations = 20): ImmutableDecimal; |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -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); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | - $internalScale = $scale + 2; |
|
101 | + $internalScale = $scale+2; |
|
102 | 102 | |
103 | 103 | /** @var ImmutableDecimal $e */ |
104 | 104 | $e = Numbers::makeE($internalScale); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ); |
139 | 139 | } |
140 | 140 | |
141 | - $internalScale = $scale + 2; |
|
141 | + $internalScale = $scale+2; |
|
142 | 142 | |
143 | 143 | /** @var ImmutableDecimal $rangePdf */ |
144 | 144 | $rangePdf = |
@@ -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 = |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @throws IntegrityConstraint |
64 | 64 | * @throws IncompatibleObjectState |
65 | 65 | */ |
66 | - public function cdf(int|float|DecimalInterface $x, int $scale = 10): ImmutableDecimal |
|
66 | + public function cdf(int | float | DecimalInterface $x, int $scale = 10): ImmutableDecimal |
|
67 | 67 | { |
68 | 68 | |
69 | 69 | $x = Numbers::makeOrDont(Numbers::IMMUTABLE, $x); |
@@ -76,7 +76,7 @@ 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 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @throws IntegrityConstraint |
102 | 102 | * @throws IncompatibleObjectState |
103 | 103 | */ |
104 | - public function pmf(float|int|DecimalInterface $x, int $scale = 10): ImmutableDecimal |
|
104 | + public function pmf(float | int | DecimalInterface $x, int $scale = 10): ImmutableDecimal |
|
105 | 105 | { |
106 | 106 | $x = Numbers::makeOrDont(Numbers::IMMUTABLE, $x); |
107 | 107 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
116 | - $internalScale = $scale + 2; |
|
116 | + $internalScale = $scale+2; |
|
117 | 117 | |
118 | 118 | $e = Numbers::makeE($internalScale); |
119 | 119 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | while (true) { |
260 | 260 | /** @var ImmutableDecimal $u */ |
261 | - $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
261 | + $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
262 | 262 | /** @var ImmutableDecimal $x */ |
263 | 263 | $x = $alpha->subtract($one->subtract($u)->divide($u)->ln(20)->divide($beta)); |
264 | 264 | /** @var ImmutableDecimal $n */ |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | ->multiply($e->pow($eExponent)) |
54 | 54 | ->multiply(SeriesProvider::maclaurinSeries( |
55 | 55 | $x, |
56 | - function ($n) { |
|
56 | + function($n) { |
|
57 | 57 | return Numbers::makeOne(); |
58 | 58 | }, |
59 | - function ($n) { |
|
59 | + function($n) { |
|
60 | 60 | return SequenceProvider::nthOddNumber($n); |
61 | 61 | }, |
62 | - function ($n) { |
|
62 | + function($n) { |
|
63 | 63 | return SequenceProvider::nthOddNumber($n)->doubleFactorial(); |
64 | 64 | }, |
65 | 65 | 0, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $x = Numbers::makeOrDont(Numbers::IMMUTABLE, $x); |
103 | 103 | |
104 | 104 | $scale = $x->getScale(); |
105 | - $internalScale = $scale + 2; |
|
105 | + $internalScale = $scale+2; |
|
106 | 106 | |
107 | 107 | $answer = Numbers::makeOne($internalScale); |
108 | 108 | $pi = Numbers::makePi($internalScale); |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | $answer = $answer->multiply( |
113 | 113 | SeriesProvider::maclaurinSeries( |
114 | 114 | $x, |
115 | - function ($n) { |
|
115 | + function($n) { |
|
116 | 116 | $negOne = Numbers::make(Numbers::IMMUTABLE, -1); |
117 | 117 | |
118 | 118 | return $negOne->pow($n); |
119 | 119 | }, |
120 | - function ($n) { |
|
120 | + function($n) { |
|
121 | 121 | return SequenceProvider::nthOddNumber($n); |
122 | 122 | }, |
123 | - function ($n) { |
|
123 | + function($n) { |
|
124 | 124 | $n = Numbers::makeOrDont(Numbers::IMMUTABLE, $n); |
125 | 125 | |
126 | 126 | return $n->factorial()->multiply(SequenceProvider::nthOddNumber($n->asInt())); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $p = Numbers::makeOrDont(Numbers::IMMUTABLE, $p); |
150 | 150 | |
151 | 151 | $scale = $scale ?? $p->getScale(); |
152 | - $internalScale = $scale + $p->numberOfDecimalDigits(); |
|
152 | + $internalScale = $scale+$p->numberOfDecimalDigits(); |
|
153 | 153 | |
154 | 154 | $two = Numbers::make(Numbers::IMMUTABLE, 2, $internalScale); |
155 | 155 | $invErfArg = $two->multiply($p)->subtract(1); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | static::$inverseErrorCoefs->push(new ImmutableFraction(Numbers::makeOne(), Numbers::makeOne())); |
201 | 201 | } |
202 | 202 | |
203 | - $terms =& static::$inverseErrorCoefs; |
|
203 | + $terms = & static::$inverseErrorCoefs; |
|
204 | 204 | |
205 | 205 | if ($terms->offsetExists($termIndex)) { |
206 | 206 | return $terms->get($termIndex); |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | |
211 | 211 | for ($k = $nextTerm;$k <= $termIndex;$k++) { |
212 | 212 | $termValue = new ImmutableFraction(new ImmutableDecimal('0'), new ImmutableDecimal('1')); |
213 | - for ($m = 0;$m <= ($k - 1);$m++) { |
|
213 | + for ($m = 0;$m <= ($k-1);$m++) { |
|
214 | 214 | $part1 = $terms->get($m); |
215 | - $part2 = $terms->get($k - 1 - $m); |
|
215 | + $part2 = $terms->get($k-1-$m); |
|
216 | 216 | $part3 = $part1->multiply($part2); |
217 | - $part4 = ($m + 1)*($m*2 + 1); |
|
217 | + $part4 = ($m+1)*($m*2+1); |
|
218 | 218 | $part5 = $part3->divide($part4); |
219 | 219 | $termValue = $termValue->add($part5); |
220 | 220 | } |
@@ -243,23 +243,23 @@ discard block |
||
243 | 243 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $z); |
244 | 244 | |
245 | 245 | $scale = $scale ?? $z->getScale(); |
246 | - $internalScale = $scale + $z->numberOfDecimalDigits(); |
|
246 | + $internalScale = $scale+$z->numberOfDecimalDigits(); |
|
247 | 247 | |
248 | 248 | $pi = Numbers::makePi($internalScale); |
249 | 249 | |
250 | 250 | $answer = SeriesProvider::maclaurinSeries( |
251 | 251 | $z, |
252 | - static function ($n) use ($pi) { |
|
252 | + static function($n) use ($pi) { |
|
253 | 253 | if ($n > 0) { |
254 | 254 | return $pi->pow($n)->multiply(StatsProvider::inverseErrorCoefficients($n)); |
255 | 255 | } |
256 | 256 | |
257 | 257 | return Numbers::makeOne(); |
258 | 258 | }, |
259 | - static function ($n) { |
|
259 | + static function($n) { |
|
260 | 260 | return SequenceProvider::nthOddNumber($n); |
261 | 261 | }, |
262 | - static function ($n) { |
|
262 | + static function($n) { |
|
263 | 263 | if ($n > 0) { |
264 | 264 | $extra = Numbers::make(Numbers::IMMUTABLE, 2)->pow(SequenceProvider::nthEvenNumber($n)); |
265 | 265 | } else { |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @throws IntegrityConstraint |
35 | 35 | */ |
36 | 36 | public static function randomInt( |
37 | - int|string|DecimalInterface $min, |
|
38 | - int|string|DecimalInterface $max, |
|
37 | + int | string | DecimalInterface $min, |
|
38 | + int | string | DecimalInterface $max, |
|
39 | 39 | RandomMode $mode = RandomMode::Entropy, |
40 | 40 | ?int $seed = null |
41 | 41 | ): ImmutableDecimal |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | */ |
121 | 121 | $entropyBytes = $randomizer->getBytes($bytesNeeded->asInt()); |
122 | 122 | $baseTwoBytes = ''; |
123 | - for($i = 0; $i < strlen($entropyBytes); $i++){ |
|
124 | - $baseTwoBytes .= decbin( ord( $entropyBytes[$i] ) ); |
|
123 | + for ($i = 0;$i < strlen($entropyBytes);$i++) { |
|
124 | + $baseTwoBytes .= decbin(ord($entropyBytes[$i])); |
|
125 | 125 | } |
126 | 126 | } catch (Exception $e) { |
127 | 127 | throw new OptionalExit( |
128 | 128 | 'System error from random_bytes().', |
129 | 129 | 'Ensure your system is configured correctly.', |
130 | - 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: ' . $e->getMessage() |
|
130 | + 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: '.$e->getMessage() |
|
131 | 131 | ); |
132 | 132 | } |
133 | 133 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $randomizer = self::getRandomizer($mode); |
186 | 186 | |
187 | 187 | $result = '0.'; |
188 | - for ($i = 0; $i < $scale; $i++) { |
|
188 | + for ($i = 0;$i < $scale;$i++) { |
|
189 | 189 | $result .= $randomizer->getInt(0, 9); |
190 | 190 | } |
191 | 191 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | * @throws RandomException |
202 | 202 | */ |
203 | 203 | public static function randomReal( |
204 | - int|string|DecimalInterface $min, |
|
205 | - int|string|DecimalInterface $max, |
|
204 | + int | string | DecimalInterface $min, |
|
205 | + int | string | DecimalInterface $max, |
|
206 | 206 | int $scale, |
207 | 207 | RandomMode $mode = RandomMode::Entropy |
208 | 208 | ): ImmutableDecimal |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | return $min; |
220 | 220 | } |
221 | 221 | |
222 | - $intScale = $scale + 2; |
|
222 | + $intScale = $scale+2; |
|
223 | 223 | |
224 | 224 | $range = $max->subtract($min); |
225 | 225 | |
226 | - $intScale = $intScale + $range->numberOfTotalDigits(); |
|
226 | + $intScale = $intScale+$range->numberOfTotalDigits(); |
|
227 | 227 | |
228 | 228 | $randomDecimal = self::randomDecimal($intScale, $mode); |
229 | 229 |
@@ -171,7 +171,7 @@ |
||
171 | 171 | if ($num->isReal() && $num->isNatural() && $num->isPositive()) { |
172 | 172 | $newValue = clone $this; |
173 | 173 | |
174 | - for ($i=0;$num->isGreaterThan($i);$i++) { |
|
174 | + for ($i = 0;$num->isGreaterThan($i);$i++) { |
|
175 | 175 | $newValue = $newValue->multiply($this); |
176 | 176 | } |
177 | 177 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function subtract(VectorInterface $vector): VectorInterface; |
14 | 14 | |
15 | - public function multiply(int|float|string|NumberInterface|VectorInterface $value): NumberInterface|VectorInterface; |
|
15 | + public function multiply(int | float | string | NumberInterface | VectorInterface $value): NumberInterface | VectorInterface; |
|
16 | 16 | |
17 | 17 | public function multiplyScalar(NumberInterface $number): VectorInterface; |
18 | 18 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | */ |
94 | 94 | public function rotate(bool $clockwise = true): MatrixInterface |
95 | 95 | { |
96 | - $tempData = $clockwise ? $this->rows : $this->columns; |
|
96 | + $tempData = $clockwise ? $this->rows : $this->columns; |
|
97 | 97 | $mode = $clockwise ? self::MODE_COLUMNS_INPUT : self::MODE_ROWS_INPUT; |
98 | 98 | |
99 | 99 | $tempData = array_reverse($tempData); |