Re: Testing Mathematica Expressions?
- To: mathgroup at smc.vnet.net
- Subject: [mg106614] Re: Testing Mathematica Expressions?
- From: Noqsi <jpd at noqsi.com>
- Date: Mon, 18 Jan 2010 02:36:38 -0500 (EST)
- References: <hiuusd$92o$1@smc.vnet.net>
On Jan 17, 5:13 am, AES <sieg... at stanford.edu> wrote: > 5) Is ToExpression["exprx"] /. ruleOne really exactly the same thing > (or, will it produce exactly the same results) as exprx /. ruleOne? That you even ask this question shows that you simply haven't done your homework. Please study the tutorials listed at: tutorial/ExpressionsOverview in the Documentation Center. Many programming systems (including Mathematica) feature powerful string pattern and replacement capabilities. The most common approach is so-called "regular expressions", which after >40 years of refinement are extremely flexible and powerful for text processing. In principle, they could be used for computer algebra, but in practice they are impractical. The amusing http://blog.stevenlevithan.com/archives/algebra-with-regexes starts out "Regexes suck at math". In Mathematica, Replace[] is not the same as StringReplace[]. Indeed, they are very different, and their application areas are almost disjoint. Computer algebra is necessarily more formal and mechanical than human algebra. Wolfram has done a great job of presenting the underlying structures in a comprehensible way to a human user, but there are practical limits. And often, as a human user, you need to access that formal, mechanical level to unambiguously program Mathematica for particular tasks, so completely hiding it would be a disaster. The checkered history of generalized functions in Mathematica should serve as a cautionary example to those who believe that attempting heuristic decoding of user intentions is a good idea in any but the shallowest situations. See: http://forums.wolfram.com/mathgroup/archive/2009/Jun/msg00180.html for further discussion of this issue.