Skip to content

Commit eee00a7

Browse files
refactor: made the method a class method. Next we can inline the instance method.
1 parent b8434f0 commit eee00a7

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/Math-Polynomials/PMPolynomial.class.st

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ PMPolynomial class >> coefficients: anArray [
2626
^self new initialize: anArray reverse
2727
]
2828

29+
{ #category : #information }
30+
PMPolynomial class >> rootFindingAlgorithmWith: precision [
31+
32+
| rootFinder |
33+
rootFinder := PMNewtonZeroFinder new.
34+
rootFinder desiredPrecision: precision.
35+
^ rootFinder
36+
]
37+
2938
{ #category : #operation }
3039
PMPolynomial >> * aNumberOrPolynomial [
3140

@@ -240,12 +249,8 @@ PMPolynomial >> reciprocal [
240249
]
241250

242251
{ #category : #information }
243-
PMPolynomial >> rootFindingAlgorithmWith: precision [
244-
245-
| rootFinder |
246-
rootFinder := PMNewtonZeroFinder new.
247-
rootFinder desiredPrecision: precision.
248-
^ rootFinder
252+
PMPolynomial >> rootFindingAlgorithmWith: precision [
253+
^ self class rootFindingAlgorithmWith: precision
249254
]
250255

251256
{ #category : #information }

0 commit comments

Comments
 (0)