Given a list, I want to find all elements that have positive imaginary part.
For example, if $y,z\in\mathbb R$ and $a>0$ and the list is $\{ ia+y, -ia+z\}$, then the result should be $\{ia+y\}$.
However, my code using Assuming
and Select
does not work.
Assuming[{y \[Element] Reals, z \[Element] Reals, a > 0},
Select[{I a + y, -I a + z2}, Im[#] > 0 &]]
Although the expected reslut is {I a + y}
, Mathematica gives {}
. I suspect that condition given by Assuming
seems to be not effective. How can I fix this problem?
Assuming[{y \[Element] Reals, z2 \[Element] Reals, a > 0}, Select[{I a + y, -I a + z2}, Simplify[Im[#] > 0] &]]
$\endgroup$