as-500/hw24/data.cpp

24 lines
646 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
for (double logn_e = -10; logn_e <= 10; logn_e = logn_e + 0.0625) {
double n_e = pow(10,logn_e);
double net_cooling = hnu *
(1e-13)*pow(n_e,2) *
(
(2.19)*pow(1.47e-7*n_e+1,-1) -
(3.95)*pow(1-(1.47e-7*(n_e)),-1)
);
std::cout << std::setprecision(4) << std::fixed
<< std::scientific
<< std::setw(10) << n_e << '\t'
<< std::setw(10) << net_cooling << '\n';
}
return 0;
}