当前位置: 首页>>代码示例>>Python>>正文


Python C.acos方法代码示例

本文整理汇总了Python中sympy.core.C.acos方法的典型用法代码示例。如果您正苦于以下问题:Python C.acos方法的具体用法?Python C.acos怎么用?Python C.acos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sympy.core.C的用法示例。


在下文中一共展示了C.acos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: eval

# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import acos [as 别名]
    def eval(cls, arg):
        arg = sympify(arg)

        if arg.is_Number:
            if arg is S.NaN:
                return S.NaN
            elif arg is S.Infinity:
                return S.Infinity
            elif arg is S.NegativeInfinity:
                return S.Infinity
            elif arg is S.Zero:
                return S.Pi*S.ImaginaryUnit / 2
            elif arg is S.One:
                return S.Zero
            elif arg is S.NegativeOne:
                return S.Pi*S.ImaginaryUnit

        if arg.is_number:
            cst_table = {
                S.ImaginaryUnit : C.log(S.ImaginaryUnit*(1+sqrt(2))),
                -S.ImaginaryUnit : C.log(-S.ImaginaryUnit*(1+sqrt(2))),
                S.Half       : S.Pi/3,
                -S.Half      : 2*S.Pi/3,
                sqrt(2)/2    : S.Pi/4,
                -sqrt(2)/2   : 3*S.Pi/4,
                1/sqrt(2)    : S.Pi/4,
                -1/sqrt(2)   : 3*S.Pi/4,
                sqrt(3)/2    : S.Pi/6,
                -sqrt(3)/2   : 5*S.Pi/6,
                (sqrt(3)-1)/sqrt(2**3) : 5*S.Pi/12,
                -(sqrt(3)-1)/sqrt(2**3) : 7*S.Pi/12,
                sqrt(2+sqrt(2))/2 : S.Pi/8,
                -sqrt(2+sqrt(2))/2 : 7*S.Pi/8,
                sqrt(2-sqrt(2))/2 : 3*S.Pi/8,
                -sqrt(2-sqrt(2))/2 : 5*S.Pi/8,
                (1+sqrt(3))/(2*sqrt(2)) : S.Pi/12,
                -(1+sqrt(3))/(2*sqrt(2)) : 11*S.Pi/12,
                (sqrt(5)+1)/4 : S.Pi/5,
                -(sqrt(5)+1)/4 : 4*S.Pi/5
            }

            if arg in cst_table:
                if arg.is_real:
                    return cst_table[arg]*S.ImaginaryUnit
                return cst_table[arg]

        if arg is S.ComplexInfinity:
            return S.Infinity

        i_coeff = arg.as_coefficient(S.ImaginaryUnit)

        if i_coeff is not None:
            if _coeff_isneg(i_coeff):
                return S.ImaginaryUnit * C.acos(i_coeff)
            return S.ImaginaryUnit * C.acos(-i_coeff)
        else:
            if _coeff_isneg(arg):
                return -cls(-arg)
开发者ID:ENuge,项目名称:sympy,代码行数:60,代码来源:hyperbolic.py

示例2: angle_between

# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import acos [as 别名]
    def angle_between(l1, l2):
        """The angle formed between the two linear entities.

        Parameters
        ----------
        l1 : LinearEntity
        l2 : LinearEntity

        Returns
        -------
        angle : angle in radians

        Notes
        -----
        From the dot product of vectors v1 and v2 it is known that:

            dot(v1, v2) = |v1|*|v2|*cos(A)

        where A is the angle formed between the two vectors. We can
        get the directional vectors of the two lines and readily
        find the angle between the two using the above formula.

        Examples
        --------
        >>> from sympy import Point, Line
        >>> p1, p2, p3 = Point(0, 0), Point(0, 4), Point(2, 0)
        >>> l1, l2 = Line(p1, p2), Line(p1, p3)
        >>> l1.angle_between(l2)
        pi/2

        """
        v1 = l1.p2 - l1.p1
        v2 = l2.p2 - l2.p1
        return C.acos((v1[0]*v2[0] + v1[1]*v2[1]) / (abs(v1)*abs(v2)))
