5
$\begingroup$

Sometimes, mathematica likes to give me complex results when, e.g, integrating a real valued function. The result might be something like

Log[-t - I w] + Log[-t + I w]

where t and w are >0. The question is: How can I automatically convert this to

Log[t^2 + w^2]

?

The obvious command

FullSimplify[Log[-t - I w] + Log[-t + I w],  Assumptions -> {t > 0, w > 0}]

does not do anything.

$\endgroup$
10
$\begingroup$
expr = Log[-t - I w] + Log[-t + I w];

expr // ComplexExpand[#, TargetFunctions -> {Re, Im}] & // 
 Simplify[#, {w > 0, t > 0}] &

(*  Log[t^2 + w^2]  *)
$\endgroup$

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.