MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why this can't be reduced by mathematica?!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114197] Re: Why this can't be reduced by mathematica?!
  • From: Valeri Astanoff <astanoff at gmail.com>
  • Date: Fri, 26 Nov 2010 05:31:55 -0500 (EST)
  • References: <iciul1$leo$1@smc.vnet.net> <iclfg0$ld0$1@smc.vnet.net>

On Nov 25, 11:58 am, Valeri Astanoff <astan... at gmail.com> wrote:
> On Nov 24, 12:58 pm, olfa <olfa.mra... at yahoo.fr> wrote:
>
> > Hi Mathematica Community,
>
> > Reduce[s==Sum[a[index], {index, i + 1, N}] - Sum[a[index], {index, j +
> > 1, N}] &&
> > j >= i,{s}]
>
> > the output should be s==Sum[a[index], {index, i+1, j }]
>
> > but it is not!
> > Thank you.
>
> Good day,
>
> You can do it this way :
>
> In[1]:= myCombine[Sum[a_, {i_, i1_, i2_}] -
>  Sum[a_, {i_, j1_, j2_}]] :=
>  Sum[a, {i, Min[i1, j1], Max[i1, j1] - 1}] +
>  Sum[a, {i, Min[i2, j2] + 1, Max[i2, j2]}]
>
> In[2]:= s = Sum[a[index], {index, i + 1, n}] - Sum[a[index], {index, j
> + 1, n}];
>
> In[3]:= s // myCombine // Simplify[#, j >= i] &
>
> Out[3]= Sum[a[index], {index, 1 + i, j}]
>
> --
> Valeri

Here is the same one with some "protection" :

myCombine[Sum[a_, {i_, i1_, i2_}] - Sum[a_, {i_, j1_, j2_}]] /;
 i1 == j1 || i2 == j2 := If[i2 == j2, Sign[j1 - i1], Sign[j2 - i2]]*
(Sum[a, {i, Min[i1, j1], Max[i1, j1] - 1}] +
 Sum[a, {i, Min[i2, j2] + 1, Max[i2, j2]}])

v.a.


  • Prev by Date: Can't read a package
  • Next by Date: Re: disappointing CUDA speed
  • Previous by thread: Re: Why this can't be reduced by mathematica?!
  • Next by thread: help! I've lost the menu bar