本文整理匯總了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