From: R Fateman on
Leonid Shifrin wrote:
> Regarding this issue, I think I entirely agree with what David Bailey
> and other people said: I don't consider replacement rules as a
> mathematical tool for end users, but rather as an inner layer of
> Mathematica, which is also exposed for flexibility / convenience and
> intended primarily to be used by the more advanced users.

Unfortunately many users or potential users are not as sophisticated in
their understanding of the distinction between the underlying mechanisms
of a syntax-driven
transformation system. They simply take the marketing blurbs about "A
system for doing mathematics" as a description suggesting that --hey, I
do mathematics too. They don't really know what "syntax" means and they
don't think they need to know, because syntax is not part of their
mathematics education.

Now a person educated as a computer scientist would generally know a
fair amount about syntax, and might be willing to use
"A system that uses syntax-directed transformation rules for
computation". In fact there are several such systems that have been
designed, starting in the early 1960s. In deference to Steve C's
reluctance to allow the names of other computer systems to appear
in mathgroup, I won't name them. But at least 6 come to my mind.

I still don't understand the reluctance of people to say "OK,
mathematician-who-doesn't-know syntax" ... HERE's the substitution
facility for YOU.
and write the program. Or at least a first cut of one, so that it can
be refined.

In this way, they can implement some missing functionality themselves at
their own risk without the need to wait for a new Mathematica release.
It is stated in the documentation that rule substitution is purely
syntax-based, and therefore not guaranteed to always make sense.

It says that it won't always make sense? Hm. (I am traveling and don't
have Mathematica with me, and can't check...) Doesn't make sense?!
How could that be.. It must make sense to SOME people. Maybe even me or
you. So now there are more levels.
The high-priest, keeper of the mysterium(us?). The second level priest
who understands syntax but for whom some transformations "don't make
sense",a person who not a true syntax-geek. Perhaps this is the typical
programmer who learns some Mathematica....
The third level, maybe a skilled mathematician? The fourth level, some
novice, unsophisticated student learning math; and maybe down the
ladder further ?

RJF



From: Andrzej Kozlowski on

On 3 Jan 2010, at 17:41, Leonid Shifrin wrote:

