Re: Abs help
- To: mathgroup at smc.vnet.net
- Subject: [mg42017] Re: Abs help
- From: "Dr. Wolfgang Hintze" <weh at snafu.de>
- Date: Mon, 16 Jun 2003 03:58:08 -0400 (EDT)
- References: <bc7on7$6bt$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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. > >