File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/Math-Tests-Polynomials Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,25 @@ PMPolynomialTest >> testPolynomialRoots [
242242 self assert: (roots at: 3 ) - 5 closeTo: 0
243243]
244244
245+ { #category : #' iterative algorithms' }
246+ PMPolynomialTest >> testPolynomialRootsForConstant [
247+ | polynomial |
248+ " Here, compute the roots of the quadratic (2x + 1)"
249+ polynomial := PMPolynomial coefficients: #(1) .
250+ self should: [ polynomial roots ] raise: Error description: ' Function' ' s derivative seems to be zero everywhere' .
251+
252+ ]
253+
254+ { #category : #' iterative algorithms' }
255+ PMPolynomialTest >> testPolynomialRootsForLinear [
256+ | polynomial roots |
257+ " Here, compute the roots of the quadratic (2x + 1)"
258+ polynomial := PMPolynomial coefficients: #(1 2) .
259+ roots := polynomial roots .
260+ self assert: roots size equals: 1 .
261+ self assert: (roots at: 1 ) closeTo: - 0.5 .
262+ ]
263+
245264{ #category : #' iterative algorithms' }
246265PMPolynomialTest >> testPolynomialRootsForQuadratic [
247266 | polynomial roots |
You can’t perform that action at this time.
0 commit comments