MathGroup Archive 2010

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

Search the Archive

Re: Simplifying Logs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113147] Re: Simplifying Logs
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 15 Oct 2010 13:51:37 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

That would be written something like

ComplexityFunction -> (100 LeafCount[#] + exprSize[#] &)


Bob Hanlon

---- Raffy <adraffy at gmail.com> wrote: 

=============
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: Graphics driver for stereoscopic 3D
  • Next by Date: Pi vs its decimal approximation
  • Previous by thread: Re: Simplifying Logs
  • Next by thread: Re: Simplifying Logs