Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import itertools
  2. import numpy as np
  3. from scipy import optimize
  4. from scipy import integrate
  5.  
  6. n=763.0; s=762.0; b=0.0026; y=0.5673
  7. def p(x,b,n,y,s): return 1.0/(x*(b*n+y*np.log(x)-s*b*x))
  8. def Ui(x,x1,b,n,y,s): return (integrate.fixed_quad(p, x, x1, args=(b,n,y,s), n=5)[0]-1.0)
  9.  
  10. def t(x,x1,b,n,y,s): return optimize.newton(Ui, x1, p, args=(x,b,n,y,s), maxiter=500)
  11.  
  12. x=0.99; x1=1.0
  13. X=[1]
  14. for _ in xrange(1,15): x1=round(t(x1,x, b, n, y, s),500); x=x1; X.append(x)
  15. Xu = X[1:]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement