@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public static function createFromFoil(array $group1, array $group2): PolynomialFunction |
174 | 174 | { |
175 | - $group1exp = count($group1) - 1; |
|
176 | - $group2exp = count($group2) - 1; |
|
175 | + $group1exp = count($group1)-1; |
|
176 | + $group2exp = count($group2)-1; |
|
177 | 177 | |
178 | 178 | /** @var ImmutableDecimal[] $finalCoefs */ |
179 | 179 | $finalCoefs = []; |
@@ -198,16 +198,16 @@ discard block |
||
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); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | if (!$num->isWhole()) { |
71 | 71 | $precision += 5; |
72 | 72 | $exponent = $num->multiply($this->ln($precision)); |
73 | - return $exponent->exp($precision)->truncateToPrecision($precision - 5)->getValue(); |
|
73 | + return $exponent->exp($precision)->truncateToPrecision($precision-5)->getValue(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return ArithmeticProvider::pow($this->asReal(), $num->asReal(), $precision); |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | $left = self::translateToNative($this); |
37 | 37 | $right = self::translateToNative($num); |
38 | 38 | |
39 | - $value = $left + $right; |
|
40 | - $value = (string)$value; |
|
39 | + $value = $left+$right; |
|
40 | + $value = (string) $value; |
|
41 | 41 | |
42 | 42 | return $value; |
43 | 43 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $left = self::translateToNative($this); |
48 | 48 | $right = self::translateToNative($num); |
49 | 49 | |
50 | - $value = $left - $right; |
|
51 | - $value = (string)$value; |
|
50 | + $value = $left-$right; |
|
51 | + $value = (string) $value; |
|
52 | 52 | |
53 | 53 | return $value; |
54 | 54 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | $left = self::translateToNative($this); |
59 | 59 | $right = self::translateToNative($num); |
60 | 60 | |
61 | - $value = $left * $right; |
|
62 | - $value = (string)$value; |
|
61 | + $value = $left*$right; |
|
62 | + $value = (string) $value; |
|
63 | 63 | |
64 | 64 | return $value; |
65 | 65 | } |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | $left = self::translateToNative($this); |
70 | 70 | $right = self::translateToNative($num); |
71 | 71 | |
72 | - $value = $left / $right; |
|
73 | - $value = (string)$value; |
|
72 | + $value = $left/$right; |
|
73 | + $value = (string) $value; |
|
74 | 74 | |
75 | 75 | return $value; |
76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $right = self::translateToNative($num); |
82 | 82 | |
83 | 83 | $value = pow($left, $right); |
84 | - $value = (string)$value; |
|
84 | + $value = (string) $value; |
|
85 | 85 | |
86 | 86 | return $value; |
87 | 87 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | protected function sqrtNative() |
90 | 90 | { |
91 | 91 | $value = sqrt($this->asFloat()); |
92 | - $value = (string)$value; |
|
92 | + $value = (string) $value; |
|
93 | 93 | |
94 | 94 | return $value; |
95 | 95 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | |
29 | 29 | $answer = SeriesProvider::maclaurinSeries( |
30 | 30 | $modulo, |
31 | - function ($n) { |
|
31 | + function($n) { |
|
32 | 32 | $negOne = Numbers::make(Numbers::IMMUTABLE, -1, 100); |
33 | 33 | |
34 | 34 | return $negOne->pow($n); |
35 | 35 | }, |
36 | - function ($n) { |
|
36 | + function($n) { |
|
37 | 37 | return SequenceProvider::nthOddNumber($n); |
38 | 38 | }, |
39 | - function ($n) { |
|
39 | + function($n) { |
|
40 | 40 | return SequenceProvider::nthOddNumber($n)->factorial(); |
41 | 41 | }, |
42 | 42 | 0, |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | |
74 | 74 | $answer = SeriesProvider::maclaurinSeries( |
75 | 75 | $modulo, |
76 | - function ($n) { |
|
76 | + function($n) { |
|
77 | 77 | return SequenceProvider::nthPowerNegativeOne($n); |
78 | 78 | }, |
79 | - function ($n) { |
|
79 | + function($n) { |
|
80 | 80 | return SequenceProvider::nthEvenNumber($n); |
81 | 81 | }, |
82 | - function ($n) { |
|
82 | + function($n) { |
|
83 | 83 | return SequenceProvider::nthEvenNumber($n)->factorial(); |
84 | 84 | }, |
85 | 85 | 0, |
@@ -158,20 +158,20 @@ discard block |
||
158 | 158 | } else { |
159 | 159 | $answer = SeriesProvider::maclaurinSeries( |
160 | 160 | $modulo, |
161 | - function ($n) { |
|
161 | + function($n) { |
|
162 | 162 | $nthOddNumber = SequenceProvider::nthOddNumber($n); |
163 | 163 | |
164 | 164 | return SequenceProvider::nthEulerZigzag($nthOddNumber->asInt()); |
165 | 165 | }, |
166 | - function ($n) { |
|
166 | + function($n) { |
|
167 | 167 | |
168 | 168 | return SequenceProvider::nthOddNumber($n); |
169 | 169 | }, |
170 | - function ($n) { |
|
170 | + function($n) { |
|
171 | 171 | return SequenceProvider::nthOddNumber($n)->factorial(); |
172 | 172 | }, |
173 | 173 | 0, |
174 | - $precision + 1 |
|
174 | + $precision+1 |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | if ($mod2Pi->isEqual(0)) { |
206 | 206 | return $this->setValue(static::INFINITY); |
207 | - } elseif($modPi->isEqual(0)) { |
|
207 | + } elseif ($modPi->isEqual(0)) { |
|
208 | 208 | return $this->setValue(static::NEG_INFINITY); |
209 | 209 | } |
210 | 210 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $rounded = $whole.'.'; |
56 | 56 | |
57 | - for ($i = 0;$i < $decimals;$i++) { |
|
57 | + for ($i = 0; $i < $decimals; $i++) { |
|
58 | 58 | $rounded .= $fractionalArr[$i]; |
59 | 59 | } |
60 | 60 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $total = strlen($fractional); |
143 | 143 | $fractional = ltrim($fractional, '0'); |
144 | 144 | |
145 | - return ($total - strlen($fractional)); |
|
145 | + return ($total-strlen($fractional)); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | public function isFloat(): bool |
225 | 225 | { |
226 | 226 | |
227 | - return (bool)ArithmeticProvider::compare($this->getDecimalPart(), '0'); |
|
227 | + return (bool) ArithmeticProvider::compare($this->getDecimalPart(), '0'); |
|
228 | 228 | |
229 | 229 | } |
230 | 230 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | throw new IncompatibleObjectState('Cannot export number as integer because it is out of range'); |
236 | 236 | } |
237 | 237 | |
238 | - return (float)$this->asReal(); |
|
238 | + return (float) $this->asReal(); |
|
239 | 239 | |
240 | 240 | } |
241 | 241 |
@@ -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); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function rotate(bool $clockwise = true): MatrixInterface |
315 | 315 | { |
316 | - $tempData = $clockwise ? $this->rows : $this->columns; |
|
316 | + $tempData = $clockwise ? $this->rows : $this->columns; |
|
317 | 317 | $mode = $clockwise ? self::MODE_COLUMNS_INPUT : self::MODE_ROWS_INPUT; |
318 | 318 | |
319 | 319 | $tempData = array_reverse($tempData); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | |
466 | 466 | foreach ($this->rows as $rowKey => $row) { |
467 | 467 | $resultArray[$rowKey] = new NumberCollection(); |
468 | - for ($i = 0;$i < $value->getColumnCount();$i++) { |
|
468 | + for ($i = 0; $i < $value->getColumnCount(); $i++) { |
|
469 | 469 | $cellVal = Numbers::makeZero(); |
470 | 470 | /** @var NumberInterface $num */ |
471 | 471 | foreach ($row->toArray() as $index => $num) { |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | $newMatrixData = []; |
509 | 509 | |
510 | 510 | // TODO: Implement minors & cofactors method https://www.mathsisfun.com/algebra/matrix-inverse-minors-cofactors-adjugate.html |
511 | - for ($i = 0;$i < $columnCount;$i++) { |
|
512 | - for ($r = 0;$r < $columnCount;$r++) { |
|
511 | + for ($i = 0; $i < $columnCount; $i++) { |
|
512 | + for ($r = 0; $r < $columnCount; $r++) { |
|
513 | 513 | |
514 | 514 | } |
515 | 515 | } |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | $newRows = []; |
538 | 538 | |
539 | - for ($i = 0;$i < $this->getRowCount();$i++) { |
|
539 | + for ($i = 0; $i < $this->getRowCount(); $i++) { |
|
540 | 540 | if ($i === $excludeRow) { |
541 | 541 | continue; |
542 | 542 | } |