Re: Abs help
- To: mathgroup at smc.vnet.net
- Subject: [mg41988] Re: Abs help
- From: rex_chaos at 21cn.com (Rex_chaos)
- Date: Mon, 16 Jun 2003 03:56:41 -0400 (EDT)
- References: <bc7on7$6bt$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
rex_chaos at 21cn.com (Rex_chaos) wrote in message news:<bc7on7$6bt$1 at smc.vnet.net>...
> 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?
It's just an example. What I really want is to define a global real
variable or tell me how to redefine the Abs function for obtaining a
definite result rather then the expression itself.
I have defined my Abs like
MyAbs[expr_] := Simplify[ComplexExpand[
expr/.Abs[x_]->Sqrt[x*Conjugate[x]] ]]
The function works sometimes to some expressions but not always. :(