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


Groups > comp.soft-sys.math.mathematica > #13016 > unrolled thread

How to get the Real and Imaginary part of an expression

Started by"Eduardo M. A. M. Mendes" <emammendes@gmail.com>
First post2013-01-03 02:14 +0000
Last post2013-01-05 07:16 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  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

#13016 — How to get the Real and Imaginary part of an expression

From"Eduardo M. A. M. Mendes" <emammendes@gmail.com>
Date2013-01-03 02:14 +0000
SubjectHow to get the Real and Imaginary part of an expression
Message-ID<kc2pi7$mdh$1@smc.vnet.net>
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


[toc] | [next] | [standalone]


#13032

From"Nasser M. Abbasi" <nma@12000.org>
Date2013-01-05 07:16 +0000
Message-ID<kc8k18$b0e$1@smc.vnet.net>
In reply to#13016
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web