I am trying to isolate out the real and complex terms in a fairly large expression. During the process, I have made several assumptions that last throughout the entire process.
$Assumptions = Element[{x,y},Reals] && {x,y}>0
When I try separating the real and complex parts, the Re
and Im
functions have trouble with terms where variables appear in the denominator. For example
Im[1/(x^2 + 4 y^2)^(9/2)] //Simplify = Im[1/(x^2 + 4 y^2)^(9/2)]
Even though all the terms are real and positive, meaning there should be no complex component, and the expression should be zero
I have checked, and if the denominator does not involve two or more terms, Im
does work successfully. For example
Im[1/(x^2)^(9/2) ] //Simplify = 0
Im[1/(4 y^2)^(9/2)] //Simplify = 0
Can someone please comment on if this is a bug in the version I have, or am I doing something incorrect here? A mwe is provided below. For reference, I am using version 10.0.0.0
-Thanks
In[421]:=
$Assumptions = Element[{x, y}, Reals] && {x, y} > 0 ;
Simplify[Im[1/(x^2 + 4*y^2)^(9/2)]]
Simplify[Im[1/(x^2)^(9/2)]]
Simplify[Im[1/(y^2)^(9/2)]]
Out[424]= Im[1/(x^2+4 y^2)^(9/2)]
Out[425]= 0
Out[426]= 0
Edit
If I modify the assumptions to define each one separately, the code runs fine. e.g
$Assumptions = Element[x, Reals] && Element[y, Reals] && x > 0 && y > 0 ;
In my main program, I have a large number of variables that are both real and positive, is there a way to assign these all at once, or do I need to do each one separately?
varlist
then$Assumptions = And @@ (Element[#, Reals] && # > 0 & /@ varlist)
will do the trick. $\endgroup$ComplexExpand[Im[...]]
. That should work. Same for the real part $\endgroup$