In [1]:
from scipy import integrate
from math import *
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt

In [2]:
z=np.arange(0.01,10000)
        
Ezo = lambda x: 1/(x*sqrt(0.01*(x)**3+0.99*(x)**2))

np.vectorize(Ezo)
#Calculate comoving distance of a data point using the Redshift - This definition is based on the cosmology model we take. Here the distance for E-dS universe is considered. Also note that c/H0 ratio is cancelled in the equations and hence not taken.

Hzo = lambda x: 1/(sqrt(0.01*(x)**3+0.99*(x)**2))

np.vectorize(Hzo)

def t_OU(x):
  return integrate.quad(Ezo, 0, 1/(1+x))
t_OU=np.vectorize(t_OU)

def a_OU(x):
  return integrate.quad(Ezo, 0, x)
a_OU=np.vectorize(a_OU)
#sp.exp(
#print t_OU(z)
#plt.plot(z,t_OU(z)[1])
#print z
#print 1/(1+z)
print t_OU(z)[0]
print np.exp(a_OU(z)[0])
#plt.plot(t_OU(z)[0],1/(1+z))
plt.plot(t_OU(z)[0],np.exp(a_OU(z)[0]))


[ -1.05771757e+00  -2.06277420e+00  -3.06781835e+00 ...,  -1.00484632e+04
  -1.00494770e+04  -1.00504916e+04]
[  2.00127228e-44   3.54263051e-01   5.81229579e-01 ...,   9.68733067e-01
   9.68733560e-01   9.68734052e-01]
/usr/lib/python2.7/dist-packages/scipy/integrate/quadpack.py:295: UserWarning: The integral is probably divergent, or slowly convergent.
  warnings.warn(msg)
/usr/lib/python2.7/dist-packages/scipy/integrate/quadpack.py:295: UserWarning: The algorithm does not converge.  Roundoff error is detected
  in the extrapolation table.  It is assumed that the requested tolerance
  cannot be achieved, and that the returned result (if full_output = 1) is 
  the best which can be obtained.
  warnings.warn(msg)
Out[2]:
[<matplotlib.lines.Line2D at 0x7f8f31f2b2d0>]

In [5]:
a=np.arange(0.01,1,0.01)
        
sc = lambda x: 5/(4*sqrt(1+1/(2*x)))

def t_OU(x):
  return integrate.quad(sc, 0, x)
t_OU=np.vectorize(t_OU)

print a
print t_OU(a)[0]
plt.plot(t_OU(a)[0],a)
#plt.plot(t_OU(a)[0],t_OU(a)[0]+0.18)
#plt.plot(t_OU(a)[0],1.1*t_OU(a)[0]+0.12)
#plt.plot(t_OU(a)[0],np.power(t_OU(a)[0],2.0/3.0))


[ 0.01  0.02  0.03  0.04  0.05  0.06  0.07  0.08  0.09  0.1   0.11  0.12
  0.13  0.14  0.15  0.16  0.17  0.18  0.19  0.2   0.21  0.22  0.23  0.24
  0.25  0.26  0.27  0.28  0.29  0.3   0.31  0.32  0.33  0.34  0.35  0.36
  0.37  0.38  0.39  0.4   0.41  0.42  0.43  0.44  0.45  0.46  0.47  0.48
  0.49  0.5   0.51  0.52  0.53  0.54  0.55  0.56  0.57  0.58  0.59  0.6
  0.61  0.62  0.63  0.64  0.65  0.66  0.67  0.68  0.69  0.7   0.71  0.72
  0.73  0.74  0.75  0.76  0.77  0.78  0.79  0.8   0.81  0.82  0.83  0.84
  0.85  0.86  0.87  0.88  0.89  0.9   0.91  0.92  0.93  0.94  0.95  0.96
  0.97  0.98  0.99]
[ 0.00117152  0.00329417  0.00601691  0.00921104  0.01280077  0.01673418
  0.02097271  0.02548617  0.03025009  0.03524412  0.04045097  0.04585575
  0.05144544  0.05720857  0.0631349   0.06921528  0.07544143  0.08180583
  0.08830164  0.09492257  0.10166285  0.10851715  0.11548054  0.12254842
  0.12971653  0.13698089  0.14433777  0.15178368  0.15931533  0.16692964
  0.1746237   0.18239476  0.19024024  0.19815766  0.2061447   0.21419916
  0.22231894  0.23050203  0.23874654  0.24705065  0.25541264  0.26383086
  0.27230373  0.28082974  0.28940744  0.29803546  0.30671248  0.31543721
  0.32420843  0.33302498  0.34188573  0.3507896   0.35973553  0.36872253
  0.37774963  0.3868159   0.39592043  0.40506237  0.41424086  0.42345511
  0.43270433  0.44198776  0.45130468  0.46065438  0.47003618  0.4794494
  0.48889342  0.4983676   0.50787135  0.51740408  0.52696523  0.53655424
  0.54617059  0.55581374  0.56548321  0.5751785   0.58489913  0.59464465
  0.60441461  0.61420856  0.62402608  0.63386676  0.6437302   0.653616
  0.66352379  0.67345318  0.68340382  0.69337536  0.70336744  0.71337974
  0.72341193  0.73346368  0.74353469  0.75362465  0.76373326  0.77386023
  0.78400529  0.79416814  0.80434853]
Out[5]:
[<matplotlib.lines.Line2D at 0x7f8f30244c10>]

In [3]: