0
|
4909 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
GROUPS:

# ComplexExpand, Conjugate, Piecewise - an unexpected result

Posted 11 years ago
 ComplexExpand[Conjugate[Piecewise[{{-I,a>0}},I]]]The above expresstion yields (a is an undetermined symbol, you can replace it with 1 if you like)Piecewise[{{-I,a>0}},I]I expect this expression to yieldPiecewise[{{I,a>0}},-I]because this is what conjugate do. It seems that Conjugate function have been ignored.
4 Replies
Sort By:
Posted 11 years ago
 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 11 years ago
 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]= Ior use set delayIn[32]:= f[a_]:=ComplexExpand[Conjugate[Piecewise[{{-I,a>0}},I]]]In[33]:= f[1]Out[33]= IYou can make a suggestion to support@wolfram.com about this concern.
Posted 11 years ago
 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 11 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.