Re: Extracting Re and Im parts of a symbolic expression
- To: mathgroup at smc.vnet.net
- Subject: [mg42077] Re: Extracting Re and Im parts of a symbolic expression
- From: AES/newspost <siegman at stanford.edu>
- Date: Wed, 18 Jun 2003 02:10:58 -0400 (EDT)
- References: <bcmodv$sm8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <bcmodv$sm8$1 at smc.vnet.net>, Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote: > Note that CompelxExpand[Re[z]] works, Re[ComplexExpand[z]] is pointless > since it is just Re[z]. And the reason why this question keeps coming up year after year on this newsgroup (and why I have to look up the answer in my own online "Mathematica Notes" notebook almost every time I use this construct) is that the intuitive way any normal user would write an expression to get the real part of an expression is Re[ComplexExpand[expr]] whereas the "correct" Mathematica statement ComplexExpand[Re[expr]] is under any normal interpretation an absurd way of expressing what the user wants. [In real life compound expressions almost expand **from the inside out**: If you want the log of the sin of z you write Log[Sin[z]]. So, the second expression above says you're going to take the REAL part of expr, and then COMPLEX-EXPAND the result, even though the result is something that's already explicitly real, right? Don't both explaining again **why** it works this way -- my only point is that maybe in a larger picture of the logical design of Mathematica syntax it has to be structured this way, but unfortunately it's an intrinsically confusing way of expressing the user's objective, and always will be.] -- "Power tends to corrupt. Absolute power corrupts absolutely." Lord Acton (1834-1902) "Dependence on advertising tends to corrupt. Total dependence on advertising corrupts totally." (today's equivalent)