From: Michael Orlitzky Date: Sun, 3 Feb 2013 02:43:16 +0000 (-0500) Subject: Fix two compiler warnings. X-Git-Url: http://gitweb.michael.orlitzky.com/?p=numerical-analysis.git;a=commitdiff_plain;h=6bee43b14215e788215751b468f2d1beeb55134b Fix two compiler warnings. --- diff --git a/src/ODE/IVP.hs b/src/ODE/IVP.hs index 233e5f8..d4876de 100644 --- a/src/ODE/IVP.hs +++ b/src/ODE/IVP.hs @@ -72,14 +72,15 @@ eulers_method x0 y0 xN f n = xs = partition n x0 xN -- The 'go' function actually does all the work. It takes a list - -- of intervals [(x0,x1), (x1, x2)...] and peels off the first + -- of intervals [(v0,v1), (v1, v2)...] and peels off the first -- one. It then runs the single-step Euler's method on that -- interval, and afterwards recurses down the rest of the list. + -- go :: [(a,a)] -> b -> (a -> b -> b) -> [b] go [] _ _ = [] - go ((x0,x1):rest) y0 f = y1 : (go rest y1 f) + go ((v0,v1):rest) w0 g = w1 : (go rest w1 g) where - y1 = eulers_method1 x0 y0 f (x1 - x0) + w1 = eulers_method1 v0 w0 g (v1 - v0) -- | Perform as many iterations of Euler's method over the interval @@ -111,4 +112,5 @@ eulers_methodH :: (RealFrac a, RealFrac b) eulers_methodH x0 y0 xN f h = eulers_method x0 y0 xN f n where + n :: Integer n = floor $ (xN - x0) / h