Re: Simplification with Integers assumption
- To: mathgroup at smc.vnet.net
- Subject: [mg74730] Re: [mg74709] Simplification with Integers assumption
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 2 Apr 2007 07:00:04 -0400 (EDT)
- References: <200704010819.EAA07442@smc.vnet.net>
On 1 Apr 2007, at 09:19, did wrote:
> On Mathematica 5.2 Windows, with the 4 similar commands:
>
> Simplify[ Sum[ n! / (2*p)! / (n - 2*p)! , {p, 1, Infinity} ] ,
> Assumptions -> n > 0]
>
> FullSimplify[ Sum[ n! / (2*p)! / (n - 2*p)! , {p, 1, Infinity} ] ,
> Assumptions -> n > 0]
>
> Simplify[ Sum[ n! / (2*p)! / (n - 2*p)! , {p, 1, Infinity} ] ,
> Assumptions -> n > 0 && n =E2=88=88 Integers]
>
> FullSimplify[ Sum[ n! / (2*p)! / (n - 2*p)! , {p, 1, Infinity}] ,
> Assumptions -> n > 0 && n =E2=88=88 Integers]
>
>
> I get the different answers:
>
> Out[1]= -(-2 + 2^n) n! Gamma[n] Sin[n Pi] / (2 Pi)
>
> Out[2]= -1 + 2^(-1+n)
>
> Out[3]= 0
>
> Out[4]= 0
>
> Outputs 1 & 2 look OK, but 3 & 4 are not. It seems that, with the
> assumption n Integer,
> Mathematica simplifies Sin[n Pi] by 0, omitting that Gamma[-n] is
> infinite.
> Is it the expected behavior?
>
> In this example, the simplest form can be obtained without imposing n
> Integer (I
> presume it's the correct answer), but in other situations it will be
> required. What
> is the safe way to do it?
>
> Thanks
>
>
The problem is that
Assuming[Element[n,Integers],Simplify[Sin[n Pi]]]
0
But
Simplify[Gamma[n], n =E2=88=88 Integers]
Gamma[n]
(even adding the assumption n<0 will still return Gamma[n]).
Since
Sum[n!/(2*p)!/(n - 2*p)!, {p, 1, Infinity}]
-(((-2 + 2^n)*n!*Gamma[-n]*Sin[n*Pi])/(2*Pi))
simplifying with the assumption ELement[n,Integers] will result in
Gamma[-n]*0 and since in Mathematica any symbol s (except explicit
Infitiniy and its variants) s*0 is always 0, you will get 0.
The best way to avoid the problem is to try to get an expression for
the sum not involving the Gamma function at all, if possible. In this =
since FullSimplify without the condition Element[n,Integers] returns
an expression not involving Gamma, you cant then Simplify again using =
the this assumption, although in this particular case it won't make
any difference. This is one of the cases where one needs to pay
careful attention to the effect of different assumptions in
FullSimplify may have on the the expression they are being applied
to. The danger is that if one of the assumptions implies that one of
the factors in in a product is zero the whole product will be reduced =
to 0, unless one of the other factors are explicitly known to
Mathematica=E2=80=99s evaluator be infinite under the given assumptions. =
An
example of the latter case is:
FullSimplify[Sum[n!/(2*p)!/(n - 2*p)!, {p, 1, Infinity}], {n == 3}]
While this partiular problem could perhaps be solved by adding the
knowledge that Gamma[n] is CompexInfinity for any negative integer to =
Simplify and FullSimplify some problems of this kind will always
remain since Mathematica's evaluator turns x*0 to 0 even if nothing
is known about x (and in particular when x is an implicit but not
explicit Infinity).
Andrzej Kozlowski
- References:
- Simplification with Integers assumption
- From: "did" <didier.oslo@hotmail.com>
- Simplification with Integers assumption