mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
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:

committed by
Harshil

parent
39912aed57
commit
beafe3656f
@ -15,7 +15,7 @@ def bisection(function, a, b): # finds where the function becomes 0 in [a,b] us
|
||||
return
|
||||
else:
|
||||
mid = (start + end) / 2
|
||||
while abs(start - mid) > 0.0000001: # until we achieve precise equals to 10^-7
|
||||
while abs(start - mid) > 10**-7: # until we achieve precise equals to 10^-7
|
||||
if function(mid) == 0:
|
||||
return mid
|
||||
elif function(mid) * function(start) < 0:
|
||||
@ -29,5 +29,5 @@ def bisection(function, a, b): # finds where the function becomes 0 in [a,b] us
|
||||
def f(x):
|
||||
return math.pow(x, 3) - 2*x - 5
|
||||
|
||||
|
||||
print(bisection(f, 1, 1000))
|
||||
if __name__ == "__main__":
|
||||
print(bisection(f, 1, 1000))
|
||||
|
Reference in New Issue
Block a user