当前位置: 首页>>代码示例>>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;未经允许,请勿转载。