本文整理汇总了Python中sympy.core.C.tan方法的典型用法代码示例。如果您正苦于以下问题:Python C.tan方法的具体用法?Python C.tan怎么用?Python C.tan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.core.C
的用法示例。
在下文中一共展示了C.tan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __new__
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import tan [as 别名]
def __new__(cls, p1, pt=None, angle=None, **kwargs):
p1 = Point(p1)
if pt is not None and angle is None:
try:
p2 = Point(pt)
except NotImplementedError:
raise ValueError('The 2nd argument was not a valid Point;\nif it was meant to be an angle it should be given with keyword "angle".')
if p1 == p2:
raise ValueError('A Ray requires two distinct points.')
elif angle is not None and pt is None:
# we need to know if the angle is an odd multiple of pi/2
c = pi_coeff(sympify(angle))
p2 = None
if c is not None:
if c.is_Rational:
if c.q == 2:
if c.p == 1:
p2 = p1 + Point(0, 1)
elif c.p == 3:
p2 = p1 + Point(0, -1)
elif c.q == 1:
if c.p == 0:
p2 = p1 + Point(1, 0)
elif c.p == 1:
p2 = p1 + Point(-1, 0)
if p2 is None:
c *= S.Pi
else:
c = angle
if not p2:
p2 = p1 + Point(1, C.tan(c))
else:
raise ValueError('A 2nd point or keyword "angle" must be used.')
return LinearEntity.__new__(cls, p1, p2, **kwargs)
示例2: eval
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import tan [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.One
elif arg is S.NegativeInfinity:
return S.NegativeOne
elif arg is S.Zero:
return S.Zero
elif arg.is_negative:
return -cls(-arg)
else:
i_coeff = arg.as_coefficient(S.ImaginaryUnit)
if i_coeff is not None:
return S.ImaginaryUnit * C.tan(i_coeff)
else:
if arg.as_coeff_mul()[0].is_negative:
return -cls(-arg)
if arg.func == asinh:
x = arg.args[0]
return x/sqrt(1+x**2)
if arg.func == acosh:
x = arg.args[0]
return sqrt(x-1) * sqrt(x+1) / x
if arg.func == atanh:
return arg.args[0]
示例3: __new__
# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import tan [as 别名]
def __new__(cls, p1, pt=None, angle=None, **kwargs):
p1 = Point(p1)
if pt is not None and angle is None:
try:
p2 = Point(pt)
except NotImplementedError:
from sympy.utilities.misc import filldedent
raise ValueError(filldedent('''
The 2nd argument was not a valid Point; if
it was meant to be an angle it should be
given with keyword "angle".'''))
if p1 == p2:
raise ValueError('A Ray requires two distinct points.')
elif angle is not None and pt is None:
# we need to know if the angle is an odd multiple of pi/2
c = pi_coeff(sympify(angle))
p2 = None
if c is not None:
if c.is_Rational:
if c.q == 2:
if c.p == 1:
p2 = p1 + Point(0, 1)
elif c.p == 3:
p2 = p1 + Point(0, -1)
elif c.q == 1:
if c.p == 0:
p2 = p1 + Point(1, 0)
elif c.p == 1:
p2 = p1 + Point(-1, 0)
if p2 is None:
c *= S.Pi
else:
c = angle % (2*S.Pi)
if not p2:
m = 2*c/S.Pi
left = And(1 < m, m < 3) # is it in quadrant 2 or 3?
x = Piecewise((-1, left), (1, True))
y = Piecewise((-C.tan(c), left), (C.tan(c), True))
p2 = p1 + Point(x, y)
else:
raise ValueError('A 2nd point or keyword "angle" must be used.')
return LinearEntity.__new__(cls, p1, p2, **kwargs)