MathGroup Archive 2005

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

Search the Archive

Re: Re: Complex Oddity

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57651] Re: [mg57631] Re: Complex Oddity
  • From: Pratik Desai <pdesai1 at umbc.edu>
  • Date: Fri, 3 Jun 2005 05:33:34 -0400 (EDT)
  • References: <d79enu$lbl$1@smc.vnet.net><d7hahj$3q6$1@smc.vnet.net> <200506020917.FAA11965@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

jfeth at azlink.com wrote:

>I use Jones matrices to evaluate optical circuits and always need to
>find the intensity of two interfering electric fields.  The intensity
>(or brightness) of a field is found as a positive real value from a
>complex field as the field times the complex conjugate of the field.
>As you can see below, Mathematica gives yet another complex value when
>one does this straightforward multiplication instead of the real value
>that, I might add, is drilled into all students at the first glimpse of
> root(-1).  For several weeks I struggled to use Mathematica in my
>circuit evaluation until one inspired Saturday, after several pots of
>coffee, dumb luck and iteration brought forth Intensity[expr_]:= below.
> I don't know why it works, I don't know how it works, and I
>don't know another way to do the job, but, even as ugly as it is, at
>least it works and it works very quickly.  Importantly, it also gives
>me answers as cosines with arguments that are (real)sums and
>differences of characteristic delays, misalignments, and phase
>modulation terms.
>
>f=E^(I*d)
>
>In[1]:=
>f*Conjugate[f]
>
>Out[1]=
> E^ (I*d - I*Conjugate[d])
>
>In[2]:=
>Intensity[expr_]:=
>TrigReduce[ExpToTrig[expr*TrigToExp[ComplexExpand[Conjugate[ExpToTrig[expr]]]]]]
>
>In[3]:=
>Intensity[f]
>
>Out[3]=
>1
>
>With this solution in hand, as an optical engineer, I now have the
>luxury of wondering 1) exactly what mathematical elegance (or utility)
>is gained by Mathematica's assumption that every variable is always
>complex, and 2) why there is apparently no way in Mathematica to
>globally define a variable as a real number (i.e., its own conjugate).
>
>Regards,
>
>John Feth
>
>
>John Reed 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
>>
>>    
>>
>
>  
>
I have also struggled with the very same questions, I have found the 
TagSet defination invaluable here is how I would deal with your problem

TagSet[d, Im[d], 0];
TagSet[d, Re[d], d];
TagSet[d, Conjugate[d], d];
f[d_] := E^(I*d)
f[d]*Conjugate[f[d]]
 >>1

The fundamental question remains why does Mathematica treat all 
variables as complex, well the simple answer may be WHY NOT!!. You can 
always tell mathematica which variables are real/complex, by giving them 
thier identity(shown above)  which is the way it is supposed to work, 
isn't it? :-)


Best Regards

Pratik Desai




-- 
Pratik Desai
Graduate Student
UMBC
Department of Mechanical Engineering
Phone: 410 455 8134



  • Prev by Date: NonlinearFit
  • Next by Date: Re: mml files
  • Previous by thread: Re: Re: Complex Oddity
  • Next by thread: Re: Re: Complex Oddity