X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FRoots%2FSimple.hs;fp=src%2FRoots%2FSimple.hs;h=03b39aeb643de47ed6546693c26346851b80b0fc;hb=cc93d648089344338030a9b79cd7bea7c6e8c997;hp=a6aa09e497ba841d2c3a8e0be2749aab27c72662;hpb=e21dd0f819e165daceec53c205dd0ab622fceee2;p=numerical-analysis.git diff --git a/src/Roots/Simple.hs b/src/Roots/Simple.hs index a6aa09e..03b39ae 100644 --- a/src/Roots/Simple.hs +++ b/src/Roots/Simple.hs @@ -195,8 +195,8 @@ newton_iterations :: (Field.C a) -> (a -> a) -- ^ The derivative of @f@ -> a -- ^ Initial guess, x-naught -> [a] -newton_iterations f f' x0 = - iterate next x0 +newton_iterations f f' = + iterate next where next xn = xn - ( (f xn) / (f' xn) ) @@ -280,8 +280,8 @@ secant_iterations :: (Field.C a) -> a -- ^ Initial guess, x-naught -> a -- ^ Second initial guess, x-one -> [a] -secant_iterations f x0 x1 = - iterate2 g x0 x1 +secant_iterations f = + iterate2 g where g prev2 prev1 = let x_change = prev1 - prev2