Re-design psnr.py code and change image names (#592)

* Change some Image File names & re-code the psnr algorithm (conserving both methods). Also Added new example.

* Selected psnr method and reformat some code from arithmetic_analysis
This commit is contained in:
Rafael García Cuéllar
2018-11-05 18:19:08 +01:00
committed by Harshil
parent 39912aed57
commit beafe3656f
10 changed files with 53 additions and 50 deletions

View File

@ -5,12 +5,13 @@ def intersection(function,x0,x1): #function is the f we want to find its root an
x_n1 = x1
while True:
x_n2 = x_n1-(function(x_n1)/((function(x_n1)-function(x_n))/(x_n1-x_n)))
if abs(x_n2 - x_n1)<0.00001 :
if abs(x_n2 - x_n1) < 10**-5:
return x_n2
x_n=x_n1
x_n1=x_n2
def f(x):
return math.pow(x,3)-2*x-5
return math.pow(x , 3) - (2 * x) -5
print(intersection(f,3,3.5))
if __name__ == "__main__":
print(intersection(f,3,3.5))