X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FRoots%2FFast.hs;h=5efdf3be99eec871931d18c6095333b8bd31ce83;hb=e73e40c515938df4de629dbc88463c5d88bca7c8;hp=cda999ceab62a2fcc3b1f77e07560fb22403d6d3;hpb=e15cc4256054bfaa60cd7ed167c0448957c85ed2;p=numerical-analysis.git diff --git a/src/Roots/Fast.hs b/src/Roots/Fast.hs index cda999c..5efdf3b 100644 --- a/src/Roots/Fast.hs +++ b/src/Roots/Fast.hs @@ -8,7 +8,7 @@ where import Data.List (find) -import Vector +import Normed has_root :: (Fractional a, Ord a, Ord b, Num b) @@ -104,7 +104,7 @@ fixed_point_iterations f x0 = -- -- We also return the number of iterations required. -- -fixed_point_with_iterations :: (Vector a, RealFrac b) +fixed_point_with_iterations :: (Normed a, RealFrac b) => (a -> a) -- ^ The function @f@ to iterate. -> b -- ^ The tolerance, @epsilon@. -> a -- ^ The initial value @x0@. @@ -115,7 +115,7 @@ fixed_point_with_iterations f epsilon x0 = xn = fixed_point_iterations f x0 xn_plus_one = tail xn - abs_diff v w = norm_2 (v - w) + abs_diff v w = norm (v - w) -- The nth entry in this list is the absolute value of x_{n} - -- x_{n+1}.