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


Python sympy.acos方法代碼示例

本文整理匯總了Python中sympy.acos方法的典型用法代碼示例。如果您正苦於以下問題:Python sympy.acos方法的具體用法?Python sympy.acos怎麽用?Python sympy.acos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sympy的用法示例。


在下文中一共展示了sympy.acos方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_conv7b

# 需要導入模塊: import sympy [as 別名]
# 或者: from sympy import acos [as 別名]
def test_conv7b():
    x = sympy.Symbol("x")
    y = sympy.Symbol("y")
    assert sympify(sympy.sin(x/3)) == sin(Symbol("x") / 3)
    assert sympify(sympy.sin(x/3)) != cos(Symbol("x") / 3)
    assert sympify(sympy.cos(x/3)) == cos(Symbol("x") / 3)
    assert sympify(sympy.tan(x/3)) == tan(Symbol("x") / 3)
    assert sympify(sympy.cot(x/3)) == cot(Symbol("x") / 3)
    assert sympify(sympy.csc(x/3)) == csc(Symbol("x") / 3)
    assert sympify(sympy.sec(x/3)) == sec(Symbol("x") / 3)
    assert sympify(sympy.asin(x/3)) == asin(Symbol("x") / 3)
    assert sympify(sympy.acos(x/3)) == acos(Symbol("x") / 3)
    assert sympify(sympy.atan(x/3)) == atan(Symbol("x") / 3)
    assert sympify(sympy.acot(x/3)) == acot(Symbol("x") / 3)
    assert sympify(sympy.acsc(x/3)) == acsc(Symbol("x") / 3)
    assert sympify(sympy.asec(x/3)) == asec(Symbol("x") / 3) 
開發者ID:symengine,項目名稱:symengine.py,代碼行數:18,代碼來源:test_sympy_conv.py

示例2: liu_vinokur_12

# 需要導入模塊: import sympy [as 別名]
# 或者: from sympy import acos [as 別名]
def liu_vinokur_12():
    lmbda = frac(4, 27) * (
        4 * sqrt(79) * cos((acos(67 * sqrt(79) / 24964) + 2 * numpy.pi) / 3) + 71
    )
    alpha1 = (+sqrt(9 * lmbda ** 2 - 248 * lmbda + 1680) + 28 - 3 * lmbda) / (
        112 - 10 * lmbda
    )
    alpha2 = (-sqrt(9 * lmbda ** 2 - 248 * lmbda + 1680) + 28 - 3 * lmbda) / (
        112 - 10 * lmbda
    )
    w1 = ((21 - lmbda) * alpha2 - 7) / (420 * alpha1 ** 2 * (alpha2 - alpha1))
    w2 = ((21 - lmbda) * alpha1 - 7) / (420 * alpha2 ** 2 * (alpha1 - alpha2))
    weights = numpy.concatenate(
        [numpy.full(4, w1), numpy.full(4, w2), numpy.full(6, lmbda ** 2 / 840)]
    )
    points = numpy.concatenate(
        [_r_alpha(alpha1), _r_alpha(alpha2), _r_beta(1 / sqrt(lmbda))]
    )
    degree = 5

    return T3Scheme("Liu-Vinokur 12", weights, points, degree, source) 
開發者ID:nschloe,項目名稱:quadpy,代碼行數:23,代碼來源:_liu_vinokur.py

示例3: test_conv7

