Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Forcing Re[]'s to be Real

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18239] Re: Forcing Re[]'s to be Real
  • From: "David Keith" <dkeith at sarif.com>
  • Date: Thu, 24 Jun 1999 14:24:20 -0400
  • Organization: Hevanet Communications
  • References: <7kpbj1$4b8@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Anthony,

Two things I think:

1) Your definition assigned to k[w] instead of k[w_],

2) Re[] doesn't seem to want to approximate the exact number Sqrt[Complex],
but Re[Complex]//N ans Re[ApproximateComplex] works fine. Since plot uses
N[] it seems to work fine also.

Dave

See below:


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

In[305]:=
Re[k[1]]

Out[305]=
\!\(Re[\ at \(2 - \[ImaginaryI]\)]\)

In[306]:=
Re[k[1.]]

Out[306]=
1.45535

In[298]:=
Re[k[1]] // N

Out[298]=
1.45535

In[299]:=
Im[k[1]] // N

Out[299]=
-0.343561

Plot[{Re[k[x]], Im[k[x]]}, {x, -5, 5}]

Anthony Foglia wrote in message <7kpbj1$4b8 at smc.vnet.net>...
> 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
>




  • Prev by Date: Re: Forcing Re[]'s to be Real
  • Next by Date: Re: Moving average type process
  • Previous by thread: Re: Forcing Re[]'s to be Real
  • Next by thread: Re: Forcing Re[]'s to be Real