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


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

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

Started byBob Hanlon <hanlonr357@gmail.com>
First post2013-01-05 07:16 +0000
Last post2013-01-05 07:16 +0000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to get the Real and Imaginary part of an expression Bob Hanlon <hanlonr357@gmail.com> - 2013-01-05 07:16 +0000

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

FromBob Hanlon <hanlonr357@gmail.com>
Date2013-01-05 07:16 +0000
SubjectRe: How to get the Real and Imaginary part of an expression
Message-ID<kc8k13$b0c$1@smc.vnet.net>
expr = (w = 882)/(s^2 + 2*z*w*s + w^2);

re = Re[ComplexExpand[expr, s]] //
   Simplify[#, Element[z, Reals]] &;

im = Im[ComplexExpand[expr, s]] //
   Simplify[#, Element[z, Reals]] &;

expr == re + I*im // FullSimplify

True

Using a concrete example

s2 = RandomComplex[] // Rationalize[#, 0] &;

re2 = re /. s -> s2 //
   Simplify[#, Element[z, Reals]] &;

im2 = im /. s -> s2 //
   Simplify[#, Element[z, Reals]] &;


(expr /. s -> s2) == re2 + I*im2 // Simplify

True


Bob Hanlon


On Wed, Jan 2, 2013 at 9:16 PM, Eduardo M. A. M. Mendes
<emammendes@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
>
>
>

[toc] | [standalone]


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


csiph-web