RE: Complex Numbers

*To*: mathgroup at smc.vnet.net*Subject*: [mg47438] RE: [mg47425] Complex Numbers*From*: "Florian Jaccard" <florian.jaccard at eiaj.ch>*Date*: Mon, 12 Apr 2004 03:44:52 -0400 (EDT)*Reply-to*: <florian.jaccard at eiaj.ch>*Sender*: owner-wri-mathgroup at wolfram.com

ComplexExpand[expr] expands expr assuming that all variables are real. So if you want that a and b are assumed to be real, you have first to take the real part, and then ComplexExpand ! In[1]:= ComplexExpand[Re[ Exp[a I] Exp[b I]]] Out[1]= Cos[a+b] You often will have to use the option : ComplexExpand[... ,TargetFunctions->{Re,Im}] to obtain what you really want. You can also use Simplify and tell Mathematica that all your variables are real : In[4]:= Simplify[Re[Exp[a*I]*Exp[b*I]], Element[_, Reals]] Out[4]= Cos[a + b] Regards Florian Jaccard -----Message d'origine----- De : Alejandro Vizcarra [mailto:gebankos at prodigy.net.mx] Envoyé : dim., 11. avril 2004 10:44 À : mathgroup at smc.vnet.net Objet : [mg47425] Complex Numbers Hi,: I always have problems when dealing with complex numbers. How can i work with Mathematica in such a way that every expression will be considered real unless it is declared explicitly complex (like a = 3 + 4 I ) ? For example if I type Re[ComplexExpand[ Exp[a I] Exp[b I]]] I get the answer -Im[Sin[ a+b]]+Re[Cos[a+b]] Instead of simply Cos[a+ b] Thnx! Alejandro Vizcarra