开发者ID:AlexandruFlorescu,项目名称:sympy,代码行数:36,代码来源:line.py

示例3: angle_between

# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import acos [as 别名]
    def angle_between(l1, l2):
        """
        Returns an angle formed between the two linear entities.

        Description of Method Used:
        ===========================
            From the dot product of vectors v1 and v2 it is known that:
                dot(v1, v2) = |v1|*|v2|*cos(A)
            where A is the angle formed between the two vectors. We can
            get the directional vectors of the two lines and readily
            find the angle between the two using the above formula.
        """
        v1 = l1.p2 - l1.p1
        v2 = l2.p2 - l2.p1
        return C.acos( (v1[0]*v2[0]+v1[1]*v2[1]) / (abs(v1)*abs(v2)) )
开发者ID:Aang,项目名称:sympy,代码行数:17,代码来源:line.py

示例4: angle_between

# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import acos [as 别名]
    def angle_between(self, o):
        """Angle between the plane and other geometric entity.

        Parameters
        ==========

        LinearEntity3D, Plane.

        Returns
        =======

        angle : angle in radians

        Notes
        =====

        This method accepts only 3D entities as it's parameter, but if you want
        to calculate the angle between a 2D entity and a plane you should
        first convert to a 3D entity by projecting onto a desired plane and
        then proceed to calculate the angle.

        Examples
        ========

        >>> from sympy import Point3D, Line3D, Plane
        >>> a = Plane(Point3D(1, 2, 2), normal_vector=[1, 2, 3])
        >>> b = Line3D(Point3D(1, 3, 4), Point3D(2, 2, 2))
        >>> a.angle_between(b)
        -asin(sqrt(21)/6)

        """
        from sympy.geometry.line3d import LinearEntity3D
        if isinstance(o, LinearEntity3D):
            a = Matrix(self.normal_vector)
            b = Matrix(o.direction_ratio)
            c = a.dot(b)
            d = sqrt(sum([i**2 for i in self.normal_vector]))
            e = sqrt(sum([i**2 for i in o.direction_ratio]))
            return C.asin(c/(d*e))
        if isinstance(o, Plane):
            a = Matrix(self.normal_vector)
            b = Matrix(o.normal_vector)
            c = a.dot(b)
            d = sqrt(sum([i**2 for i in self.normal_vector]))
            e = sqrt(sum([i**2 for i in o.normal_vector]))
            return C.acos(c/(d*e))
开发者ID:akshayah3,项目名称:sympy,代码行数:48,代码来源:plane.py

示例5: angle_between

# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import acos [as 别名]
    def angle_between(l1, l2):
        """The angle formed between the two linear entities.

        Parameters
        ==========

        l1 : LinearEntity
        l2 : LinearEntity

        Returns
        =======

        angle : angle in radians

        Notes
        =====

        From the dot product of vectors v1 and v2 it is known that:

            ``dot(v1, v2) = |v1|*|v2|*cos(A)``

        where A is the angle formed between the two vectors. We can
        get the directional vectors of the two lines and readily
        find the angle between the two using the above formula.

        See Also
        ========

        is_perpendicular

        Examples
        ========

        >>> from sympy import Point3D, Line3D
        >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(-1, 2, 0)
        >>> l1, l2 = Line3D(p1, p2), Line3D(p2, p3)
        >>> l1.angle_between(l2)
        acos(-sqrt(2)/3)

        """
        v1 = l1.p2 - l1.p1
        v2 = l2.p2 - l2.p1
        return C.acos(v1.dot(v2)/(abs(v1)*abs(v2)))
开发者ID:msGenDev,项目名称:sympy,代码行数:45,代码来源:line3d.py


注:本文中的sympy.core.C.acos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。