@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } elseif ($this->isEqual(0)) { |
29 | 29 | $answer = Numbers::makeZero(); |
30 | 30 | } else { |
31 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
31 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
32 | 32 | $one = Numbers::makeOne($precision+2); |
33 | 33 | |
34 | 34 | if ($z->abs()->isGreaterThan(1)) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ); |
40 | 40 | } |
41 | 41 | |
42 | - $answer = $z->divide($one->subtract($z->pow(2))->sqrt($precision + 2), $precision + 2)->arctan($precision + 2, false); |
|
42 | + $answer = $z->divide($one->subtract($z->pow(2))->sqrt($precision+2), $precision+2)->arctan($precision+2, false); |
|
43 | 43 | } |
44 | 44 | if ($round) { |
45 | 45 | $answer = $answer->roundToPrecision($precision); |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | } elseif ($this->isEqual(1)) { |
67 | 67 | $answer = Numbers::makeZero(); |
68 | 68 | } else { |
69 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
70 | - $one = Numbers::makeOne($precision + 2); |
|
69 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
70 | + $one = Numbers::makeOne($precision+2); |
|
71 | 71 | |
72 | 72 | if ($z->abs()->isGreaterThan(1)) { |
73 | 73 | throw new IntegrityConstraint( |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | $answer = $one->subtract($z->pow(2)) |
81 | - ->sqrt($precision + 2) |
|
82 | - ->divide($z, $precision + 2) |
|
83 | - ->arctan($precision + 2, false); |
|
81 | + ->sqrt($precision+2) |
|
82 | + ->divide($z, $precision+2) |
|
83 | + ->arctan($precision+2, false); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | if ($round) { |
@@ -98,41 +98,41 @@ discard block |
||
98 | 98 | |
99 | 99 | $precision = $precision ?? $this->getPrecision(); |
100 | 100 | |
101 | - $one = Numbers::makeOne($precision + 2); |
|
101 | + $one = Numbers::makeOne($precision+2); |
|
102 | 102 | |
103 | 103 | $oldBase = $this->convertForModification(); |
104 | 104 | |
105 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
105 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
106 | 106 | |
107 | 107 | if ($z->isEqual(1)) { |
108 | - $answer = Numbers::makePi($precision + 2)->divide(4, $precision + 2); |
|
108 | + $answer = Numbers::makePi($precision+2)->divide(4, $precision+2); |
|
109 | 109 | } elseif ($z->isEqual(-1)) { |
110 | - $answer = Numbers::makePi($precision + 2)->divide(4, $precision +2)->multiply(-1); |
|
110 | + $answer = Numbers::makePi($precision+2)->divide(4, $precision+2)->multiply(-1); |
|
111 | 111 | } else { |
112 | 112 | |
113 | 113 | if ($z->abs()->isGreaterThan(1)) { |
114 | - $rangeAdjust = Numbers::makePi($precision + 2)->divide(2, $precision + 2); |
|
114 | + $rangeAdjust = Numbers::makePi($precision+2)->divide(2, $precision+2); |
|
115 | 115 | |
116 | 116 | if ($z->isNegative()) { |
117 | 117 | $rangeAdjust = $rangeAdjust->multiply(-1); |
118 | 118 | } |
119 | 119 | |
120 | - $z = $one->divide($z, $precision + 2); |
|
120 | + $z = $one->divide($z, $precision+2); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $answer = SeriesProvider::maclaurinSeries( |
124 | 124 | $z, |
125 | - function ($n) { |
|
125 | + function($n) { |
|
126 | 126 | return SequenceProvider::nthPowerNegativeOne($n); |
127 | 127 | }, |
128 | - function ($n) { |
|
128 | + function($n) { |
|
129 | 129 | return SequenceProvider::nthOddNumber($n); |
130 | 130 | }, |
131 | - function ($n) { |
|
131 | + function($n) { |
|
132 | 132 | return SequenceProvider::nthOddNumber($n); |
133 | 133 | }, |
134 | 134 | 0, |
135 | - $precision + 1 |
|
135 | + $precision+1 |
|
136 | 136 | ); |
137 | 137 | |
138 | 138 | if (isset($rangeAdjust)) { |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | |
156 | 156 | $precision = $precision ?? $this->getPrecision(); |
157 | 157 | |
158 | - $piDivTwo = Numbers::makePi($precision + 2)->divide(2, $precision + 2); |
|
158 | + $piDivTwo = Numbers::makePi($precision+2)->divide(2, $precision+2); |
|
159 | 159 | |
160 | 160 | $oldBase = $this->convertForModification(); |
161 | 161 | |
162 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
162 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
163 | 163 | |
164 | 164 | $arctan = $z->arctan($precision+2, false); |
165 | 165 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $oldBase = $this->convertForModification(); |
184 | 184 | |
185 | - $one = Numbers::makeOne($precision + 2); |
|
185 | + $one = Numbers::makeOne($precision+2); |
|
186 | 186 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
187 | 187 | |
188 | 188 | if ($z->abs()->isLessThan(1)) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | ); |
194 | 194 | } |
195 | 195 | |
196 | - $answer = $one->divide($z, $precision + 2)->arccos($precision + 2); |
|
196 | + $answer = $one->divide($z, $precision+2)->arccos($precision+2); |
|
197 | 197 | |
198 | 198 | if ($round) { |
199 | 199 | $answer = $answer->roundToPrecision($precision); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | $oldBase = $this->convertForModification(); |
214 | 214 | |
215 | - $one = Numbers::makeOne($precision + 2); |
|
215 | + $one = Numbers::makeOne($precision+2); |
|
216 | 216 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
217 | 217 | |
218 | 218 | if ($z->abs()->isLessThan(1)) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ); |
224 | 224 | } |
225 | 225 | |
226 | - $answer = $one->divide($z, $precision + 2)->arcsin($precision + 2); |
|
226 | + $answer = $one->divide($z, $precision+2)->arcsin($precision+2); |
|
227 | 227 | |
228 | 228 | if ($round) { |
229 | 229 | $answer = $answer->roundToPrecision($precision); |