Message Boards Message Boards

0
|
5201 Views
|
6 Replies
|
3 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to get the log of an expression as a sum of logs?

Posted 9 years ago

Presume I have an expression, a x b, and want to take the log, seeing it is log(a) + log(b). What function should I use? I would have thought Log would be the right one but it does not seem to do that; I get back Log[a b].

POSTED BY: Xuinkr Bin
6 Replies
Posted 9 years ago

There's a discussion of something very related at Mathematica StackExchange.

POSTED BY: Jim Baldwin

You are looking for PowerExpand:

Log[a b c] // PowerExpand
(* giving:  Log[a]+Log[b]+Log[c] *)

Henrik

POSTED BY: Henrik Schachner
Posted 9 years ago

While I think this answer is correct, when I use c in the expression, I get negative infinity. Replacing c with d works. Is c considered a "special variable" of some sort?

POSTED BY: Xuinkr Bin

Hi Xuinkr Bin,

no, c hast no chance of being a special (i.e. system-) variable. Only variables beginning with a capital letter can have such a meaning. Begin your notebook with the command

ClearAll["Global`*"]

or with a fresh kernel and try again.

Regards Henrik

POSTED BY: Henrik Schachner
Posted 9 years ago

This is what you want to do?

y = abc; log = Total[Map[Log[#] &, y[[1 ;; -1]]]]

POSTED BY: Juan Miranda
Posted 9 years ago

Maybe. I'm not familiar enough with the notation to say for certain one way or another.

POSTED BY: Xuinkr Bin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract