Comment #3 on issue 3054 by ness...@gmail.com: Simplification of ratios of
gamma functions
http://code.google.com/p/sympy/issues/detail?id=3054
As of a recent commit, expand_func does this in certain cases:
In [2]: gamma(S(1)/4)/gamma(S(5)/4)
Out[2]:
Γ(1/4)
──────
Γ(5/4)
In [3]: expand_func(_)
Out[3]: 4
It would be good to add functionality to combsimp to do
this "intelligently". What do you think about the following very simplistic
patch:
diff --git a/sympy/simplify/simplify.py b/sympy/simplify/simplify.py
index f6b2ddb..310eaa5 100644
--- a/sympy/simplify/simplify.py
+++ b/sympy/simplify/simplify.py
@@ -2307,6 +2307,12 @@ def eval(cls, a, b):
lambda n, k: rf((n-k+1).expand(), k.expand())/rf(1, k.expand()))
expr = expr.replace(factorial,
lambda n: rf(1, n.expand()))
+ def expander(n):
+ if n.is_rational:
+ return expand_func(gamma(n))
+ else:
+ return gamma(n)
+ expr = expr.replace(gamma, expander)
expr = expr.replace(gamma,
lambda n: rf(1, (n-1).expand()))
[It is obvious this is far from complete, but covers the main use case.]
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.