當前位置: 首頁>>代碼示例>>Python>>正文


Python sympy.erfc方法代碼示例

本文整理匯總了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. 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:27,代碼來源:smooth_sensitivity.py

示例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)))) 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:5,代碼來源:smooth_sensitivity.py

示例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)))) 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:5,代碼來源:smooth_sensitivity.py

示例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) 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:4,代碼來源:smooth_sensitivity.py

示例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 
開發者ID:symengine,項目名稱:symengine.py,代碼行數:8,代碼來源:test_sympy_conv.py


注:本文中的sympy.erfc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。