SoloCodigo
		Programación Web y Scripting => Python => Mensaje iniciado por: mpce en Viernes  3 de Septiembre de 2010, 21:36
		
			
			- 
				A ver si alguien me ayuda a desifrar donde este codigo tiene un error, es un buen reto para ustedes, que saben de programacion, y asi me hechan una mano!!!
 
 saludos!!!
 
 codigo fuente:
 
 def bisection(fun, lower, upper, error_s = 0.01):
 
 xl = lower
 xu = upper
 xrNew = (xl+xu)/2
 error_a = 100
 ##    c = 1
 
 while fun(xrNew) != 0 and error_a > error_s:
 
 ##        print 'c= ', c, '| xl= ', xl, '| xu= ', xu, '| xr= ', xrNew, '| e_a= ', error_a
 ##        c+=1
 
 if fun(xrNew) < 0:
 xu = xrNew
 else:
 xl = xrNew
 
 xrOld = xrNew
 xrNew = (xl+xu)/2
 
 if xrNew != 0:
 error_a = abs((xrNew - xrOld)/xrNew) * 100
 
 ##    print 'c= ', c, '| xl= ', xl, '| xu= ', xu, '| xr= ', xrNew, '| e_a= ', error_a
 
 return xrNew