sympy.Mul: _prod, sympy.Pow: lambda x, y: x**y, sympy.exp: lambda x: core.exp(x), sympy.log: lambda x: core.log(x), sympy.sin: lambda x: core.sin(x), sympy.asin: lambda x: core.asin(x), sympy.sinh: lambda x: core.sinh(x), sympy.asinh: lambda x: core.asinh(x), sympy.cos: lambda x: core.cos(x), sympy.acos: lambda x: core.acos(x), sympy.cosh: lambda x: core.cosh(x), sympy.acosh: lambda x: core.acosh(x), sympy.tan: lambda x: core.tan(x), sympy.atan: lambda x: core.atan(x), sympy.tanh: lambda x: core.tanh(x), sympy.atanh: lambda x: core.atanh(x), sympy.ceiling: lambda x: core.ceil(x), sympy.floor: lambda x: core.floor(x), sympy.Derivative: _nondifferentiable, } except ImportError: #pragma:nocover _sympy_available = False # A "public" attribute indicating that differentiate() can be called # ... this provides a bit of future-proofing for alternative approaches # to symbolic differentiation. differentiate_available = _sympy_available class NondifferentiableError(ValueError): """A Pyomo-specific ValueError raised for non-differentiable expressions"""
sympy.Add: _sum, sympy.Mul: _prod, sympy.Pow: lambda x,y: x**y, sympy.log: lambda x: core.log(x), sympy.sin: lambda x: core.sin(x), sympy.asin: lambda x: core.asin(x), sympy.sinh: lambda x: core.sinh(x), sympy.asinh: lambda x: core.asinh(x), sympy.cos: lambda x: core.cos(x), sympy.acos: lambda x: core.acos(x), sympy.cosh: lambda x: core.cosh(x), sympy.acosh: lambda x: core.acosh(x), sympy.tan: lambda x: core.tan(x), sympy.atan: lambda x: core.atan(x), sympy.tanh: lambda x: core.tanh(x), sympy.atanh: lambda x: core.atanh(x), sympy.ceiling: lambda x: core.ceil(x), sympy.floor: lambda x: core.floor(x), sympy.Derivative: _nondifferentiable, } except ImportError: #pragma:nocover _sympy_available = False class NondifferentiableError(ValueError): """A Pyomo-specific ValueError raised for non-differentiable expressions""" pass def differentiate(expr, wrt=None, wrt_list=None): if not _sympy_available: