Numerical integration: Difference between revisions

m
m (→‎{{header|Haskell}}: (tidying string concatenations in the test))
Line 2,348:
main =
mapM_
(\(s, e@(f_, a, b, n)) -> do
putStrLn $
(concat
[ justifyLeftindent 20 ' ' ("f(x) = " ++ s)
, show [a, b]
, " ("
, show n
, " approximations)"
])
mapM_
(\(s, integration) ->
putStrLn (indent 20 (s ++ ":") ++ show (uncurry4 integration e)))
(justifyLeft 20 ' ' (s ++ ":") ++ show (uncurry4 integration e)))
ms
putStrLn [])
integrations
where
justifyLeftindent n c s = take n . (s ++ replicate n c' ')</lang>
{{Out}}
<pre>f(x) = x^3 [0.0,1.0] (100 approximations)
9,659

edits