Created
November 4, 2010 12:18
-
-
Save olivierverdier/662378 to your computer and use it in GitHub Desktop.
calc_pep_index in Python
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
def calc_pep_index(A,E): | |
R = E | |
for i in xrange(1000): | |
R1 = .975*(A*R)+.025*E | |
if norm(R1-R) < some_tolerance: | |
break | |
R = R1 | |
else: | |
raise Exception("no convergence") | |
return R |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment