2 #define _CRTDBG_MAP_ALLOC
3 #define _CRT_SECURE_NO_WARNINGS
10 #define DBL_EPSILON std::numeric_limits<double>::epsilon()
26 double dphir_dDelta_a = (phi->
base(tau,delta+ddelta)-phi->
base(tau,delta-ddelta))/(2*ddelta);
27 double dphir_dDelta_e = phi->
dDelta(tau,delta);
29 double d2phir_dDelta2_a = (phi->
dDelta(tau,delta+ddelta)-phi->
dDelta(tau,delta-ddelta))/(2*ddelta);
30 double d2phir_dDelta2_e = phi->
dDelta2(tau,delta);
32 double d2phir_dDelta_dTau_a = (phi->
dDelta(tau+dtau,delta)-phi->
dDelta(tau-dtau,delta))/(2*dtau);
33 double d2phir_dDelta_dTau_e = phi->
dDelta_dTau(tau,delta);
35 double d3phir_dDelta2_dTau_a = (phi->
dDelta_dTau(tau,delta+ddelta)-phi->
dDelta_dTau(tau,delta-ddelta))/(2*ddelta);
36 double d3phir_dDelta2_dTau_e = phi->
dDelta2_dTau(tau,delta);
38 double d3phir_dDelta_dTau2_a = (phi->
dDelta_dTau(tau+dtau,delta)-phi->
dDelta_dTau(tau-dtau,delta))/(2*dtau);
39 double d3phir_dDelta_dTau2_e = phi->
dDelta_dTau2(tau,delta);
41 double d3phir_dDelta3_a = (phi->
dDelta2(tau,delta+ddelta)-phi->
dDelta2(tau,delta-ddelta))/(2*ddelta);
42 double d3phir_dDelta3_e = phi->
dDelta3(tau,delta);
44 double dphir_dTau_a = (phi->
base(tau+dtau,delta)-phi->
base(tau-dtau,delta))/(2*dtau);
45 double dphir_dTau_e = phi->
dTau(tau,delta);
47 double d2phir_dTau2_a = (phi->
dTau(tau+dtau,delta)-phi->
dTau(tau-dtau,delta))/(2*dtau);
48 double d2phir_dTau2_e = phi->
dTau2(tau,delta);
50 double d3phir_dTau3_a = (phi->
dTau2(tau+dtau,delta)-phi->
dTau2(tau-dtau,delta))/(2*dtau);
51 double d3phir_dTau3_e = phi->
dTau3(tau,delta);
53 double d2phir_dDelta2 = 0;
57 phir_power::phir_power(std::vector<double> n_in,std::vector<double> d_in,std::vector<double> t_in, std::vector<double> l_in,
int iStart_in,
int iEnd_in)
67 phir_power::phir_power(std::vector<double> n_in,std::vector<double> d_in,std::vector<double> t_in,
int iStart_in,
int iEnd_in)
72 l.assign(
d.size(),0.0);
77 phir_power::phir_power(
const double n_in[],
const double d_in[],
const double t_in[],
int iStart_in,
int iEnd_in,
int N)
79 n=std::vector<double>(n_in,n_in+N);
80 d=std::vector<double>(d_in,d_in+N);
81 t=std::vector<double>(t_in,t_in+N);
82 l.assign(d.size(),0.0);
89 n=std::vector<double>(n_in,n_in+N);
90 d=std::vector<double>(d_in,d_in+N);
91 t=std::vector<double>(t_in,t_in+N);
92 l.assign(d.size(),0.0);
99 n=std::vector<double>(n_in,n_in+N);
100 d=std::vector<double>(d_in,d_in+N);
101 t=std::vector<double>(t_in,t_in+N);
102 l=std::vector<double>(l_in,l_in+N);
107 phir_power::phir_power(
const double n_in[],
const double d_in[],
const double t_in[],
const double l_in[],
int iStart_in,
int iEnd_in,
int N)
109 n=std::vector<double>(n_in,n_in+N);
110 d=std::vector<double>(d_in,d_in+N);
111 t=std::vector<double>(t_in,t_in+N);
112 l=std::vector<double>(l_in,l_in+N);
124 throw ValueError(
format(
"coefficient %0.16f does not round to integer within DBL_EPSILON",
l[i]).c_str());
132 double summer=0, log_tau = log(tau), log_delta = log(delta);
133 for (
unsigned int i=iStart;i<=iEnd;i++)
135 summer += n[i]*A(log_tau,log_delta,delta,i);
141 double summer=0, log_tau = log(tau), log_delta = log(delta);
142 for (
unsigned int i=iStart;i<=iEnd;i++)
144 summer += n[i]*dA_dTau(log_tau,log_delta,delta,i);
150 double summer=0, log_tau = log(tau), log_delta = log(delta);
151 for (
unsigned int i=iStart;i<=iEnd;i++)
153 summer += n[i]*d2A_dTau2(log_tau,log_delta,delta,i);
159 double summer=0, log_tau = log(tau), log_delta = log(delta);
160 for (
unsigned int i=iStart;i<=iEnd;i++)
163 summer+=n[i]*t[i]*(t[i]-1)*(t[i]-2)*exp((t[i]-3)*log_tau+d[i]*log_delta-pow(delta,(
int)l[i]));
165 summer+=n[i]*t[i]*(t[i]-1)*(t[i]-2)*exp((t[i]-3)*log_tau+d[i]*log_delta);
187 double summer=0, log_tau = log(tau), log_delta = log(delta);
188 for (
unsigned int i=iStart;i<=iEnd;i++)
191 double pow_delta_li = pow(delta,(
int)l[i]);
192 summer+=n[i]*t[i]*(t[i]-1)*(d[i]-l[i]*pow_delta_li)*exp((t[i]-2)*log_tau+(d[i]-1)*log_delta-pow_delta_li);
195 summer+=n[i]*t[i]*(t[i]-1)*d[i]*exp((t[i]-2)*log_tau+(d[i]-1)*log_delta);
201 double summer=0, log_tau = log(tau), log_delta = log(delta);
202 for (
unsigned int i=iStart;i<=iEnd;++i)
204 summer += n[i]*dA_dDelta(log_tau,log_delta,delta,i);
210 double summer=0, log_tau = log(tau), log_delta = log(delta);
211 for (
unsigned int i=iStart;i<=iEnd;i++)
213 summer += n[i]*d2A_dDelta2(log_tau,log_delta,delta,i);
219 double summer=0, log_tau = log(tau), log_delta = log(delta);
220 for (
unsigned int i=iStart;i<=iEnd;i++)
224 double pow_delta_li = pow(delta,(
int)l[i]);
225 double bracket = (d[i]*(d[i]-1)*(d[i]-2)+pow_delta_li*(-2*l[i]+6*d[i]*l[i]-3*d[i]*d[i]*l[i]-3*d[i]*l[i]*l[i]+3*l[i]*l[i]-l[i]*l[i]*l[i])+pow_delta_li*pow_delta_li*(3*d[i]*l[i]*l[i]-3*l[i]*l[i]+3*l[i]*l[i]*l[i])-l[i]*l[i]*l[i]*pow_delta_li*pow_delta_li*pow_delta_li);
226 summer+=n[i]*bracket*exp(t[i]*log_tau+(d[i]-3)*log_delta-pow_delta_li);
229 summer+=n[i]*d[i]*(d[i]-1.0)*(d[i]-2)*exp(t[i]*log_tau+(d[i]-3)*log_delta);
235 double summer=0, log_tau = log(tau), log_delta = log(delta);
236 for (
unsigned int i=iStart;i<=iEnd;i++)
239 double pow_delta_li = pow(delta,(
int)l[i]);
240 summer+=n[i]*t[i]*(((d[i]-l[i]*pow_delta_li))*(d[i]-1-l[i]*pow_delta_li)-l[i]*l[i]*pow_delta_li)*exp((t[i]-1)*log_tau+(d[i]-2)*log_delta-pow_delta_li);
243 summer+=n[i]*d[i]*t[i]*(d[i]-1)*exp((t[i]-1)*log_tau+(d[i]-2)*log_delta);
249 double summer=0, log_tau = log(tau), log_delta = log(delta);
250 for (
unsigned int i=iStart;i<=iEnd;i++)
252 summer += n[i]*d2A_dDelta_dTau(log_tau, log_delta, delta, i);
257 double phir_power::A(
double log_tau,
double log_delta,
double delta,
int i)
throw()
260 return exp(t[i]*log_tau+d[i]*log_delta-pow(delta,(
int)l[i]));
262 return exp(t[i]*log_tau+d[i]*log_delta);
266 double pow_delta_li, li, ni, di, ti;
267 ni = n[i]; di = d[i]; ti = t[i]; li = l[i];
269 pow_delta_li = pow(delta,(
int)li);
270 return (di-li*pow_delta_li)*exp(ti*log_tau+(di-1)*log_delta-pow_delta_li);
274 return di*exp(ti*log_tau+(di-1)*log_delta);
280 double pow_delta_li = pow(delta,(
int)l[i]);
281 return ((d[i]-l[i]*pow_delta_li)*(d[i]-1.0-l[i]*pow_delta_li) - l[i]*l[i]*pow_delta_li)*exp(t[i]*log_tau+(d[i]-2)*log_delta-pow_delta_li);
284 return d[i]*(d[i]-1.0)*exp(t[i]*log_tau+(d[i]-2)*log_delta);
289 double pow_delta_li = pow(delta,(
int)l[i]);
290 return t[i]*(d[i]-l[i]*pow_delta_li)*exp((t[i]-1)*log_tau+(d[i]-1)*log_delta-pow_delta_li);
293 return d[i]*t[i]*exp((t[i]-1)*log_tau+(d[i]-1)*log_delta);
299 return t[i]*exp((t[i]-1)*log_tau+d[i]*log_delta-pow(delta,(
int)l[i]));
301 return t[i]*exp((t[i]-1)*log_tau+d[i]*log_delta);
306 return t[i]*(t[i]-1)*exp((t[i]-2)*log_tau+d[i]*log_delta-pow(delta,(
int)l[i]));
308 return t[i]*(t[i]-1)*exp((t[i]-2)*log_tau+d[i]*log_delta);
314 std::vector<double> out = tau;
315 for (
int i = 0; i < (int)tau.size(); i++)
317 out[i] = this->dDelta(tau[i],delta[i]);
323 std::vector<double> out = tau;
324 for (
int i = 0; i < (int)tau.size(); i++)
326 out[i] = this->dDelta2(tau[i],delta[i]);
332 std::vector<double> out = tau;
333 for (
int i = 0; i < (int)tau.size(); i++)
335 out[i] = this->dTau2(tau[i],delta[i]);
341 std::vector<double> out = tau;
342 for (
int i = 0; i < (int)tau.size(); i++)
344 out[i] = this->dDelta_dTau(tau[i],delta[i]);
349 #ifndef DISABLE_CATCH
350 TEST_CASE(
"Power Helmholtz terms",
"[helmholtz],[fast]")
353 double n[]={0.0, 0.5586817e-1, 0.4982230e0, 0.2458698e-1, 0.8570145e-3, 0.4788584e-3, -0.1800808e1, 0.2671641e0, -0.4781652e-1, 0.1423987e-1, 0.3324062e0, -0.7485907e-2, 0.1017263e-3, -0.5184567e+0, -0.8692288e-1, 0.2057144e+0, -0.5000457e-2, 0.4603262e-3, -0.3497836e-2, 0.6995038e-2, -0.1452184e-1, -0.1285458e-3};
354 double d[]={0,2,1,3,6,6,1,1,2,5,2,2,4,1,4,1,2,4,1,5,3,10};
355 double t[]={0.0,-1.0/2.0,0.0,0.0,0.0,3.0/2.0,3.0/2.0,2.0,2.0,1.0,3.0,5.0,1.0,5.0,5.0,6.0,10.0,10.0,10.0,18.0,22.0,50.0};
356 double c[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,2.0,2.0,2.0,2.0,2.0,2.0,3.0,3.0,3.0,4.0};
363 double ANA = phir.
dDelta(0.5, 0.5);
364 double NUM = (phir.
base(0.5, 0.5+eps) - phir.
base(0.5,0.5-eps))/(2*eps);
369 double ANA = phir.
dTau(0.5, 0.5);
370 double NUM = (phir.
base(0.5+eps, 0.5) - phir.
base(0.5-eps,0.5))/(2*eps);
375 double ANA = phir.
dDelta2(0.5, 0.5);
376 double NUM = (phir.
dDelta(0.5, 0.5+eps) - phir.
dDelta(0.5,0.5-eps))/(2*eps);
381 double ANA = phir.
dTau2(0.5, 0.5);
382 double NUM = (phir.
dTau(0.5+eps, 0.5) - phir.
dTau(0.5-eps,0.5))/(2*eps);
388 double NUM = (phir.
dTau(0.5, 0.5+eps) - phir.
dTau(0.5,0.5-eps))/(2*eps);
398 for (
unsigned int i=iStart;i<=iEnd;i++)
426 this->n=std::vector<double>(n, n+N);
427 this->d=std::vector<double>(d, d+N);
428 this->t=std::vector<double>(t, t+N);
429 this->l=std::vector<double>(l, l+N);
430 this->g=std::vector<double>(g, g+N);
436 this->n = std::vector<double>(n, n+N);
437 this->d = std::vector<double>(d, d+N);
438 this->t = std::vector<double>(t, t+N);
439 this->l = std::vector<double>(l, l+N);
440 this->g = std::vector<double>(g, g+N);
448 double summer=0, log_tau = log(tau), log_delta = log(delta);
449 for (
unsigned int i=iStart;i<=iEnd;i++)
451 summer += n[i]*exp(t[i]*log_tau+d[i]*log_delta-g[i]*pow(delta,l[i]));
457 double summer=0, log_tau = log(tau), log_delta = log(delta);
458 for (
unsigned int i=iStart;i<=iEnd;i++)
460 summer += n[i]*t[i]*exp((t[i]-1)*log_tau+d[i]*log_delta-g[i]*pow(delta,l[i]));
466 double summer=0, log_tau = log(tau), log_delta = log(delta);
467 for (
unsigned int i=iStart;i<=iEnd;i++)
469 summer+=n[i]*t[i]*(t[i]-1)*exp((t[i]-2)*log_tau+d[i]*log_delta-g[i]*pow(delta,l[i]));
475 double summer=0, log_tau = log(tau), log_delta = log(delta);
476 for (
unsigned int i=iStart;i<=iEnd;i++)
478 summer+=n[i]*t[i]*(t[i]-1)*(t[i]-2)*exp((t[i]-3)*log_tau+d[i]*log_delta-g[i]*pow(delta,l[i]));
484 double summer=0, log_tau = log(tau), log_delta = log(delta);
485 for (
unsigned int i=iStart;i<=iEnd;i++)
487 double pow_delta_li = pow(delta,l[i]);
488 summer+=n[i]*t[i]*(t[i]-1)*(d[i]-g[i]*l[i]*pow_delta_li)*exp((t[i]-2)*log_tau+(d[i]-1)*log_delta-g[i]*pow_delta_li);
494 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_delta_li;
495 for (
unsigned int i=iStart;i<=iEnd;i++)
497 pow_delta_li = pow(delta,l[i]);
498 summer += n[i]*(d[i]-g[i]*l[i]*pow_delta_li)*exp(t[i]*log_tau+(d[i]-1)*log_delta-g[i]*pow_delta_li);
504 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_delta_li;
505 for (
unsigned int i=iStart;i<=iEnd;i++)
507 pow_delta_li = pow(delta,l[i]);
509 double bracket = d[i]*d[i] - 2*d[i]*pow(delta,l[i])*g[i]*l[i] - d[i] + pow(delta,2*l[i])*g[i]*g[i]*l[i]*l[i] - pow(delta,l[i])*g[i]*l[i]*l[i] + pow(delta,l[i])*g[i]*l[i];
510 summer += n[i]*bracket*exp(t[i]*log_tau+(d[i]-2)*log_delta-g[i]*pow_delta_li);
516 double summer=0, log_tau = log(tau), log_delta = log(delta);
517 for (
unsigned int i=iStart;i<=iEnd;i++)
522 double pow_delta_li = pow(delta,l[i]);
523 double pow_delta_2li = pow(delta,2*l[i]);
524 double pow_delta_3li = pow(delta,3*l[i]);
525 double bracket = d[i]*d[i]*d[i] - 3*d[i]*d[i]*pow_delta_li*g[i]*l[i] - 3*d[i]*d[i] + 3*d[i]*pow_delta_2li*g[i]*g[i]*l[i]*l[i] - 3*d[i]*pow_delta_li*g[i]*l[i]*l[i] + 6*d[i]*pow_delta_li*g[i]*l[i] + 2*d[i] - pow_delta_3li*g[i]*g[i]*g[i]*l[i]*l[i]*l[i] + 3*pow_delta_2li*g[i]*g[i]*l[i]*l[i]*l[i] - 3*pow_delta_2li*g[i]*g[i]*l[i]*l[i] - pow_delta_li*g[i]*l[i]*l[i]*l[i] + 3*pow_delta_li*g[i]*l[i]*l[i] - 2*pow_delta_li*g[i]*l[i];
526 summer += n[i]*bracket*exp(t[i]*log_tau+(d[i]-3)*log_delta-g[i]*pow_delta_li);
532 double summer=0, log_tau = log(tau), log_delta = log(delta);
533 for (
unsigned int i=iStart;i<=iEnd;i++)
535 double pow_delta_li = pow(delta,l[i]);
537 double bracket = d[i]*d[i] - 2*d[i]*pow(delta,l[i])*g[i]*l[i] - d[i] + pow(delta,2*l[i])*g[i]*g[i]*l[i]*l[i] - pow(delta,l[i])*g[i]*l[i]*l[i] + pow(delta,l[i])*g[i]*l[i];
538 summer += n[i]*t[i]*bracket*exp((t[i]-1)*log_tau+(d[i]-2)*log_delta-g[i]*pow_delta_li);
544 double summer=0, log_tau = log(tau), log_delta = log(delta);
545 for (
unsigned int i=iStart;i<=iEnd;i++)
547 double pow_delta_li = pow(delta,l[i]);
548 summer+=n[i]*t[i]*(d[i]-g[i]*l[i]*pow_delta_li)*exp((t[i]-1)*log_tau+(d[i]-1)*log_delta-g[i]*pow_delta_li);
557 for (
unsigned int i=iStart;i<=iEnd;i++)
573 phir_Lemmon2005::phir_Lemmon2005(std::vector<double> n,std::vector<double> d,std::vector<double> t, std::vector<double> l, std::vector< double> m,
int iStart_in,
int iEnd_in)
585 this->n=std::vector<double>(n,n+N);
586 this->d=std::vector<double>(d,d+N);
587 this->t=std::vector<double>(t,t+N);
588 this->l=std::vector<double>(l,l+N);
589 this->m=std::vector<double>(m,m+N);
593 phir_Lemmon2005::phir_Lemmon2005(
const double n[],
const double d[],
const double t[],
const double l[],
const double m[],
int iStart_in,
int iEnd_in,
int N)
595 this->n=std::vector<double>(n,n+N);
596 this->d=std::vector<double>(d,d+N);
597 this->t=std::vector<double>(t,t+N);
598 this->l=std::vector<double>(l,l+N);
599 this->m=std::vector<double>(m,m+N);
607 double summer=0, log_tau = log(tau), log_delta = log(delta);
608 for (
unsigned int i=iStart;i<=iEnd;i++)
610 if (l[i] != 0 && m[i] != 0)
611 summer += n[i]*exp(t[i]*log_tau+d[i]*log_delta-pow(delta,l[i])-pow(tau,m[i]));
612 else if (l[i] != 0 && m[i] == 0)
613 summer += n[i]*exp(t[i]*log_tau+d[i]*log_delta-pow(delta,l[i]));
615 summer += n[i]*exp(t[i]*log_tau+d[i]*log_delta);
621 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_tau_mi;
622 for (
unsigned int i=iStart;i<=iEnd;i++)
624 if (l[i] != 0 && m[i] != 0){
625 pow_tau_mi = pow(tau,m[i]);
626 summer += n[i]*(t[i]-m[i]*pow_tau_mi)*exp((t[i]-1)*log_tau+d[i]*log_delta-pow(delta,l[i])-pow_tau_mi);
628 else if (l[i] != 0 && m[i] == 0)
629 summer += n[i]*t[i]*exp((t[i]-1)*log_tau+d[i]*log_delta-pow(delta,l[i]));
631 summer += n[i]*t[i]*exp((t[i]-1)*log_tau+d[i]*log_delta);
637 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_tau_mi;
638 for (
unsigned int i=iStart;i<=iEnd;i++)
640 if (l[i] != 0 && m[i] != 0){
641 pow_tau_mi = pow(tau,m[i]);
642 double bracket = (t[i]-m[i]*pow_tau_mi)*(t[i]-1-m[i]*pow_tau_mi)-m[i]*m[i]*pow_tau_mi;
643 summer+=n[i]*bracket*exp((t[i]-2)*log_tau+d[i]*log_delta-pow(delta,l[i])-pow_tau_mi);
645 else if (l[i] != 0 && m[i] == 0)
646 summer+=n[i]*t[i]*(t[i]-1)*exp((t[i]-2)*log_tau+d[i]*log_delta-pow(delta,l[i]));
648 summer+=n[i]*t[i]*(t[i]-1)*exp((t[i]-2)*log_tau+d[i]*log_delta);
683 double summer=0, log_tau = log(tau), log_delta = log(delta),pow_delta_li, pow_tau_mi, bracket;
684 for (
unsigned int i=iStart;i<=iEnd;i++)
686 if (l[i] != 0 && m[i] != 0){
687 pow_delta_li = pow(delta,l[i]);
688 pow_tau_mi = pow(tau,m[i]);
689 bracket = -pow(tau,t[i]+m[i]-3)*m[i]*m[i]*(2*t[i]-2*m[i]*pow_tau_mi-1-m[i])+((t[i]-2)*pow(tau,t[i]-3)-pow(tau,t[i]-2)*m[i]*pow(tau,m[i]-1))*((t[i]-m[i]*pow_tau_mi)*(t[i]-1-m[i]*pow_tau_mi)-m[i]*m[i]*pow_tau_mi);
690 summer += n[i]*t[i]*(t[i]-1)*(t[i]-2)*exp((t[i]-3)*log_tau+d[i]*log_delta-pow_delta_li-pow_tau_mi);
692 else if (l[i] != 0 && m[i] == 0){
693 summer += n[i]*t[i]*(t[i]-1)*(t[i]-2)*exp((t[i]-3)*log_tau+d[i]*log_delta-pow(delta,l[i]));
696 summer += n[i]*t[i]*(t[i]-1)*(t[i]-2)*exp((t[i]-3)*log_tau+d[i]*log_delta);
702 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_delta_li, pow_tau_mi, bracket;
703 for (
unsigned int i=iStart;i<=iEnd;i++)
705 if (l[i] != 0 && m[i] != 0){
706 pow_delta_li = pow(delta,l[i]);
707 pow_tau_mi = pow(tau,m[i]);
709 bracket = ((t[i]-m[i]*pow_tau_mi)*(t[i]-1-m[i]*pow_tau_mi)-m[i]*m[i]*pow_tau_mi)*(d[i]-l[i]*pow_delta_li);
710 summer+=n[i]*bracket*exp((t[i]-2)*log_tau+(d[i]-1)*log_delta-pow_delta_li-pow_tau_mi);
712 else if (l[i] != 0 && m[i] == 0){
713 pow_delta_li = pow(delta,l[i]);
714 summer+=n[i]*t[i]*(t[i]-1)*(d[i]-l[i]*pow_delta_li)*exp((t[i]-2)*log_tau+(d[i]-1)*log_delta-pow_delta_li);
717 summer+=n[i]*t[i]*(t[i]-1)*d[i]*exp((t[i]-2)*log_tau+(d[i]-1)*log_delta);
723 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_delta_li, pow_tau_mi;
724 for (
unsigned int i=iStart;i<=iEnd;i++)
726 if (l[i] != 0 && m[i] != 0){
727 pow_delta_li = pow(delta,l[i]);
728 pow_tau_mi = pow(tau,m[i]);
729 summer += n[i]*(d[i]-l[i]*pow_delta_li)*exp(t[i]*log_tau+(d[i]-1)*log_delta-pow_delta_li-pow_tau_mi);
731 else if (l[i]>0 && m[i] == 0){
732 pow_delta_li = pow(delta,l[i]);
733 summer += n[i]*(d[i]-l[i]*pow_delta_li)*exp(t[i]*log_tau+(d[i]-1)*log_delta-pow_delta_li);
736 summer += n[i]*d[i]*exp(t[i]*log_tau+(d[i]-1)*log_delta);
742 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_delta_li, pow_tau_mi;
743 for (
unsigned int i=iStart;i<=iEnd;i++)
745 if (l[i] != 0 && m[i] != 0){
746 pow_delta_li = pow(delta,l[i]);
747 pow_tau_mi = pow(tau,m[i]);
748 summer+=n[i]*((d[i]-l[i]*pow_delta_li)*(d[i]-1.0-l[i]*pow_delta_li) - l[i]*l[i]*pow_delta_li)*exp(t[i]*log_tau+(d[i]-2)*log_delta-pow_delta_li-pow_tau_mi);
751 else if (l[i] != 0 && m[i] == 0){
752 pow_delta_li = pow(delta,l[i]);
753 summer+=n[i]*((d[i]-l[i]*pow_delta_li)*(d[i]-1.0-l[i]*pow_delta_li) - l[i]*l[i]*pow_delta_li)*exp(t[i]*log_tau+(d[i]-2)*log_delta-pow_delta_li);
756 summer+=n[i]*d[i]*(d[i]-1.0)*exp(t[i]*log_tau+(d[i]-2)*log_delta);
762 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_delta_li, pow_tau_mi, bracket;
763 for (
unsigned int i=iStart;i<=iEnd;i++)
765 if (l[i] != 0 && m[i] != 0){
766 pow_delta_li = pow(delta,l[i]);
767 pow_tau_mi = pow(tau,m[i]);
768 bracket = (d[i]*(d[i]-1)*(d[i]-2)+pow_delta_li*(-2*l[i]+6*d[i]*l[i]-3*d[i]*d[i]*l[i]-3*d[i]*l[i]*l[i]+3*l[i]*l[i]-l[i]*l[i]*l[i])+pow_delta_li*pow_delta_li*(3*d[i]*l[i]*l[i]-3*l[i]*l[i]+3*l[i]*l[i]*l[i])-l[i]*l[i]*l[i]*pow_delta_li*pow_delta_li*pow_delta_li);
769 summer+=n[i]*bracket*exp(t[i]*log_tau+(d[i]-3)*log_delta-pow_delta_li-pow_tau_mi);
771 else if (l[i] != 0 && m[i] == 0)
773 pow_delta_li = pow(delta,l[i]);
774 bracket = (d[i]*(d[i]-1)*(d[i]-2)+pow_delta_li*(-2*l[i]+6*d[i]*l[i]-3*d[i]*d[i]*l[i]-3*d[i]*l[i]*l[i]+3*l[i]*l[i]-l[i]*l[i]*l[i])+pow_delta_li*pow_delta_li*(3*d[i]*l[i]*l[i]-3*l[i]*l[i]+3*l[i]*l[i]*l[i])-l[i]*l[i]*l[i]*pow_delta_li*pow_delta_li*pow_delta_li);
775 summer+=n[i]*bracket*exp(t[i]*log_tau+(d[i]-3)*log_delta-pow_delta_li);
778 summer+=n[i]*d[i]*(d[i]-1.0)*(d[i]-2)*exp(t[i]*log_tau+(d[i]-3)*log_delta);
785 double summer=0, log_tau = log(tau), log_delta = log(delta), bracket, pow_tau_mi, pow_delta_li;
786 for (
unsigned int i=iStart;i<=iEnd;i++)
788 if (l[i] != 0 && m[i] != 0){
789 pow_delta_li = pow(delta,l[i]);
790 pow_tau_mi = pow(tau,m[i]);
791 bracket = (t[i]-m[i]*pow_tau_mi)*(((d[i]-l[i]*pow_delta_li))*(d[i]-1-l[i]*pow_delta_li)-l[i]*l[i]*pow_delta_li);
792 summer += n[i]*bracket*exp((t[i]-1)*log_tau+(d[i]-2)*log_delta-pow_delta_li-pow_tau_mi);
794 else if (l[i] != 0 && m[i] == 0){
795 pow_delta_li = pow(delta,l[i]);
796 bracket = t[i]*(((d[i]-l[i]*pow_delta_li))*(d[i]-1-l[i]*pow_delta_li)-l[i]*l[i]*pow_delta_li);
797 summer += n[i]*bracket*exp((t[i]-1)*log_tau+(d[i]-2)*log_delta-pow_delta_li);
800 summer += n[i]*d[i]*t[i]*(d[i]-1)*exp((t[i]-1)*log_tau+(d[i]-2)*log_delta);
806 double summer=0, log_tau = log(tau), log_delta = log(delta), pow_delta_li, pow_tau_mi;
807 for (
unsigned int i=iStart;i<=iEnd;i++)
809 if (l[i] != 0 && m[i] != 0){
810 pow_delta_li = pow(delta,l[i]);
811 pow_tau_mi = pow(tau,m[i]);
812 summer+=n[i]*(d[i]-l[i]*pow_delta_li)*(t[i]-m[i]*pow_tau_mi)*exp((t[i]-1)*log_tau+(d[i]-1)*log_delta-pow_delta_li-pow_tau_mi);
814 else if (l[i] != 0 && m[i] == 0){
815 double pow_delta_li = pow(delta,l[i]);
816 summer+=n[i]*t[i]*(d[i]-l[i]*pow_delta_li)*exp((t[i]-1)*log_tau+(d[i]-1)*log_delta-pow_delta_li);
819 summer+=n[i]*d[i]*t[i]*exp((t[i]-1)*log_tau+(d[i]-1)*log_delta);
825 std::vector<double> alpha_in, std::vector<double> epsilon_in, std::vector<double> beta_in, std::vector<double> gamma_in,
826 unsigned int iStart_in,
unsigned int iEnd_in)
840 double epsilon_in[],
double beta_in[],
double gamma_in[],
841 unsigned int iStart_in,
unsigned int iEnd_in,
unsigned int N)
843 n=std::vector<double>(n_in,n_in+N);
844 d=std::vector<double>(d_in,d_in+N);
845 t=std::vector<double>(t_in,t_in+N);
846 alpha=std::vector<double>(alpha_in,alpha_in+N);
847 epsilon=std::vector<double>(epsilon_in,epsilon_in+N);
848 beta=std::vector<double>(beta_in,beta_in+N);
849 gamma=std::vector<double>(gamma_in,gamma_in+N);
854 const double epsilon_in[],
const double beta_in[],
const double gamma_in[],
855 unsigned int iStart_in,
unsigned int iEnd_in,
unsigned int N)
857 n=std::vector<double>(n_in,n_in+N);
858 d=std::vector<double>(d_in,d_in+N);
859 t=std::vector<double>(t_in,t_in+N);
860 alpha=std::vector<double>(alpha_in,alpha_in+N);
861 epsilon=std::vector<double>(epsilon_in,epsilon_in+N);
862 beta=std::vector<double>(beta_in,beta_in+N);
863 gamma=std::vector<double>(gamma_in,gamma_in+N);
873 for (
unsigned int i=iStart;i<=iEnd;i++)
896 for (
unsigned int i=iStart;i<=iEnd;i++)
898 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
899 summer+=n[i]*pow(delta,d[i])*pow(tau,t[i])*psi;
906 for (
unsigned int i=iStart;i<=iEnd;i++)
908 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
909 summer+=n[i]*pow(delta,d[i])*pow(tau,t[i])*psi*(t[i]/tau-2.0*beta[i]*(tau-gamma[i]));
916 for (
unsigned int i=iStart;i<=iEnd;i++)
918 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
919 summer+=n[i]*pow(delta,d[i])*pow(tau,t[i])*psi*(pow(t[i]/tau-2.0*beta[i]*(tau-gamma[i]),2)-t[i]/pow(tau,2)-2.0*beta[i]);
926 for (
unsigned int i=iStart;i<=iEnd;i++)
929 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
930 double dpsi_dTau = exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2))*(-2*beta[i]*(tau-gamma[i]));
932 double bracket = pow(t[i]/tau-2.0*beta[i]*(tau-gamma[i]),2)-t[i]/pow(tau,2)-2.0*beta[i];
933 double dbracket_dTau = 2*(t[i]/tau-2.0*beta[i]*(tau-gamma[i]))*(-t[i]/tau/tau-2*beta[i])+2*t[i]/pow(tau,3);
934 summer+=n[i]*pow(delta,d[i])*(t[i]*pow(tau,t[i]-1)*psi*bracket+pow(tau,t[i])*dpsi_dTau*bracket+pow(tau,t[i])*psi*dbracket_dTau);
941 for (
unsigned int i=iStart;i<=iEnd;i++)
943 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
944 summer+=n[i]*pow(delta,d[i])*pow(tau,t[i])*psi*(d[i]/delta-2.0*alpha[i]*(delta-epsilon[i]));
951 for (
unsigned int i=iStart;i<=iEnd;i++)
953 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
954 summer+=n[i]*pow(tau,t[i])*psi*(-2.0*alpha[i]*pow(delta,d[i])+4.0*pow(alpha[i],2)*pow(delta,d[i])*pow(delta-epsilon[i],2)-4.0*d[i]*alpha[i]*pow(delta,d[i]-1)*(delta-epsilon[i])+d[i]*(d[i]-1.0)*pow(delta,d[i]-2));
961 for (
unsigned int i=iStart;i<=iEnd;i++)
963 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
964 double bracket = (pow(d[i]-2*alpha[i]*delta*(delta-epsilon[i]),3)-3*d[i]*d[i]+2*d[i]-6*d[i]*alpha[i]*delta*delta+6*alpha[i]*delta*(delta-epsilon[i])*(d[i]+2*alpha[i]*delta*delta));
965 summer+=n[i]*pow(tau,t[i])*pow(delta,d[i]-3)*psi*bracket;
972 for (
unsigned int i=iStart;i<=iEnd;i++)
974 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
975 summer+=n[i]*pow(tau,t[i])*psi*(t[i]/tau-2.0*beta[i]*(tau-gamma[i]))*(-2.0*alpha[i]*pow(delta,d[i])+4.0*pow(alpha[i],2)*pow(delta,d[i])*pow(delta-epsilon[i],2)-4.0*d[i]*alpha[i]*pow(delta,d[i]-1)*(delta-epsilon[i])+d[i]*(d[i]-1.0)*pow(delta,d[i]-2));
982 for (
unsigned int i=iStart;i<=iEnd;i++)
984 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
985 summer+=n[i]*pow(delta,d[i])*pow(tau,t[i])*psi*(d[i]/delta-2.0*alpha[i]*(delta-epsilon[i]))*(t[i]/tau-2.0*beta[i]*(tau-gamma[i]));
992 for (
unsigned int i=iStart;i<=iEnd;i++)
994 psi=exp(-alpha[i]*pow(delta-epsilon[i],2)-beta[i]*pow(tau-gamma[i],2));
995 summer+=n[i]*pow(delta,d[i])*pow(tau,t[i])*psi*(d[i]/delta-2.0*alpha[i]*(delta-epsilon[i]))*(pow(t[i]-2.0*beta[i]*tau*(tau-gamma[i]),2)-t[i]-2*beta[i]*tau*tau)/tau/tau;
1001 std::vector<double> eta_in, std::vector<double> epsilon_in, std::vector<double> beta_in, std::vector<double> gamma_in,
1002 unsigned int iStart_in,
unsigned int iEnd_in)
1020 for (
unsigned int i=iStart;i<=iEnd;i++)
1040 double epsilon_in[],
double beta_in[],
double gamma_in[],
1041 unsigned int iStart_in,
unsigned int iEnd_in,
unsigned int N)
1043 n=std::vector<double>(n_in, n_in+N);
1044 d=std::vector<double>(d_in, d_in+N);
1045 t=std::vector<double>(t_in, t_in+N);
1046 eta=std::vector<double>(eta_in, eta_in+N);
1047 epsilon=std::vector<double>(epsilon_in, epsilon_in+N);
1048 beta=std::vector<double>(beta_in, beta_in+N);
1049 gamma=std::vector<double>(gamma_in, gamma_in+N);
1055 double summer = 0, psi;
1056 for (
unsigned int i=iStart;i<=iEnd;i++)
1058 psi = exp(-eta[i]*pow(delta-epsilon[i],2)-beta[i]*(delta-gamma[i]));
1059 summer += n[i]*pow(tau,t[i])*pow(delta,d[i])*psi;
1065 double summer = 0, psi;
1066 for (
unsigned int i=iStart;i<=iEnd;i++)
1068 psi = exp(-eta[i]*pow(delta-epsilon[i],2)-beta[i]*(delta-gamma[i]));
1069 summer += n[i]*pow(tau,t[i])*pow(delta,d[i])*psi*(d[i]/delta-2*eta[i]*(delta-epsilon[i])-beta[i]);
1075 double summer = 0, psi;
1076 for (
unsigned int i=iStart;i<=iEnd;i++)
1078 psi = exp(-eta[i]*pow(delta-epsilon[i],2)-beta[i]*(delta-gamma[i]));
1079 summer += n[i]*pow(tau,t[i])*pow(delta,d[i])*psi*(pow(d[i]/delta-2*eta[i]*(delta-epsilon[i])-beta[i],2)-d[i]/delta/delta-2*eta[i]);
1085 double summer = 0, psi;
1086 for (
unsigned int i=iStart;i<=iEnd;i++)
1088 psi = exp(-eta[i]*pow(delta-epsilon[i],2)-beta[i]*(delta-gamma[i]));
1089 summer += n[i]*t[i]*pow(tau,t[i]-1)*pow(delta,d[i])*psi;
1095 double summer = 0, psi;
1096 for (
unsigned int i=iStart;i<=iEnd;i++)
1098 psi = exp(-eta[i]*pow(delta-epsilon[i],2)-beta[i]*(delta-gamma[i]));
1099 summer += n[i]*t[i]*(t[i]-1)*pow(tau,t[i]-2)*pow(delta,d[i])*psi;
1105 double summer = 0, psi;
1106 for (
unsigned int i=iStart;i<=iEnd;i++)
1108 psi = exp(-eta[i]*pow(delta-epsilon[i],2)-beta[i]*(delta-gamma[i]));
1109 summer += n[i]*t[i]*pow(tau,t[i]-1)*pow(delta,d[i])*psi*(d[i]/delta-2*eta[i]*(delta-epsilon[i])-beta[i]);
1116 std::vector<double> a_in, std::vector<double> b_in, std::vector<double> beta_in,
1117 std::vector<double> A_in, std::vector<double> B_in, std::vector<double> C_in,
1118 std::vector<double> D_in,
int iStart_in,
int iEnd_in)
1135 double a[],
double b[],
double beta[],
1136 double A[],
double B[],
double C[],
1137 double D[],
int iStart,
int iEnd,
1140 this->n=std::vector<double>(n,n+N);
1141 this->d=std::vector<double>(d,d+N);
1142 this->t=std::vector<double>(t,t+N);
1143 this->a=std::vector<double>(a,a+N);
1144 this->b=std::vector<double>(b,b+N);
1145 this->beta=std::vector<double>(beta,beta+N);
1146 this->A=std::vector<double>(A,A+N);
1147 this->B=std::vector<double>(B,B+N);
1148 this->C=std::vector<double>(C,C+N);
1149 this->D=std::vector<double>(D,D+N);
1150 this->iStart=iStart;
1160 for (
int i=iStart;i<=iEnd;i++)
1183 double summer=0,theta,DELTA,PSI;
1184 for (
int i=iStart;i<=iEnd;i++)
1186 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1/(2*beta[i]));
1187 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1188 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1189 summer+=n[i]*pow(DELTA,b[i])*delta*PSI;
1196 double summer=0,theta,DELTA,PSI,dPSI_dDelta,dDELTA_dDelta,dDELTAbi_dDelta;
1197 for (
int i=iStart;i<=iEnd;i++)
1199 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i]));
1200 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1201 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1202 dPSI_dDelta=-2.0*C[i]*(delta-1.0)*PSI;
1203 dDELTA_dDelta=(delta-1.0)*(A[i]*theta*2.0/beta[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)+2.0*B[i]*a[i]*pow(pow(delta-1.0,2),a[i]-1.0));
1208 dDELTAbi_dDelta = 0;
1211 dDELTAbi_dDelta=b[i]*pow(DELTA,b[i]-1.0)*dDELTA_dDelta;
1213 summer+=n[i]*(pow(DELTA,b[i])*(PSI+delta*dPSI_dDelta)+dDELTAbi_dDelta*delta*PSI);
1219 double summer=0,theta,DELTA,PSI,dPSI_dDelta,dDELTA_dDelta,dDELTAbi_dDelta;
1220 double dDELTAbi_dTau,dPSI_dTau, dtheta_dDelta;
1221 double dPSI2_dDelta2, dDELTA2_dDelta2,dDELTAbi2_dDelta2,dPSI2_dTau2,dDELTAbi2_dTau2;
1222 double dDELTAbi2_dDelta_dTau,dPSI2_dDelta_dTau;
1223 double dDELTAbi3_dDelta_dTau2,dPSI3_dDelta_dTau2;
1225 for (
int i=iStart;i<=iEnd;i++)
1227 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i]));
1228 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1229 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1231 dPSI_dDelta=-2.0*C[i]*(delta-1.0)*PSI;
1232 dDELTA_dDelta=(delta-1.0)*(A[i]*theta*2.0/beta[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)+2.0*B[i]*a[i]*pow(pow(delta-1.0,2),a[i]-1.0));
1233 dDELTAbi_dDelta=b[i]*pow(DELTA,b[i]-1.0)*dDELTA_dDelta;
1235 dPSI2_dDelta2=(2.0*C[i]*pow(delta-1.0,2)-1.0)*2.0*C[i]*PSI;
1236 dDELTA2_dDelta2=1.0/(delta-1.0)*dDELTA_dDelta+pow(delta-1.0,2)*(4.0*B[i]*a[i]*(a[i]-1.0)*pow(pow(delta-1.0,2),a[i]-2.0)+2.0*pow(A[i]/beta[i],2)*pow(pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0),2)+A[i]*theta*4.0/beta[i]*(1.0/(2.0*beta[i])-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-2.0));
1237 dDELTAbi2_dDelta2=b[i]*(pow(DELTA,b[i]-1.0)*dDELTA2_dDelta2+(b[i]-1.0)*pow(DELTA,b[i]-2.0)*pow(dDELTA_dDelta,2));
1239 dPSI_dTau=-2.0*D[i]*(tau-1.0)*PSI;
1240 dDELTAbi_dTau=-2.0*theta*b[i]*pow(DELTA,b[i]-1.0);
1242 dPSI2_dTau2=(2.0*D[i]*pow(tau-1.0,2)-1.0)*2.0*D[i]*PSI;
1243 dDELTAbi2_dTau2=2.0*b[i]*pow(DELTA,b[i]-1.0)+4.0*pow(theta,2)*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2.0);
1244 dPSI2_dDelta_dTau=4.0*C[i]*D[i]*(delta-1.0)*(tau-1.0)*PSI;
1245 dDELTAbi2_dDelta_dTau=-A[i]*b[i]*2.0/beta[i]*pow(DELTA,b[i]-1.0)*(delta-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)-2.0*theta*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2.0)*dDELTA_dDelta;
1247 dPSI3_dDelta_dTau2 = 2*D[i]*(2*D[i]*pow(tau-1,2)-1)*dPSI_dDelta;
1248 dtheta_dDelta = A[i]/(2*beta[i])*pow(pow(delta-1,2),1/(2*beta[i])-1)*2*(delta-1);
1249 dDELTAbi3_dDelta_dTau2 = 2*b[i]*(b[i]-1)*pow(DELTA,b[i]-2)*dDELTA_dDelta+4*pow(theta,2)*b[i]*(b[i]-1)*(b[i]-2)*pow(DELTA,b[i]-3)*dDELTA_dDelta+8*theta*b[i]*(b[i]-1)*pow(DELTA,b[i]-2)*dtheta_dDelta;
1251 summer += n[i]*delta*(dDELTAbi2_dTau2*dPSI_dDelta+dDELTAbi3_dDelta_dTau2*PSI+2*dDELTAbi_dTau*dPSI2_dDelta_dTau+2.0*dDELTAbi2_dDelta_dTau*dPSI_dTau+pow(DELTA,b[i])*dPSI3_dDelta_dTau2+dDELTAbi_dDelta*dPSI2_dTau2)+n[i]*(dDELTAbi2_dTau2*PSI+2.0*dDELTAbi_dTau*dPSI_dTau+pow(DELTA,b[i])*dPSI2_dTau2);
1258 double summer=0,theta,DELTA,PSI,dPSI_dDelta,dDELTA_dDelta,dDELTAbi_dDelta;
1259 double dPSI2_dDelta2, dDELTA2_dDelta2,dDELTAbi2_dDelta2;
1260 for (
int i=iStart;i<=iEnd;i++)
1262 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i]));
1263 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1264 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1266 dPSI_dDelta=-2.0*C[i]*(delta-1.0)*PSI;
1267 dDELTA_dDelta=(delta-1.0)*(A[i]*theta*2.0/beta[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)+2.0*B[i]*a[i]*pow(pow(delta-1.0,2),a[i]-1.0));
1268 dDELTAbi_dDelta=b[i]*pow(DELTA,b[i]-1.0)*dDELTA_dDelta;
1270 dPSI2_dDelta2=(2.0*C[i]*pow(delta-1.0,2)-1.0)*2.0*C[i]*PSI;
1271 dDELTA2_dDelta2=1.0/(delta-1.0)*dDELTA_dDelta+pow(delta-1.0,2)*(4.0*B[i]*a[i]*(a[i]-1.0)*pow(pow(delta-1.0,2),a[i]-2.0)+2.0*pow(A[i]/beta[i],2)*pow(pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0),2)+A[i]*theta*4.0/beta[i]*(1.0/(2.0*beta[i])-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-2.0));
1272 dDELTAbi2_dDelta2=b[i]*(pow(DELTA,b[i]-1.0)*dDELTA2_dDelta2+(b[i]-1.0)*pow(DELTA,b[i]-2.0)*pow(dDELTA_dDelta,2));
1274 summer+=n[i]*(pow(DELTA,b[i])*(2.0*dPSI_dDelta+delta*dPSI2_dDelta2)+2.0*dDELTAbi_dDelta*(PSI+delta*dPSI_dDelta)+dDELTAbi2_dDelta2*delta*PSI);
1280 double summer=0,theta,DELTA,PSI,dPSI_dDelta,dDELTA_dDelta,dDELTAbi_dDelta;
1281 double dPSI2_dDelta2, dDELTA2_dDelta2,dDELTAbi2_dDelta2;
1282 double dPSI3_dDelta3,PI,dPI_dDelta,dDELTA3_dDelta3, dDELTAbi3_dDelta3;
1283 double dtheta_dDelta;
1284 for (
int i=iStart;i<=iEnd;i++)
1286 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i]));
1287 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1288 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1290 dPSI_dDelta=-2.0*C[i]*(delta-1.0)*PSI;
1291 dDELTA_dDelta=(delta-1.0)*(A[i]*theta*2.0/beta[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)+2.0*B[i]*a[i]*pow(pow(delta-1.0,2),a[i]-1.0));
1292 dDELTAbi_dDelta=b[i]*pow(DELTA,b[i]-1.0)*dDELTA_dDelta;
1294 dPSI2_dDelta2=(2.0*C[i]*pow(delta-1.0,2)-1.0)*2.0*C[i]*PSI;
1295 dDELTA2_dDelta2=1.0/(delta-1.0)*dDELTA_dDelta+pow(delta-1.0,2)*(4.0*B[i]*a[i]*(a[i]-1.0)*pow(pow(delta-1.0,2),a[i]-2.0)+2.0*pow(A[i]/beta[i],2)*pow(pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0),2)+A[i]*theta*4.0/beta[i]*(1.0/(2.0*beta[i])-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-2.0));
1296 dDELTAbi2_dDelta2=b[i]*(pow(DELTA,b[i]-1.0)*dDELTA2_dDelta2+(b[i]-1.0)*pow(DELTA,b[i]-2.0)*pow(dDELTA_dDelta,2));
1298 dPSI3_dDelta3=2.0*C[i]*PSI*(-4*C[i]*C[i]*pow(delta-1.0,3)+6*C[i]*(delta-1));
1299 dtheta_dDelta = A[i]/(2*beta[i])*pow(pow(delta-1,2),1/(2*beta[i])-1)*2*(delta-1);
1301 PI = 4*B[i]*a[i]*(a[i]-1)*pow(pow(delta-1,2),a[i]-2)+2*pow(A[i]/beta[i],2)*pow(pow(delta-1,2),1/beta[i]-2)+4*A[i]*theta/beta[i]*(1/(2*beta[i])-1)*pow(pow(delta-1,2),1/(2*beta[i])-2);
1302 dPI_dDelta = -8*B[i]*a[i]*(a[i]-1)*(a[i]-2)*pow(pow(delta-1,2),a[i]-5.0/2.0)-8*pow(A[i]/beta[i],2)*(1/(2*beta[i])-1)*pow(pow(delta-1,2),1/beta[i]-5.0/2.0)-(8*A[i]*theta)/beta[i]*(1/(2*beta[i])-1)*(1/(2*beta[i])-2)*pow(pow(delta-1,2),1/(2*beta[i])-5.0/2.0)+4*A[i]/beta[i]*(1/(2*beta[i])-1)*pow(pow(delta-1,2),1/(2*beta[i])-2)*dtheta_dDelta;
1303 dDELTA3_dDelta3 = 1/(delta-1)*dDELTA2_dDelta2-1/pow(delta-1,2)*dDELTA_dDelta+pow(delta-1,2)*dPI_dDelta+2*(delta-1)*PI;
1304 dDELTAbi3_dDelta3 = b[i]*(pow(DELTA,b[i]-1)*dDELTA3_dDelta3+dDELTA2_dDelta2*(b[i]-1)*pow(DELTA,b[i]-2)*dDELTA_dDelta+(b[i]-1)*(pow(DELTA,b[i]-2)*2*dDELTA_dDelta*dDELTA2_dDelta2+pow(dDELTA_dDelta,2)*(b[i]-2)*pow(DELTA,b[i]-3)*dDELTA_dDelta));
1306 summer += n[i]*(pow(DELTA,b[i])*(3.0*dPSI2_dDelta2+delta*dPSI3_dDelta3)+3.0*dDELTAbi_dDelta*(2*dPSI_dDelta+delta*dPSI2_dDelta2)+3*dDELTAbi2_dDelta2*(PSI+delta*dPSI_dDelta)+dDELTAbi3_dDelta3*PSI*delta);
1314 double theta,DELTA,PSI,dPSI_dDelta,dDELTA_dDelta,dDELTAbi_dDelta,dPSI2_dDelta2,dDELTAbi2_dDelta2,dDELTA2_dDelta2;
1315 double dPSI2_dDelta_dTau, dDELTAbi2_dDelta_dTau, dPSI_dTau, dDELTAbi_dTau;
1316 double Line1,Line2,Line3,dDELTA2_dDelta_dTau,dDELTA3_dDelta2_dTau,dDELTAbim1_dTau,dDELTAbim2_dTau;
1317 double dDELTA_dTau,dDELTAbi3_dDelta2_dTau,dPSI3_dDelta2_dTau;
1319 for (
int i=iStart;i<=iEnd;i++)
1321 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i]));
1322 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1323 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1325 dPSI_dDelta=-2.0*C[i]*(delta-1.0)*PSI;
1326 dDELTA_dDelta=(delta-1.0)*(A[i]*theta*2.0/beta[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)+2.0*B[i]*a[i]*pow(pow(delta-1.0,2),a[i]-1.0));
1327 dDELTAbi_dDelta=b[i]*pow(DELTA,b[i]-1.0)*dDELTA_dDelta;
1329 dPSI2_dDelta2=(2.0*C[i]*pow(delta-1.0,2)-1.0)*2.0*C[i]*PSI;
1330 dDELTA2_dDelta2=1.0/(delta-1.0)*dDELTA_dDelta+pow(delta-1.0,2)*(4.0*B[i]*a[i]*(a[i]-1.0)*pow(pow(delta-1.0,2),a[i]-2.0)+2.0*pow(A[i]/beta[i],2)*pow(pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0),2)+A[i]*theta*4.0/beta[i]*(1.0/(2.0*beta[i])-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-2.0));
1331 dDELTAbi2_dDelta2=b[i]*(pow(DELTA,b[i]-1.0)*dDELTA2_dDelta2+(b[i]-1.0)*pow(DELTA,b[i]-2.0)*pow(dDELTA_dDelta,2));
1333 dPSI_dTau=-2.0*D[i]*(tau-1.0)*PSI;
1334 dDELTAbi_dTau=-2.0*theta*b[i]*pow(DELTA,b[i]-1.0);
1336 dPSI2_dDelta_dTau=4.0*C[i]*D[i]*(delta-1.0)*(tau-1.0)*PSI;
1337 dDELTAbi2_dDelta_dTau=-A[i]*b[i]*2.0/beta[i]*pow(DELTA,b[i]-1.0)*(delta-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)-2.0*theta*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2.0)*dDELTA_dDelta;
1340 dPSI3_dDelta2_dTau = (2.0*C[i]*pow(delta-1.0,2)-1.0)*2.0*C[i]*dPSI_dTau;
1341 dDELTA_dTau = -2*theta;
1342 dDELTA2_dDelta_dTau = 2.0*A[i]/(beta[i])*pow(pow(delta-1,2),1.0/(2.0*beta[i])-0.5);
1343 dDELTA3_dDelta2_dTau = 2.0*A[i]*(beta[i]-1)/(beta[i]*beta[i])*pow(pow(delta-1,2),1/(2*beta[i])-1.0);
1345 dDELTAbim1_dTau = (b[i]-1)*pow(DELTA,b[i]-2)*dDELTA_dTau;
1346 dDELTAbim2_dTau = (b[i]-2)*pow(DELTA,b[i]-3)*dDELTA_dTau;
1347 Line1 = dDELTAbim1_dTau*dDELTA2_dDelta2 + pow(DELTA,b[i]-1)*dDELTA3_dDelta2_dTau;
1348 Line2 = (b[i]-1)*(dDELTAbim2_dTau*pow(dDELTA_dDelta,2)+pow(DELTA,b[i]-2)*2*dDELTA_dDelta*dDELTA2_dDelta_dTau);
1349 dDELTAbi3_dDelta2_dTau = b[i]*(Line1+Line2);
1351 Line1 = pow(DELTA,b[i])*(2*dPSI2_dDelta_dTau+delta*dPSI3_dDelta2_dTau)+dDELTAbi_dTau*(2*dPSI_dDelta+delta*dPSI2_dDelta2);
1352 Line2 = 2*dDELTAbi_dDelta*(dPSI_dTau+delta*dPSI2_dDelta_dTau)+2*dDELTAbi2_dDelta_dTau*(PSI+delta*dPSI_dDelta);
1353 Line3 = dDELTAbi2_dDelta2*delta*dPSI_dTau + dDELTAbi3_dDelta2_dTau*delta*PSI;
1354 summer += n[i]*(Line1+Line2+Line3);
1361 double summer=0,theta,DELTA,PSI,dPSI_dDelta,dDELTAbi_dDelta;
1362 double dPSI_dTau, dDELTAbi_dTau,dDELTA_dDelta, dPSI2_dDelta_dTau;
1363 double dDELTAbi2_dDelta_dTau;
1364 for (
int i=iStart;i<=iEnd;i++)
1366 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i]));
1367 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1368 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1370 dPSI_dDelta=-2.0*C[i]*(delta-1.0)*PSI;
1371 dDELTA_dDelta=(delta-1.0)*(A[i]*theta*2.0/beta[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)+2.0*B[i]*a[i]*pow(pow(delta-1.0,2),a[i]-1.0));
1372 dDELTAbi_dDelta=b[i]*pow(DELTA,b[i]-1.0)*dDELTA_dDelta;
1373 dPSI_dTau=-2.0*D[i]*(tau-1.0)*PSI;
1374 dDELTAbi_dTau=-2.0*theta*b[i]*pow(DELTA,b[i]-1.0);
1376 dPSI2_dDelta_dTau=4.0*C[i]*D[i]*(delta-1.0)*(tau-1.0)*PSI;
1377 dDELTAbi2_dDelta_dTau=-A[i]*b[i]*2.0/beta[i]*pow(DELTA,b[i]-1.0)*(delta-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*beta[i])-1.0)-2.0*theta*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2.0)*dDELTA_dDelta;
1379 summer+=n[i]*(pow(DELTA,b[i])*(dPSI_dTau+delta*dPSI2_dDelta_dTau)+delta*dDELTAbi_dDelta*dPSI_dTau+ dDELTAbi_dTau*(PSI+delta*dPSI_dDelta)+dDELTAbi2_dDelta_dTau*delta*PSI);
1386 double summer=0,theta,DELTA,PSI,dPSI_dTau, dDELTAbi_dTau;
1388 for (
int i=iStart;i<=iEnd;i++)
1390 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1.0/(2.0*beta[i]));
1391 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1392 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1393 dPSI_dTau=-2.0*D[i]*(tau-1.0)*PSI;
1397 dDELTAbi_dTau = -2.0*theta*b[i]*pow(DELTA,b[i]-1.0);
1398 summer+=n[i]*delta*(dDELTAbi_dTau*PSI+pow(DELTA,b[i])*dPSI_dTau);
1405 double summer=0,theta,DELTA,PSI,dPSI_dTau, dDELTAbi_dTau;
1406 double dPSI2_dTau2, dDELTAbi2_dTau2;
1407 for (
int i=iStart;i<=iEnd;i++)
1409 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1/(2*beta[i]));
1410 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1411 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1412 dPSI_dTau=-2.0*D[i]*(tau-1.0)*PSI;
1413 dDELTAbi_dTau=-2.0*theta*b[i]*pow(DELTA,b[i]-1.0);
1414 dPSI2_dTau2=(2.0*D[i]*pow(tau-1.0,2)-1.0)*2.0*D[i]*PSI;
1415 dDELTAbi2_dTau2=2.0*b[i]*pow(DELTA,b[i]-1.0)+4.0*pow(theta,2)*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2.0);
1416 summer+=n[i]*delta*(dDELTAbi2_dTau2*PSI+2.0*dDELTAbi_dTau*dPSI_dTau+pow(DELTA,b[i])*dPSI2_dTau2);
1422 double summer=0,theta,DELTA,PSI,dPSI_dTau, dDELTAbi_dTau;
1423 double dPSI2_dTau2, dDELTAbi2_dTau2, dPSI3_dTau3, dDELTAbi3_dTau3;
1424 for (
int i=iStart;i<=iEnd;i++)
1426 theta=(1.0-tau)+A[i]*pow(pow(delta-1.0,2),1/(2*beta[i]));
1427 DELTA=pow(theta,2)+B[i]*pow(pow(delta-1.0,2),a[i]);
1428 PSI=exp(-C[i]*pow(delta-1.0,2)-D[i]*pow(tau-1.0,2));
1429 dPSI_dTau=-2.0*D[i]*(tau-1.0)*PSI;
1430 dDELTAbi_dTau=-2.0*theta*b[i]*pow(DELTA,b[i]-1.0);
1431 dPSI2_dTau2=(2.0*D[i]*pow(tau-1.0,2)-1.0)*2.0*D[i]*PSI;
1432 dDELTAbi2_dTau2=2.0*b[i]*pow(DELTA,b[i]-1.0)+4.0*pow(theta,2)*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2.0);
1434 dPSI3_dTau3=2.0*D[i]*PSI*(-4*D[i]*D[i]*pow(tau-1,3)+6*D[i]*(tau-1));
1435 dDELTAbi3_dTau3 = -12.0*theta*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2)-8*pow(theta,3)*b[i]*(b[i]-1)*(b[i]-2)*pow(DELTA,b[i]-3.0);
1436 summer += n[i]*delta*(dDELTAbi3_dTau3*PSI+(3.0*dDELTAbi2_dTau2)*dPSI_dTau+(3*dDELTAbi_dTau )*dPSI2_dTau2+pow(DELTA,b[i])*dPSI3_dTau3);
1440 #ifndef DISABLE_CATCH
1441 TEST_CASE((
char*)
"Non-analytic critical point Helmholtz derivative check", (
char*)
"[helmholtz],[fast]")
1444 double n[] = {0,-0.666422765408E+00,0.726086323499E+00,0.550686686128E-01};
1445 double d[] = {0,2,3,3};
1446 double t[] = {0, 1.00, 3.00, 3.00};
1447 double a[] = {0, 3.5, 3.5, 3.0};
1448 double b[] = {0, 0.875, 0.925, 0.875};
1449 double beta[] = {9,0.300, 0.300, 0.300};
1450 double A[] = {0, 0.700, 0.700, 0.700};
1451 double B[] = {0, 0.3, 0.3, 1.0};
1452 double C[] = {0, 10.0, 10.0, 12.5};
1453 double D[] = {0, 275.0, 275.0, 275.0};
1455 phir_critical phir =
phir_critical(n,d,t,a,b,beta,A,B,C,D,1,3,4);
1460 double ANA = phir.
dDelta(0.5, 0.5);
1461 double NUM = (phir.
base(0.5, 0.5+eps) - phir.
base(0.5,0.5-eps))/(2*eps);
1462 REQUIRE(abs(NUM-ANA) < 1e-12);
1466 double ANA = phir.
dTau(0.5, 0.5);
1467 double NUM = (phir.
base(0.5+eps, 0.5) - phir.
base(0.5-eps,0.5))/(2*eps);
1468 REQUIRE(abs(NUM-ANA) < 1e-12);
1472 double ANA = phir.
dDelta2(0.5, 0.5);
1473 double NUM = (phir.
dDelta(0.5, 0.5+eps) - phir.
dDelta(0.5,0.5-eps))/(2*eps);
1474 REQUIRE(abs(NUM-ANA) < 1e-12);
1478 double ANA = phir.
dTau2(0.5, 0.5);
1479 double NUM = (phir.
dTau(0.5+eps, 0.5) - phir.
dTau(0.5-eps,0.5))/(2*eps);
1480 REQUIRE(abs(NUM-ANA) < 1e-12);
1485 double NUM = (phir.
dTau(0.5, 0.5+eps) - phir.
dTau(0.5,0.5-eps))/(2*eps);
1486 REQUIRE(abs(NUM-ANA) < 1e-12);
1543 return 2/(sqrt(1+4*Deltabar*delta)+1);
1547 double X = this->
X(delta,Deltabar);
1548 return -delta*X*X/(2*Deltabar*delta*X+1);
1552 double X = this->
X(delta,Deltabar);
1553 return -Deltabar*X*X/(2*Deltabar*delta*X+1);
1569 double X = this->
X(delta, Deltabar);
1571 double d_dXdtau_dbeta = -delta*X*X/(2*Deltabar*delta*X+1);
1572 double d_dXdtau_dDeltabar = 2*delta*delta*X*X*X/pow(2*Deltabar*delta*X+1,2)*beta;
1573 double d_dXdtau_dX = -2*beta*delta*X*(Deltabar*delta*X+1)/pow(2*Deltabar*delta*X+1,2);
1576 return d_dXdtau_dX*dX_dDeltabar*beta+d_dXdtau_dDeltabar*beta+d_dXdtau_dbeta*dbeta_dtau;
1581 double X = this->
X(delta, Deltabar);
1585 double d_dXddelta_dDeltabar = X*X*(2*delta*delta*X*alpha-1)/pow(2*Deltabar*delta*X+1,2);
1586 double d_dXddelta_dalpha = -delta*X*X/(2*Deltabar*delta*X+1);
1587 double d_dXddelta_dX = -(Deltabar+delta*alpha)*2*(Deltabar*delta*X*X+X)/pow(2*Deltabar*delta*X+1,2);
1589 return d_dXddelta_dX*dX_dDeltabar*beta+d_dXddelta_dDeltabar*beta+d_dXddelta_dalpha*dalpha_dtau;
1594 double X = this->
X(delta, Deltabar);
1598 double dX_ddelta_constall = X*X*(2*Deltabar*Deltabar*X-alpha)/pow(2*Deltabar*delta*X+1,2);
1599 double d_dXddelta_dX = -(Deltabar+delta*alpha)*2*(Deltabar*delta*X*X+X)/pow(2*Deltabar*delta*X+1,2);
1600 double d_dXddelta_dDeltabar = X*X*(2*delta*delta*X*alpha-1)/pow(2*Deltabar*delta*X+1,2);
1601 double d_dXddelta_dalpha = -delta*X*X/(2*Deltabar*delta*X+1);
1606 double val = (dX_ddelta_constall
1607 + d_dXddelta_dX*dX_ddelta
1608 + d_dXddelta_dX*dX_dDeltabar*alpha
1609 + d_dXddelta_dDeltabar*alpha
1610 + d_dXddelta_dalpha*dalpha_ddelta);
1615 double Delta = this->
Deltabar(tau, delta);
1616 double X = this->
X(delta, Delta);
1621 double dXtt_dX = 2*X*delta*(-6*Delta*pow(Delta_t, 2)*pow(X, 2)*pow(delta, 2)*(Delta*X*delta + 1) + 3*pow(Delta_t, 2)*X*delta*(2*Delta*X*delta + 1) - Delta_tt*pow(2*Delta*X*delta + 1, 3) + X*delta*(Delta*Delta_tt + 3*pow(Delta_t, 2))*pow(2*Delta*X*delta + 1, 2))/pow(2*Delta*X*delta + 1, 4);
1622 double dXtt_dDelta = 2*pow(X, 3)*pow(delta, 2)*(-6*pow(Delta_t, 2)*X*delta*(Delta*X*delta + 1) - 3*pow(Delta_t, 2)*X*delta*(2*Delta*X*delta + 1) + Delta_tt*pow(2*Delta*X*delta + 1, 2))/pow(2*Delta*X*delta + 1, 4);
1623 double dXtt_dDelta_t = 4*Delta_t*pow(X, 3)*pow(delta, 2)*(3*Delta*X*delta + 2)/pow(2*Delta*X*delta + 1, 3);
1624 double dXtt_dDelta_tt = -pow(X, 2)*delta/(2*Delta*X*delta + 1);
1625 return dXtt_dX*dX_dDelta*Delta_t+dXtt_dDelta*Delta_t + dXtt_dDelta_t*Delta_tt + dXtt_dDelta_tt*Delta_ttt;
1629 double Delta = this->
Deltabar(tau, delta);
1630 double X = this->
X(delta, Delta);
1638 double dXtt_ddelta = pow(X, 2)*(-12*Delta*pow(Delta_t, 2)*pow(X, 2)*pow(delta, 2)*(Delta*X*delta + 1) + 2*pow(Delta_t, 2)*X*delta*(-Delta*X*delta + 2)*(2*Delta*X*delta + 1) - Delta_tt*pow(2*Delta*X*delta + 1, 3) + 2*X*delta*(Delta*Delta_tt + 2*pow(Delta_t, 2))*pow(2*Delta*X*delta + 1, 2))/pow(2*Delta*X*delta + 1, 4);
1639 double dXtt_dX = 2*X*delta*(-6*Delta*pow(Delta_t, 2)*pow(X, 2)*pow(delta, 2)*(Delta*X*delta + 1) + 3*pow(Delta_t, 2)*X*delta*(2*Delta*X*delta + 1) - Delta_tt*pow(2*Delta*X*delta + 1, 3) + X*delta*(Delta*Delta_tt + 3*pow(Delta_t, 2))*pow(2*Delta*X*delta + 1, 2))/pow(2*Delta*X*delta + 1, 4);
1640 double dXtt_dDelta = 2*pow(X, 3)*pow(delta, 2)*(-6*pow(Delta_t, 2)*X*delta*(Delta*X*delta + 1) - 3*pow(Delta_t, 2)*X*delta*(2*Delta*X*delta + 1) + Delta_tt*pow(2*Delta*X*delta + 1, 2))/pow(2*Delta*X*delta + 1, 4);
1641 double dXtt_dDelta_t = 4*Delta_t*pow(X, 3)*pow(delta, 2)*(3*Delta*X*delta + 2)/pow(2*Delta*X*delta + 1, 3);
1642 double dXtt_dDelta_tt = -pow(X, 2)*delta/(2*Delta*X*delta + 1);
1643 return dXtt_ddelta + dXtt_dX*dX_ddelta + dXtt_dX*dX_dDelta*Delta_d + dXtt_dDelta*Delta_d + dXtt_dDelta_t*Delta_dt + dXtt_dDelta_tt*Delta_dtt;
1648 double Delta = this->
Deltabar(tau, delta);
1649 double X = this->
X(delta, Delta);
1658 double dXdd_dX = 2*X*(-6*Delta*pow(X, 2)*delta*pow(Delta + Delta_d*delta, 2)*(Delta*X*delta + 1) - Delta_dd*delta*pow(2*Delta*X*delta + 1, 3) + 2*X*(2*Delta*X*delta + 1)*(-Delta*Delta_d*delta*(2*Delta_d*X*pow(delta, 2) - 1) - Delta*delta*(2*pow(Delta, 2)*X - Delta_d) + Delta*(Delta + Delta_d*delta)*(Delta*X*delta + 1) + Delta_d*delta*(Delta + Delta_d*delta)*(Delta*X*delta + 1)) + pow(2*Delta*X*delta + 1, 2)*(3*pow(Delta, 2)*X + Delta*Delta_dd*X*pow(delta, 2) + Delta*X*(Delta + Delta_d*delta) + pow(Delta_d, 2)*X*pow(delta, 2) + Delta_d*X*delta*(Delta + Delta_d*delta) + Delta_d*(2*Delta_d*X*pow(delta, 2) - 1) - Delta_d))/pow(2*Delta*X*delta + 1, 4);
1659 double dXdd_ddelta = pow(X, 2)*(-24*pow(Delta, 4)*pow(X, 3)*delta - 8*pow(Delta, 3)*Delta_d*pow(X, 3)*pow(delta, 2) - 18*pow(Delta, 3)*pow(X, 2) + 8*pow(Delta, 2)*Delta_d*pow(X, 2)*delta - 4*pow(Delta, 2)*Delta_dd*pow(X, 2)*pow(delta, 2) + 10*Delta*pow(Delta_d, 2)*pow(X, 2)*pow(delta, 2) + 12*Delta*Delta_d*X - 4*Delta*Delta_dd*X*delta + 8*pow(Delta_d, 2)*X*delta - Delta_dd)/(16*pow(Delta, 4)*pow(X, 4)*pow(delta, 4) + 32*pow(Delta, 3)*pow(X, 3)*pow(delta, 3) + 24*pow(Delta, 2)*pow(X, 2)*pow(delta, 2) + 8*Delta*X*delta + 1);
1660 double dXdd_dDelta = pow(X, 3)*(-8*pow(Delta, 2)*Delta_d*pow(X, 2)*pow(delta, 3) + 8*pow(Delta, 2)*Delta_dd*pow(X, 2)*pow(delta, 4) + 10*pow(Delta, 2)*X*delta - 24*Delta*pow(Delta_d, 2)*pow(X, 2)*pow(delta, 4) + 8*Delta*Delta_d*X*pow(delta, 2) + 8*Delta*Delta_dd*X*pow(delta, 3) + 8*Delta - 18*pow(Delta_d, 2)*X*pow(delta, 3) + 12*Delta_d*delta + 2*Delta_dd*pow(delta, 2))/(16*pow(Delta, 4)*pow(X, 4)*pow(delta, 4) + 32*pow(Delta, 3)*pow(X, 3)*pow(delta, 3) + 24*pow(Delta, 2)*pow(X, 2)*pow(delta, 2) + 8*Delta*X*delta + 1);
1661 double dXdd_dDelta_d = 2*pow(X, 2)*(2*X*delta*(Delta + Delta_d*delta)*(Delta*X*delta + 1) + (2*Delta*X*delta + 1)*(2*Delta_d*X*pow(delta, 2) - 1))/pow(2*Delta*X*delta + 1, 3);
1662 double dXdd_dDelta_dd = -pow(X, 2)*delta/(2*Delta*X*delta + 1);
1664 return dXdd_dX*dX_dDelta*Delta_t + dXdd_dDelta*Delta_t + dXdd_dDelta_d*Delta_dt + dXdd_dDelta_dd*Delta_ddt;
1667 double Xdd(
double X,
double delta,
double Delta,
double Delta_d,
double Delta_dd)
1669 return Delta*pow(X, 2)*(2*Delta + 2*Delta_d*delta)*(Delta*pow(X, 2)*delta + X)/pow(2*Delta*X*delta + 1, 3) + Delta_d*pow(X, 2)*delta*(2*Delta + 2*Delta_d*delta)*(Delta*pow(X, 2)*delta + X)/pow(2*Delta*X*delta + 1, 3) + Delta_d*pow(X, 2)*(2*Delta_d*X*pow(delta, 2) - 1)/pow(2*Delta*X*delta + 1, 2) - Delta_dd*pow(X, 2)*delta/(2*Delta*X*delta + 1) + pow(X, 2)*(2*pow(Delta, 2)*X - Delta_d)/pow(2*Delta*X*delta + 1, 2);
1674 double Delta = this->
Deltabar(tau, delta);
1675 double X = this->
X(delta, Delta);
1682 double dXdd_dX = 2*X*(-6*Delta*pow(X, 2)*delta*pow(Delta + Delta_d*delta, 2)*(Delta*X*delta + 1) - Delta_dd*delta*pow(2*Delta*X*delta + 1, 3) + 2*X*(2*Delta*X*delta + 1)*(-Delta*Delta_d*delta*(2*Delta_d*X*pow(delta, 2) - 1) - Delta*delta*(2*pow(Delta, 2)*X - Delta_d) + Delta*(Delta + Delta_d*delta)*(Delta*X*delta + 1) + Delta_d*delta*(Delta + Delta_d*delta)*(Delta*X*delta + 1)) + pow(2*Delta*X*delta + 1, 2)*(3*pow(Delta, 2)*X + Delta*Delta_dd*X*pow(delta, 2) + Delta*X*(Delta + Delta_d*delta) + pow(Delta_d, 2)*X*pow(delta, 2) + Delta_d*X*delta*(Delta + Delta_d*delta) + Delta_d*(2*Delta_d*X*pow(delta, 2) - 1) - Delta_d))/pow(2*Delta*X*delta + 1, 4);
1683 double dXdd_ddelta = pow(X, 2)*(-24*pow(Delta, 4)*pow(X, 3)*delta - 8*pow(Delta, 3)*Delta_d*pow(X, 3)*pow(delta, 2) - 18*pow(Delta, 3)*pow(X, 2) + 8*pow(Delta, 2)*Delta_d*pow(X, 2)*delta - 4*pow(Delta, 2)*Delta_dd*pow(X, 2)*pow(delta, 2) + 10*Delta*pow(Delta_d, 2)*pow(X, 2)*pow(delta, 2) + 12*Delta*Delta_d*X - 4*Delta*Delta_dd*X*delta + 8*pow(Delta_d, 2)*X*delta - Delta_dd)/(16*pow(Delta, 4)*pow(X, 4)*pow(delta, 4) + 32*pow(Delta, 3)*pow(X, 3)*pow(delta, 3) + 24*pow(Delta, 2)*pow(X, 2)*pow(delta, 2) + 8*Delta*X*delta + 1);
1684 double dXdd_dDelta = pow(X, 3)*(-8*pow(Delta, 2)*Delta_d*pow(X, 2)*pow(delta, 3) + 8*pow(Delta, 2)*Delta_dd*pow(X, 2)*pow(delta, 4) + 10*pow(Delta, 2)*X*delta - 24*Delta*pow(Delta_d, 2)*pow(X, 2)*pow(delta, 4) + 8*Delta*Delta_d*X*pow(delta, 2) + 8*Delta*Delta_dd*X*pow(delta, 3) + 8*Delta - 18*pow(Delta_d, 2)*X*pow(delta, 3) + 12*Delta_d*delta + 2*Delta_dd*pow(delta, 2))/(16*pow(Delta, 4)*pow(X, 4)*pow(delta, 4) + 32*pow(Delta, 3)*pow(X, 3)*pow(delta, 3) + 24*pow(Delta, 2)*pow(X, 2)*pow(delta, 2) + 8*Delta*X*delta + 1);
1685 double dXdd_dDelta_d = 2*pow(X, 2)*(2*X*delta*(Delta + Delta_d*delta)*(Delta*X*delta + 1) + (2*Delta*X*delta + 1)*(2*Delta_d*X*pow(delta, 2) - 1))/pow(2*Delta*X*delta + 1, 3);
1686 double dXdd_dDelta_dd = -pow(X, 2)*delta/(2*Delta*X*delta + 1);
1688 return dXdd_ddelta + dXdd_dX*(dX_ddelta + dX_dDelta*Delta_d) + dXdd_dDelta*Delta_d + dXdd_dDelta_d*Delta_dd + dXdd_dDelta_dd*Delta_ddd;
1694 return 0.5*(2-
eta)/pow(1-eta,(
int)3);
1698 return 0.5*(5-2*
eta)/pow(1-eta,(
int)4);
1702 return 3*(3-
eta)/pow(1-eta,(
int)5);
1706 return 6*(7-2*
eta)/pow(1-eta,(
int)6);
1709 return this->
vbarn*delta;
1713 double X = this->
X(delta, this->
Deltabar(tau, delta));
1714 return this->
m*this->
a*((log(X)-X/2.0+0.5));
1718 double X = this->
X(delta, this->
Deltabar(tau, delta));
1719 return this->
m*this->
a*(1/X-0.5)*this->
dX_ddelta(tau, delta);
1723 double X = this->
X(delta, this->
Deltabar(tau, delta));
1724 return this->
m*this->
a*(1/X-0.5)*this->
dX_dtau(tau, delta);
1728 double X = this->
X(delta, this->
Deltabar(tau, delta));
1729 double X_tau = this->
dX_dtau(tau, delta);
1730 double X_tautau = this->
d2X_dtau2(tau, delta);
1731 return this->
m*this->
a*((1/X-0.5)*X_tautau-pow(X_tau/X, 2));
1735 double X = this->
X(delta, this->
Deltabar(tau, delta));
1736 double X_delta = this->
dX_ddelta(tau, delta);
1737 double X_deltadelta = this->
d2X_ddelta2(tau, delta);
1738 return this->
m*this->
a*((1/X-0.5)*X_deltadelta-pow(X_delta/X,2));
1742 double X = this->
X(delta, this->
Deltabar(tau, delta));
1743 double X_delta = this->
dX_ddelta(tau, delta);
1744 double X_deltadelta = this->
d2X_ddelta2(tau, delta);
1745 double X_tau = this->
dX_dtau(tau, delta);
1747 return this->
m*this->
a*((-X_tau/X/
X)*X_delta+X_deltatau*(1/X-0.5));
1751 double X = this->
X(delta, this->
Deltabar(tau, delta));
1752 double X_t = this->
dX_dtau(tau, delta);
1753 double X_tt = this->
d2X_dtau2(tau, delta);
1754 double X_ttt = this->
d3X_dtau3(tau, delta);
1755 return this->
m*this->
a*((1/X-1.0/2.0)*X_ttt+(-X_t/pow(X,(
int)2))*X_tt-2*(pow(X,(
int)2)*(X_t*X_tt)-pow(X_t,(
int)2)*(X*X_t))/pow(X,(
int)4));
1759 double X = this->
X(delta, this->
Deltabar(tau, delta));
1760 double X_t = this->
dX_dtau(tau, delta);
1761 double X_d = this->
dX_ddelta(tau, delta);
1762 double X_tt = this->
d2X_dtau2(tau, delta);
1765 return this->
m*this->
a*((1/X-1.0/2.0)*X_dtt-X_d/pow(X,(
int)2)*X_tt-2*(pow(X,(
int)2)*(X_t*X_dt)-pow(X_t,(
int)2)*(X*X_d))/pow(X,(
int)4));
1769 double X = this->
X(delta, this->
Deltabar(tau, delta));
1770 double X_t = this->
dX_dtau(tau, delta);
1771 double X_d = this->
dX_ddelta(tau, delta);
1775 return this->
m*this->
a*((1/X-1.0/2.0)*X_ddt-X_t/pow(X,(
int)2)*X_dd-2*(pow(X,(
int)2)*(X_d*X_dt)-pow(X_d,(
int)2)*(X*X_t))/pow(X,(
int)4));
1779 double X = this->
X(delta, this->
Deltabar(tau, delta));
1780 double X_d = this->
dX_ddelta(tau, delta);
1783 return this->
m*this->
a*((1/X-1.0/2.0)*X_ddd-X_d/pow(X,(
int)2)*X_dd-2*(pow(X,(
int)2)*(X_d*X_dd)-pow(X_d,(
int)2)*(X*X_d))/pow(X,(
int)4));
1785 #ifndef DISABLE_CATCH
1787 TEST_CASE(
"SAFT Helmholtz derivative check",
"[helmholtz],[fast]")
1789 double m = 0.977118832;
1790 double epsilon = 5.46341463;
1791 double vbarn = 0.204481952;
1792 double kappa = 0.148852832e-2;
1798 double ANA = phir.
dDelta(0.5, 0.5);
1799 double NUM = (phir.
base(0.5, 0.5+eps) - phir.
base(0.5,0.5-eps))/(2*eps);
1800 REQUIRE(fabs(NUM-ANA) < 1e-6);
1804 double ANA = phir.
dTau(0.5, 0.5);
1805 double NUM = (phir.
base(0.5+eps, 0.5) - phir.
base(0.5-eps,0.5))/(2*eps);
1806 REQUIRE(fabs(NUM-ANA) < 1e-6);
1810 double ANA = phir.
dDelta2(0.5, 0.5);
1811 double NUM = (phir.
dDelta(0.5, 0.5+eps) - phir.
dDelta(0.5,0.5-eps))/(2*eps);
1812 REQUIRE(fabs(NUM-ANA) < 1e-6);
1816 double ANA = phir.
dTau2(0.5, 0.5);
1817 double NUM = (phir.
dTau(0.5+eps, 0.5) - phir.
dTau(0.5-eps,0.5))/(2*eps);
1818 REQUIRE(fabs(NUM-ANA) < 1e-6);
1823 double NUM = (phir.
dTau(0.5, 0.5+eps) - phir.
dTau(0.5,0.5-eps))/(2*eps);
1824 REQUIRE(fabs(NUM-ANA) < 1e-6);
1828 double ANA = phir.
dTau3(0.5, 0.5);
1829 double NUM = (phir.
dTau2(0.5+eps, 0.5) - phir.
dTau2(0.5-eps,0.5))/(2*eps);
1830 REQUIRE(fabs(NUM-ANA) < 1e-6);
1834 double ANA = phir.
dDelta3(0.5, 0.5);
1835 double NUM = (phir.
dDelta2(0.5, 0.5+eps) - phir.
dDelta2(0.5,0.5-eps))/(2*eps);
1836 REQUIRE(fabs(NUM-ANA) < 1e-6);
1842 REQUIRE(fabs(NUM-ANA) < 1e-6);
1848 REQUIRE(fabs(NUM-ANA) < 1e-6);
1857 for (
int i=iStart;i<=iEnd;i++)
1869 for (
int i=iStart;i<=iEnd;i++)
1871 summer+=a[i]*log(1.0-exp(-theta[i]*tau));
1878 for (
int i=iStart;i<=iEnd;i++)
1880 summer+=a[i]*theta[i]*(1.0/(1.0-exp(-theta[i]*tau))-1.0);
1887 for (
int i=iStart;i<=iEnd;i++)
1889 summer -= a[i]*pow(theta[i],2.0)*exp(theta[i]*tau)/pow(1.0-exp(theta[i]*tau),2.0);
1896 for (
int i=iStart;i<=iEnd;i++)
1898 summer += a[i]*pow(theta[i],2.0)*theta[i]*exp(theta[i]*tau)*(exp(theta[i]*tau)+1)/pow(exp(theta[i]*tau)-1,3.0);
1908 for (
int i=iStart;i<=iEnd;i++)
1933 for (
int i=iStart;i<=iEnd;i++)
1936 summer+=a[i]*log(c[i]+exp(theta[i]*tau));
1943 for (
int i=iStart;i<=iEnd;i++)
1945 summer+=a[i]*theta[i]*exp(tau*theta[i])/(c[i]+exp(theta[i]*tau));
1952 for (
int i=iStart;i<=iEnd;i++)
1954 summer+=a[i]*pow(theta[i],2)*c[i]*exp(tau*theta[i])/pow(c[i]+exp(tau*theta[i]),2);
1961 for (
int i=iStart;i<=iEnd;i++)
1963 summer += a[i]*pow(theta[i],2.0)*c[i]*(-theta[i])*exp(theta[i]*tau)*(exp(theta[i]*tau)-c[i])/pow(exp(theta[i]*tau)+c[i],3.0);
1971 for (
int i=1;i<=5;i++)
1973 if (i==1 || i==2 || i==4){
2015 return (4*a[4]*a[5])/(Tc*(2*exp(-(2*a[5]*tau)/Tc)+2))+(4*a[2]*a[3])/(Tc*(2*exp(-(2*a[3]*tau)/Tc)-2))-a[1]/tau;
2025 if (a[4] == 0.0 && a[5] == 0.0)
2031 term1 = (4*a[4]*a[5]*a[5]*((tau*Tc*exp((2*a[5]*tau)/Tc))/(2*a[5]*exp((2*a[5]*tau)/Tc)+2*a[5])-(Tc*Tc*log(exp((2*a[5]*tau)/Tc)+1))/(4*a[5]*a[5])))/Tc/Tc;
2034 double term2 = (4*a[2]*a[3]*a[3]*((Tc*Tc*log(exp((a[3]*tau)/Tc)+1))/(4*a[3]*a[3])+(Tc*Tc*log(exp((a[3]*tau)/Tc)-1))/(4*a[3]*a[3])-(tau*Tc*exp((2*a[3]*tau)/Tc))/(2*a[3]*exp((2*a[3]*tau)/Tc)-2*a[3])))/Tc/Tc;
2035 double term3 = a[1]*log(tau);
2036 return term1 + term2 + term3;
2040 return a[1]+a[2]*pow(a[3]*tau/Tc/sinh(a[3]*tau/Tc),2)+a[4]*pow(a[5]*tau/Tc/(cosh(a[5]*tau/Tc)),2);
2046 return -
cp0(tau)/(tau*tau*R_u);
2051 return 2*a[1]/tau/tau/tau/R_u -a[2]/R_u*(-2)*pow(a[3]/Tc,3)*cosh(a[3]*tau/Tc)/pow(sinh(a[3]*tau/Tc),3) -a[4]/R_u*(-2)*pow(a[5]/Tc,3)*sinh(a[5]*tau/Tc)/pow(cosh(a[5]*tau/Tc),3);
2060 for (
int i=iStart;i<=iEnd;i++)
2074 for (
int i = iStart; i<=iEnd; i++){
2078 sum += a[i]/tau-a[i]/tau0;
2082 sum += a[i]/Tc*log(tau0/tau);
2086 sum+=a[i]*pow(Tc,t)*pow(tau,-t-1)/(t+1)-a[i]*pow(Tc,t)/(pow(tau0,t+1)*(t+1));
2095 for (
int i = iStart; i<=iEnd; i++){
2099 sum += -a[i]/(tau*tau);
2103 sum += -a[i]/(tau*Tc);
2107 sum += -a[i]*pow(Tc/tau,tv[i])/(tau*tau);
2116 for (
int i = iStart; i<=iEnd; i++){
2120 sum += 2*a[i]/(tau*tau*tau);
2124 sum += a[i]/(tau*tau*Tc);
2128 sum += a[i]*pow(Tc/tau,tv[i])*(tv[i]+2)/(tau*tau*tau);
2137 #ifndef DISABLE_CATCH
2160 TEST_CASE(
"phi0_power Helmholtz derivative check",
"[helmholtz],[fast]")
2171 double ANA = phi.
dDelta(0.5, 0.5);
2172 double NUM = (phi.
base(0.5, 0.5+eps) - phi.
base(0.5,0.5-eps))/(2*eps);
2173 REQUIRE(fabs(NUM-ANA) < 1e-6);
2177 double ANA = phi.
dTau(0.5, 0.5);
2178 double NUM = (phi.
base(0.5+eps, 0.5) - phi.
base(0.5-eps,0.5))/(2*eps);
2179 REQUIRE(fabs(NUM-ANA) < 1e-6);
2183 double ANA = phi.
dDelta2(0.5, 0.5);
2184 double NUM = (phi.
dDelta(0.5, 0.5+eps) - phi.
dDelta(0.5,0.5-eps))/(2*eps);
2185 REQUIRE(fabs(NUM-ANA) < 1e-6);
2189 double ANA = phi.
dTau2(0.5, 0.5);
2190 double NUM = (phi.
dTau(0.5+eps, 0.5) - phi.
dTau(0.5-eps,0.5))/(2*eps);
2191 REQUIRE(fabs(NUM-ANA) < 1e-6);
2196 double NUM = (phi.
dTau(0.5, 0.5+eps) - phi.
dTau(0.5,0.5-eps))/(2*eps);
2197 REQUIRE(fabs(NUM-ANA) < 1e-6);
double d3Deltabar_dtau3__constdelta(double tau, double delta)
double d3Deltabar_ddelta_dtau2(double tau, double delta)
std::vector< double > dTau2V(std::vector< double > tau, std::vector< double > delta)
phir_exponential(std::vector< double >, std::vector< double >, std::vector< double >, std::vector< double >, std::vector< double >, int, int)
double dTau(double tau, double delta)
double dDelta2_dTau(double tau, double delta)
double dDeltabar_dtau__constdelta(double tau, double delta)
double dTau(double tau, double delta)
double dDelta_dTau2(double tau, double delta)
double dDelta2_dTau(double tau, double delta)
virtual double dTau(double tau, double delta)=0
double A(double log_tau, double log_delta, double delta, int i)
Derivatives for a single term for use in fitter.
double base(double tau, double delta)
double dTau(double tau, double delta)
virtual double dDelta2(double tau, double delta)=0
double dX_dtau(double tau, double delta)
double dTau(double tau, double delta)
double dDelta(double tau, double delta)
virtual double dDelta2_dTau(double tau, double delta)=0
double dDelta_dTau(double tau, double delta)
double dTau3(double tau, double delta)
double d2A_dDelta_dTau(double log_tau, double log_delta, double delta, int i)
double d3Deltabar_ddelta3__consttau(double tau, double delta)
double dDelta_dTau2(double tau, double delta)
double dDelta_dTau(double tau, double delta)
double dDelta(double tau, double delta)
void cache()
Cache some terms for internal use.
double dA_dDelta(double log_tau, double log_delta, double delta, int i)
double dTau(double tau, double delta)
std::vector< double > dDelta2V(std::vector< double > tau, std::vector< double > delta)
double dDelta_dTau(double tau, double delta)
double dDelta2(double tau, double delta)
double d2Deltabar_ddelta_dtau(double tau, double delta)
double d2g_deta2(double eta)
double dTau3(double tau, double delta)
double dDelta2_dTau(double tau, double delta)
double dDelta3(double tau, double delta)
double X(double delta, double Deltabar)
double dTau(double tau, double delta)
double dDelta2(double tau, double delta)
double dTau3(double tau, double delta)
phir_Lemmon2005(std::vector< double >, std::vector< double >, std::vector< double >, std::vector< double >, std::vector< double >, int, int)
double dX_ddelta(double tau, double delta)
double dX_ddelta__constDeltabar(double delta, double Deltabar)
double dDelta_dTau2(double tau, double delta)
double dTau2(double tau, double delta)
double dTau2(double tau, double delta)
double dDelta2(double tau, double delta)
double dDelta_dTau2(double tau, double delta)
double anti_deriv_cp0_tau(double tau)
double d2Deltabar_ddelta2__consttau(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
double d2X_ddeltadtau(double tau, double delta)
double dA_dTau(double log_tau, double log_delta, double delta, int i)
double d2X_dtau2(double tau, double delta)
double anti_deriv_cp0_tau2(double tau)
double dDelta2(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
virtual double base(double tau, double delta)=0
std::vector< double > d
The power for the delta terms.
double dTau2(double tau, double delta)
GenericValue & AddMember(GenericValue &name, GenericValue &value, Allocator &allocator)
Add a member (name-value pair) to the object.
double dDelta(double tau, double delta)
double dDelta_dTau2(double tau, double delta)
double base(double tau, double delta)
double d3X_ddeltadtau2(double tau, double delta)
double dDelta3(double tau, double delta)
virtual double dDelta_dTau2(double tau, double delta)=0
double dTau2(double tau, double delta)
double d3X_ddelta3(double tau, double delta)
double dDeltabar_ddelta__consttau(double tau, double delta)
double dDelta(double tau, double delta)
double dTau(double tau, double delta)
double dDelta2(double tau, double delta)
virtual double dDelta(double tau, double delta)=0
double dDelta_dTau2(double tau, double delta)
double dTau2(double tau, double delta)
GenericValue & PushBack(GenericValue &value, Allocator &allocator)
Append a value at the end of the array.
double dTau2(double tau, double delta)
double dTau3(double tau, double delta)
double dX_dDeltabar__constdelta(double delta, double Deltabar)
A document for parsing JSON text as DOM.
double dDelta2(double tau, double delta)
double base(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
double base(double tau, double delta)
double d2Deltabar_dtau2__constdelta(double tau, double delta)
virtual double dTau2(double tau, double delta)=0
std::vector< double > dDelta_dTauV(std::vector< double > tau, std::vector< double > delta)
double dTau3(double tau, double delta)
double dTau3(double tau, double delta)
double dTau3(double tau, double delta)
double dTau3(double tau, double delta)
virtual double dTau3(double tau, double delta)=0
double dDelta3(double tau, double delta)
double d2X_ddelta2(double tau, double delta)
double d3X_ddelta2dtau(double tau, double delta)
std::vector< double > t
The powers for the tau terms.
double dDelta2_dTau(double tau, double delta)
double dTau(double tau, double delta)
double dTau2(double tau, double delta)
double dTau(double tau, double delta)
Allocator & GetAllocator()
Get the allocator of this document.
double dDelta_dTau(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
double base(double tau, double delta)
REQUIRE(fabs(CPWater.p()-RPWater.p())< 1e-4)
double dDelta(double tau, double delta)
double d3g_deta3(double eta)
double dTau2(double tau, double delta)
double d2A_dDelta2(double log_tau, double log_delta, double delta, int i)
double base(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
double base(double tau, double delta)
double dDelta2(double tau, double delta)
double dTau2(double tau, double delta)
double dDelta3(double tau, double delta)
double dDelta(double tau, double delta)
double dDelta_dTau(double tau, double delta)
double dDelta2_dTau(double tau, double delta)
double base(double tau, double delta)
double dDelta3(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
std::vector< double > dDeltaV(std::vector< double > tau, std::vector< double > delta)
Vectorized form so iteration happens at c++ level.
double dTau2(double tau, double delta)
double d3X_dtau3(double tau, double delta)
virtual double dDelta3(double tau, double delta)=0
double dDelta(double tau, double delta)
This is the abstract base class upon which each residual Helmholtz energy class is built...
double dg_deta(double eta)
double Deltabar(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
phir_critical(std::vector< double > n_in, std::vector< double > d_in, std::vector< double > t_in, std::vector< double > a_in, std::vector< double > b_in, std::vector< double > beta_in, std::vector< double > A_in, std::vector< double > B_in, std::vector< double > C_in, std::vector< double > D_in, int iStart_in, int iEnd_in)
double dDelta_dTau(double tau, double delta)
#define SECTION(name, description)
double d3Deltabar_ddelta2_dtau(double tau, double delta)
double dTau3(double tau, double delta)
Represents a JSON value. Use Value for UTF8 encoding and default allocator.
double dTau3(double tau, double delta)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
double Xdd(double X, double delta, double Delta, double Delta_d, double Delta_dd)
void to_json(rapidjson::Value &el, rapidjson::Document &doc)
double dTau2(double tau, double delta)
double dDelta2_dTau(double tau, double delta)
double dDelta_dTau(double tau, double delta)
std::vector< double > n
The coefficients multiplying each term.
double d2A_dTau2(double log_tau, double log_delta, double delta, int i)
double base(double tau, double delta)
double base(double tau, double delta)
double dDelta3(double tau, double delta)
double dDelta2(double tau, double delta)
double dTau(double tau, double delta)
void check_derivatives(phi_BC *phi, double tau, double delta, double ddelta, double dtau)
double dDelta(double tau, double delta)
virtual double dDelta_dTau(double tau, double delta)=0
double dDelta_dTau(double tau, double delta)
TEST_CASE("Power Helmholtz terms","[helmholtz],[fast]")
double dTau(double tau, double delta)