       Re: basic complex number question

• To: mathgroup at smc.vnet.net
• Subject: [mg72114] Re: [mg72081] basic complex number question
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Wed, 13 Dec 2006 06:38:36 -0500 (EST)
• Organization: Mathematics & Statistics, Univ. of Mass./Amherst
• References: <200612110954.EAA07116@smc.vnet.net>

```Well actually Re and Im DO return the real and imaginary part of their
arguments, as advertized.  It's just that Mathematica may not know from
what you give as argument what the real and imaginary parts are.

For example:

Im[2+3I]
3

(As expected.)  But:

Im[x+I y]
Im[x+I y]

(the best Mathematica can do without mind-reading: perhaps you were
thinking Im[(2I) + I (3I)]).

To obtain what you probably want, wrap Re and Im with ComplexExpand.
For example:

ComplexExpand[Exp[x+I y]]
E^x*Cos[y] + I*E^x*Sin[y]

(result shown in InputForm).

Daniel Mazur wrote:
> My apologies for asking a question *this* basic, but here goes:
> Functions Im[] and Re[] don't really evaluate imaginary and real part of
> analytical expressions. What do I need to do to get this done?
> Thanks,
> Daniel
>

--
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

```

• Prev by Date: Re: solve ODE help?
• Next by Date: Re: How to find Minimal Poly of a possible algebraic number?
• Previous by thread: basic complex number question
• Next by thread: Re: basic complex number question