Re: how mathematica deals with complex i in output
- To: mathgroup at smc.vnet.net
- Subject: [mg34350] Re: [mg34334] how mathematica deals with complex i in output
- From: Hugh Walker <hwalker at gvtc.com>
- Date: Thu, 16 May 2002 05:08:34 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Nicholas Bock asks ============ After integrating an expression, mathematica gave me the following: (Local) Out[5]//InputForm= ((I/4)*p^2*Log[1 - (I*Sqrt[a]*(p + qD))/Sqrt[-(a*p^2) - \[Omega]]])/(a^(3/2)*Sqrt[-(a*p^2) - \[Omega]]) Sorry about the somewhat confusing form of this expression, but I don't know how to do this better in an email. Anyway, my question is this: There are a number of I's in the output, which would make you believe that the output is something complex. Upon closer inspection though one notices that it is actually not, since all the factors of I cancel from this expression, if the definition of I is used, I == sqrt(-1). How can I tell mathematica to do the same and to eliminate all those factors of I for me? I already tried a number of things, for example RealOnly, ImRe, but so far nothing worked. I guess this is a problem of how mathematica formats its output and how it arranges the terms in the output, but I don't know how to change that behavior. ============ If your output is out and all parameters are real then what you want is out//ComplexExpand[#,TargetFunctions->{Re,Im}] & ============ Hugh Walker Gnarly Oaks