本文整理汇总了Python中sympy.core.C.cos方法的典型用法代码示例。如果您正苦于以下问题:Python C.cos方法的具体用法?Python C.cos怎么用?Python C.cos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.core.C
的用法示例。
在下文中一共展示了C.cos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: as_real_imag
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def as_real_imag(self, deep=True, **hints):
if self.args[0].is_real:
if deep:
hints['complex'] = False
return (self.expand(deep, **hints), S.Zero)
else:
return (self, S.Zero)
if deep:
re, im = self.args[0].expand(deep, **hints).as_real_imag()
else:
re, im = self.args[0].as_real_imag()
denom = sinh(re)**2 + C.cos(im)**2
return (sinh(re)*cosh(re)/denom, C.sin(im)*C.cos(im)/denom)
示例2: arbitrary_point
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def arbitrary_point(self, parameter="t"):
"""A parameterized point on the ellipse.
Parameters
----------
parameter : str, optional
Default value is 't'.
Returns
-------
arbitrary_point : Point
Raises
------
ValueError
When `parameter` already appears in the functions.
See Also
--------
Point
Examples
--------
>>> from sympy import Point, Ellipse
>>> e1 = Ellipse(Point(0, 0), 3, 2)
>>> e1.arbitrary_point()
Point(3*cos(t), 2*sin(t))
"""
t = _symbol(parameter)
if t.name in (f.name for f in self.free_symbols):
raise ValueError("Symbol %s already appears in object and cannot be used as a parameter." % t.name)
return Point(self.center[0] + self.hradius * C.cos(t), self.center[1] + self.vradius * C.sin(t))
示例3: vertices
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def vertices(self):
"""The vertices of the regular polygon.
Returns
-------
vertices : list
Each vertex is a Point.
See Also
--------
Point
Examples
--------
>>> from sympy.geometry import RegularPolygon, Point
>>> rp = RegularPolygon(Point(0, 0), 5, 4)
>>> rp.vertices
[Point(5, 0), Point(0, 5), Point(-5, 0), Point(0, -5)]
"""
points = []
c, r, n = self
v = 2*S.Pi/n
for k in xrange(0, n):
points.append(Point(c[0] + r*C.cos(k*v), c[1] + r*C.sin(k*v)))
return points
示例4: _eval_expand_complex
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def _eval_expand_complex(self, deep=True, **hints):
re, im = self.args[0].as_real_imag()
if deep:
re = re.expand(deep, **hints)
im = im.expand(deep, **hints)
cos, sin = C.cos(im), C.sin(im)
return exp(re) * cos + S.ImaginaryUnit * exp(re) * sin
示例5: arbitrary_point
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def arbitrary_point(self, parameter_name='t'):
"""A parametric point on the ellipse.
Parameters
----------
parameter_name : str, optional
Default value is 't'.
Returns
-------
arbitrary_point : Point
See Also
--------
Point
Examples
--------
>>> from sympy import Point, Ellipse
>>> e1 = Ellipse(Point(0, 0), 3, 2)
>>> e1.arbitrary_point()
Point(3*cos(t), 2*sin(t))
"""
t = C.Symbol(parameter_name, real=True)
return Point(self.center[0] + self.hradius*C.cos(t),
self.center[1] + self.vradius*C.sin(t))
示例6: as_real_imag
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def as_real_imag(self, deep=True, **hints):
re, im = self.args[0].as_real_imag()
if deep:
re = re.expand(deep, **hints)
im = im.expand(deep, **hints)
cos, sin = C.cos(im), C.sin(im)
return (exp(re) * cos, exp(re) * sin)
示例7: as_real_imag
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def as_real_imag(self, deep=True, **hints):
"""
Returns this function as a 2-tuple representing a complex number.
Examples
========
>>> from sympy import I
>>> from sympy.abc import x
>>> from sympy.functions import exp
>>> exp(x).as_real_imag()
(exp(re(x))*cos(im(x)), exp(re(x))*sin(im(x)))
>>> exp(1).as_real_imag()
(E, 0)
>>> exp(I).as_real_imag()
(cos(1), sin(1))
>>> exp(1+I).as_real_imag()
(E*cos(1), E*sin(1))
See Also
========
sympy.functions.elementary.complexes.re
sympy.functions.elementary.complexes.im
"""
re, im = self.args[0].as_real_imag()
if deep:
re = re.expand(deep, **hints)
im = im.expand(deep, **hints)
cos, sin = C.cos(im), C.sin(im)
return (exp(re)*cos, exp(re)*sin)
示例8: apothem
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def apothem(self):
"""
Returns the apothem/inradius of the regular polygon (i.e., the
radius of the inscribed circle).
"""
n = self.__getitem__(2)
return self.radius * C.cos(S.Pi/n)
示例9: vertices
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def vertices(self):
points = []
c, r, n = self
v = 2*S.Pi/n
for k in xrange(0, n):
points.append( Point(c[0] + r*C.cos(k*v), c[1] + r*C.sin(k*v)) )
return points
示例10: eval
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [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.One
elif arg.is_negative:
return cls(-arg)
else:
i_coeff = arg.as_coefficient(S.ImaginaryUnit)
if i_coeff is not None:
return C.cos(i_coeff)
else:
if arg.as_coeff_mul()[0].is_negative:
return cls(-arg)
if arg.func == asinh:
return sqrt(1+arg.args[0]**2)
if arg.func == acosh:
return arg.args[0]
if arg.func == atanh:
return 1/sqrt(1-arg.args[0]**2)
if arg.func == acoth:
x = arg.args[0]
return x/(sqrt(x-1) * sqrt(x+1))
示例11: as_real_imag
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def as_real_imag(self, deep=True, **hints):
if self.args[0].is_real:
if deep:
hints["complex"] = False
return (self.expand(deep, **hints), S.Zero)
else:
return (self, S.Zero)
if deep:
re, im = self.args[0].expand(deep, **hints).as_real_imag()
else:
re, im = self.args[0].as_real_imag()
return (sinh(re) * C.cos(im), cosh(re) * C.sin(im))
示例12: as_real_imag
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def as_real_imag(self, deep=True, **hints):
"""
Returns this function as a complex coordinate.
"""
if self.args[0].is_real:
if deep:
hints['complex'] = False
return (self.expand(deep, **hints), S.Zero)
else:
return (self, S.Zero)
if deep:
re, im = self.args[0].expand(deep, **hints).as_real_imag()
else:
re, im = self.args[0].as_real_imag()
return (sinh(re)*C.cos(im), cosh(re)*C.sin(im))
示例13: apothem
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def apothem(self):
"""The inradius of the regular polygon.
The apothem/inradius is the radius of the inscribed circle.
Returns
-------
apothem : number or instance of Basic
Examples
--------
>>> from sympy import Symbol
>>> from sympy.geometry import RegularPolygon, Point
>>> radius = Symbol('r')
>>> rp = RegularPolygon(Point(0, 0), radius, 4)
>>> rp.apothem
r*2**(1/2)/2
"""
n = self.__getitem__(2)
return self.radius * C.cos(S.Pi/n)
示例14: arbitrary_point
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def arbitrary_point(self, parameter='t'):
"""A parameterized point on the ellipse.
Parameters
==========
parameter : str, optional
Default value is 't'.
Returns
=======
arbitrary_point : Point
Raises
======
ValueError
When `parameter` already appears in the functions.
See Also
========
sympy.geometry.point.Point
Examples
========
>>> from sympy import Point, Ellipse
>>> e1 = Ellipse(Point(0, 0), 3, 2)
>>> e1.arbitrary_point()
Point(3*cos(t), 2*sin(t))
"""
t = _symbol(parameter)
if t.name in (f.name for f in self.free_symbols):
raise ValueError(filldedent('Symbol %s already appears in object '
'and cannot be used as a parameter.' % t.name))
return Point(self.center.x + self.hradius*C.cos(t),
self.center.y + self.vradius*C.sin(t))
示例15: _eval_rewrite_as_cos
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import cos [as 别名]
def _eval_rewrite_as_cos(self, arg):
I = S.ImaginaryUnit
return C.cos(I*arg) + I*C.cos(I*arg + S.Pi/2)