       Re: Extracting Real Parts from NN Expression

• To: mathgroup at smc.vnet.net
• Subject: [mg51173] Re: [mg51149] Extracting Real Parts from NN Expression
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Thu, 7 Oct 2004 05:25:55 -0400 (EDT)
• References: <200410060834.EAA24222@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```
On 6 Oct 2004, at 17:34, Carlos Felippa wrote:

> Thank you very much to those who replied to early posts on the subject
> title and help me fix several mistakes.  Finally got a robust
> extraction function that has worked on a series of problems:
>
> RealPart[c_]:=ComplexExpand[(c+Conjugate[c])/2,TargetFunctions-
> >{Re,Im}];
>
> I used this in expressions such as
> Solve[RealPart[expr]==0,{unknowns}], in which expr is a complicated
> nonnumeric complex-valued expression, to solve some stability
> transition problems in C&G.  (If the real part becomes positive
> stability is lost).
>
> To see what happens with built-in Re[], a simple example is
> instructive:
>
>   expr=x^2-a^2+2*I*x*y;
>
>   Print[    Solve[Re[expr]==0,x]        //InputForm];
>   Solve returns unevaluated
>
>   Print[    Solve[RealPart[expr]==0,x]  //InputForm];
>   {{x -> -a}, {x -> a}}
>
> Note: a similar imaginary part extractor
>
> ImagPart[c_]:=ComplexExpand[-I*(c-Conjugate[c])/2,TargetFunctions-
> >{Re,Im}];
>
> is still iffy, but I dont need it for my application.  It could
> certainly be improved.
>

By why do you insist on this:

> (c+Conjugate[c])/2

if

Solve[ComplexExpand[Re[expr], TargetFunctions ->
{Re, Im}] == 0, x]

{{x -> -a}, {x -> a}}

works just as well?

The same applies to yout ImagPrart, why not just:

ComplexExpand[Im[expr], TargetFunctions ->
{Re, Im}]

???

Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/~andrzej/
http://www.mimuw.edu.pl/~akoz/

```

• Prev by Date: Re: Re: notation for integration limits
• Next by Date: Re: solve and simplify. force left hand side to be 0==
• Previous by thread: Extracting Real Parts from NN Expression
• Next by thread: Re: Extracting Real Parts from NN Expression