本文整理汇总了Python中sympy.core.basic.Basic.cosh方法的典型用法代码示例。如果您正苦于以下问题:Python Basic.cosh方法的具体用法?Python Basic.cosh怎么用?Python Basic.cosh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.core.basic.Basic
的用法示例。
在下文中一共展示了Basic.cosh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _eval_expand_complex
# 需要导入模块: from sympy.core.basic import Basic [as 别名]
# 或者: from sympy.core.basic.Basic import cosh [as 别名]
def _eval_expand_complex(self, *args):
if self[0].is_real:
return self
re, im = self[0].as_real_imag()
denom = sin(re)**2 + Basic.sinh(im)**2
return (sin(re)*cos(re) - \
S.ImaginaryUnit*Basic.sinh(im)*Basic.cosh(im))/denom
示例2: _eval_apply
# 需要导入模块: from sympy.core.basic import Basic [as 别名]
# 或者: from sympy.core.basic.Basic import cosh [as 别名]
def _eval_apply(self, arg):
arg = Basic.sympify(arg)
if isinstance(arg, Basic.Number):
if isinstance(arg, Basic.NaN):
return S.NaN
elif isinstance(arg, Basic.Zero):
return S.One
elif arg.is_negative:
return self(-arg)
else:
i_coeff = arg.as_coefficient(S.ImaginaryUnit)
if i_coeff is not None:
return Basic.cosh(i_coeff)
else:
pi_coeff = arg.as_coefficient(S.Pi)
if pi_coeff is not None:
if isinstance(pi_coeff, Basic.Rational):
cst_table = {
1 : S.One,
2 : S.Zero,
3 : S.Half,
4 : S.Half*Basic.sqrt(2),
6 : S.Half*Basic.sqrt(3),
}
try:
result = cst_table[pi_coeff.q]
if (2*pi_coeff.p // pi_coeff.q) % 4 in (1, 2):
return -result
else:
return result
except KeyError:
pass
coeff, terms = arg.as_coeff_terms()
if coeff.is_negative:
return self(-arg)