0
$\begingroup$

a small question, as following picture shows, even i use Assuming[], still no final result. Formally my question is: if all variabls in a expr are real, how to get Re[] or Im[]

enter image description here

$\endgroup$
2
  • 3
    $\begingroup$ Did you try ComplexExpand[Re[a + b*I]] up to the documentation? $\endgroup$
    – user64494
    Commented Apr 18, 2023 at 15:33
  • $\begingroup$ @user64494 effective, thanks $\endgroup$ Commented Apr 18, 2023 at 15:39

3 Answers 3

4
$\begingroup$

Simplification isn't automatic. Try

c = a + I b;
Assuming[Element[a | b, Reals], Re[c] // FullSimplify]
(*    a    *)
$\endgroup$
4
$\begingroup$

Given:

c = a + I b;

The real part of c is:

Re[c] // ComplexExpand

Out: a

The imaginary part of c is:

Im[c] // ComplexExpand

Out: b

$\endgroup$
1
$\begingroup$

You have to apply a simplifying command to get the system work. Without calling some procedures the system only makes some simplifications, that are true universally and don't need time, eg x+x --> 2x and polynomial standarization in general.

By design any function non analytic in the complete complex domain with the exception of some poles are taboo. This reduces automatic simplification to rationals of multinomials, exponentials and elliptic functions.

Your case needs Simplify to make the assumptions work as intended

In[2]:= Assuming[a\[Element]Reals,Simplify[{Re[a],ReIm[a+b]}]]
Out[2]= {a,{a+Re[b],Im[b]}}

Re, Im, Abs and Arg are the basis of non-analytic functions; except for professionals, better to use it on numeric values only:

Always one should keep in mind, that the passage of an expression through such a one-way filter alters the space non-numeric variables are living in, after that.

$\endgroup$

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