Re: How to get the Real and Imaginary part of an expression

• To: mathgroup at smc.vnet.net
• Subject: [mg129340] Re: How to get the Real and Imaginary part of an expression
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Sat, 5 Jan 2013 02:21:05 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <20130103021627.CBD1368B0@smc.vnet.net>

```Since there seems to be some typo or else some spurious control code
("=882") in the numerator of your fraction, for purposes of
explanation I'll change the numerator just to w.

In general, the way to extract the real and imaginary parts of a complex
number is to use ComplexExpand along with, of course, Re and Im. Here,
though, you have both real and complex variables, so I think you'll need
to express the complex s in the form x + I y. Then applying
ComplexExpand will treat all the variables w, z, x, and y as real:

ComplexExpand[Re[(w)/(s^2 + 2*z*w*s + w^2) /. s -> x + I y]]
w^3/((w^2 + x^2 - y^2 + 2*w*x*z)^2 + (2*x*y + 2*w*y*z)^2) +
(w*x^2)/((w^2 + x^2 - y^2 + 2*w*x*z)^2 + (2*x*y + 2*w*y*z)^2) -
(w*y^2)/((w^2 + x^2 - y^2 + 2*w*x*z)^2 + (2*x*y + 2*w*y*z)^2) +
(2*w^2*x*z)/((w^2 + x^2 - y^2 + 2*w*x*z)^2 + (2*x*y + 2*w*y*z)^2)

And similarly for Im.

(I've shown the results in one-dimensional InputForm for purposes of
this plain-text e-mail.)

On Jan 2, 2013, at 9:16 PM, Eduardo M. A. M. Mendes <emammendes at gmail.com> wrote:

> Hello
>
> I need to extract the real and imaginary part of the following expression
>
> (w=882)/(s^2+2*z*w*s+w^2)
>
> where w and z are positive constants.  s is a complex variable.
>
> Applying Re and Im to the expression does not do much.   By hand, one can easily find them.
>
> What am I missing?
>
> many thanks
>
> Ed
>
>

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

```

• Prev by Date: Attaching a notebook to a message
• Next by Date: Re: How to get the Real and Imaginary part of an expression
• Previous by thread: Re: How to get the Real and Imaginary part of an expression
• Next by thread: Re: How to get the Real and Imaginary part of an expression