       Re: How to Extract a common factor from a Sum

• To: mathgroup at smc.vnet.net
• Subject: [mg13137] Re: How to Extract a common factor from a Sum
• From: "Allan Hayes" <hay at haystack.demon.cc.uk>
• Date: Mon, 13 Jul 1998 07:41:51 -0400
• References: <6mq9k4\$2pi@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```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?
>
>
>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)