# Derivation and Conversion of Planck-Einstein Terms

Start with a generalized Helmholtz energy from 
$$\alpha^0 = a_k\log\left[c_k + d_k\exp\left(\frac{b_k\tau}{T_c}\right)\right]$$

The ideal-gas specific heat can be obtained from 
$$\frac{c_p^0}{R} = -\tau^2\alpha^0_{\tau\tau}$$

After some math shown below (and some manual grouping):
$$\frac{c_p^0}{R} = - \frac{a_{k} (b_{k}\tau/T_c)^{2} c_k d_{k} e^{\frac{b_{k} \tau}{T_{c}}}}{ \left(c_{k} + d_{k} e^{\frac{b_{k} \tau}{T_{c}}}\right)^2} $$

Two important identities:
$$ \left(\frac{1}{\cosh x}\right) = \frac{2e^{-x}}{1+e^{-2x}}$$
$$ \left(\frac{1}{\sinh x}\right) = \frac{2e^{-x}}{1-e^{-2x}}$$
which yield
$$ \left(\frac{x}{\cosh x}\right)^2 = \frac{4x^2e^{-2x}}{(1+e^{-2x})^2} = \frac{(-2x)^2e^{-2x}}{(1+e^{-2x})^2}$$
$$ \left(\frac{x}{\sinh x}\right)^2 = \frac{4x^2e^{-2x}}{(1-e^{-2x})^2} = \frac{(-2x)^2e^{-2x}}{(1-e^{-2x})^2}$$


```
from __future__ import division
from sympy import *
init_session(quiet=True)
init_printing()
```

    IPython console for SymPy 0.7.5 (Python 2.7.2-32-bit) (ground types: python)



```
a_k,b_k,c_k,d_k,tau,T_c = symbols('a_k,b_k,c_k,d_k,tau,T_c',real=True)
alpha0 = a_k*log(c_k + d_k*exp(b_k*tau/T_c))
print 'No derivatives'
display(alpha0)
print 'First partial w.r.t. tau'
display(diff(alpha0, tau, 1).simplify())
print 'Second partial w.r.t. tau'
display(diff(alpha0, tau, 2).simplify())
print latex(diff(alpha0, tau, 2).simplify()*(-tau**2))
print 'Third partial w.r.t. tau'
display(diff(alpha0, tau, 3).simplify())
```

Aly-Lee starts as
$$\frac{c_p^0}{R_u} = A + B\left(\frac{C/T}{\sinh(C/T)}\right)^2 + D\left(\frac{E/T}{\cosh(E/T)}\right)^2$$
and generalized Plank-Einstein term is given by
$$\frac{c_p^0}{R_u} = - \frac{a_{k} b_{k}^{2} c_{k} d_{k} \tau^{2} e^{\frac{b_{k} \tau}{T_{c}}}}{T_{c}^{2} \left(c_{k} + d_{k} e^{\frac{b_{k} \tau}{T_{c}}}\right)^{2}}$$

Constant is separated out, and handled separately.  sinh part can be expanded as
$$B\left(\frac{C/T}{\sinh(C/T)}\right)^2 = \frac{B(-2C/T)^2\exp(-2C/T)}{(1-\exp(-2C/T))^2}$$
where
$$a_k = B$$
$$b_k = -2C$$
$$c_k = 1$$
$$d_k = -1$$

cosh part can be expanded as
$$D\left(\frac{E/T}{\cosh(E/T)}\right)^2 = \frac{D(-2E/T)^2\exp(-2E/T)}{(1+\exp(-2E/T))^2}$$
where
$$a_k = -D$$
$$b_k = -2E$$
$$c_k = 1$$
$$d_k = 1$$


```
B, D, T = symbols('B, D, T', real = True, positive = True)
# From Aly-Lee:
term1 = ((D/T)/sinh(D/T))**2
# Planck Einstein
term2 = (B/T)**2*exp(B/T)/(exp(B/T)-1)**2
diff1 = term2 - term1
display(diff1.rewrite(exp).subs(B, 2*D).simplify())
term2 = (2*D/T)**2*exp(2*D/T)/(exp(2*D/T)-1)**2
display(term2)
print 'which is the same as the Aly-Lee sinh term with a_k = C, b_k = 2*D, c_k = -1, d_k = 1'

B, F, T = symbols('B, F, T', real = True, positive = True)
# From Aly-Lee:
term1 = ((F/T)/cosh(F/T))**2
# Planck Einstein
term2 = (B/T)**2*exp(-B/T)/(exp(-B/T)+1)**2
diff2 = term2 - term1
display(diff2.rewrite(exp).subs(B, 2*F).simplify())
# So Aly-Lee cosh term can be directly converted to Plank-Einstein2 term with b_k = 2*F, and c=1
```

ec7b485159f9bf72eec9634785e3d5de961e7a00
ipynb
Jupyter Notebook
doc/notebooks/CP0.ipynb
pauliacomi/CoolProp
80eb4601c67ecd04353067663db50937fd7ccdae
MIT
2015-01-14T16:49:41.000Z
2022-03-29T07:48:50.000Z
doc/notebooks/CP0.ipynb
pauliacomi/CoolProp
80eb4601c67ecd04353067663db50937fd7ccdae
MIT
2015-01-01T07:42:45.000Z
2022-03-31T23:48:56.000Z
doc/notebooks/CP0.ipynb
pauliacomi/CoolProp
80eb4601c67ecd04353067663db50937fd7ccdae
MIT
2015-01-02T17:24:27.000Z
2022-03-19T07:01:00.000Z
Qwen/Qwen-72B
1. YES
2. YES