Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import scipy.integrate as integrate
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4.  
  5. def integrand(x, a, b):
  6. c = 1. - a - b
  7. return 1/(x*(a*x**(-3)+c*x**(-2)+b)**0.5)
  8.  
  9.  
  10. # the five models we wish to test
  11. models = [ (0.,0.), (0.,1.), (1.,0.), (2.5,0.), (0.3,0.7) ]
  12.  
  13. # calculate t(a) for each model
  14. for (om,ol) in models :
  15. print("Model: om=%.2f, ol=%.2f"%(om,ol))
  16.  
  17. # we need to calculate t(a) for each a, that we want to
  18. # plot
  19. t_array = np.array([])
  20. a_array = np.linspace(0.001,5.0,100)
  21. ae = 1.e-5
  22. for a1 in a_array :
  23. t = integrate.quad(integrand,ae, a1, args=(om,ol))
  24. t_array = np.append(t_array,t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement