# How can I simplify $\log(512)$ to $9\log(2)$?

Can you explain me about the result of Integrate.

\!$$\*SubsuperscriptBox[\(\[Integral]$$, $$1$$, $$3$$]$$\*SubsuperscriptBox[\(\[Integral]$$,
$$1$$, $$3$$]\*FractionBox[$$9 v$$, $$v + u\ v$$] \[DifferentialD]u \[DifferentialD]v\)\)
(*
2 log(512)
*)

% // Simplify
(*
2 log(512)
*)

% // FullSimplify
(*
18 log(2)
*)


However, I cannot FullSimplify this result

FullSimplify[Log[512]]
(*
log(512)
*)

Log[512] // N
(*
6.23832
*)

FullSimplify[2 Log[512]] // N
(*
12.4766
*)


So question $1$ is how to simplify Log[512] and why it doesn't simplify to 9Log[2] by default.

9 Log[2] // N
(*
6.23832
*)


When I'm integrating by hand, I collect 9 or 18 easily, so I like the result 18 log(2) , not 2 log(512), so I wonder why Mathematica gives this result?

-

Mathematica does not consider 9 Log[2] to be "simpler" than Log[512]. The full default ComplexityFunction is not disclosed (the one in the documentation is not entirely equivalent IIRC), but a good first-order approximation is often LeafCount

LeafCount /@ {Log[512], 9 Log[2]}

{2, 4}


If you provide a ComplexityFunction that uses a different metric by which 9 Log[2] has a lower score than Log[512], such as the largest integer that appears in the expression, it will reduce as you desire:

FullSimplify[Log[512], ComplexityFunction -> (Max @ Cases[#, _Integer, {0, -1}] &)]

9 Log[2]

-

This kind of transformation Log[512] -> 9 Log[2] is not a simplification of the underlying expression but rather expanding it, there is PowerExpand which appears to be the simplest approach:

PowerExpand @ Log @ 512

9 Log[2]


We can see that Log[512] is simpler than 9 Log[2], to demonstrate it we can use TreeForm:

GraphicsRow[ TreeForm /@ {9 Log[2], Log[512]}]


When we are trying to transform adequate expressions with FullSimplify LeafCount only approximates ComplexityFunction, however in general it can't explain specific simplifications. Moreover ComplexityFunction works in a different way in Mathematica 9 in comparison to earlier versions, see e.g. FullSimplify does not work on this expression with no unknowns discussing how one can deal with similar problems.
Having said that I find simpler using the TransformationsFunctions option of FullSimplify rather than searching for appropriate ComplexityFunction, namely here we would use PowerExpand:

FullSimplify[ Log[512], TransformationFunctions -> PowerExpand]

9 Log[2]


Now FullSimlify uses only PowerExpand while (see the documentation):

TransformationFunctions -> {Automatic, $f_1$, $f_2$, $\ldots$ } uses built-in transformation functions together with the functions $f_i$.

-
Artes, congratulations on the Steward badge. That's a lot of reviewing. Thank you! – Mr.Wizard Dec 24 '13 at 12:45