Re: Re: Re: How to simplify to a result that is real

*To*: mathgroup at smc.vnet.net*Subject*: [mg50769] Re: [mg50750] Re: [mg50735] Re: How to simplify to a result that is real*From*: Andrzej Kozlowski <andrzej at akikoz.net>*Date*: Sun, 19 Sep 2004 21:39:27 -0400 (EDT)*References*: <cidt38$brv$1@smc.vnet.net> <200409180948.FAA00572@smc.vnet.net> <200409190755.DAA17960@smc.vnet.net> <1C034D6C-0A39-11D9-A57C-000A95B4967A@akikoz.net>*Sender*: owner-wri-mathgroup at wolfram.com

Actually, I think your question is more interesting that I had at first realized. Having thought about this I now think that when you evaluate ComplexExpand[exp[a,b,c,...],TargetFunctions->{Re,Im}], where a,b,c,... are parameters, the following thing happens. First ComplexExpand[exp[a,b,c,...],{a,b,c,...},TargetFunctions->{Re,Im}] is evaluated in terms of Re[a], Im[a], Re[b], Im[b] ...and then all the Im[a],Im[b] are set to 0 and all Re[a],Re[b] ... are set to a, b .... That is why they do not appear in the final answer. I came to this conclusion by considering the following puzzle: ComplexExpand[a/(b + c*I), TargetFunctions -> {Re}] (a*b)/(2*b*(b + I*c) - (b + I*c)^2) - (I*a*c)/(2*b*(b + I*c) - (b + I*c)^2) ComplexExpand[a/(b + c*I), TargetFunctions -> {Im}] (a*b)/((b + I*c)^2 - 2*I*(b + I*c)*c) - (I*a*c)/((b + I*c)^2 - 2*I*(b + I*c)*c) The puzzle is: why are these answers different and how are they arrived at? My answer is that they are evaluated as follows: ComplexExpand[a/(b + c*I), {a, b, c}, TargetFunctions -> {Re}] /. {Re[a] -> a, Re[b] -> b, Re[c] -> c} (a*b)/(2*b*(b + I*c) - (b + I*c)^2) - (I*a*c)/(2*b*(b + I*c) - (b + I*c)^2) ComplexExpand[a/(b + c*I), {a, b, c}, TargetFunctions -> {Im}] /. {Im[a] -> 0, Im[b] -> 0, Im[c] -> 0} (a*b)/((b + I*c)^2 - 2*I*(b + I*c)*c) - (I*a*c)/((b + I*c)^2 - 2*I*(b + I*c)*c) Note that the very long expression resulting from evaluating ComplexExpand[a/(b + c*I), {a, b, c}, TargetFunctions -> {Re}] does indeed contain only terms of the form Re[a] ... and the expression resulting form evaluating: ComplexExpand[a/(b + c*I), {a, b, c}, TargetFunctions -> {Im}] only terms of the frm Im[a], Im[b] .... Andrzej On 19 Sep 2004, at 21:40, Andrzej Kozlowski wrote: > I am not sure if I have understood you correctly, but normally, > ComplexExpand[expression, TargetFunctions -> {Re, Im}] will explicitly > include Re and Im only if expression contains some symbols that are > specified to be complex, e.g: > > ComplexExpand[(a + b*I)/(c + d*I), TargetFunctions -> > {Im, Re}] > > (a*c)/(c^2 + d^2) + I*((b*c)/(c^2 + d^2) - > (a*d)/(c^2 + d^2)) + (b*d)/(c^2 + d^2) > > > but here explicit Re and Im are present: > > ComplexExpand[(a + b*I)/(c + d*I), {a}, > TargetFunctions -> {Im, Re}] > > > (Im[a]*d)/(c^2 + d^2) + (b*d)/(c^2 + d^2) + > (c*Re[a])/(c^2 + d^2) + I*((Im[a]*c)/(c^2 + d^2) + > (b*c)/(c^2 + d^2) - (d*Re[a])/(c^2 + d^2)) > > > > With other target functions this is not necessarily always the case, > e.g. > > ComplexExpand[(a + b*I)/(c + d*I), TargetFunctions -> > {Abs}] > > (a*c)/Abs[c + I*d]^2 + I*((b*c)/Abs[c + I*d]^2 - > (a*d)/Abs[c + I*d]^2) + (b*d)/Abs[c + I*d]^2 > > Andrzej Kozlowski > Chiba, Japan > http://www.akikoz.net/~andrzej/ > http://www.mimuw.edu.pl/~akoz/ > > > > On 19 Sep 2004, at 16:55, DrBob wrote: > >> *This message was transferred with a trial version of CommuniGate(tm) >> Pro* >> It's interesting that the output of ComplexExpand[ch, TargetFunctions >> -> {Re, Im}] in this case doesn't include Re or Im. What is >> ComplexExpand really doing, here? >> >> Bobby >> >> On Sat, 18 Sep 2004 05:48:55 -0400 (EDT), Peter Valko >> <p-valko at tamu.edu> wrote: >> >>> Richard Chen <richard at doubleprime.com> wrote in message >>> news:<cidt38$brv$1 at smc.vnet.net>... >>>> The command: >>>> >>>> Integrate[1/(1 + e Cos[t]), {t, 0, a}, >>>> Assumptions -> {-1 < e < 1, 0 < a < Pi}] >>>> >>>> leads to a complex valued result. I could not make >>>> mathematica to render the result in a form that is >>>> purely real. ComplexExpand, Refine all do not seem to work. >>>> >>>> Does anyone know how to make mathematica to simplify this >>>> result into a real form? >>>> >>>> Thanks for any info. >>>> >>>> Richard >>> >>> >>> >>> Richard, >>> >>> I think this will work: >>> >>> >>> ch = Integrate[1/(1 + e Cos[t]), {t, 0, a}, Assumptions -> {-1 < e < >>> 1, 0 < a < Pi}] >>> >>> FullSimplify[ComplexExpand[ch, TargetFunctions -> {Re, Im}], {-1 < e >>> < >>> 1, 0 < a < Pi}] >>> >>> >>> The result is >>> >>> (-2*ArcTan[((-1 + e)*Tan[a/2])/Sqrt[1 - e^2]])/Sqrt[1 - e^2] >>> >>> >>> Peter >>> >>> >>> >> >> >> >> -- >> DrBob at bigfoot.com >> www.eclecticdreams.net >> >> >

**References**:**Re: How to simplify to a result that is real***From:*p-valko@tamu.edu (Peter Valko)

**Re: Re: How to simplify to a result that is real***From:*DrBob <drbob@bigfoot.com>

**Re: Sum question and general comment**

**Re: more than 1 function with Plot3D**

**Re: Re: Re: How to simplify to a result that is real**

**Re: Re: How to simplify to a result that is real**