# 需要導入模塊: import sympy [as 別名]
# 或者: from sympy import acos [as 別名]
def test_conv7():
    x = Symbol("x")
    y = Symbol("y")
    assert sin(x/3) == sin(sympy.Symbol("x") / 3)
    assert cos(x/3) == cos(sympy.Symbol("x") / 3)
    assert tan(x/3) == tan(sympy.Symbol("x") / 3)
    assert cot(x/3) == cot(sympy.Symbol("x") / 3)
    assert csc(x/3) == csc(sympy.Symbol("x") / 3)
    assert sec(x/3) == sec(sympy.Symbol("x") / 3)
    assert asin(x/3) == asin(sympy.Symbol("x") / 3)
    assert acos(x/3) == acos(sympy.Symbol("x") / 3)
    assert atan(x/3) == atan(sympy.Symbol("x") / 3)
    assert acot(x/3) == acot(sympy.Symbol("x") / 3)
    assert acsc(x/3) == acsc(sympy.Symbol("x") / 3)
    assert asec(x/3) == asec(sympy.Symbol("x") / 3)

    assert sin(x/3)._sympy_() == sympy.sin(sympy.Symbol("x") / 3)
    assert sin(x/3)._sympy_() != sympy.cos(sympy.Symbol("x") / 3)
    assert cos(x/3)._sympy_() == sympy.cos(sympy.Symbol("x") / 3)
    assert tan(x/3)._sympy_() == sympy.tan(sympy.Symbol("x") / 3)
    assert cot(x/3)._sympy_() == sympy.cot(sympy.Symbol("x") / 3)
    assert csc(x/3)._sympy_() == sympy.csc(sympy.Symbol("x") / 3)
    assert sec(x/3)._sympy_() == sympy.sec(sympy.Symbol("x") / 3)
    assert asin(x/3)._sympy_() == sympy.asin(sympy.Symbol("x") / 3)
    assert acos(x/3)._sympy_() == sympy.acos(sympy.Symbol("x") / 3)
    assert atan(x/3)._sympy_() == sympy.atan(sympy.Symbol("x") / 3)
    assert acot(x/3)._sympy_() == sympy.acot(sympy.Symbol("x") / 3)
    assert acsc(x/3)._sympy_() == sympy.acsc(sympy.Symbol("x") / 3)
    assert asec(x/3)._sympy_() == sympy.asec(sympy.Symbol("x") / 3) 
開發者ID:symengine,項目名稱:symengine.py,代碼行數:31,代碼來源:test_sympy_conv.py

示例4: cartesian_to_spherical_sympy

# 需要導入模塊: import sympy [as 別名]
# 或者: from sympy import acos [as 別名]
def cartesian_to_spherical_sympy(X):
    vacos = numpy.vectorize(sympy.acos)
    return numpy.stack([_atan2_0(X), vacos(X[:, 2])], axis=1) 
開發者ID:nschloe,項目名稱:quadpy,代碼行數:5,代碼來源:_helpers.py

示例5: zeeman_theta

# 需要導入模塊: import sympy [as 別名]
# 或者: from sympy import acos [as 別名]
def zeeman_theta(u, v, w, z=0, a=0):
    """ Find Zeeman angle along the magnetic field
    """

    try:
        import sympy as sp
    except ModuleNotFoundError:
        raise RuntimeError("Must have sympy installed to use")

    U, V, W, Z, A = np.meshgrid(u, v, w, z, a, copy=False)
    N = len(U.flatten())

    if type(sp.symbols('u')) == type(u):
        sin = sp.sin
        cos = sp.cos
        acos = sp.acos
        sqrt = sp.sqrt
        d = np.empty((N), type(u))
    else:
        sin = np.sin
        cos = np.cos
        acos = np.arccos
        sqrt = np.sqrt
        d = np.empty((N), float)

    for i in range(N):
        H = np.array([U.flat[i], V.flat[i], W.flat[i]])
        L = np.array([sin(Z.flat[i])*cos(A.flat[i]),
                      sin(Z.flat[i])*sin(A.flat[i]), cos(Z.flat[i])])
        d[i] = acos(H.dot(L) / sqrt(H.dot(H)))

    if type(sp.symbols('u')) == type(u):
        return d[0]

    shape = []
    for input in [u, v, w, z, a]:
        if np.isscalar(input):
            continue
        shape.append(len(input))

    if shape:
        d = d.reshape(shape)
    else:
        d = d[0]

    return d 
開發者ID:atmtools,項目名稱:typhon,代碼行數:48,代碼來源:em.py


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