# HG changeset patch
# User Aleksey Khudyakov
# Date 1319635663 -10800
# Node ID 6882f7e76fb35f06d356f7db270b69e85dbd51b7
# Parent dfb01e980ce74dfd8c0fc44f2085c1e1ab3856f3
Hardcode maximum number of iterations to 100 for solveNewton
diff --git a/Numeric/Tools/Equation.hs b/Numeric/Tools/Equation.hs
--- a/Numeric/Tools/Equation.hs
+++ b/Numeric/Tools/Equation.hs
@@ -155,13 +155,12 @@
-- | Solve equation using Newton-Raphson method. Root must be
-- bracketed. If Newton's step jumps outside of bracket or do not
-- converge sufficiently fast function reverts to bisection.
-solveNewton :: Int -- ^ Maximum number of iterations
- -> Double -- ^ Absolute error tolerance
+solveNewton :: Double -- ^ Absolute error tolerance
-> (Double,Double) -- ^ Lower and upper bounds for root
-> (Double -> Double) -- ^ Function
-> (Double -> Double) -- ^ Function's derivative
-> Root Double
-solveNewton nMax eps (lo,hi) f f'
+solveNewton eps (lo,hi) f f'
| flo == 0 = Root lo
| fhi == 0 = Root hi
| flo * fhi > 0 = NotBracketed
@@ -182,7 +181,7 @@
| abs dx < eps = Root x' -- Precision achieved
| within 0 x x' = Root x' -- Newton step doesn't improve solution
-- Too many iterations
- | i > nMax = SearchFailed
+ | i > (100::Int) = SearchFailed
-- Newton step jumped out of range or step decreases too slow.
-- Revert to bisection.
-- NOTE this guard is selected if dx evaluated to NaN or ±∞.