-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCosMoCal.cpp
More file actions
64 lines (50 loc) · 1.09 KB
/
Copy pathCosMoCal.cpp
File metadata and controls
64 lines (50 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <complex>
#include <time.h>
#include <functional>
#include <algorithm>
#include <ctime>
#include <vector>
#include <thread>
#include "./spline.h"
#include <random>
#include <string>
using std::sin;
using std::cos;
using std::tan;
using std::exp;
using std::pow;
using std::log;
using std::sqrt;
using std::atan;
using namespace std;
#define PI acos(-1)
double HubbleParam(double z)
{
double Omegam = 0.30966;
double Omegav = 0.69034;
double H0 = 67.66;
return H0 * sqrt(Omegam * pow(1 + z, 3) + Omegav);
}
double AngularDiameterDis(double zStart, double zEnd)
{
vector<double> zset;
double zstep = 0.0001;
double Integrad = 0;
double lightspeed = 2.9979246 * pow(10,5);
for(double zi = zStart; zi <= zEnd; zi += zstep)
{
zset.push_back(zi);
Integrad += 1/HubbleParam(zi);
// cout << zi << endl;
}
return Integrad * zstep * lightspeed / (1 + zEnd);
}
// int main()
// {
// double DL = AngularDiameterDis(0, 1);
// cout << DL << endl;
// }