1
$\begingroup$

I am trying to simplify this expression

expr = -2 π Im[(a b (b - l) o)/(k l (b^2 + 4 o^2 π^2))] + 
   a b (b l + 4 o^2 π^2) Re[1/(b^2 k l + 4 k l o^2 π^2)]

Simplify[Re[expr],  Assumptions -> {Element[{o, a, b, k, l}, Reals]}]

which returns

$$a b \left(b l+4 \pi ^2 o^2\right) \Re\left(\frac{1}{b^2 k l+4 \pi ^2 k l o^2}\right)-2 \pi \Im\left(\frac{a b o (b-l)}{k l \left(b^2+4 \pi ^2 o^2\right)}\right).$$

Why is the imaginary part not set to zero, although I have stated that all parameter are real? What am I missing?

$\endgroup$
5
  • 1
    $\begingroup$ try ComplexExpand? $\endgroup$
    – kglr
    Commented Jul 5, 2018 at 14:00
  • $\begingroup$ Is it easy to understand, why that is necessary? $\endgroup$ Commented Jul 5, 2018 at 14:06
  • $\begingroup$ Re >> Details says: "Re[expr] is left unevaluated if expr is not a numeric quantity." (same for Im). Since the arguments of Im and Re in your expression are not numeric quantities, Im[a1] and Re[a2] do not evaluate to 0 and a2. ComplexExpand expands expr assuming that all variables are real. (and, it seems, it forces evaluation of Im[...] and Re[...]) $\endgroup$
    – kglr
    Commented Jul 5, 2018 at 14:21
  • $\begingroup$ Thank you, that helps. $\endgroup$ Commented Jul 5, 2018 at 14:31
  • $\begingroup$ AskingQuestions, my pleasure. $\endgroup$
    – kglr
    Commented Jul 5, 2018 at 14:33

2 Answers 2

3
$\begingroup$
ComplexExpand @ Re[expr]

(a b^2 l)/(b^2 k l + 4 k l o^2 π^2) + (4 a b o^2 π^2)/( b^2 k l + 4 k l o^2 π^2)

Simplify[%]

(a b^2 l + 4 a b o^2 π^2)/(b^2 k l + 4 k l o^2 π^2)

% // TeXForm

$\frac{a b^2 l+4 \pi ^2 a b o^2}{b^2 k l+4 \pi ^2 k l o^2}$

$\endgroup$
1
$\begingroup$

Just one remark:

The Simplification you asked for also works without ComplexExpand. Therefor you have to give assumptions, which make Re[] evaluable.

In your case

Simplify[Re[expr],Assumptions -> {Element[{o, a, b, k, l}, Reals], b^2 k l + 4 k l o^2 \[Pi]^2 != 0}]
(*(a b (b l + 4 o^2 \[Pi]^2))/(b^2 k l + 4 k l o^2 \[Pi]^2)*)

you must avoid vanishing Denominator in expr.

$\endgroup$
1
  • $\begingroup$ Good point..... $\endgroup$ Commented Jul 6, 2018 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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