Re: Sum expansion
- To: mathgroup at smc.vnet.net
- Subject: [mg32646] Re: [mg32630] Sum expansion
- From: BobHanlon at aol.com
- Date: Fri, 1 Feb 2002 16:10:44 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2/1/02 2:26:08 AM, fischerc at itam.cas.cz writes:
>I would like to arrange exression
>A Sum [ B_i ,{i,1,s}]
>into expression
>Sum [ A B_i, {i,1,s} ]
>
>Following transformation code gives unwanted answer:
>A*Sum[Subscript[B, i], {i, 1, s}] /.
> a_*Sum[b_, {i, 1, s}] -> Sum[a*b, {i, 1, s}]
>Result is
>A s Bi
>
>I understand, why it behawes this way, but I dont know the correct way.
>
Use RuleDelayed
A*Sum[Subscript[B,i], {i,1,s}] /.
a_*Sum[b_, {i_, i0_, in_}] :> Sum[a*b, {i,i0,in}]
Bob Hanlon
Chantilly, VA USA