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

In [60]:
z=np.arange(0.01,100)
        
Ezo = lambda x: 1/(x*sqrt(0.2*(x)**3+0.8*(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.2*(x)**3+0.8*(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]))


[  -2.28035766   -3.4095852    -4.5316073    -5.65168857   -6.77096871
   -7.88984104   -9.00847762  -10.12696564  -11.24535401  -12.36367229
  -13.48193941  -14.60016803  -15.71836697  -16.83654254  -17.95469937
  -19.07284095  -20.19096996  -21.30908847  -22.42719814  -23.54530029
  -24.66339598  -25.78148609  -26.89957134  -28.01765234  -29.1357296
  -30.25380354  -31.37187454  -32.4899429   -33.6080089   -34.72607278
  -35.84413474  -36.96219495  -38.08025358  -39.19831076  -40.31636663
  -41.43442128  -42.55247482  -43.67052733  -44.78857889  -45.90662958
  -47.02467946  -48.14272858  -49.260777    -50.37882477  -51.49687192
  -52.61491851  -53.73296456  -54.85101011  -55.96905518  -57.08709982
  -58.20514404  -59.32318786  -60.44123132  -61.55927442  -62.6773172
  -63.79535966  -64.91340182  -66.0314437   -67.14948532  -68.26752669
  -69.3855678   -70.5036087   -71.62164937  -72.73968984  -73.8577301
  -74.97577017  -76.09381007  -77.21184979  -78.32988934  -79.44792874
  -80.56596799  -81.68400708  -82.80204604  -83.92008487  -85.03812356
  -86.15616213  -87.27420059  -88.39223893  -89.51027715  -90.62831528
  -91.7463533   -92.86439122  -93.98242905  -95.48794778  -96.21850443
  -97.336542    -98.45457948  -99.57261688 -100.69065421 -101.80869146
 -102.92672864 -104.04476575 -105.74402431 -106.28083978 -107.39887669
 -108.51691355 -109.63495034 -110.75298708 -111.87102376 -112.98906039]
[  8.59666743e-50   1.04593336e-01   1.85090533e-01   2.26555341e-01
   2.52378869e-01   2.70507498e-01   2.84251953e-01   2.95233471e-01
   3.04342756e-01   3.12112470e-01   3.18882502e-01   3.24881113e-01
   3.30268055e-01   3.35159001e-01   3.39640124e-01   3.43777188e-01
   3.47621435e-01   3.51213509e-01   3.54586164e-01   3.57766162e-01
   3.60775635e-01   3.63633092e-01   3.66354164e-01   3.68952165e-01
   3.71438534e-01   3.73823164e-01   3.76114672e-01   3.78320609e-01
   3.80447629e-01   3.82501624e-01   3.84487839e-01   3.86410964e-01
   3.88275208e-01   3.90084363e-01   3.91841859e-01   3.93550809e-01
   3.95214046e-01   3.96834155e-01   3.98413505e-01   3.99954270e-01
   4.01458448e-01   4.02927885e-01   4.04364285e-01   4.05769227e-01
   4.07144178e-01   4.08490501e-01   4.09809464e-01   4.11102254e-01
   4.12369977e-01   4.13613671e-01   4.14834307e-01   4.16032799e-01
   4.17210004e-01   4.18366730e-01   4.19503739e-01   4.20621748e-01
   4.21721439e-01   4.22803451e-01   4.23868394e-01   4.24916843e-01
   4.25949346e-01   4.26966422e-01   4.27968565e-01   4.28956243e-01
   4.29929906e-01   4.30889978e-01   4.31836867e-01   4.32770960e-01
   4.33692628e-01   4.34602225e-01   4.35500092e-01   4.36386551e-01
   4.37261914e-01   4.38126480e-01   4.38980533e-01   4.39824348e-01
   4.40658188e-01   4.41482307e-01   4.42296948e-01   4.43102344e-01
   4.43898721e-01   4.44686297e-01   4.45465279e-01   4.46235869e-01
   4.46998261e-01   4.47752643e-01   4.48499195e-01   4.49238093e-01
   4.49969503e-01   4.50693590e-01   4.51410512e-01   4.52120419e-01
   4.52823461e-01   4.53519779e-01   4.54209512e-01   4.54892793e-01
   4.55569752e-01   4.56240516e-01   4.56905205e-01   4.57563939e-01]
Out[60]:
[<matplotlib.lines.Line2D at 0x7f1c48408890>]

In [18]:
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.2)
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[18]:
[<matplotlib.lines.Line2D at 0x7fbbe24eaf50>]

In [ ]: