Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: How to get the Real and Imaginary part of an expression
Replies: 10   Last Post: Jan 5, 2013 2:18 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
R Martinez

Posts: 13
Registered: 5/25/09
Re: How to get the Real and Imaginary part of an expression
Posted: Jan 5, 2013 2:17 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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@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

<html><head><meta http-equiv="Content-Type" content="text/html =
charset=us-ascii"></head><body style="word-wrap: break-word; =
-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@gmail.com">emammendes@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)--



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.