Inverse temperature (beta) extrapolation (beta)#

Classes:

du_func(beta, n)

Sympy function to evaluate energy fluctuations using central moments.

u_func_central(beta)

Sympy function to evaluate energy averages using central moments.

dxdu_func_nobeta(beta, n)

Sympy function to evaluate observable energy fluctuations using central moments.

dxdu_func_beta(beta, n, deriv)

Sympy function to evaluate derivatives of observable fluctuations using central moments.

x_func_central_nobeta(beta)

Sympy function to evaluate derivatives of observable \(\langle x \rangle\) using central moments.

x_func_central_beta(beta, deriv)

Sympy function to evaluate derivatives of observable \(\langle x(\beta) \rangle\) using central moments.

u_func(beta, n)

Sympy function to evaluate derivatives of energy \(\langle u \rangle\) using raw moments.

xu_func(beta, n[, deriv])

Sympy function to evaluate derivatives of \(\langle x u^n \rangle\).

SymDerivBeta(func[, args, expand, post_func])

Provide symbolic expressions for \(d^n \langle x \rangle /d\beta^n\).

Functions:

factory_derivatives([name, n, d, xalpha, ...])

Factory function to provide derivative function for expansion.

factory_extrapmodel(beta, data, *[, name, ...])

Factory function to create Extrapolation model for beta expansion.

factory_perturbmodel(beta, uv, xv[, alpha_name])

Factory function to create PerturbModel for beta expansion.

class thermoextrap.beta.du_func(beta, n)[source]#

Bases: SymFuncBase

Sympy function to evaluate energy fluctuations using central moments.

\(\text{du_func}(\beta, n) = \langle (u(\beta) - \langle u(\beta) \rangle)^n \rangle\)

Notes

sub in {'beta': 'None'} to convert to indexed objects Have to use 'None' instead of None as sympy does some magic to the input arguments.

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta, n)

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta, n)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.u_func_central(beta)[source]#

Bases: SymFuncBase

Sympy function to evaluate energy averages using central moments.

\(\text{u_func_central}(beta, n) = \langle u(\beta)^n \rangle\)

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta)

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.dxdu_func_nobeta(beta, n)[source]#

Bases: SymFuncBase

Sympy function to evaluate observable energy fluctuations using central moments.

\(\text{dxdu_func_nobeta}(\beta, n) = \langle \delta x (\delta u)^n \rangle\)

for use when x is not a function of beta.

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta, n)

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta, n)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.dxdu_func_beta(beta, n, deriv)[source]#

Bases: SymFuncBase

Sympy function to evaluate derivatives of observable fluctuations using central moments.

\(\text{dxdu_func_beta}(\beta, n, d) = \langle \delta x^{(d)}(\beta)(\delta u)^n \rangle\), where \(x^{(k)} = d^k x / d\beta^k\).

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta, n, deriv)

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta, n, deriv)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.x_func_central_nobeta(beta)[source]#

Bases: SymFuncBase

Sympy function to evaluate derivatives of observable \(\langle x \rangle\) using central moments.

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta)

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.x_func_central_beta(beta, deriv)[source]#

Bases: SymFuncBase

Sympy function to evaluate derivatives of observable \(\langle x(\beta) \rangle\) using central moments.

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta, deriv)

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta, deriv)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.u_func(beta, n)[source]#

Bases: SymFuncBase

Sympy function to evaluate derivatives of energy \(\langle u \rangle\) using raw moments.

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta, n)

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta, n)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.xu_func(beta, n, deriv=None)[source]#

Bases: SymFuncBase

Sympy function to evaluate derivatives of \(\langle x u^n \rangle\).

If x is a function of beta, then \(\text{xu_func}(\beta, n, d) = \langle x^{(d)} u^n \rangle\). If x is not a function of beta, drop argument d.

Methods:

deriv_args()

Symbol arguments of function.

fdiff([argindex])

Derivative of function.

eval(beta, n[, deriv])

Evaluate function.

classmethod deriv_args()[source]#

Symbol arguments of function.

This is used by Data class to create a ‘lambdfied’ callable function.

fdiff(argindex=1)[source]#

Derivative of function. This will be used by thermoextrap.models.SymDerivBase.

classmethod eval(beta, n, deriv=None)[source]#

Evaluate function.

We use the convention of passing in beta=’None’ to evaluate the function to an indexed variable.

class thermoextrap.beta.SymDerivBeta(func, args=None, expand=True, post_func=None)[source]#

Bases: SymDerivBase

Provide symbolic expressions for \(d^n \langle x \rangle /d\beta^n\).

Parameters:
  • func (Function) – Function to differentiate. This should (most likely) be an instance of thermoextrap.models.SymFuncBase

  • args (sequence of Symbol) – Arguments to func

  • expand (bool) – If True, apply expand()

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

Methods:

x_ave([xalpha, central, expand, post_func])

General method to find derivatives of \(\langle x \rangle\).

u_ave([central, expand, post_func])

General constructor for symbolic derivatives of \(\langle u \rangle\).

dun_ave(n[, expand, post_func, central])

Constructor for derivatives of \(\langle (\delta u)^n\rangle\).

dxdun_ave(n[, xalpha, expand, post_func, d, ...])

Constructor for derivatives of \(\langle \delta x \delta u^n\rangle\).

un_ave(n[, expand, post_func, central])

Constructor for derivatives of \(\langle u^n\rangle\).

xun_ave(n[, d, xalpha, expand, post_func, ...])

Constructor for deriatives of \(\langle x^{(d)} u^n\rangle\).

