# FullSimplify does not work well

It is obvious that the answer to

FullSimplify[ - Log[-I x] + Log[ I x ] , Assumptions -> { x ∈ Reals, x != 0 } ]


is

 I π Sign[x]


whereas Mathematica gives back the same expression as the input..

How does one make it give the obvious answer?

• But PowerExpand type of additional qualifications do not help if I want to eg. simplify Floor[ (π - 2 Arg[wm] - 2 Arg[x])/(4 π) ] which has the obvious answer -(1- UnitStep[x] UnitStep[wm]) when both x and wm are real and non-zero. – Quasar Supernova Oct 30 '17 at 6:43

You can include PowerExpand in the list of TransformationFunctions, and adjust the ComplexityFunction so that the intermediate forms produced by PowerExpand are not discarded as being too complex:

FullSimplify[
-Log[-I x] + Log[I x],
Assumptions -> x ∈ Reals && x != 0,
TransformationFunctions -> {Automatic, PowerExpand[#, Assumptions -> True]&},
ComplexityFunction -> (LeafCount[#]+10 Count[#, _Log, Infinity]&)
] //TeXForm


$\begin{cases} -i \pi & x<0 \\ i \pi & \operatorname{True} \end{cases}$

Note the inclusion of the options Assumptions->True in the PowerExpand call. With the default, PowerExpand can produce incorrect results, while adding any option (except Automatic) to PowerExpand means the output will be correct. Also, I include the TeXForm wrapper so that the output is a reasonable facsimile of what you would see in Mathematica.

With Carl Woll's insight that Assumptions->True needs to be used with PowerExpand in this case,

Assuming[{x ∈ Reals, x != 0}, -Log[-I x] + Log[I x] //
PowerExpand[#, Assumptions -> True] & // Simplify]


• This is somewhat less intimidating and I shall use this. Thanks to all who answered. However, I am disappointed that FullSimplify does not do what its name claims to do without further prodding and prompting... – Quasar Supernova Oct 30 '17 at 5:51

I have tried with rules:

-Log[Conjugate[I a]]+Log[I a] //. {Log[Conjugate[I a]] -> Log[I a] - 2 I Arg[I a], Arg[I a] -> \[Pi]Sign[a]/2}

(*I \[Pi]Sign[a]*)

• Sir, the import of the question is: I don't want to simplify expressions using my knowledge of mathematics, rather I want Mathematica to tell me the simplest version of the right answer without me having to supply predigested versions of the problem which is what your attempt at a solution is... – Quasar Supernova Oct 29 '17 at 12:01
• OK, let us try with this (the assumptions are basically the same, and follows Carl Woll & Bob Hanlon answers): Assuming[Arg[z] == Sign[Im[z]], -Log[Conjugate[z]] + Log[z] // PowerExpand[#, Assumptions -> True] & // FullSimplify] (* 2 I Sign[Im[z]] *) – José Antonio Díaz Navas Oct 29 '17 at 19:40