MathGroup Archive 2010

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

Search the Archive

Re: Simplifying Logs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113127] Re: Simplifying Logs
  • From: Raffy <adraffy at gmail.com>
  • Date: Wed, 13 Oct 2010 23:28:01 -0400 (EDT)
  • References: <i93k7o$e4s$1@smc.vnet.net>

On Oct 12, 11:39 pm, Themis Matsoukas <tmatsou... at me.com> wrote:
> This works as expected and combines the logs:
>
> Simplify[Log[a] - Log[b], Assumptions -> {a > 0, b > 0}]
>
> Log[a/b]
>
> But this doesn't:
>
> Simplify[1 + Log[a] - Log[b], Assumptions -> {a > 0, b > 0}]
>
> 1 + Log[a] - Log[b]
>
> This seems inconsistent to me. I suppose I would like to see a CombineLog=
s command in the future.
>
> Themis

1 + Log[a/b] // LeafCount === 8
1 + Log[a] - Log[b] // LeafCount === 8

ClearAll[exprSize];
exprSize[x_] := StringLength@ToString[Unevaluated[x], InputForm];
SetAttributes[exprSize,HoldFirst];

Caution: exprSize[1+1] ==> "1 + 1" ==> 5

1 + Log[a/b] // exprSize === 12
1 + Log[a] - Log[b] // exprSize === 19

Simplify[1 + Log[a] - Log[b], Assumptions -> {a > 0, b > 0},
ComplexityFunction -> exprSize] === 1 + Log[a/b]

It would be great for Mathematica to support multiple complexity
functions in case of a tie, similar to SortBy/GatherBy/SplitBy/etc.
ie. ComplexityFunction -> {LeafCount, exprSize}


  • Prev by Date: Re: something nice I found today, return multiple values from a function
  • Next by Date: Re: Simplifying Logs
  • Previous by thread: Re: A Bug in symbolic summation?
  • Next by thread: Re: Simplifying Logs