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

• To: mathgroup at smc.vnetnet
• Subject: [mg129333] Re: How to get the Real and Imaginary part of an expression
• From: R Martinez <rm.tech at mac.com>
• Date: Sat, 5 Jan 2013 02:18:45 -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>

```Eduardo,

Two problems:

(1) Mathematica does not know that s is a complex variable.

(2) The functions Re[ ] and Im[ ] work only for numeric arguments.

Try the following:

-----
Clear[s, z, w, x, y]
(w = 882.)/(s^2 + 2*z*w*s + w^2)

f = % /. s -> x + I y

ComplexExpand[%]

-----------

HTH,

Raul

On Jan 2, 2013, at 6: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
>
>
>

--Boundary_(ID_rnQ7W0VSrA7Op0O/vuqrsw)
Content-type: text/html; CHARSET=US-ASCII
Content-transfer-encoding: quoted-printable

-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
">Eduardo,<div><br></div><div>Two problems:</div><div><br></div><div>(1) =
Mathematica does not know that s is a complex =
variable.</div><div><br></div><div>(2) The functions Re[ ] and Im[ ] =
work only for numeric arguments.</div><div><br></div><div>Try the =
following:</div><div><br></div><div>-----</div><div><div style="margin: =
0px; font-family: Helvetica; font-size: 16px; ">Clear[s, z, w, x, y]<br>
(w = 882.)/(s^2 + 2*z*w*s + w^2)<br>
<br>
f = % /. s -&gt; x + I y<br>
<br>
ComplexExpand[%]</div><div style="margin: 0px; font-family: Helvetica; =
font-size: 16px; "><br></div><div style="margin: 0px; font-family: =
Helvetica; font-size: 16px; ">-----------</div><div style="margin: =
0px; font-family: Helvetica; font-size: 16px; "><br></div><div =
style="margin: 0px; font-size: 16px; font-family: Helvetica; =
">HTH,</div><div style="margin: 0px; font-size: 16px; font-family: =
Helvetica; "><br></div><div style="margin: 0px; font-size: 16px; =
font-family: Helvetica; ">Raul</div><div style="margin: 0px; =
font-size: 12px; font-family: Helvetica; "><br></div><div><div>On Jan 2, =
2013, at 6:16 PM, Eduardo M. A. M. Mendes &lt;<a =
href="mailto:emammendes at gmail.com">emammendes at gmail.com</a>&gt; =
wrote:</div><br class="Apple-interchange-newline"><blockquote =
type="cite">Hello<br><br>I need to extract the real and imaginary part =
of the following =
expression<br><br>(w=882)/(s^2+2*z*w*s+w^2)<br><br>where w and z are =
positive constants. &nbsp;s is a complex variable.<br><br>Applying Re =
and Im to the expression does not do much. &nbsp;&nbsp;By hand, one can =
easily find them. <br><br>What am I missing?<br><br>many =
thanks<br><br>Ed<br><br><br><br></blockquote></div><br></div></body></html=
>=

--Boundary_(ID_rnQ7W0VSrA7Op0O/vuqrsw)--

```

• Prev by Date: Re: How to get the Real and Imaginary part of an expression
• Next by Date: Re: PolynomialQuotient slow
• 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