MathGroup Archive 2010

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

Search the Archive

Re: More /.{I->-1} craziness

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106204] Re: More /.{I->-1} craziness
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Tue, 5 Jan 2010 01:44:03 -0500 (EST)
  • References: <200912300915.EAA17299@smc.vnet.net> <hhhmn8$o9t$1@smc.vnet.net> <201001030840.DAA09997@smc.vnet.net> <hhshmg$kn7$1@smc.vnet.net>

  Does it bear repeating?

In f[x_]:= ...    the x_ is a pattern.

The reality in Mathematica programming is that this is NOT a function 
definition, but a replacement rule.  Contrary to Andrzej's opinion,
this is not "mathematical"   but is made up of exactly the same stuff as 
  Rules, with pattern matching and replacement.

It is a useful shorthand illusion that you are defining a function.
But it is an illusion.  Wolfram, in his earlier SMP, called these
Projections, but I guess that was just to confusing.

Here's a pattern-driven rule that describes how to replace f[something]:
f[x_]:=x+1

In contrast,
Mathematica DOES have functions. To define the (I think appx. same)
function as f above, you can do this:

f=#1+1&

and for people who wonder what this is, you can try it out and/or read 
the manual.

And as for when/if these are exactly the same, I think there would have 
to be some examination of the role of free and bound variables, the 
effect of "return" and other issues that, by and large, also cause 
confusion in the Mathematica context, since some ideas borrowed from 
well-understood programming concepts were not quite understood by the 
initial implementors of Mathematica.  I don't know if they have been 
patched correctly in the current system.



RJF


Andrzej Kozlowski wrote:
> On 3 Jan 2010, at 17:40, Vince Virgilio wrote:
>.....


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.

If you believe this then it seems that syntactic substitution would 
really be a weak tool in so much of applied mathematics, and you should
be seeking a better tool.

RJF


  • Prev by Date: Re: overimpose graphics on an imported image
  • Next by Date: Re: Wrong ODE solution in Mathematica 7?
  • Previous by thread: Re: Re: More /.{I->-1} craziness
  • Next by thread: Re: More /.{I->-1} craziness