@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | foreach ($this->rows as $rowKey => $row) { |
| 232 | 232 | $resultArray[$rowKey] = new NumberCollection(); |
| 233 | - for ($i = 0;$i < $value->getColumnCount();$i++) { |
|
| 233 | + for ($i = 0; $i < $value->getColumnCount(); $i++) { |
|
| 234 | 234 | $cellVal = Numbers::makeZero(); |
| 235 | 235 | /** @var NumberInterface $num */ |
| 236 | 236 | foreach ($row->toArray() as $index => $num) { |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | $newMatrixData = []; |
| 274 | 274 | |
| 275 | 275 | // TODO: Implement minors & cofactors method https://www.mathsisfun.com/algebra/matrix-inverse-minors-cofactors-adjugate.html |
| 276 | - for ($i = 0;$i < $columnCount;$i++) { |
|
| 277 | - for ($r = 0;$r < $columnCount;$r++) { |
|
| 276 | + for ($i = 0; $i < $columnCount; $i++) { |
|
| 277 | + for ($r = 0; $r < $columnCount; $r++) { |
|
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | $newRows = []; |
| 303 | 303 | |
| 304 | - for ($i = 0;$i < $this->getRowCount();$i++) { |
|
| 304 | + for ($i = 0; $i < $this->getRowCount(); $i++) { |
|
| 305 | 305 | if ($i === $excludeRow) { |
| 306 | 306 | continue; |
| 307 | 307 | } |
@@ -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); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public static function makeE(int $digits): string |
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - $internalPrecision = $digits + 5; |
|
| 30 | + $internalPrecision = $digits+5; |
|
| 31 | 31 | |
| 32 | 32 | $one = Numbers::makeOne($internalPrecision)->setMode(Selectable::CALC_MODE_PRECISION); |
| 33 | 33 | $denominator = Numbers::make(Numbers::MUTABLE, '1', $internalPrecision)->setMode(Selectable::CALC_MODE_PRECISION); |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | ->multiply($e->pow($eExponent)) |
| 50 | 50 | ->multiply(SeriesProvider::maclaurinSeries( |
| 51 | 51 | $x, |
| 52 | - function ($n) { |
|
| 52 | + function($n) { |
|
| 53 | 53 | return Numbers::makeOne(); |
| 54 | 54 | }, |
| 55 | - function ($n) { |
|
| 55 | + function($n) { |
|
| 56 | 56 | return SequenceProvider::nthOddNumber($n); |
| 57 | 57 | }, |
| 58 | - function ($n) { |
|
| 58 | + function($n) { |
|
| 59 | 59 | return SequenceProvider::nthOddNumber($n)->doubleFactorial(); |
| 60 | 60 | }, |
| 61 | 61 | 0, |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $x = Numbers::makeOrDont(Numbers::IMMUTABLE, $x); |
| 96 | 96 | |
| 97 | 97 | $precision = $x->getPrecision(); |
| 98 | - $internalPrecision = $precision + 2; |
|
| 98 | + $internalPrecision = $precision+2; |
|
| 99 | 99 | |
| 100 | 100 | $answer = Numbers::makeOne($internalPrecision); |
| 101 | 101 | $pi = Numbers::makePi($internalPrecision); |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | $answer = $answer->multiply( |
| 106 | 106 | SeriesProvider::maclaurinSeries( |
| 107 | 107 | $x, |
| 108 | - function ($n) { |
|
| 108 | + function($n) { |
|
| 109 | 109 | $negOne = Numbers::make(Numbers::IMMUTABLE, -1); |
| 110 | 110 | |
| 111 | 111 | return $negOne->pow($n); |
| 112 | 112 | }, |
| 113 | - function ($n) { |
|
| 113 | + function($n) { |
|
| 114 | 114 | return SequenceProvider::nthOddNumber($n); |
| 115 | 115 | }, |
| 116 | - function ($n) { |
|
| 116 | + function($n) { |
|
| 117 | 117 | $n = Numbers::makeOrDont(Numbers::IMMUTABLE, $n); |
| 118 | 118 | |
| 119 | 119 | return $n->factorial()->multiply(SequenceProvider::nthOddNumber($n->asInt())); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $p = Numbers::makeOrDont(Numbers::IMMUTABLE, $p); |
| 141 | 141 | |
| 142 | 142 | $precision = $precision ?? $p->getPrecision(); |
| 143 | - $internalPrecision = $precision + 2; |
|
| 143 | + $internalPrecision = $precision+2; |
|
| 144 | 144 | |
| 145 | 145 | $two = Numbers::make(Numbers::IMMUTABLE, 2, $internalPrecision); |
| 146 | 146 | $invErfArg = $two->multiply($p)->subtract(1); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public static function inverseErrorCoefficients(int $termIndex): ImmutableFraction |
| 186 | 186 | { |
| 187 | 187 | |
| 188 | - $terms =& static::$inverseErrorCoefs; |
|
| 188 | + $terms = & static::$inverseErrorCoefs; |
|
| 189 | 189 | |
| 190 | 190 | if (is_null(static::$inverseErrorCoefs)) { |
| 191 | 191 | $terms = new Vector(); |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $nextTerm = $terms->count(); |
| 201 | 201 | |
| 202 | - for ($k = $nextTerm;$k <= $termIndex;$k++) { |
|
| 202 | + for ($k = $nextTerm; $k <= $termIndex; $k++) { |
|
| 203 | 203 | $termValue = new ImmutableFraction(new ImmutableDecimal('0'), new ImmutableDecimal('1')); |
| 204 | - for ($m = 0;$m <= ($k - 1);$m++) { |
|
| 204 | + for ($m = 0; $m <= ($k-1); $m++) { |
|
| 205 | 205 | $part1 = $terms->get($m); |
| 206 | - $part2 = $terms->get($k - 1 - $m); |
|
| 206 | + $part2 = $terms->get($k-1-$m); |
|
| 207 | 207 | $part3 = $part1->multiply($part2); |
| 208 | - $part4 = ($m + 1)*($m*2 + 1); |
|
| 208 | + $part4 = ($m+1)*($m*2+1); |
|
| 209 | 209 | $part5 = $part3->divide($part4); |
| 210 | 210 | $termValue = $termValue->add($part5); |
| 211 | 211 | } |
@@ -234,23 +234,23 @@ discard block |
||
| 234 | 234 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $z); |
| 235 | 235 | |
| 236 | 236 | $precision = $precision ?? $z->getPrecision(); |
| 237 | - $internalPrecision = $precision + 1; |
|
| 237 | + $internalPrecision = $precision+1; |
|
| 238 | 238 | |
| 239 | 239 | $pi = Numbers::makePi($internalPrecision); |
| 240 | 240 | |
| 241 | 241 | $answer = SeriesProvider::maclaurinSeries( |
| 242 | 242 | $z, |
| 243 | - static function ($n) use ($pi) { |
|
| 243 | + static function($n) use ($pi) { |
|
| 244 | 244 | if ($n > 0) { |
| 245 | 245 | return $pi->pow($n)->multiply(StatsProvider::inverseErrorCoefficients($n)); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | return Numbers::makeOne(); |
| 249 | 249 | }, |
| 250 | - static function ($n) { |
|
| 250 | + static function($n) { |
|
| 251 | 251 | return SequenceProvider::nthOddNumber($n); |
| 252 | 252 | }, |
| 253 | - static function ($n) { |
|
| 253 | + static function($n) { |
|
| 254 | 254 | if ($n > 0) { |
| 255 | 255 | $extra = Numbers::make(Numbers::IMMUTABLE, 2)->pow(SequenceProvider::nthEvenNumber($n)); |
| 256 | 256 | } else { |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | public static function radiansToDegrees($radians) |
| 18 | 18 | { |
| 19 | 19 | $radians = Numbers::makeOrDont(Numbers::IMMUTABLE, $radians); |
| 20 | - $pi = Numbers::makePi($radians->getPrecision() + 2); |
|
| 20 | + $pi = Numbers::makePi($radians->getPrecision()+2); |
|
| 21 | 21 | |
| 22 | - return $radians->multiply(180)->divide($pi, $radians->getPrecision() + 2)->round($radians->getPrecision() - 2)->getValue(); |
|
| 22 | + return $radians->multiply(180)->divide($pi, $radians->getPrecision()+2)->round($radians->getPrecision()-2)->getValue(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | public static function degreesToRadians($degrees) |
| 32 | 32 | { |
| 33 | 33 | $degrees = Numbers::makeOrDont(Numbers::IMMUTABLE, $degrees); |
| 34 | - $pi = Numbers::makePi($degrees->getPrecision() + 1); |
|
| 34 | + $pi = Numbers::makePi($degrees->getPrecision()+1); |
|
| 35 | 35 | |
| 36 | 36 | return $degrees->multiply($pi)->divide(180)->round($degrees->getPrecision())->getValue(); |
| 37 | 37 | } |