Re: Log[Product[]] expansion to Sum[Log[]]?
- To: mathgroup at smc.vnet.net
- Subject: [mg9210] Re: [mg9160] Log[Product[]] expansion to Sum[Log[]]?
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Tue, 21 Oct 1997 02:03:24 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Julian Stoev <stoev at SPAM-RE-MO-VER-usa.net> [mg9160] Log[Product[]]
expansion to Sum[Log[]]?
I want
Log[Product[SomeFunction[k],{k,1,N}]] to be transformed to
Sum[Log[SomeFunction[k]],{k,1,N}]
Julian:
Locally we can use
PowerExpand[Log[Product[fn[k],{k,1,3}]]]
Log[fn[1]]+Log[fn[2]]+Log[fn[3]]
But this does not work on Log[Product[SomeFunction[k],{k,1,N}]] The
following works automatically
Unprotect[Log];
Log[Product[fn[k],{k,1,n}]] := Sum[Log[fn[k]],{k,1,n}];
Log[HoldPattern[Times[x__fn]]]:=Log/@ Plus[x]; Protect[Log];
Check:
Log[Product[fn[k],{k,1,n}]]
Sum[Log[fn[k]], {k, 1, n}]
Log[fn[1] fn[2]]
Log[fn[1]] + Log[fn[2]]
Log[fn[1]]
Log[fn[1]]
Log[Times[]]
0
Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/training.html voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester, UK