It is obvious that the answer to

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


 I π Sign[x]

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

How does one make it give the obvious answer?

  • $\begingroup$ 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. $\endgroup$ – 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:

    -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]

enter image description here

  • $\begingroup$ 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... $\endgroup$ – 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]*)
  • 1
    $\begingroup$ 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... $\endgroup$ – Quasar Supernova Oct 29 '17 at 12:01
  • $\begingroup$ 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]] *) $\endgroup$ – José Antonio Díaz Navas Oct 29 '17 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.