module Polynomial.Maclaurin (polyexp, polyln1,
polycos, polysin, polyatan,
polycosh, polysinh, polyatanh) where
ifacs :: [Double]
ifacs = map (1/) $ scanl (*) 1 [1..]
inverses :: [Double]
inverses = map (1/) $ 1:[1..]
polyexp :: Int -> [Double]
polyexp n = take (n+1) ifacs
polyln1 :: Int -> [Double]
polyln1 n = 0 : (take n $ zipWith (*) i $ map (1/) [1..])
where i = [ 1, 1 ] ++ i
polycos :: Int -> [Double]
polycos n = take (n+1) $ zipWith (*) i ifacs
where i = [ 1, 0, 1, 0 ] ++ i
polysin :: Int -> [Double]
polysin n = take (n+1) $ zipWith (*) i ifacs
where i = [ 0, 1, 0, 1 ] ++ i
polyatan :: Int -> [Double]
polyatan n = take (n+1) $ zipWith (*) i inverses
where i = [ 0, 1, 0, 1 ] ++ i
polycosh :: Int -> [Double]
polycosh n = take (n+1) $ zipWith (*) i ifacs
where i = [ 1, 0 ] ++ i
polysinh :: Int -> [Double]
polysinh n = take (n+1) $ zipWith (*) i ifacs
where i = [ 0, 1 ] ++ i
polyatanh :: Int -> [Double]
polyatanh n = take (n+1) $ zipWith (*) i inverses
where i = [ 0, 1 ] ++ i