Re: Working with Log

*To*: mathgroup at smc.vnet.net*Subject*: [mg112117] Re: Working with Log*From*: Alexei Boulbitch <alexei.boulbitch at iee.lu>*Date*: Tue, 31 Aug 2010 04:17:00 -0400 (EDT)

Hi, Themis, one idea may be as follows. Introduce two functions for expansion and to collect logarithms: expandLog[expr_] := Module[{rule1, rule2, a, b, x}, rule1 = Log[a_*b_] -> Log[a] + Log[b]; rule2 = Log[a_^x_] -> x*Log[a]; (expr /. rule1) /. rule2 ]; collectLog[expr_] := Module[{rule1, rule2, a, b, x}, rule1 = Log[a_] + Log[b_] -> Log[a*b]; rule2 = x_*Log[a_] -> Log[a^x]; (expr /. rule1) /. rule2 /. rule1 /. rule2 ]; Then: Log[Sin[x]*Cos[y]] // expandLog Log[Cos[y]] + Log[Sin[x]] Log[a + b] + Log[c + d] // collectLog Log[(a + b) (c + d)] Have fun, Alexei I can use PowerExapnd to expand a Log: PowerExpand[Log[a b]] Log[a] + Log[b] How can I do the opposite, i.e. combine Log[a] + Log[b] into Log[a b]? Thanks Themis -- Alexei Boulbitch, Dr. habil. Senior Scientist Material Development IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 CONTERN Luxembourg Tel: +352 2454 2566 Fax: +352 2454 3566 Mobile: +49 (0) 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu www.iee.lu -- This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation. __________ Information from ESET NOD32 Antivirus, version of virus signature database 5410 (20100830) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com