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 4.2 ............ ordre convergence corde"
26 print ordre_convergence(iteration_corde(0,pi/2,0,200,1E-9,f)[1])
29 print "TP 4.2 ............ ordre convergence lagrange"
30 print ordre_convergence(iteration_lagrange(0,pi/2,200,1E-9,f)[1])
33 print "TP 4.2 ............ ordre convergence newton"
34 print ordre_convergence(iteration_newton(0,200,1E-9,f,fp)[1])
38 if __name__ == '__main__':