Skip to content

Commit

Permalink
refactor: Rename Variable - it looks like it is a root.
Browse files Browse the repository at this point in the history
  • Loading branch information
hemalvarambhia committed Dec 24, 2023
1 parent 6ebf707 commit a585d96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Math-Polynomials/PMPolynomial.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ PMPolynomial >> roots [
{ #category : #information }
PMPolynomial >> roots: aNumber [

| pol roots x rootFinder |
| pol roots root rootFinder |
rootFinder := PMNewtonZeroFinder with: aNumber.
pol := self class coefficients:
(coefficients reverse collect: [ :each | each asFloat ]).
Expand All @@ -248,10 +248,10 @@ PMPolynomial >> roots: aNumber [
rootFinder
setFunction: pol;
setDerivative: pol derivative.
x := rootFinder evaluate.
root := rootFinder evaluate.
rootFinder hasConverged ] whileTrue: [
roots add: x.
pol := pol deflatedAt: x.
roots add: root.
pol := pol deflatedAt: root.
pol degree > 0 ifFalse: [ ^ roots ] ].
^ roots
]
Expand Down

0 comments on commit a585d96

Please sign in to comment.