Permalink
Browse files

Merge pull request #1475 from smichr/combsimp

combsimp: cleanup
  • Loading branch information...
2 parents 15c2c89 + 92365af commit dd8352a0582b91b286a98fabfb0af7486faeeb03 @smichr smichr committed Aug 9, 2012
Showing with 12 additions and 16 deletions.
  1. +12 −16 sympy/simplify/simplify.py
View
28 sympy/simplify/simplify.py
@@ -2511,7 +2511,7 @@ def _run(coeffs):
c = u[j]
coeffs.remove(c)
got[i] = c
- return one, got
+ return one.q, got[0], got[1:]
def _mult_thm(gammas, numer, denom):
# pull off and analyze the leading coefficient from each gamma arg
@@ -2532,30 +2532,26 @@ def _mult_thm(gammas, numer, denom):
run = _run(coeffs)
if run is None:
break
- d, seq = run
# process the sequence that was found:
# 1) convert all the gamma functions to have the right
# argument (could be off by an integer)
# 2) append the factors corresponding to the theorem
# 3) append the new gamma function
+ n, ui, other = run
+
# (1)
- ui = seq[0]
- other = seq[1:]
- offset = 0
- for i, u in enumerate(other):
- n = (u - ui - (u - ui) % 1)
- if n and n.is_Integer:
- # if u is sorted, this should be true
- assert n > 0
- con = resid + u - 1
- for k in range(n):
- numer.append(con - k)
+ for u in other:
+ con = resid + u - 1
+ for k in range(int(u - ui)):
+ numer.append(con - k)
+
+ con = n*(resid + ui) # for (2) and (3)
+
# (2)
- con = d.q*(resid + ui) # for (2) and (3)
- numer.append((2*S.Pi)**(S(d.q - 1)/2)*
- d.q**(S(1)/2 - con))
+ numer.append((2*S.Pi)**(S(n - 1)/2)*
+ n**(S(1)/2 - con))
# (3)
new.append(con)

0 comments on commit dd8352a

Please sign in to comment.