Re: Forcing Re[]'s to be Real

• To: mathgroup at smc.vnet.net
• Subject: [mg18281] Re: Forcing Re[]'s to be Real
• From: pitakc at ee.pdx.edu (Pitak Chenkosol)
• Date: Fri, 25 Jun 1999 15:05:25 -0400
• References: <7kpbj1\$4b8@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```
Hello,

How about the followings : (I cut and paste from a DOS window so the format
may not look good but you get the idea)

In[1]:= k[w_] := Sqrt[w^2 (1 + (2/(1 + I w)))]

In[2]:= ComplexExpand[Re[k[w]]]

2
Arg[1 + -------]
2                  2                  1 + I w
Out[2]= Sqrt[w ] Sqrt[Abs[1 + -------]] Cos[----------------]
1 + I w              2

In[3]:= ComplexExpand[Im[k[w]]]

2
Arg[1 + -------]
2                  2                  1 + I w
Out[3]= Sqrt[w ] Sqrt[Abs[1 + -------]] Sin[----------------]
1 + I w              2

In[4]:= ComplexExpand[Re[k[11/17]]]

187
ArcTan[---]
1361 1/4            494
11 (----)    Cos[-----------]
205               2
Out[4]= -----------------------------
17

In[5]:= ComplexExpand[Im[k[11/17]]]

187
ArcTan[---]
1361 1/4            494
-11 (----)    Sin[-----------]
205               2
Out[5]= ------------------------------
17

In[6]:= ComplexExpand[Re[k[11/17]]]//N

Out[6]= 1.0217

In[7]:= ComplexExpand[Im[k[11/17]]]//N

Out[7]= -0.186906

Hope that help.

Regards,

Pitak

-----

afoglia at hal.physics.ucsb.edu (Anthony Foglia) writes:

>	I seem to have found an interesting problem involving computing the
>real part of complex numbers.  (Interesting, in that it wasn't there a few
>weeks ago when I ran the (as-far-as-i-can-remember) exact same code.)

>I have a complex function:

>k[w] := Sqrt[w^2 (1 + (2 / (1 + I w)))]

>I want to graph the real and imaginary parts, but Mathematica doesn't want
>to express the Re[k[w]] as a real number.  What do I mean?  Well, if I
>type:

>Re[Sqrt[1+I]]

>I get out

>Re[Sqrt[1+I]]

>Same if I do Re[ComplexExpand[Sqrt[1+I]]], or Re[(1+I)^(1/2)].  But if I
>enter:

>Re[ComplexExpand[(1+I)^(1/2)]

>Mathematica is kind enough to respond with:

>2^(1/4) Cos[Pi/8]

>I'm certain that this is the root of my problem, but I'll be damned if I
>know why Mathematica doesn't like it now, but did a few weeks ago.  Any
>help?

>--Anthony

--
Pitak Chenkosol, Dept. Electrical Eng.,|  " I was born not knowing and have
Portland State University,             |    only had a little time to change
P.O. Box 751, Portland, OR 97207-0751. |    that here and there."
E-mail: pitakc at ee.pdx.edu              |                Richard P. Feynman

```

• Prev by Date: Mathematica from Perl?
• Next by Date: System of equations
• Previous by thread: Re: Forcing Re[]'s to be Real
• Next by thread: Canceling square roots with Simplify