def _sympysage_polygamma(self): """ EXAMPLES:: sage: from sympy import Symbol, polygamma as pg sage: _ = var('x, y') sage: pgxy = pg(Symbol('x'), Symbol('y')) sage: assert psi(x)._sympy_() == pg(0, Symbol('x')) sage: assert psi(x) == pg(0, Symbol('x'))._sage_() sage: assert psi(x,y)._sympy_() == pgxy sage: assert psi(x,y) == pgxy._sage_() sage: integrate(psi(x), x, algorithm='sympy') integrate(psi(x), x) """ from sage.functions.other import psi return psi(self.args[0]._sage_(), self.args[1]._sage_())
def _eval_(self, s, x): r""" TESTS:: sage: hurwitz_zeta(x, 1) zeta(x) sage: hurwitz_zeta(4, 3) 1/90*pi^4 - 17/16 sage: hurwitz_zeta(-4, x) -1/5*x^5 + 1/2*x^4 - 1/3*x^3 + 1/30*x sage: hurwitz_zeta(3, 0.5) 8.41439832211716 """ if x == 1: return zeta(s) if s in ZZ and s > 1: return ((-1)**s) * psi(s - 1, x) / factorial(s - 1) elif s in ZZ and s < 0: return -bernoulli_polynomial(x, -s + 1) / (-s + 1) else: return
def _eval_(self, s, x): r""" TESTS:: sage: hurwitz_zeta(x, 1) zeta(x) sage: hurwitz_zeta(4, 3) 1/90*pi^4 - 17/16 sage: hurwitz_zeta(-4, x) -1/5*x^5 + 1/2*x^4 - 1/3*x^3 + 1/30*x sage: hurwitz_zeta(3, 0.5) 8.41439832211716 """ if x == 1: return zeta(s) if s in ZZ and s > 1: return ((-1) ** s) * psi(s - 1, x) / factorial(s - 1) elif s in ZZ and s < 0: return -bernoulli_polynomial(x, -s + 1) / (-s + 1) else: return
def _eval_(self, s, x): r""" TESTS:: sage: hurwitz_zeta(x, 1) zeta(x) sage: hurwitz_zeta(4, 3) 1/90*pi^4 - 17/16 sage: hurwitz_zeta(-4, x) -1/5*x^5 + 1/2*x^4 - 1/3*x^3 + 1/30*x sage: hurwitz_zeta(3, 0.5) 8.41439832211716 """ co = get_coercion_model().canonical_coercion(s, x)[0] if is_inexact(co) and not isinstance(co, Expression): return self._evalf_(s, x, parent=parent(co)) if x == 1: return zeta(s) if s in ZZ and s > 1: return ((-1)**s) * psi(s - 1, x) / factorial(s - 1) elif s in ZZ and s < 0: return -bernoulli_polynomial(x, -s + 1) / (-s + 1) else: return
def _eval_(self, s, x): r""" TESTS:: sage: hurwitz_zeta(x, 1) zeta(x) sage: hurwitz_zeta(4, 3) 1/90*pi^4 - 17/16 sage: hurwitz_zeta(-4, x) -1/5*x^5 + 1/2*x^4 - 1/3*x^3 + 1/30*x sage: hurwitz_zeta(3, 0.5) 8.41439832211716 """ co = get_coercion_model().canonical_coercion(s, x)[0] if is_inexact(co) and not isinstance(co, Expression): return self._evalf_(s, x, parent=parent(co)) if x == 1: return zeta(s) if s in ZZ and s > 1: return ((-1) ** s) * psi(s - 1, x) / factorial(s - 1) elif s in ZZ and s < 0: return -bernoulli_polynomial(x, -s + 1) / (-s + 1) else: return