MathGroup Archive 2002

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

Search the Archive

Re: Getting Symbolic Real and Imag Parts? (Once Again)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33508] Re: Getting Symbolic Real and Imag Parts? (Once Again)
  • From: aes <siegman at stanford.edu>
  • Date: Sun, 24 Mar 2002 01:44:03 -0500 (EST)
  • Organization: Stanford University
  • References: <a7cs6t$hv8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Thanks to several people who emailed me to point out that the way to get 
symbolic real and imag parts of an expression is

   Real part =  ComplexExpand[Re[expr]]    

   Imag part =  ComplexExpand[Im[expr]]    

and also my apologies for belatedly realizing that I had raised this question 
once before, months ago; gotten the same answer; and forgotten it.  It's now 
stored in my online collection on Mathematica hints and kinks.

Might as well also repeat the same comment that I made last time, however, 
namely that writing the expression in this form seems syntactically bizarre, not 
so say nonsensical.  The expression

   ComplexExpand[Re[Sin[a + I b]]]    

would normally be interpreted as saying, in words, "Do a complex expansion of 
the real part of the sine of a + I B", presumably producing a complex result, 
including adding a "+ I 0" to make the result complex.

What's really wanted, however, and what's actually accomplished by this 
expression, is instead, "Take the real part of the complex expansion of the sine 
of a + I b", a result you would expect to be written as

   Re[ComplexExpand[Sin[a+I b]]]

It's sort of like having to write  Log[Sin[z]]  when what you want is  
Sin[Log[z]] 



> OK,  so you can use ComplexExpand expand to find the symbolic real and imag 
> parts of an expression -- e.g. the input
> 
>       zComplex = ComplexExpand[ Sin[a+I b], TargetFunctions->{Re,Im}]
> 
> gives as output
> 
>       Cosh[b] Sin[a] + I Cos[a] Sinh[b]
> 
> as desired.  But now, how do I get Mathematica to peel out the symbolically 
> real and 
> imaginary parts of this? -- that is, what inputs
> 
>       zR = ???
> 
>       zI = ???
> 
> will give as outputs 
> 
>       Cosh[b] Sin[a]
> 
> and
> 
>       Cos[a] Sinh[b]
> 
> (Maybe an example in the ComplexExpand Help file would be helpful?)


  • Prev by Date: Re: How to pass an input to the child MathKernel?
  • Next by Date: Re: Adding columns and rows to a table
  • Previous by thread: Re: Getting Symbolic Real and Imag Parts? (Once Again)
  • Next by thread: Sinh[y]/y as y->0?