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 [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 function is supposed to be the direct translation of the formula of a term within the sum. But it isn't: it is actually cluttered with lots of type conversions, and I had a hard time figuring out how to make it work at all. I hope that this is not the easiest way to do that and I would appreciate any help on how to handle those type conversion issues...

Thanks,
Chris

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to