本文整理汇总了Python中sympy.functions.special.hyper.hyper函数的典型用法代码示例。如果您正苦于以下问题:Python hyper函数的具体用法?Python hyper怎么用?Python hyper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hyper函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: eval
def eval(cls, n, a, b, x):
# Simplify to other polynomials
# P^{a, a}_n(x)
if a == b:
if a == -S.Half:
return RisingFactorial(S.Half, n) / factorial(n) * chebyshevt(n, x)
elif a == S.Zero:
return legendre(n, x)
elif a == S.Half:
return RisingFactorial(3*S.Half, n) / factorial(n + 1) * chebyshevu(n, x)
else:
return RisingFactorial(a + 1, n) / RisingFactorial(2*a + 1, n) * gegenbauer(n, a + S.Half, x)
elif b == -a:
# P^{a, -a}_n(x)
return gamma(n + a + 1) / gamma(n + 1) * (1 + x)**(a/2) / (1 - x)**(a/2) * assoc_legendre(n, -a, x)
elif a == -b:
# P^{-b, b}_n(x)
return gamma(n - b + 1) / gamma(n + 1) * (1 - x)**(b/2) / (1 + x)**(b/2) * assoc_legendre(n, b, x)
if not n.is_Number:
# Symbolic result P^{a,b}_n(x)
# P^{a,b}_n(-x) ---> (-1)**n * P^{b,a}_n(-x)
if x.could_extract_minus_sign():
return S.NegativeOne**n * jacobi(n, b, a, -x)
# We can evaluate for some special values of x
if x == S.Zero:
return (2**(-n) * gamma(a + n + 1) / (gamma(a + 1) * factorial(n)) *
hyper([-b - n, -n], [a + 1], -1))
if x == S.One:
return RisingFactorial(a + 1, n) / factorial(n)
elif x == S.Infinity:
if n.is_positive:
# Make sure a+b+2*n \notin Z
if (a + b + 2*n).is_integer:
raise ValueError("Error. a + b + 2*n should not be an integer.")
return RisingFactorial(a + b + n + 1, n) * S.Infinity
else:
# n is a given fixed integer, evaluate into polynomial
return jacobi_poly(n, a, b, x)
示例2: _eval_rewrite_as_hyper
def _eval_rewrite_as_hyper(self, m, **kwargs):
return (pi/2)*hyper((S.Half, S.Half), (S.One,), m)
示例3: _eval_rewrite_as_hyper
def _eval_rewrite_as_hyper(self, z):
return (pi/2)*hyper((S.Half, S.Half), (S.One,), z)
示例4: _eval_rewrite_as_hyper
def _eval_rewrite_as_hyper(self, z):
return pi*z**3/6 * hyper([S(3)/4], [S(3)/2, S(7)/4], -pi**2*z**4/16)
示例5: _eval_rewrite_as_hyper
def _eval_rewrite_as_hyper(self, z):
pf1 = S.One / (3 ** (S(2) / 3) * gamma(S(2) / 3))
pf2 = z / (root(3, 3) * gamma(S(1) / 3))
return pf1 * hyper([], [S(2) / 3], z ** 3 / 9) - pf2 * hyper([], [S(4) / 3], z ** 3 / 9)
示例6: test_sympy__functions__special__hyper__hyper
def test_sympy__functions__special__hyper__hyper():
from sympy.functions.special.hyper import hyper
assert _test_args(hyper([1, 2, 3], [4, 5], x))