Last active
December 29, 2015 11:44
-
-
Save paulohrpinheiro/75e2d59f9dd98aaa8416 to your computer and use it in GitHub Desktop.
Exercício 4 do capítulo 3 de Haskell: uma abordagem Prática, Cláudio Cesar de Sá & Márcio Ferreira da Silva
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
--ep4 | |
fatorial x | (x==1) = 1 | |
| otherwise = x * fatorial (x-1) | |
e_x x n | (n==0) = 1 | |
| otherwise = ( (x**n) / fatorial n ) + (e_x x (n-1) ) | |
delta x = delta' x 0 | |
where delta' x n | (exp_x - (e_x x n)) < 0.001 = 0 | |
| otherwise = 1 + delta' x (n+1) | |
where exp_x = exp x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Também pode ser