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

*To*: mathgroup at smc.vnet.net*Subject*: [mg129328] Re: How to get the Real and Imaginary part of an expression*From*: "Nasser M. Abbasi" <nma at 12000.org>*Date*: Sat, 5 Jan 2013 02:17: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*: <kc2pi7$mdh$1@smc.vnet.net>*Reply-to*: nma at 12000.org

On 1/2/2013 8:14 PM, Eduardo M. A. M. Mendes 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. > You can use ComplexExpand. For example ---------------- expr = s + 2 I b + c ComplexExpand[Re[expr]] (* c + s *) ComplexExpand[Im[expr]] (* 2 b *) ------------------- For your example, I might do Clear[s, z, w, a, b]; expr = w/(s^2 + 2*z*w*s + w^2); ComplexExpand[Re[expr /. s -> a + I b]] --Nasser