Re: ComplexExpand and subscrips

*To*: mathgroup at smc.vnet.net*Subject*: [mg109580] Re: ComplexExpand and subscrips*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Thu, 6 May 2010 04:51:54 -0400 (EDT)

This is not really anything particularly related to Subscript but rather a consequence of the following behaviour: In[22]:== ComplexExpand[Re[f[x]]] Out[22]== f[x] In[23]:== ComplexExpand[Re[f[a, x]]] Out[23]== f[a, x] In[24]:== ComplexExpand[Re[f[a][x]]] Out[24]== Re[f[a][x]] The mathematical justification of this behaviour is not clear to me. In fact, I am not convinced that the first output is justified: ComplexExpand assumes that all variables are real unless stated otherwise, but it is not clear why assuming that x is real implies that f[x] is real for any f. This will only be the case if f is real valued on real numbers (e.g. a holonomic function) but this is not the same as assuming that the variables are real (as stated in the documentation). For some reason this assumption is not made when the function has the form f[a] or f[a,b] and Subscript[f,n] is simply a special case of that. Andrzej Kozlowski On 5 May 2010, at 19:06, slawek wrote: > Why the Out[4] and Out[2] are quite different? The eq is a sample and has > got no deep meaning. > > In[1]:== eq == p1[x] + I p2[x] + Sin[p1[x] - I p2[x]] > Out[1]== p1[x] + I p2[x] + Sin[p1[x] - I p2[x]] > In[2]:== Re[eq] // ComplexExpand > Out[2]== p1[x] + Cosh[p2[x]] Sin[p1[x]] > In[3]:== eq /. {p1 -> Subscript[p, 1], p2 -> Subscript[p, 2]} > Out[3]== Sin[Subscript[p, 1][x] - I Subscript[p, 2][x]] + Subscript[p, 1][x] > + I Subscript[p, 2][x] > In[4]:== Re[ eq /. {p1 -> Subscript[p, 1], p2 -> Subscript[p, 2]}] // > ComplexExpand > Out[4]== -Im[Subscript[p, 2][x]] + Re[Subscript[p, 1][x]] + > Cosh[Im[Subscript[p, 1][x]] - Re[Subscript[p, 2][x]]] Sin[Im[Subscript[p, > 2][x]] + Re[Subscript[p, 1][x]]] > > TIA > slawek > > >