from_name(name[, xalpha, central, expand, ...])

Create a derivative expressions indexer by name.

classmethod x_ave(xalpha=False, central=None, expand=True, post_func=None)[source]#

General method to find derivatives of \(\langle x \rangle\).

Parameters:
  • xalpha (bool, default False) – Flag whether u depends on variable alpha.

  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

  • expand (bool) – If True, apply expand()

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

classmethod u_ave(central=None, expand=True, post_func=None)[source]#

General constructor for symbolic derivatives of \(\langle u \rangle\).

Parameters:
  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

  • expand (bool) – If True, apply expand()

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

classmethod dun_ave(n, expand=True, post_func=None, central=None)[source]#

Constructor for derivatives of \(\langle (\delta u)^n\rangle\).

Parameters:
  • n (int) – Order of moment.

  • expand (bool) – If True, apply expand()

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

classmethod dxdun_ave(n, xalpha=False, expand=True, post_func=None, d=None, central=None)[source]#

Constructor for derivatives of \(\langle \delta x \delta u^n\rangle\).

Parameters:
  • n (int) – Order of moment.

  • expand (bool) – If True, apply expand()

  • xalpha (bool, default False) – Flag whether u depends on variable alpha.

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

  • d (int) – Order of derivative of x.

  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

Notes

If xalpha is True, must also specify d.

classmethod un_ave(n, expand=True, post_func=None, central=None)[source]#

Constructor for derivatives of \(\langle u^n\rangle\).

Parameters:
  • n (int) – Order of moment.

  • expand (bool) – If True, apply expand()

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

classmethod xun_ave(n, d=None, xalpha=False, expand=True, post_func=None, central=None)[source]#

Constructor for deriatives of \(\langle x^{(d)} u^n\rangle\).

Parameters:
  • n (int) – Order of moment.

  • d (int) – Order of derivative of x.

  • xalpha (bool, default False) – Flag whether u depends on variable alpha.

  • expand (bool) – If True, apply expand()

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

classmethod from_name(name, xalpha=False, central=None, expand=True, post_func=None, n=None, d=None)[source]#

Create a derivative expressions indexer by name.

Parameters:
  • name ({'xave', 'uave', 'dun_ave', 'un_ave'})

  • All properties use post_func and expand parameters.

    • x_ave: general average of <x>(central, xalpha)

    • u_ave: <u>(central)

    • dun_ave: derivative of <(u - <u>)**n>(central, n)

    • dxdun_ave: derivatives of <dx^(d) * du**n>(xalpha, n, d)

    • un_ave: derivative of <u**n>(n)

    • xun_ave: derivative of <x^(d) * u**n>(xalpha, n, [d])

    • lnPi_correction: derivatives of <lnPi - beta * mu * N>(central)

  • xalpha (bool, default False) – Whether property depends on alpha (beta)

  • central (bool, default False) – Whether central moments expansion should be used

  • expand (bool, default True) – Whether expressions should be expanded

  • n (int, optional) – n parameter used for dun_ave or un_ave

  • d (int, optional) – d parameter for dxdun_ave

thermoextrap.beta.factory_derivatives(name='x_ave', n=None, d=None, xalpha=False, central=None, post_func=None, expand=True)[source]#

Factory function to provide derivative function for expansion.

Parameters:
  • name ({x_ave, u_ave, dxdun_ave, dun_ave, un_ave, xun_ave})

  • xalpha (bool, default False) – Flag whether u depends on variable alpha.

  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

Returns:

derivatives (thermoextrap.models.Derivatives instance) – Object used to calculate taylor series coefficients

thermoextrap.beta.factory_extrapmodel(beta, data, *, name='x_ave', n=None, d=None, xalpha=None, central=None, order=None, alpha_name='beta', derivatives=None, post_func=None, derivatives_kws=None)[source]#

Factory function to create Extrapolation model for beta expansion.

Parameters:
  • beta (float) – reference value of inverse temperature

  • data (object) – Instance of data object, e.g. thermoextrap.data.DataCentralMoments

  • n (int) – Order of moment.

  • d (int) – Order of derivative of x.

  • order (int) – maximum order of moments/expansion to calculate

  • xalpha (bool, default False) – Flag whether u depends on variable alpha.

  • central (bool) – If True, Use central moments. Otherwise, use raw moments.

  • post_func (str or callable()) – Transformation of base function. For example, post_fuc = -sympy.log is equivalent to passing minus_log=True If a string, then apply the following standard functions

    • minus_log : post_func = -sympy.log

    • pow_i : post_func = lambda f: pow(f, i). E.g., pow_2 => pow(f, 2)

  • alpha_name (str, default 'beta') – name of expansion parameter

  • kws (dict) – extra arguments to factory_data_values

Returns:

extrapmodel (ExtrapModel)

Notes

Note that default values for parameters order, xalpha, and central are inferred from corresponding attributes of data.

See also

ExtrapModel

thermoextrap.beta.factory_perturbmodel(beta, uv, xv, alpha_name='beta', **kws)[source]#

Factory function to create PerturbModel for beta expansion.

Parameters:
  • beta (float) – reference value of inverse temperature

  • uv (array-like) – raw values of u (energy) if not DataArray, wrap with xrwrap_uv

  • xv (xarray.DataArray) – raw values of x (observable) if not DataArray, wrap with xrwrap_xv

  • alpha_name (str, default 'beta') – name of expansion parameter

  • kws (dict) – extra arguments to data object

Returns:

perturbmodel (thermoextrap.models.PerturbModel)

See also

PerturbModel