Skip to content

Commit

Permalink
806: Improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Katja Sophie Hotz committed Apr 25, 2013
1 parent 68c77bf commit 87f6baf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 5 additions & 4 deletions sympy/functions/special/hyper.py
Expand Up @@ -195,10 +195,11 @@ def _eval_expand_func(self, **hints):
def _eval_rewrite_as_Sum(self, ap, bq, z):
from sympy.functions import factorial, RisingFactorial, Piecewise
n = C.Dummy("n", integer=True)
rfap = Tuple(*[RisingFactorial(a,n) for a in ap])
rfbq = Tuple(*[RisingFactorial(b,n) for b in bq])
coeff = Mul(*rfap)/Mul(*rfbq)
return Piecewise( (C.Sum(coeff * z**n/factorial(n), (n, 0, oo)), self.convergence_statement), (self, True) )
rfap = Tuple(*[RisingFactorial(a, n) for a in ap])
rfbq = Tuple(*[RisingFactorial(b, n) for b in bq])
coeff = Mul(*rfap) / Mul(*rfbq)
return Piecewise((C.Sum(coeff * z**n / factorial(n), (n, 0, oo)),
self.convergence_statement), (self, True))

@property
def argument(self):
Expand Down
7 changes: 5 additions & 2 deletions sympy/functions/special/tests/test_hyper.py
Expand Up @@ -77,9 +77,12 @@ def replace_dummy(expr, sym):
def test_hyper_rewrite_sum():
from sympy import RisingFactorial, factorial, Dummy, Sum
_k = Dummy("k")
assert replace_dummy(hyper((1,2),(1,3),x).rewrite(Sum),_k) == Sum(x**_k/factorial(_k)*RisingFactorial(2,_k)/RisingFactorial(3,_k), (_k, 0, oo))
assert replace_dummy(hyper((1, 2), (1, 3), x).rewrite(Sum), _k) == \
Sum(x**_k / factorial(_k) * RisingFactorial(2, _k) /
RisingFactorial(3, _k), (_k, 0, oo))

assert hyper((1,2,3),(-1,3),z).rewrite(Sum) == hyper((1,2,3),(-1,3),z)
assert hyper((1, 2, 3), (-1, 3), z).rewrite(Sum) == \
hyper((1, 2, 3), (-1, 3), z)


def test_radius_of_convergence():
Expand Down

0 comments on commit 87f6baf

Please sign in to comment.