Re: Re: Abs help
- To: mathgroup at smc.vnet.net
- Subject: [mg42058] Re: [mg42017] Re: Abs help
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 17 Jun 2003 05:44:04 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
This is unnecessarily complicated: y = Exp[I*x] + 1; FullSimplify[ComplexExpand[Abs[y], TargetFunctions -> {Re, Im}]] Sqrt[2]*Sqrt[1 + Cos[x]] On Monday, June 16, 2003, at 04:58 PM, Dr. Wolfgang Hintze wrote: > In my opinion, to deal with complex numbers in Mathematica is sometimes > not very intuitive. But if we define our own Abs[] > > wehAbs[t_] := > Sqrt[ComplexExpand[t, TargetFunctions -> {Abs, Arg}]* > ComplexExpand[Conjugate[t], TargetFunctions -> {Abs, Arg}]] > // > TrigExpand // Simplify > > then > > In[1]:= > y = Exp[I*x] + 1; > > gives > > In[23]:= > wehAbs[y] > > Out[23]= > Sqrt[2]*Sqrt[1 + Cos[x]] > > Notice that the result differs from yours. > > Wolfgang > > > Rex_chaos wrote: > >> hi all, >> Here is a expr >> y=Exp[I*x]+1; >> where x is REAL. I would like to take the absolute value of y >> >> However, it gives >> >> In[1]:=Abs[ExpToTrig[y]]^2 >> Out[1]=Abs[1 + Cos[2 x] + \[ImaginaryI] Sin[2 x]]^2 >> >> How can I get the result Sin[2 x]^2 + (1+Cos[2 x])^2 ? >> >> How to tell mathematica x is REAL? >> >> Thanks. >> >> > > > Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/