MathGroup Archive 1998

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

Search the Archive

Re: How to Extract a common factor from a Sum


Frank Loewenthal wrote:

> Hi Folks
>
> I have a symbolical sum like
>
> expr = Sum[ a f[k], {k,1,N}] and I want to force Mathematica to write
> this as
> expr = a Sum[f[k], {k,1,N}]
>
> What ever I tried it did not work.
> Does anyone knows a solution?
>
> Thanks in advance
>
> Frank

  I made a little error in my previous posting:

In[1]:= Unprotect[Sum]

Out[1]= {Sum}

In[2]:= Sum[a_ b__,{k_,i__}] /; FreeQ[a,k] := a Sum[b,{k,i}]

In[3]:= Sum[a f[k] g[k],{k,1,N}]

Sum::itform: Argument g[k] at position 2
     does not have the correct form for an iterator.

Out[3]= a Sum[f[k], g[k], {k, 1, N}]

you need to wrap the b in Times:

In[4]:= Sum[a_ b__,{k_,i__}] /; FreeQ[a,k] := a Sum[Times[b],{k,i}]

In[5]:= Sum[a f[k] g[k],{k,1,N}]

Out[5]= a Sum[f[k] g[k], {k, 1, N}]

 Tobias



  • Prev by Date: RE: MaxBend in ParametricPlot?
  • Next by Date: Re: Split in Mathematica 2.2/ $MaxRecursion crash
  • Previous by thread: Re: How to Extract a common factor from a Sum
  • Next by thread: Re: How to Extract a common factor from a Sum