Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
x15 = B*x14
x16 = sqrt(x13 + 2.5)
x17 = 2*x8
x18 = -x17
x19 = -x13
x20 = x19 + 0.5
x21 = B*x20
x22 = sqrt(x19 + 2.5)
x23 = B*x16
x24 = 0.5*sqrt(0.1*x12 + 0.5)
x25 = x12 + 1
x26 = 4*x8
x27 = -x26
x28 = sqrt(10)*B/sqrt(x12 + 5)
x29 = 2*x12
x30 = sqrt(x29 + 10)
x31 = 1/x30
x32 = -x12 + 1
x33 = 0.5*B*x22
x34 = -x2*(T - Tc)
x35 = 2*x34**0.1
x36 = x35 + 2
x37 = x34**0.05
x38 = x30*x37
x39 = 0.5*B*x16
x40 = x37*sqrt(-x29 + 10)
x41 = 0.25*x12
x42 = B*(-x41 + 0.25)
x43 = x12*x37
x44 = x35 + x37 + 2
x45 = B*(x41 + 0.25)
x46 = -x43
- 3*E*Tc*(-T/Tc + 1)**(7/3)/7)
elif order == -1j:
# 3x increase in speed - cse via sympy
x0 = log(T)
x1 = 0.5*x0
x2 = 1/Tc
x3 = T*x2
x4 = -x3 + 1
x5 = 1.5*C
x6 = x4**0.333333333333333
x7 = 2*B
x8 = x4**0.05
x9 = log(-x6 + 1)
x10 = sqrt(3)
x11 = x10*atan(x10*(2*x6 + 1)/3)
x12 = sqrt(5)
x13 = 0.5*x12
x14 = x13 + 0.5
x15 = B*x14
x16 = sqrt(x13 + 2.5)
x17 = 2*x8
x18 = -x17
x19 = -x13
x20 = x19 + 0.5
x21 = B*x20
x22 = sqrt(x19 + 2.5)
x23 = B*x16
x24 = 0.5*sqrt(0.1*x12 + 0.5)
x25 = x12 + 1
x26 = 4*x8
x27 = -x26
x28 = sqrt(10)*B/sqrt(x12 + 5)
x16 = x13*x9*0.5
dP_dT = R/x0 - da_alpha_dT/x1
dP_dV = -x3*x4 + x5*x7
d2P_dT2 = -d2a_alpha_dT2/x1
d2P_dV2 = -2.*a_alpha*x5*x5*x1**-3 + 2.*x7 + 2.*x3*x0**-3
d2P_dTdV = -R*x4 + da_alpha_dT*x5*x6
H_dep = x12*(T*da_alpha_dT - a_alpha) - x3 + x8
S_dep = -R*log((V*x3/(x0*x8))**2)/2. + da_alpha_dT*x12 # Consider Real part of the log only via log(x**2)/2 = Re(log(x))
Cv_dep = -T*d2a_alpha_dT2*x13*(-log(((x14 - x15 + x16)/(x14 + x15 - x16))**2)*0.5) # Consider Real part of the log only via log(x**2)/2 = Re(log(x))
else:
dP_dT = R/(V - b) - da_alpha_dT/(V**2 + V*delta + epsilon)
dP_dV = -R*T/(V - b)**2 - (-2*V - delta)*a_alpha/(V**2 + V*delta + epsilon)**2
d2P_dT2 = -d2a_alpha_dT2/(V**2 + V*delta + epsilon)
d2P_dV2 = 2*(R*T/(V - b)**3 - (2*V + delta)**2*a_alpha/(V**2 + V*delta + epsilon)**3 + a_alpha/(V**2 + V*delta + epsilon)**2)
d2P_dTdV = -R/(V - b)**2 + (2*V + delta)*da_alpha_dT/(V**2 + V*delta + epsilon)**2
H_dep = P*V - R*T + 2*(T*da_alpha_dT - a_alpha)*catanh((2*V + delta)/sqrt(delta**2 - 4*epsilon)).real/sqrt(delta**2 - 4*epsilon)
S_dep = -R*log(V) + R*log(P*V/(R*T)) + R*log(V - b) + 2*da_alpha_dT*catanh((2*V + delta)/sqrt(delta**2 - 4*epsilon)).real/sqrt(delta**2 - 4*epsilon)
Cv_dep = -T*(sqrt(1/(delta**2 - 4*epsilon))*log(V - delta**2*sqrt(1/(delta**2 - 4*epsilon))/2 + delta/2 + 2*epsilon*sqrt(1/(delta**2 - 4*epsilon))) - sqrt(1/(delta**2 - 4*epsilon))*log(V + delta**2*sqrt(1/(delta**2 - 4*epsilon))/2 + delta/2 - 2*epsilon*sqrt(1/(delta**2 - 4*epsilon))))*d2a_alpha_dT2
return [dP_dT, dP_dV, d2P_dT2, d2P_dV2, d2P_dTdV, H_dep, S_dep, Cv_dep]
x25 = x12 + 1
x26 = 4*x8
x27 = -x26
x28 = sqrt(10)*B/sqrt(x12 + 5)
x29 = 2*x12
x30 = sqrt(x29 + 10)
x31 = 1/x30
x32 = -x12 + 1
x33 = 0.5*B*x22
x34 = -x2*(T - Tc)
x35 = 2*x34**0.1
x36 = x35 + 2
x37 = x34**0.05
x38 = x30*x37
x39 = 0.5*B*x16
x40 = x37*sqrt(-x29 + 10)
x41 = 0.25*x12
x42 = B*(-x41 + 0.25)
x43 = x12*x37
x44 = x35 + x37 + 2
x45 = B*(x41 + 0.25)
x46 = -x43
x47 = x35 - x37 + 2
return A*x0 + 2.85714285714286*B*x4**0.35 - C*x1 + C*x11 + D*x0 - D*x3 - E*x1 - E*x11 + 0.75*E*x4**1.33333333333333 + 3*E*x6 + 1.5*E*x9 - x15*atan(x14*(x16 + x17)) + x15*atan(x14*(x16 + x18)) - x21*atan(x20*(x17 + x22)) + x21*atan(x20*(x18 + x22)) + x23*atan(x24*(x25 + x26)) - x23*atan(x24*(x25 + x27)) - x28*atan(x31*(x26 + x32)) + x28*atan(x31*(x27 + x32)) - x33*log(x36 - x38) + x33*log(x36 + x38) + x39*log(x36 - x40) - x39*log(x36 + x40) + x4**0.666666666666667*x5 - x42*log(x43 + x44) + x42*log(x46 + x47) + x45*log(x43 + x47) - x45*log(x44 + x46) + x5*x9 + x7*atan(x8) - x7*atanh(x8)
else:
raise Exception(order_not_found_msg)
x13 = 0.5*x12
x14 = x13 + 0.5
x15 = B*x14
x16 = sqrt(x13 + 2.5)
x17 = 2*x8
x18 = -x17
x19 = -x13
x20 = x19 + 0.5
x21 = B*x20
x22 = sqrt(x19 + 2.5)
x23 = B*x16
x24 = 0.5*sqrt(0.1*x12 + 0.5)
x25 = x12 + 1
x26 = 4*x8
x27 = -x26
x28 = sqrt(10)*B/sqrt(x12 + 5)
x29 = 2*x12
x30 = sqrt(x29 + 10)
x31 = 1/x30
x32 = -x12 + 1
x33 = 0.5*B*x22
x34 = -x2*(T - Tc)
x35 = 2*x34**0.1
x36 = x35 + 2
x37 = x34**0.05
x38 = x30*x37
x39 = 0.5*B*x16
x40 = x37*sqrt(-x29 + 10)
x41 = 0.25*x12
x42 = B*(-x41 + 0.25)
x43 = x12*x37
x44 = x35 + x37 + 2
x7 = 2*B
x8 = x4**0.05
x9 = log(-x6 + 1)
x10 = sqrt(3)
x11 = x10*atan(x10*(2*x6 + 1)/3)
x12 = sqrt(5)
x13 = 0.5*x12
x14 = x13 + 0.5
x15 = B*x14
x16 = sqrt(x13 + 2.5)
x17 = 2*x8
x18 = -x17
x19 = -x13
x20 = x19 + 0.5
x21 = B*x20
x22 = sqrt(x19 + 2.5)
x23 = B*x16
x24 = 0.5*sqrt(0.1*x12 + 0.5)
x25 = x12 + 1
x26 = 4*x8
x27 = -x26
x28 = sqrt(10)*B/sqrt(x12 + 5)
x29 = 2*x12
x30 = sqrt(x29 + 10)
x31 = 1/x30
x32 = -x12 + 1
x33 = 0.5*B*x22
x34 = -x2*(T - Tc)
x35 = 2*x34**0.1
x36 = x35 + 2
x37 = x34**0.05
x38 = x30*x37
dP_dV = -x3*x4 + x5*x7
d2P_dT2 = -d2a_alpha_dT2/x1
d2P_dV2 = -2.*a_alpha*x5*x5*x1**-3 + 2.*x7 + 2.*x3*x0**-3
d2P_dTdV = -R*x4 + da_alpha_dT*x5*x6
H_dep = x12*(T*da_alpha_dT - a_alpha) - x3 + x8
S_dep = -R*log((V*x3/(x0*x8))**2)/2. + da_alpha_dT*x12 # Consider Real part of the log only via log(x**2)/2 = Re(log(x))
Cv_dep = -T*d2a_alpha_dT2*x13*(-log(((x14 - x15 + x16)/(x14 + x15 - x16))**2)*0.5) # Consider Real part of the log only via log(x**2)/2 = Re(log(x))
else:
dP_dT = R/(V - b) - da_alpha_dT/(V**2 + V*delta + epsilon)
dP_dV = -R*T/(V - b)**2 - (-2*V - delta)*a_alpha/(V**2 + V*delta + epsilon)**2
d2P_dT2 = -d2a_alpha_dT2/(V**2 + V*delta + epsilon)
d2P_dV2 = 2*(R*T/(V - b)**3 - (2*V + delta)**2*a_alpha/(V**2 + V*delta + epsilon)**3 + a_alpha/(V**2 + V*delta + epsilon)**2)
d2P_dTdV = -R/(V - b)**2 + (2*V + delta)*da_alpha_dT/(V**2 + V*delta + epsilon)**2
H_dep = P*V - R*T + 2*(T*da_alpha_dT - a_alpha)*catanh((2*V + delta)/sqrt(delta**2 - 4*epsilon)).real/sqrt(delta**2 - 4*epsilon)
S_dep = -R*log(V) + R*log(P*V/(R*T)) + R*log(V - b) + 2*da_alpha_dT*catanh((2*V + delta)/sqrt(delta**2 - 4*epsilon)).real/sqrt(delta**2 - 4*epsilon)
Cv_dep = -T*(sqrt(1/(delta**2 - 4*epsilon))*log(V - delta**2*sqrt(1/(delta**2 - 4*epsilon))/2 + delta/2 + 2*epsilon*sqrt(1/(delta**2 - 4*epsilon))) - sqrt(1/(delta**2 - 4*epsilon))*log(V + delta**2*sqrt(1/(delta**2 - 4*epsilon))/2 + delta/2 - 2*epsilon*sqrt(1/(delta**2 - 4*epsilon))))*d2a_alpha_dT2
return [dP_dT, dP_dV, d2P_dT2, d2P_dV2, d2P_dTdV, H_dep, S_dep, Cv_dep]
return (A*T - 20*B*Tc*(-T/Tc + 1)**(27/20)/27
- 3*C*Tc*(-T/Tc + 1)**(5/3)/5 + D*(-T**2/(2*Tc) + T)
- 3*E*Tc*(-T/Tc + 1)**(7/3)/7)
elif order == -1j:
# 3x increase in speed - cse via sympy
x0 = log(T)
x1 = 0.5*x0
x2 = 1/Tc
x3 = T*x2
x4 = -x3 + 1
x5 = 1.5*C
x6 = x4**0.333333333333333
x7 = 2*B
x8 = x4**0.05
x9 = log(-x6 + 1)
x10 = sqrt(3)
x11 = x10*atan(x10*(2*x6 + 1)/3)
x12 = sqrt(5)
x13 = 0.5*x12
x14 = x13 + 0.5
x15 = B*x14
x16 = sqrt(x13 + 2.5)
x17 = 2*x8
x18 = -x17
x19 = -x13
x20 = x19 + 0.5
x21 = B*x20
x22 = sqrt(x19 + 2.5)
x23 = B*x16
x24 = 0.5*sqrt(0.1*x12 + 0.5)
x25 = x12 + 1
x26 = 4*x8
x28 = x0*x25
x29 = x28*x3
x30 = 2.*x8
x31 = 6.*V*x27 - 2.*b*x29 + x0*x13*x14*x30 + x0*x19 + x12*x15 + x15*x16 - x15*x23 + x15*x24 - x19*x6 + x19*x8 - x20*x21 - x21*x22
x32 = V - b
x33 = 2.*(R*Tc*a*kappa)
x34 = P*x2
x35 = P*x5
x36 = x25*x3
x37 = P*x10
x38 = P*R*Tc
x39 = V*x17
x40 = 2.*kappa*x3
x41 = b*x17
x42 = P*a*x3
return -Tc*(2.*a*kappa*x11*sqrt(x32**3*(x0 + x6 - x8)*(P*x7 - P*x9 + x25 + x33 + x34 + x35 + x36 - x37))*(kappa + 1.) - x31*x32*((4.*V)*(R*Tc*a*b*kappa) + x0*x33 - x0*x35 + x12*x38 + x16*x38 + x18*x39 - x18*x41 - x20*x42 - x22*x42 - x23*x38 + x24*x38 + x25*x6 - x26 - x27 + x28 + x29 + x3*x39 - x3*x41 + x30*x34 - x33*x8 + x36*x6 + 3*x37*x8 + x39*x40 - x40*x41))/(x11*x31)
else:
return Tc*(-2*a*kappa*sqrt((V - b)**3*(V**2 + 2*V*b - b**2)*(P*R*Tc*V**2 + 2*P*R*Tc*V*b - P*R*Tc*b**2 - P*V*a*kappa**2 + P*a*b*kappa**2 + R*Tc*a*kappa**2 + 2*R*Tc*a*kappa + R*Tc*a))*(kappa + 1)*(R*Tc*V**2 + 2*R*Tc*V*b - R*Tc*b**2 - V*a*kappa**2 + a*b*kappa**2)**2 + (V - b)*(R**2*Tc**2*V**4 + 4*R**2*Tc**2*V**3*b + 2*R**2*Tc**2*V**2*b**2 - 4*R**2*Tc**2*V*b**3 + R**2*Tc**2*b**4 - 2*R*Tc*V**3*a*kappa**2 - 2*R*Tc*V**2*a*b*kappa**2 + 6*R*Tc*V*a*b**2*kappa**2 - 2*R*Tc*a*b**3*kappa**2 + V**2*a**2*kappa**4 - 2*V*a**2*b*kappa**4 + a**2*b**2*kappa**4)*(P*R*Tc*V**4 + 4*P*R*Tc*V**3*b + 2*P*R*Tc*V**2*b**2 - 4*P*R*Tc*V*b**3 + P*R*Tc*b**4 - P*V**3*a*kappa**2 - P*V**2*a*b*kappa**2 + 3*P*V*a*b**2*kappa**2 - P*a*b**3*kappa**2 + R*Tc*V**2*a*kappa**2 + 2*R*Tc*V**2*a*kappa + R*Tc*V**2*a + 2*R*Tc*V*a*b*kappa**2 + 4*R*Tc*V*a*b*kappa + 2*R*Tc*V*a*b - R*Tc*a*b**2*kappa**2 - 2*R*Tc*a*b**2*kappa - R*Tc*a*b**2 + V*a**2*kappa**4 + 2*V*a**2*kappa**3 + V*a**2*kappa**2 - a**2*b*kappa**4 - 2*a**2*b*kappa**3 - a**2*b*kappa**2))/((R*Tc*V**2 + 2*R*Tc*V*b - R*Tc*b**2 - V*a*kappa**2 + a*b*kappa**2)**2*(R**2*Tc**2*V**4 + 4*R**2*Tc**2*V**3*b + 2*R**2*Tc**2*V**2*b**2 - 4*R**2*Tc**2*V*b**3 + R**2*Tc**2*b**4 - 2*R*Tc*V**3*a*kappa**2 - 2*R*Tc*V**2*a*b*kappa**2 + 6*R*Tc*V*a*b**2*kappa**2 - 2*R*Tc*a*b**3*kappa**2 + V**2*a**2*kappa**4 - 2*V*a**2*b*kappa**4 + a**2*b**2*kappa**4))