> Hi Richard,
>
> Below I describe rather extensively my view on the issues you raised. J=
ust
> to make myself clear, it is not my intention to get involved in an endles=
s
> debate on these topics. I try to adhere to DRY (don't repeat yourself)
> principle whenever I feel appropriate, so I detail my view on these subje=
cts
> below with the intention to do it only once. But I will certainly appreci=
ate
> your feedback.
>
> On Sat, Jan 2, 2010 at 9:06 AM, R Fateman <fateman(a)cs.berkeley.edu> wrote=
:
>
>> Leonid Shifrin wrote:
>>
>>> Regarding this issue, I think I entirely agree with what David Bailey a=
nd
>>> other people said: I don't consider replacement rules as a mathematical=
tool
>>> for end users, but rather as an inner layer of Mathematica, which is al=
so
>>> exposed for flexibility / convenience and intended primarily to be used=
by
>>> the more advanced users.
>>>
>>
>> Unfortunately many users or potential users are not as sophisticated in
>> their understanding of the distinction between the underlying mechanisms=
of
>> a syntax-driven
>> transformation system. They simply take the marketing blurbs about "A
>> system for doing mathematics" as a description suggesting that --hey, I=
do
>> mathematics too. They don't really know what "syntax" means and they do=
n't
>> think they need to know, because syntax is not part of their mathematics
>> education.
>>
>
> Well, if these people don't understand the importance of syntax for doing
> any formal sicence, regardless of whether it is done by a human or a
> computer, and somehow believe that some software is able to completely
> automate this problem away without any further efforts on their side - =
too
> bad for them and their current and future employers. Every tool used blin=
dly
> will eventually produce nonsense. Mathematica is a research tool. I view =
it
> as a tool for explorations, tests, verifications and sometimes discoverie=
s,
> but not a substitute for domain knowledge, intuition, right questions to =
ask
> and anticipation for possible correct answers.


I would add this: if someone does not know what syntax is he should take some time off and read almost any introductory on mathematical logic. Need not be written by anyone who has anything to do with computer science and can be in fact pretty old.
The first example form my shelf: Yuri Manin "Lecture on Mathematical Logic" vol 1., Chapter I, Section 2, Language of propositions: alphabet, syntax and interpretation. (1974, in Russian but there is no shortage of equivalent English texts).

From: Andrzej Kozlowski on

On 3 Jan 2010, at 17:40, Vince Virgilio wrote:

> On Jan 2, 5:06 am, Leonid Shifrin <lsh...(a)gmail.com> wrote:
>> Regarding this issue, I think I entirely agree with what David Bailey and
>> other people said: I don't consider replacement rules as a mathematical tool
>> for end users, but rather as an inner layer of Mathematica, which is also
>> exposed for flexibility / convenience and intended primarily to be used by
>> the more advanced users. [ . . . ]
>
> SNIP
>
> Leonid,
>
> Replacement rules are as mathematical as 'Set' rules; to classify them
> otherwise would mislead. The simple difference between the two types
> of rules is that Replace is manual while Set is automatic. Both
> provide the math concept of 'function', and both can apply to
> structures that are non-mathematical. User discretion chooses between
> them. 'More advanced users' likely will find more uses for manual rule
> sets. On the other hand, they appear in Roman Maeder's introductory
> books. (Was it "Introduction to Programming in Mathematica"?)
>
> Vince Virgilio
>

I think certain special cases of Set rules and replacement rules are "mathematical". Certainly in mathematics you often evaluate functions and expressions, and this can be done in Mathematica by defining a functions as

f[x_]:=expr

and then evaluating f[a]. That's just an evaluation and something that mathematicians of course do all the time. The local version of this is, of course,
expr/.x->a
and that's essentially the same thing. But what is not in general "mathematical" is

f[some_pattern] := expr

or

expr/.some_pattern -> something

This kind of thing is rare in mathematics, and in fact, except for the
already discussed "function" case, I can't think of any "mathematical"
example. What is very common in mathematics is the sort of thing that
PolynomialReduce is for, which looks like "semantic substitution" but is
actually replacing a given expression by simpler one which is equivalent
to it by some equivalence relation. I think its not a great exaggeration
to say that most of applied mathematics consists of evaluation and most
of pure mathematics of studying the effect of various equivalence
relations on certain expressions. Neither has much in common with
general syntactic substitution.

Andrzej Kozlowski

From: Leonid Shifrin on
Hi Vince,


> Replacement rules are as mathematical as 'Set' rules; to classify them
> otherwise would mislead. The simple difference between the two types
> of rules is that Replace is manual while Set is automatic. Both
> provide the math concept of 'function', and both can apply to
> structures that are non-mathematical. User discretion chooses between
> them.


>From the formal viewpoint, I must agree. But my impression is that 'Set'
rules and local rules with Replace are usually used in different
circumstances. The most common use case for 'Set' rules is arguably when a
user defines and "calls" her own function(s), since the rule substitution is
used in Mathematica to emulate the semantics of function calls. Most of
occasional users are routinely doing that using the simplest patterns like
_, and having no idea that they are using rules. And as long as their
arguments' patterns are not much more complicated, this will work fine.

Using local rules requires more sophistication, since the cases where you
might want to do that rather than define a function through 'Set' will most
likely require more complex patterns for which the transformation you want
to perform will only make sense in a specific context. Or may be you want
for some reason to avoid the full evaluation procedure. Perhaps there are
other reasons as well, but all of them seem to be aimed at doing something
that can not be easily done by taking a number of built-in functions and
just using them together - that's why I think it requires a deeper
familiarity with Mathematica. The problem is that it is much easier to look
up the Help and write a complex pattern / replacement rule, than to learn to
consistently do that correctly. With the calls to functions ('Set' rules),
things seem to be more straightforward.


> 'More advanced users' likely will find more uses for manual rule
> sets. On the other hand, they appear in Roman Maeder's introductory
> books. (Was it "Introduction to Programming in Mathematica"?)
>

Perhaps a person who can read Maeder's book and fully understand it should
no longer be afraid of using rules. But it's not an easy read - you have to
read between the lines. I have lost count of the number of times I re-read
some parts of it, and almost every time I found things that escaped me
previously (may be the reason is just me being stupid - I don't know).
Perhaps "Zen of Mathematica programming" would be a better title for it. I
think that the word "Introduction" in the title is somewhat misleading
(although it is certainly an introduction - Zen again. I am a big fan of all
his books, by the way).

Regards,
Leonid

From: Fred Klingener on
On Jan 3, 3:37 am, DrMajorBob <btre...(a)austin.rr.com> wrote:
> I think the way we enter and understand InputForm is syntax; FullForm is
> the way they're stored internally.
>
> So Mathematica's pattern matching isn't what I'd call syntactical...
> unless you mean "syntactical on a hidden (though discoverable) level".
>
> Bobby
....

I studied the doc center entries for a few things like Replace,
ReplaceAll, etc. as well as tutorial/ApplyingTransformationRules, and
I was unable to find a single entry that might give what we're calling
an "unsophisticated user" a hint that the lhs to be acted on is
anything other than that displayed on the notebook screen.

I wouldn't describe myself as "unsophisticated," but my expectations
are conditioned and contaminated by almost 50 years of technical
computing. As a result, I've been a slow learner of the grand
structure of Mathematica, and I've spent my share of time astonished
by the way Mathematica works and confused by the lack of rewards to be
gained by RTFM.

A mention in the docs of replacement happening on Bobby's "syntactical
on a hidden (though discoverable) level" would be sufficiently
frightening to drive some users back to the hand calculator, but
further mention that that hidden level can be discovered even by an
"unsophisticated user" as the output of //FullForm would be like
sharing the secret handshake.

First line in tutorial/Applying TransformationRules:

expr/.lhs->rhs apply a transformation rule to FullForm[expr]

unless you don't want to share the secret handshake.

Cheers,
Fred



First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Prev: Persistent assumption
Next: Financial Data - Currencies