本文整理汇总了Python中sympy.erfc方法的典型用法代码示例。如果您正苦于以下问题:Python sympy.erfc方法的具体用法?Python sympy.erfc怎么用?Python sympy.erfc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy
的用法示例。
在下文中一共展示了sympy.erfc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _is_non_decreasing
# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import erfc [as 别名]
def _is_non_decreasing(fn, q, bounds):
"""Verifies whether the function is non-decreasing within a range.
Args:
fn: Symbolic function of a single variable.
q: The name of f's variable.
bounds: Pair of (lower_bound, upper_bound) reals.
Returns:
True iff the function is non-decreasing in the range.
"""
diff_fn = sp.diff(fn, q) # Symbolically compute the derivative.
diff_fn_lambdified = sp.lambdify(
q,
diff_fn,
modules=[
"numpy", {
"erfc": scipy.special.erfc,
"erfcinv": scipy.special.erfcinv
}
])
r = scipy.optimize.minimize_scalar(
diff_fn_lambdified, bounds=bounds, method="bounded")
assert r.success, "Minimizer failed to converge."
return r.fun >= 0 # Check whether the derivative is non-negative.
示例2: _compute_bl_gnmax
# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import erfc [as 别名]
def _compute_bl_gnmax(q, sigma, num_classes):
return ((num_classes - 1) / 2 * scipy.special.erfc(
1 / sigma + scipy.special.erfcinv(2 * q / (num_classes - 1))))
示例3: _compute_bu_gnmax
# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import erfc [as 别名]
def _compute_bu_gnmax(q, sigma, num_classes):
return min(1, (num_classes - 1) / 2 * scipy.special.erfc(
-1 / sigma + scipy.special.erfcinv(2 * q / (num_classes - 1))))
示例4: _construct_symbolic_bu
# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import erfc [as 别名]
def _construct_symbolic_bu(q, sigma, m):
return (m - 1) / 2 * sp.erfc(sp.erfcinv(2 * q / (m - 1)) - 1 / sigma)
示例5: test_erfc
# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import erfc [as 别名]
def test_erfc():
x = Symbol("x")
e1 = sympy.erfc(sympy.Symbol("x"))
e2 = erfc(x)
assert sympify(e1) == e2
assert e2._sympy_() == e1