Created
July 14, 2014 08:39
-
-
Save jlouis/3e795372914fdd75bfd4 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
-module(agner). | |
-export([ec/2]). | |
fac(N) -> | |
lists:foldl(fun erlang:'*'/2, 1, lists:seq(1, N)). | |
ec(M, U) -> | |
X = math:pow(U, M) / fac(M), | |
Rho = U / M, | |
S = lists:sum([math:pow(U, K) / fac(K) || K <- lists:seq(0, M-1)]), | |
X / (X + (1 - Rho) * S). | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment