Created
January 18, 2012 21:54
-
-
Save FunctionalFirst/1636040 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inline cosine n (x:^a) : ^a = | |
let one = LanguagePrimitives.GenericOne | |
let two = one + one | |
Seq.unfold (fun (twoIp1, t) -> Some(t, (twoIp1+two, -t*x*x/(twoIp1*(twoIp1+one))))) (one,one) | |
|> Seq.take n | |
|> Seq.sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment