@@ -264,17 +264,6 @@ PMPolynomialTest >> testPolynomialRootsForLinear [
264264 self assert: (roots at: 1 ) closeTo: - 0.5 .
265265]
266266
267- { #category : #' iterative algorithms' }
268- PMPolynomialTest >> testPolynomialRootsForQuadratic [
269- | polynomial roots |
270- " Here, compute the roots of the quadratic (2x + 1)^2 = 4 x^2 + 4 x + 1"
271- polynomial := PMPolynomial coefficients: #(1 4 4) .
272- roots := polynomial roots .
273- self assert: roots size equals: 2 .
274- self assert: (roots at: 1 ) closeTo: - 0.5 .
275- self assert: (roots at: 2 ) closeTo: - 0.5 .
276- ]
277-
278267{ #category : #' function evaluation' }
279268PMPolynomialTest >> testPolynomialSubtraction [
280269 | polynomial |
@@ -286,3 +275,14 @@ PMPolynomialTest >> testPolynomialSubtraction [
286275 self assert: (polynomial at: 3 ) equals: - 1 .
287276 self assert: (polynomial at: 4 ) equals: 0
288277]
278+
279+ { #category : #' iterative algorithms' }
280+ PMPolynomialTest >> testPolynomialWithRepeatedRoots [
281+ | polynomial roots |
282+ " Here, compute the roots of the quadratic (2x + 1)^2 = 4 x^2 + 4 x + 1"
283+ polynomial := PMPolynomial coefficients: #(1 4 4) .
284+ roots := polynomial roots .
285+ self assert: roots size equals: 2 .
286+ self assert: (roots at: 1 ) closeTo: - 0.5 .
287+ self assert: (roots at: 2 ) closeTo: - 0.5 .
288+ ]
0 commit comments