Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Testing Mathematica Expressions?

  • To: mathgroup at
  • Subject: [mg106614] Re: Testing Mathematica Expressions?
  • From: Noqsi <jpd at>
  • Date: Mon, 18 Jan 2010 02:36:38 -0500 (EST)
  • References: <hiuusd$92o$>

On Jan 17, 5:13 am, AES <sieg... at> 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:


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
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

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:

for further discussion of this issue.

  • Prev by Date: Re: restricting interpolating functions to be positive
  • Next by Date: was Re: More /.{I->-1} craziness. Schools are conservative. So are
  • Previous by thread: Testing Mathematica Expressions?
  • Next by thread: Re: Testing Mathematica Expressions?