Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13032

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

From "Nasser M. Abbasi" <nma@12000.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to get the Real and Imaginary part of an expression
Date 2013-01-05 07:16 +0000
Message-ID <kc8k18$b0e$1@smc.vnet.net> (permalink)
References <kc2pi7$mdh$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

How to get the Real and Imaginary part of an expression "Eduardo M. A. M. Mendes" <emammendes@gmail.com> - 2013-01-03 02:14 +0000
  Re: How to get the Real and Imaginary part of an expression "Nasser M. Abbasi" <nma@12000.org> - 2013-01-05 07:16 +0000

csiph-web