```python
from math import log as ln

import numpy as np
import matplotlib.pyplot as plt

from chempy.units import default_constants as consts, default_units as u
from chempy.properties.water_density_tanaka_2001 import water_density
from chempy.properties.water_permittivity_bradley_pitzer_1979 import water_permittivity
import chempy.electrolytes as dh
import chempy.symbolic
```


```python
def DH_A_B(T):
    eps_r = water_permittivity(T, 1*u.bar, units=u)
    rho = water_density(T, units=u)
    b0 = 1 * u.mol/u.kg
    A = dh.A(eps_r, T, rho, b0=b0, constants=consts, units=u).simplified/ln(10)
    B = dh.B(eps_r, T, rho, b0=b0, constants=consts, units=u).rescale(1/u.angstrom)
    return A, B
```


```python
DH_A_B(298.15*u.kelvin)
```


```python
T = (np.linspace(0, 40)+273.15)*u.Kelvin
A, B = DH_A_B(T)
%matplotlib inline
plt.figure(figsize=(18,4))
plt.subplot(1, 2, 1)
plt.plot(T-273.15*u.K, A)
plt.xlabel(r"Temperature / $^\circ C$")
plt.ylabel("A")
plt.subplot(1, 2, 2)
plt.plot(T-273.15*u.K, B)
plt.xlabel(r"Temperature / $^\circ C$")
plt.ylabel("B / $\AA^{-1}$")
```


```python
import sympy as sp
sp.init_printing()
```


```python
constants = chempy.symbolic.get_constant_symbols()
constants.Avogadro_constant
```


```python
var_symbs = A, B, eps_r, T, rho, b0, I, z, a, I0, C, gamma = sp.symbols('A B epsilon_r T rho b^o I z a I^o C gamma')
one = sp.S(1)
var_symbs
```


```python
A_expr = dh.A(eps_r, T, rho, b0, constants, backend='sympy')
sp.Eq(A, A_expr)
```


```python
B_expr = dh.B(eps_r, T, rho, b0, constants, backend=sp)
sp.Eq(B, B_expr)
```


```python
sp.Eq(sp.log(gamma), dh.limiting_log_gamma(I, z, A, I0=I0, backend=sp))
```


```python
sp.Eq(sp.log(gamma), dh.extended_log_gamma(I, z, a, A, B, C=C, I0=I0, backend=sp))
```

f9dc07f9d1294391586b354fb210ea35b2d25802
ipynb
Jupyter Notebook
examples/demo_debye_huckel.ipynb
Narsil/chempy
ac7217f45a8cfe3b11ca771f78f0a04c07708818
BSD-2-Clause
examples/demo_debye_huckel.ipynb
Narsil/chempy
ac7217f45a8cfe3b11ca771f78f0a04c07708818
BSD-2-Clause
examples/demo_debye_huckel.ipynb
Narsil/chempy
ac7217f45a8cfe3b11ca771f78f0a04c07708818
BSD-2-Clause
2022-03-21T09:01:48.000Z
2022-03-21T09:01:48.000Z
Qwen/Qwen-72B
1. YES
2. YES