Re: Re: Replace and ReplaceAll -- simple application
- To: mathgroup at smc.vnet.net
- Subject: [mg105995] Re: [mg105982] Re: Replace and ReplaceAll -- simple application
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Wed, 30 Dec 2009 04:11:13 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200912270006.TAA12080@smc.vnet.net> <hh72dp$kud$1@smc.vnet.net> <hh9vfo$1rk$1@smc.vnet.net> <200912290618.BAA02632@smc.vnet.net>
- Reply-to: murray at math.umass.edu
Dpcumentation Center reference page for I, "More Information", FIRST bullet: "Numbers containing I are converged to the type Complex." And in the Examples section, subsectin "Possible Issues", 4th set of examples: "Complex numbers are atomic objects and do not explicitly contain I:" FullForm[2+I] Complex[2,1] This is not to contradict your assertion that it would be useful to give an explicit example that doing something like 2+3I /. I->-I does not in fact form the expected conjugate. But at least the documentation given does give some pause as to whether such an attempt might fail to work. On the other hand, not every possible issue can be addressed immediately at the top of documentation just because this or that user happened to experience some difficulty with it. Only gathering usage statistics, or having a focus group of users trying stuff, might suffice to escalate some issues to the point of requiring more prominent warnings. I wonder how many users in fact experience this issue. (Yes, I know a number have asked about the same thing here, but then of course one hears only from those for whom it was an issue, and not from those for whom it was not.) I can imagine, in fact, that a majority of users -- at least of relative novice users, might first think, "I want to take a conjugate; let me search the documentation how to do that -- I'll look up 'conjugate'." And, finding immediately the reference page for Conjugate, use that. AES wrote: > In article <hh9vfo$1rk$1 at smc.vnet.net>, > Richard Fateman <fateman at cs.berkeley.edu> wrote: > >> Scot T. Martin wrote: >>> The problem is that "-1." is not "1". > >> And furthermore, this bug has been declared a feature. And defended, >> repeatedly. Just as I does not occur in -I. >> It can be fixed, should be fixed, and has been fixed in other CAS. > > > I'll defer to Richard Fateman (and/or other computer algebra experts) as > to whether this general behavior (!! especially with respect to -I !!) > is a bug that should be fixed, or a feature. > > But if it's gonna be considered a feature in Mathematica, I'd strongly > suggest that it should be strongly **featured** or, if you like, it > should be warned about!! in the Mathematica documentation, especially > at the more elementary levels of documentation, **so that ordinary users > can't miss being warned about this unexpected behavior** > sorry, so that they can't miss being warned about "this feature". > > For example, right after the first line of the Help for I, which says > > I represents the imaginary unit Sqrt[-1]. > > there might be a warning line which says > > WARNING: I is a number and not a symbol. Attempting to replace > or reverse the sign of I using a rule, such as expr/.{I->-I) may > produce unexpected results if the expr contains -I. > > (By the way, note the wording above: "I represents", not "I is".) > > There are a very large number of other places in the Mathematica > documentation where emphasized WARNINGs like this would be helpful. > > (I suppose there could even be optional warning messages that appear any > time a cell executes a rule containing a number on the LHS of a > ReplaceAll symbol. And, the documentation for ReplaceAll could have an > initial WARNING message that it is not just the kind of Global Search > and Replace command that many ordinary users, familiar with many other > word processing and software apps, might well think it is. ) > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Replace and ReplaceAll -- simple application
- From: amannuc1 <Anthony.J.Mannucci@jpl.nasa.gov>
- Re: Replace and ReplaceAll -- simple application
- From: AES <siegman@stanford.edu>
- Replace and ReplaceAll -- simple application