1 import scipy.stats as st
10 def ordre_convergence(X,l=None) :
13 e = [abs(x-l) for x in X]
14 pts = [(log(e[j]),log(e[j+1])) for j in range(len(X)-2)]
16 e = [abs(x-l) for x in X]
17 pts = [(log(e[j]),log(e[j+1])) for j in range(len(X)-1)]
18 slope, intercept, r_value, p_value, std_err = st.linregress(pts)
25 print "TP 3.2 ............ ordre convergence corde"
26 print ordre_convergence(iteration_corde(0,pi/2,0,200,0.00000001,f)[1])
29 print "TP 3.2 ............ ordre convergence newton"
30 print ordre_convergence(iteration_newton(0,200,0.00000001,f,fp)[1])
33 print "TP 3.1 ............ ordre convergence lagrange"
34 print ordre_convergence(iteration_lagrange(0,pi/2,200,0.00000001,f)[1])
37 if __name__ == '__main__':