MathGroup Archive 2005

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

Search the Archive

Re: Re: Complex Oddity

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57588] Re: [mg57535] Re: Complex Oddity
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Wed, 1 Jun 2005 06:04:12 -0400 (EDT)
  • References: <d79enu$lbl$1@smc.vnet.net> <200505310900.FAA03446@smc.vnet.net>
  • Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Sometimes the design of Mathematica is counter intuitive to a person
learning it. I have seen some things in Mathematica that I think are
bugs (despite the claim in the documentation that the probability of
me seeing a bug in Mathematica is low ... consider the source ... ).
Still, I always assume that the error lies first in my understanding
of Mathematica's operation than with Mathematica itself. This attitude
may be a good approach to apply to questions asked on this list
because sometimes people are defensive of the software they use every
day (and for which they provide unpaid technical support) ...

On 5/31/05, John Reed <nospamjreed at alum.mit.edu> wrote:
> Thanks to all who explained what is happening and how to work this problem
> correctly.  Now I know one facet of working with complex numbers.  I don't
> feel much better about this however.  I received one e-mail that said this
> was my fault for not reading the documentation closely enough.  This problem
> came up in the book "Mathematica for Physics" second edition by Zimmerman
> and Olness.  They solve a problem using the Complex[a_,b_]->a rule, ( see
> page 91) but not the b part.  The b part was my idea.  Now I know why they
> didn't solve for the imaginary part this way.  They get the imaginary part
> by subtracting the real part from the complex expression and dividing by I.
> How many other gotchas are hidden in the code, waiting to bite the unwary
> and relatively new user?  What documentation tells about this kind of a
> problem or do I just have to find them for myself by hopefully catching the
> errors as they occur?
> 
> John Reed
> 
> "John Reed" <nospamjreed at alum.mit.edu> wrote in message
> news:d79enu$lbl$1 at smc.vnet.net...
> >I was trying to separate the real and imaginary parts of a complicated
> > expression, and ended up with something strange.  Here is a short version
> > of
> > what happened.
> >
> > Let z = x + I y, then realPart = z /. {Complex[a_,b_]->a} gives realPart =
> > x.  Great!
> >
> > Now, try imagPart = z /. {Complex[a_,b_]->b}  returns with imagPart = x +
> > y.
> > Oops
> >
> > In my original expression, it was harder to see, but the same error was
> > occuring.  What I tried first was using Re[z] and Im[z], but then I have
> > to
> > work with Im[y] and Im[x].  It seems to me two things need to be done
> > here.
> > First, be able to assign variables so that they always stay real or else
> > indicate an error is occuring if they turn out to be complex, and second
> > do
> > something to avoid errors like the above.  I have to say that I don't
> > trust
> > Mathematica's answers as much as I did before this came up. Now I feel
> > like
> > I better have a good idea of what the answer is before I  trust
> > Mathematica.
> >
> > John Reed
> >
> >
> 
> 


-- 
Chris Chiasson
http://chrischiasson.com/
1 (810) 265-3161


  • Prev by Date: Re: Two related question. Question 1
  • Next by Date: Re: Complex Oddity
  • Previous by thread: Re: angry FindMinimum
  • Next by thread: Re: Complex Oddity