]> gitweb.michael.orlitzky.com - numerical-analysis.git/blobdiff - src/Roots/Simple.hs
Fix compiler warnings and doctests.
[numerical-analysis.git] / src / Roots / Simple.hs
index 0a1debff0a0b1db653efabdf2be00ce9a4b91ed4..414b77787262e608ceef4a66981a5dc5ab82cc50 100644 (file)
@@ -18,8 +18,9 @@ import Normed
 import qualified Roots.Fast as F
 
 import NumericPrelude hiding (abs)
 import qualified Roots.Fast as F
 
 import NumericPrelude hiding (abs)
-import qualified Algebra.Absolute as Absolute
 import Algebra.Absolute (abs)
 import Algebra.Absolute (abs)
+import qualified Algebra.Additive as Additive
+import qualified Algebra.Algebraic as Algebraic
 import qualified Algebra.Field as Field
 import qualified Algebra.RealField as RealField
 import qualified Algebra.RealRing as RealRing
 import qualified Algebra.Field as Field
 import qualified Algebra.RealField as RealField
 import qualified Algebra.RealRing as RealRing
@@ -87,7 +88,7 @@ bisect f a b epsilon =
 --   at x0. We delegate to the version that returns the number of
 --   iterations and simply discard the number of iterations.
 --
 --   at x0. We delegate to the version that returns the number of
 --   iterations and simply discard the number of iterations.
 --
-fixed_point :: (Normed a, RealField.C b)
+fixed_point :: (Normed a, Additive.C a, Algebraic.C b, RealField.C b)
             => (a -> a) -- ^ The function @f@ to iterate.
             -> b       -- ^ The tolerance, @epsilon@.
             -> a       -- ^ The initial value @x0@.
             => (a -> a) -- ^ The function @f@ to iterate.
             -> b       -- ^ The tolerance, @epsilon@.
             -> a       -- ^ The initial value @x0@.
@@ -100,7 +101,10 @@ fixed_point f epsilon x0 =
 --   the function @f@ with the search starting at x0 and tolerance
 --   @epsilon@. We delegate to the version that returns the number of
 --   iterations and simply discard the fixed point.
 --   the function @f@ with the search starting at x0 and tolerance
 --   @epsilon@. We delegate to the version that returns the number of
 --   iterations and simply discard the fixed point.
-fixed_point_iteration_count :: (Normed a, RealField.C b)
+fixed_point_iteration_count :: (Normed a,
+                                Additive.C a,
+                                RealField.C b,
+                                Algebraic.C b)
                             => (a -> a) -- ^ The function @f@ to iterate.
                             -> b       -- ^ The tolerance, @epsilon@.
                             -> a       -- ^ The initial value @x0@.
                             => (a -> a) -- ^ The function @f@ to iterate.
                             -> b       -- ^ The tolerance, @epsilon@.
                             -> a       -- ^ The initial value @x0@.
@@ -118,7 +122,10 @@ fixed_point_iteration_count f epsilon x0 =
 --
 --   This is used to determine the rate of convergence.
 --
 --
 --   This is used to determine the rate of convergence.
 --
-fixed_point_error_ratios :: (Normed a, RealField.C b)
+fixed_point_error_ratios :: (Normed a,
+                             Additive.C a,
+                             RealField.C b,
+                             Algebraic.C b)
                    => (a -> a) -- ^ The function @f@ to iterate.
                    -> a       -- ^ The initial value @x0@.
                    -> a       -- ^ The true solution, @x_star@.
                    => (a -> a) -- ^ The function @f@ to iterate.
                    -> a       -- ^ The initial value @x0@.
                    -> a       -- ^ The true solution, @x_star@.