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 65 66 67 68
|
unsigned histogram[100000];
for (int R = 0; R < m; R++)
{
long double radius = sqrt(gen());
long double angle = gen();
long double zed = gen();
long double age = gen();
long double period = var_nor()*.001; // normal distribution of periods with a mean of 5 ms and a standard deviation of .69 mseconds
Gravitar RadialComponents;
RadialComponents.SetRadius(radius);
Gravitar AngularComponents;
AngularComponents.SetAngle(angle);
Gravitar ZedComponents;
ZedComponents.SetZed(zed);
Gravitar AgeComponents;
AgeComponents.SetAge(age);
Gravitar PeriodComponents;
PeriodComponents.SetPeriod(period);
long double x = RadialComponents.GetRadius()*cos (AngularComponents.GetAngle()*6.283185307179586476925286766559)*15329.729;
long double y = RadialComponents.GetRadius()*sin (AngularComponents.GetAngle()*6.283185307179586476925286766559)*15329.729;
long double z = ZedComponents.GetZed()*153.29729;
long double a = AgeComponents.GetAge() * 10000000.0 * 31556926.0; // Random number generated between 0 and 1, then multiplied by 10 millions years, multiplied by the number of seconds within a year
long double p = PeriodComponents.GetPeriod(); //p measured in seconds
long double prefrequency = 2.0 / p;
long double xde = x;
long double deltay = (y - 8500);
long double deltay2 = deltay*deltay;
long double yde = sqrt(deltay2);
long double zde = z;
long double xde2 = xde*xde;
long double yde2 = yde*yde;
long double zde2 = zde*zde;
long double dge = sqrt(xde2 + yde2 + zde2);
//WARNING:E is the NOT mathematical constant e.
//It is the const var of ellipticity
long double Ellipse2=Ellipse*Ellipse;
const long double pi=3.1415926535897932384626433832795,
pi4=pi*pi*pi*pi,
pi2=pi*pi,
G=6.673E-11;
long double beta= (32.0 * pi4 * G * 10E+44) / (2.421E+42);
int value = -4;
long double othervalue = -.25;
long double postfrequency = pow( (pow(prefrequency, value) + beta * Ellipse2 * a), othervalue);
long double h = ((4.0 * pi2 * G * 10E+44) / (8.077E+33)) * ((Ellipse * pow( postfrequency, 2)) / dge);
long double hx = h*1000000000;
long double hxr = floor (hx);
long double hxrf = hxr/1000000000;
//printf("Gravitar # %4f %16f %16f %16f %16f %16f %32f %16f %16f %16f %16f \n" , R+1 , x , y , z , a , p , Ellipse , prefrequency , postfrequency, dge, h, hxrf );
double f = hxrf;
histogram[size_t((f<1)?0:log10(f))]++;
std::cout << histogram[R] << std::endl;
if (myfile.is_open())
{
// myfile << " " << x << " " << y << " " << z << " " << endl;
// myfile << " " << a << " " << p << " " << prefrequency << " " << postfrequency << endl;
// myfile << h << " " << dge << " " << postfrequency << " " << R+1 << endl;
myfile << hxrf << " " << histogram << endl;
}
}
|