as-500/hw25/data.cpp

24 lines
578 B
C++
Raw Permalink Normal View History

#include <iostream>
#include <iomanip>
#include <math.h>
int main(int argc, char const *argv[])
{
double hnu = 4.138e-10; // ergs
double A = 2.20e-6;
double alpha = 7.10e3;
double EinK = 29168;
for (double logT = -10; logT <= 10; logT = logT + 0.0625) {
double T = pow(10,logT);
double cooling = hnu * A * pow(T,-0.5) * exp(-1*EinK/T);
std::cout << std::setprecision(4) << std::fixed
<< std::scientific
<< std::setw(10) << T << '\t'
<< std::setw(10) << cooling << '\n';
}
return 0;
}