@@ -30,7 +30,7 @@ |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | if ($terms > 2) { |
33 | - for ($n = 2;$n < $terms;$n++) { |
|
33 | + for ($n = 2; $n < $terms; $n++) { |
|
34 | 34 | $kN = $k1->add($k2); |
35 | 35 | $collection->push($kN); |
36 | 36 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | $sample = new NumberCollection(); |
20 | 20 | |
21 | - for ($i = 1;$i < $sampleSize;$i++) { |
|
21 | + for ($i = 1; $i < $sampleSize; $i++) { |
|
22 | 22 | $sample->push($this->random()); |
23 | 23 | } |
24 | 24 |
@@ -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 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $curVal = $this->getValue(); |
34 | 34 | $calcVal = Numbers::make(Numbers::IMMUTABLE, 1); |
35 | 35 | |
36 | - for ($i = 1;$i <= $curVal;$i++) { |
|
36 | + for ($i = 1; $i <= $curVal; $i++) { |
|
37 | 37 | $calcVal = $calcVal->multiply($i); |
38 | 38 | } |
39 | 39 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | foreach ($this->rows[0]->toArray() as $key => $value) { |
94 | 94 | $childMatrixData = []; |
95 | 95 | |
96 | - for ($i = 1;$i < $this->numRows;$i++) { |
|
96 | + for ($i = 1; $i < $this->numRows; $i++) { |
|
97 | 97 | $childMatrixData[$i-1] = $this->rows[$i]->filterByKeys([$key]); |
98 | 98 | } |
99 | 99 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | foreach ($this->rows as $rowKey => $row) { |
345 | 345 | $resultArray[$rowKey] = new NumberCollection(); |
346 | - for ($i = 0;$i < $value->getColumnCount();$i++) { |
|
346 | + for ($i = 0; $i < $value->getColumnCount(); $i++) { |
|
347 | 347 | $cellVal = Numbers::makeZero(); |
348 | 348 | /** @var NumberInterface $num */ |
349 | 349 | foreach ($row->toArray() as $index => $num) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $cumulative = Numbers::makeZero(); |
80 | 80 | |
81 | - for ($i = 0;$x->isGreaterThanOrEqualTo($i);$i++) { |
|
81 | + for ($i = 0; $x->isGreaterThanOrEqualTo($i); $i++) { |
|
82 | 82 | $cumulative = $cumulative->add($this->pmf($i)); |
83 | 83 | } |
84 | 84 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $cumulative = Numbers::makeZero(); |
147 | 147 | |
148 | - for (;$larger->isGreaterThanOrEqualTo($smaller);$smaller->add(1)) { |
|
148 | + for (;$larger->isGreaterThanOrEqualTo($smaller); $smaller->add(1)) { |
|
149 | 149 | $cumulative = $cumulative->add($this->pmf($smaller)); |
150 | 150 | } |
151 | 151 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | while (true) { |
227 | 227 | /** @var ImmutableDecimal $u */ |
228 | - $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
228 | + $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
229 | 229 | /** @var ImmutableDecimal $x */ |
230 | 230 | $x = $alpha->subtract($one->subtract($u)->divide($u)->ln(20)->divide($beta)); |
231 | 231 | /** @var ImmutableDecimal $n */ |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | /** @var ImmutableDecimal $v */ |
239 | - $v = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
239 | + $v = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
240 | 240 | /** @var ImmutableDecimal $y */ |
241 | 241 | $y = $alpha->subtract($beta->multiply($x)); |
242 | 242 | /** @var ImmutableDecimal $lhs */ |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | do { |
278 | 278 | $k = $k->add(1); |
279 | 279 | /** @var ImmutableDecimal $u */ |
280 | - $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
280 | + $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
281 | 281 | $p = $p->multiply($u); |
282 | 282 | } while ($p->isGreaterThan($L)); |
283 | 283 |
@@ -198,16 +198,16 @@ |
||
198 | 198 | * @var ImmutableDecimal $value1 |
199 | 199 | */ |
200 | 200 | foreach ($largerGroup as $key1 => $value1) { |
201 | - $largerKey = $largerExp - $key1; |
|
201 | + $largerKey = $largerExp-$key1; |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * @var int $key2 |
205 | 205 | * @var ImmutableDecimal $value2 |
206 | 206 | */ |
207 | 207 | foreach ($smallerGroup as $key2 => $value2) { |
208 | - $smallerKey = $smallerExp - $key2; |
|
208 | + $smallerKey = $smallerExp-$key2; |
|
209 | 209 | $newVal = $value1->multiply($value2); |
210 | - $newExp = $largerKey + $smallerKey; |
|
210 | + $newExp = $largerKey+$smallerKey; |
|
211 | 211 | |
212 | 212 | if (isset($finalCoefs[$newExp])) { |
213 | 213 | $finalCoefs[$newExp] = $finalCoefs[$newExp]->add($newVal); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function sort(): NumberCollectionInterface |
146 | 146 | { |
147 | - $this->getCollection()->sort(function($left, $right){ |
|
147 | + $this->getCollection()->sort(function($left, $right) { |
|
148 | 148 | return ArithmeticProvider::compare($left->getAsBaseTenRealNumber(), $right->getAsBaseTenRealNumber()); |
149 | 149 | }); |
150 | 150 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function getRandom(): NumberInterface |
279 | 279 | { |
280 | - $maxKey = $this->getCollection()->count() - 1; |
|
280 | + $maxKey = $this->getCollection()->count()-1; |
|
281 | 281 | |
282 | 282 | $key = PolyfillProvider::randomInt(0, $maxKey); |
283 | 283 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $rounded = $whole.'.'; |
50 | 50 | |
51 | - for ($i = 0;$i < $decimals;$i++) { |
|
51 | + for ($i = 0; $i < $decimals; $i++) { |
|
52 | 52 | $rounded .= $fractionalArr[$i]; |
53 | 53 | } |
54 | 54 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $total = strlen($fractional); |
131 | 131 | $fractional = ltrim($fractional, '0'); |
132 | 132 | |
133 | - return ($total - strlen($fractional)); |
|
133 | + return ($total-strlen($fractional)); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } elseif ($this->isEqual(0)) { |
28 | 28 | $answer = Numbers::makeZero(); |
29 | 29 | } else { |
30 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
30 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
31 | 31 | $one = Numbers::makeOne($precision+2); |
32 | 32 | |
33 | 33 | if ($z->abs()->isGreaterThan(1)) { |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | } elseif ($this->isEqual(1)) { |
78 | 78 | $answer = Numbers::makeZero(); |
79 | 79 | } else { |
80 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
81 | - $one = Numbers::makeOne($precision + 2); |
|
80 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
81 | + $one = Numbers::makeOne($precision+2); |
|
82 | 82 | |
83 | 83 | if ($z->abs()->isGreaterThan(1)) { |
84 | 84 | throw new IntegrityConstraint( |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | $precision = $precision ?? $this->getPrecision(); |
130 | 130 | |
131 | - $piDivTwo = Numbers::makePi($precision + 2)->divide(2, $precision + 2); |
|
131 | + $piDivTwo = Numbers::makePi($precision+2)->divide(2, $precision+2); |
|
132 | 132 | |
133 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
133 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
134 | 134 | |
135 | 135 | $arctan = $z->arctan($precision+2, false); |
136 | 136 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $precision = $precision ?? $this->getPrecision(); |
153 | 153 | |
154 | - $one = Numbers::makeOne($precision + 2); |
|
154 | + $one = Numbers::makeOne($precision+2); |
|
155 | 155 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
156 | 156 | |
157 | 157 | if ($z->abs()->isLessThan(1)) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - $answer = $one->divide($z, $precision + 2)->arccos($precision + 2); |
|
165 | + $answer = $one->divide($z, $precision+2)->arccos($precision+2); |
|
166 | 166 | |
167 | 167 | if ($round) { |
168 | 168 | $answer = $answer->roundToPrecision($precision); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $precision = $precision ?? $this->getPrecision(); |
181 | 181 | |
182 | - $one = Numbers::makeOne($precision + 2); |
|
182 | + $one = Numbers::makeOne($precision+2); |
|
183 | 183 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
184 | 184 | |
185 | 185 | if ($z->abs()->isLessThan(1)) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | ); |
191 | 191 | } |
192 | 192 | |
193 | - $answer = $one->divide($z, $precision + 2)->arcsin($precision + 2); |
|
193 | + $answer = $one->divide($z, $precision+2)->arcsin($precision+2); |
|
194 | 194 | |
195 | 195 | if ($round) { |
196 | 196 | $answer = $answer->roundToPrecision($precision); |