Re: More /.{I->-1} craziness
- To: mathgroup at smc.vnet.net
- Subject: [mg106555] Re: More /.{I->-1} craziness
- From: AES <siegman at stanford.edu>
- Date: Sat, 16 Jan 2010 06:11:27 -0500 (EST)
- Organization: Stanford University
- References: <200912300915.EAA17299@smc.vnet.net> <hhhmn8$o9t$1@smc.vnet.net> <hhpl28$9lf$1@smc.vnet.net> <hip8gf$t4d$1@smc.vnet.net>
> In article <hhpl28$9lf$1 at smc.vnet.net>, > Leonid Shifrin <lshifr at gmail.com> wrote: > > > > > I stick to my view of replacement rules as being aimed primarily at advanced > > users, or at least as a tool that should be used with much care. And one or two other responses in this thread have suggested that users should be given advanced training in the functioning and fine details of ReplaceAll before they even begin to use Mathematica. This latter proposal strikes me as a really crazy proposition, and essentially impossible in the real world. Suppose an instructor of EE or physics undergraduates in an already crammed and time-limited introductory network analysis or mechanics course starts by going through some simple phasor analyses of linear electric circuits or coupled mechanical systems with one or two resonances "by hand". Then, as take-home exercises, the students are asked to analyze and plot some 3 or 4 or 5-resonance cases using Mathematica and Manipulate (which can be a very pleasant as well as educational experience) but to do this the students first have to have a training course on Mathematica at the level suggested above? Not gonna happen. Or, as a broader approach, suppose that training in Mathematica at this level is going to be expected or required (before or after admission) of all incoming college students who might go into any Mathematica-using field of study, before they can take meaningful courses in that field? Not gonna happen. In any case, waking up this morning after reading 60 or 70 posts in this thread last night I realized that in 20+ years of using Mathematica I've always had a mental model of ReplaceAll as being essentially an **editing** tool, rather than a "mathematical" tool (whatever interpretation you might give to mathematical in that phrase). When I typed in f = expr /. rule, I expected that rule would be applied to expr as I originally typed it in -- or, better, to expr as Mathematica played it back to me in an Output cell when I typed it in earlier (very hard to argue with this latter interpretation, is it not?). Only then would that edited version of expr be evaluated and assigned to f. Isn't this more or less how the Find and Replace All capabilities function in every other ordinary software program known to man? (And isn't it how the construct /. almost always in fact functions, regardless of what internal shenanigans Mathematica goes through in processing it?) And as a final query: Is there a formal name in Mathematica for the string of characters that one types in and then sees in an Input cell before (and after) one hits the Enter key? Referring both to this character string and to the internal representation of this input string inside Mathematica as an "expression" -- in fact, the same expression -- is certainly a recipe for confusion, in debate and in understanding.