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 in message <6mq9k4$2pi at smc.vnet.net>...
>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
>

Another variant:

factorOut =
Sum[expr_ a_,its__]/;
FreeQ[a, Alternatives@@First/@{its}]:>a Sum[expr, its]

Test

Sum[ a b f[k,l]g[k] z, {k,1,N},{l,1,M}]/.factorOut

a b z Sum[f[k, l] g[k], {k, 1, N}, {l, 1, M}]

------------------------------------------------------------- Allan
Hayes
Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay at haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642



  • Prev by Date: Re: Starting Sound in Mathematica for Windows
  • Next by Date: Re: Non-commutative algebra
  • Previous by thread: Re: Inconsistencies in pattern matching.
  • Next by thread: Re: ReplacePart question (2)