combsimp() would be the place for this. In general, rewrite() doesn't do
any advanced simplification. It just rewrites functions in terms of other
functions (like factorial(x).rewrite(gamma) just replaces all 'factorial'
instances with gamma with the appropriate shift).

It seems combsimp(factorial(n)*(n+1)) doesn't work, but it's only because
it doesn't know about factorial, only gamma. This works:

In [5]: combsimp((factorial(n)*(n+1)).rewrite(gamma)).rewrite(factorial)
Out[5]: (n + 1)!

I opened https://github.com/sympy/sympy/issues/9699 for this.

Aaron Meurer

On Thu, Jun 18, 2015 at 4:19 AM, Gaurav Dhingra <[email protected]> wrote:

> Hi all
>
> I was looking on the issue https://github.com/sympy/sympy/issues/8531
> though i disagree for that simplification to occur.
>
> >>> n = Symbol('n', integer=True, positiv=True)
> >>> factrial(n)*(n+1)   # i think this should not be simplified to
> factorial(n+1)
> factorial(n)*(n+1)        # currently happens, which i think is correct.
>
>
> >>> n = Symbol('n', integer=True, positiv=True)
> >>> ( factorial(n)*(n+1) ).rewrite(factorial)
> factorial(n)*(n + 1)            # why not returned as factorial(n + 1) ??
>
> I was thinking if there is currently any way of rewriting it as
> `factorial(n + 1)`
>
>
> Gaurav Dhingra
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/cd82ac7a-7384-4891-9bca-63a0558975d4%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/cd82ac7a-7384-4891-9bca-63a0558975d4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BmZcBidtG72Zw_tA_kQHo0Qme65ukqZPQut4Qu7awM7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to