MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Log[Product[]] expansion to Sum[Log[]]?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9261] Re: Log[Product[]] expansion to Sum[Log[]]?
  • From: Jack Goldberg <jackgold at math.lsa.umich.edu>
  • Date: Fri, 24 Oct 1997 01:01:16 -0400
  • Organization: Mathematics Department, University of Michigan
  • Sender: owner-wri-mathgroup at wolfram.com

Julian Stoev wrote:

> Dear Group,
> I want to simplify some expressions involving Product[] and Log[]. This
> problem appears in calculation of Cramer-Rao lower bound of variation.
> I want
> Log[Product[SomeFunction[k],{k,1,N}]] to be transformed to
> Sum[Log[SomeFunction[k]],{k,1,N}]
>
> Mathematica does not convert it in this form. I solved temporarilly the
> problem by using 'brutal force" of rules, but I was wondering is there
> more elegant way to do this, by defining some special properties of
> SomeFunction[]?
>
> The main problem appears to be that Log[a.b] is not Log[a]+Log[b]. I
> know there were several discussions how to define variables real and
> positive, but what about functions? I don' want to make big
> modifications in default kernel behaviour.
>
> Thank you!
> --------------------------------------------------------------------------
> Julian Stoev <j.h.stoev at ieee.org>       - Ph. D. Student Intelligent
> Information Processing Lab. - Seoul National University, Korea Work:
> 872-7283, Home: 880-4191          - http://poboxes.com/stoev !!!!! Use
> REPLY-TO: or remove "SPAMREMOVER" in my address

In [mg9210]  Allan Hayes suggests unprotecting Log  and adding to the
list of rules for  Log the new rule you require.   Then the
simplification you
want will occur each time you enter 
Log[Product[SomeFunction[k]],{k,1,N}]]. Here is an alternative approach
that adds a new rule to PowerExpand.

Unprotect[PowerExpand];

PowerExpand[x_Log]  /;  Head[ x[[1]] ] === Product  := Sum[
Evaluate[Log[ x[[1,1]] ], x[[1,2]] ] ];

(* so this fires if and only if  the Head of  x, the argument to
PowerExpand,

is Log and  x  has the structure  Log[Product  ] .   The reason for
these restricitions is that I want PowerExpand to work exactly as it
did before this new simplificiation was added.   So, for example,
PowerExpand[Log[a*b]]  returns  Log[a] + Log[b].*)

Protect[PowerExpand]

Check:

PowerExpand[Log[Product[fn[k],{k,1,n}]]] returns    Sum[ Log[ fn[k] ],
{k,1,n} ]

PowerExpand[Log[Product[fn[k],{k,1,2}]]] returns    Log[ fn[1] ]+Log[
fn[2] ]

PowerExpand[Log[ fm[1] *fn[2]]]
returns   Log[ fn[1] ] + Log[ fn[2] ]

PowerExpand[Log[a^b]]
retirmes   b Log[a]

These results were checked using Unix running Mathematica Ver 3.0

Jack Goldberg
jackgold at math.lsa.umich.edu



  • Prev by Date: Finding "start directory" with Mathematica 3.0 ?
  • Next by Date: [Q] Mathematica, how to write a[[2,3]] having {2,3}
  • Previous by thread: Re: Log[Product[]] expansion to Sum[Log[]]?
  • Next by thread: mathematica question