Re: More /.{I->-1} craziness, con brio
- To: mathgroup at smc.vnet.net
- Subject: [mg106649] Re: More /.{I->-1} craziness, con brio
- From: Richard Fateman <fateman at cs.berkeley.edu>
- Date: Wed, 20 Jan 2010 06:47:44 -0500 (EST)
- References: <200912300915.EAA17299@smc.vnet.net> <hhhmn8$o9t$1@smc.vnet.net> <his71l$lad$1@smc.vnet.net> <201001171213.HAA09349@smc.vnet.net> <hj131g$bdr$1@smc.vnet.net> <4B5489D0.6050602@cs.berkeley.edu> <32552F29-F98C-497E-A6F0-9D2D03B13BF2@gmail.com> <hj40qq$sgp$1@smc.vnet.net>
Andrzej Kozlowski wrote: > And, by the way, any claims to the effect that something like what you > "explained" must be going on in the C source code in which Mathematica > is written do not count for that would be at best pure speculation which > something anyone else can do as well as you . No, I also read the documentation: "Module allows you to set up local variables, to which you can assign values and then change them. Often, however, all you really need are local constants, to which you assign a value only once. The Mathematica With construct allows you to set up such local constants. " also in the documentation for With, we learn that With is faster than Module... Timing[Do[Module[{x = 5}, x;], {10^5}]] is 3X slower than Timing[Do[With[{x = 5}, x;], {10^5}]]. This is presumably because the local variable x in With has lower overhead. No extra symbol name etc. I find Mathematica's "Trace" to be quite useless, myself, so I had to brace myself to look at what you posted there... I think that what the Trace reveals is that in the use of "With", the symbols, which I have said were "something like I$1234" are, indeed, something like I$1234, but in order to make things less burdensome for Mathematica, they are not fully instantiated symbols. This saves on memory allocation/deallocation. It also means that they print just like "I" and not like "I$1234". But that does not change the argument that they act like new symbols, local to the body of the With. Perhaps this example further illustrates the situation: With[{I=a}, f[I]+g[Complex[0,1]]] which returns f[a]+g[I]. That is, the local variable "I", which according to me becomes a secret something like I$1234, is unrelated to Complex[0,1] or I, even though they print exactly the same way. This totally misses the point of the discussion, which is the illogical consequences of the current treatment of the symbol I vs. the constant, which also appears to be compound object as well as having the appearance of a function -- of Complex[0,1]. RJF
- References:
- Re: More /.{I->-1} craziness, con brio
- From: Richard Fateman <fateman@cs.berkeley.edu>
- Re: More /.{I->-1} craziness, con brio