Message Boards Message Boards

4 Replies
4 Total Likes
View groups...
Share this post:

ComplexExpand, Conjugate, Piecewise - an unexpected result

Posted 10 years ago

The above expresstion yields (a is an undetermined symbol, you can replace it with 1 if you like)

I expect this expression to yield

because this is what conjugate do. It seems that Conjugate function have been ignored.
POSTED BY: chong wang
4 Replies
Conjugate is primarily for numbers and expressions that represent numbers (such as Root objects).

If you want Conjugate to work on the parameters inside an expression,
use Map with a level specification.  For example,
In[1]:= Map[ Conjugate, Piecewise[{{-I, a > 0}}, I], {-1} ]
Out[1]= Piecewise[{{I, Conjugate[a] > 0}}, -I]

In[2]:= FullSimplify[ %,  Element[a, Reals] ]
Out[2]= Piecewise[{{-I, a <= 0}}, I]
POSTED BY: Bruce Miller
I agree. It should stay like the input if it is not sure. 
ComplexExpand[Conjugate[Piecewise[{{-I, a > 0}}, I]]]

If you give "a" a value the result is correct 
In[31]:= ComplexExpand[Conjugate[Piecewise[{{-I,1>0}},I]]]
Out[31]= I

or use set delay
In[32]:= f[a_]:=ComplexExpand[Conjugate[Piecewise[{{-I,a>0}},I]]]
In[33]:= f[1]
Out[33]= I

You can make a suggestion to about this concern. 
POSTED BY: Shenghui Yang
The following code produce the same thing. 
In[3]:= Conjugate[f[x]]
Out[3]= Conjugate[f[x]]
In[4]:= ComplexExpand[%]
Out[4]= f[x]

The documentation says it does not always propagate into the expression. Once it stays outside, the ComplexExpand simply kills the head. 

POSTED BY: Shenghui Yang
Posted 10 years ago
I still don't understand.

The document just say it does not always propagate into arguments, but how can ComplexExpand kill it? This gives wrong results!

During a very complex calculation, I just cannot make sure every Conjugate is well dealt with (they are just intermediate results that I cannot see), and it accually took me hours to find this problem in a very big calculation. 
POSTED BY: chong wang
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract