Hi,
after some playing around with monad transformers and starting to like
those specialities of Haskell, I am currently really feeling thrown
back by a simple problem: trying to write a sine-function...
Here is the part of my code that is troubling me:
fac :: Integer - Integer
fac n = product
On Sun, Jun 13, 2004 at 11:15:28AM +0200, Christian Hofer wrote:
fac :: Integer - Integer
fac n = product [1..n]
term :: Double - Integer - Double
term x n = (-1.0::Double)**(fromInteger n) * (x**(fromInteger (2*n +
1))) /
(fromInteger (fac (2*n + 1)))
Why do you have all those
Christian Hofer wrote:
Here is the part of my code that is troubling me:
fac :: Integer - Integer
fac n = product [1..n]
term :: Double - Integer - Double
term x n = (-1.0::Double)**(fromInteger n) * (x**(fromInteger (2*n +
1))) /
(fromInteger (fac (2*n + 1)))
The term
Am 13.06.2004 um 12:44 schrieb Glynn Clements:
Using ^, term can be simplified to:
term :: Double - Integer - Double
term x n = (-1.0)^n * x^(2*n + 1) / fromInteger (fac (2*n + 1))
(Further interesting information snipped...)
Ok, I just didn't know this operator. This is actually
Lauri Alanko wrote:
fac :: Integer - Integer
fac n = product [1..n]
term :: Double - Integer - Double
term x n = (-1.0::Double)**(fromInteger n) * (x**(fromInteger (2*n +
1))) /
(fromInteger (fac (2*n + 1)))
Why do you have all those type annotations? Simply writing