26 #ifndef O2SCL_EOS_CS2_POLY_H 27 #define O2SCL_EOS_CS2_POLY_H 29 #include <gsl/gsl_sf_hyperg.h> 31 #include <o2scl/constants.h> 32 #include <o2scl/err_hnd.h> 82 void fix_params(
double nb0,
double cs20,
double nb1,
double cs21,
83 double a3,
double a4) {
86 double nb0a3=pow(nb0,a3);
87 double nb1a3=pow(nb1,a3);
88 a1i=(cs21*nb0a3-cs20*nb1a3-a4*cs20*nb0a3*nb1a3+a4*cs21*nb0a3*nb1a3)/
90 a2i=(cs20-cs21)*(1.0+a4*nb0a3)*(1.0+a4*nb1a3)/(nb0a3-nb1a3);
99 C1=mu1*pow(nb1,-a1i)*pow(1.0+a4i*pow(nb1,a3i),-a2i/a3i/a4i);
100 double na3=pow(nb2,a3i);
101 if (fabs(-a4i*na3)>1.0) {
102 O2SCL_ERR2(
"Fourth argument of hyperg_2F1 greater than 1 ",
105 C2=((1.0+
a1i)*ed2-pow(nb2,1.0+a1i)*C1*
106 gsl_sf_hyperg_2F1((1.0+a1i)/a3i,-a2i/a3i/a4i,(1.0+a1i+a3i)/a3i,
107 -a4i*na3))/(1.0+a1i);
115 double nba3=pow(nb,a3i);
116 return a1i+a2i*nba3/(1.0+a4i*nba3);
124 return pow(nb,a1i)*pow(1.0+a4i*pow(nb,a3i),a2i/a3i/a4i)*
C1;
132 double na3=pow(nb,a3i);
133 if (fabs(-a4i*na3)>1.0) {
134 O2SCL_ERR2(
"Fourth argument of hyperg_2F1 greater than 1 ",
137 return C2+pow(nb,1.0+a1i)*C1*
138 gsl_sf_hyperg_2F1((1.0+a1i)/a3i,-a2i/a3i/a4i,1.0+(1.0+a1i)/a3i,
181 double nb1=(ed1+pr1)/mub1;
182 C1=mub1*pow(nb1,-cs2);
183 C2=(ed1*cs2-pr1)/(1.0+cs2);
192 return C1*pow(nb,cs2);
200 return C1*pow(nb,cs2+1.0)/(1.0+cs2)+C2;
208 return pow((ed-C2)*(1.0+cs2)/C1,1.0/(1.0+cs2));
216 return C1*cs2*pow(nb,cs2+1.0)/(1.0+cs2)-C2;
double mu_from_nb(double nb)
Return the chemical potential in , including the rest mass, given the baryon density in ...
double pr_from_nb(double nb)
Return the pressure in given the baryon density in .
double cs2_from_nb(double nb)
Return the squared sound speed given the baryon density in .
void fix_params(double nb0, double cs20, double nb1, double cs21, double a3, double a4)
Fix and based on fitting to the sound speed at two different densities.
double C1
Chemical potential integration constant.
double a2i
Second speed of sound parameter.
double nb_from_ed(double ed)
Return the energy density in , including the rest mass energy density, given the baryon density in ...
double ed_from_nb(double nb)
Return the energy density in , including the rest mass energy density, given the baryon density in ...
An EOS based on a polynomial speed of sound.
double pr_from_nb(double nb)
Return the pressure in given the baryon density in .
double mu_from_nb(double nb)
Return the chemical potential in , including the rest mass, given the baryon density in ...
void fix_integ_consts(double nb1, double mu1, double nb2, double ed2)
Fix the integration constants by specifying the chemical potential at some baryon density and the ene...
double cs2
Speed of sound.
double C2
Energy density integration constant.
double a3i
Third speed of sound parameter.
double ed_from_nb(double nb)
Return the energy density in , including the rest mass energy density, given the baryon density in ...
#define O2SCL_ERR2(d, d2, n)
double C1
Chemical potential integration constant.
double C2
Energy density integration constant.
double a1i
First speed of sound parameter.
double a4i
Fourth speed of sound parameter.
void fix_integ_consts(double mub1, double ed1, double pr1)
Fix the integration constants by specifying the pressure, baryon chemical potential, and energy density.
EOS with a constant speed of sound.