MathGroup Archive 2011

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

Search the Archive

Re: How do you read Mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118962] Re: How do you read Mathematica?
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Wed, 18 May 2011 07:14:39 -0400 (EDT)
  • References: <iqtna1$imk$1@smc.vnet.net>

On 5/17/2011 4:48 AM, Murray Eisenberg wrote:
> I'd much rather that Mathematica read as follows:
>
>     x = y         "x is set equal to y"
I think that's ok, although the meaning is probably not what it says.
If you have previously done this:  y=3
Then x=y would be  "x is set equal to the value of y [in this case, 3]"
There is no convenient way in Mathematica to distinguish the symbol y 
from its current value, because of the evaluation semantics.  x=Hold[y] 
is not, in my opinion, convenient, and how would you speak it in such a 
way as to make it meaningful in ordinary understandable English to 
someone unfamiliar with this part of Mathematica.
>     x == y        "x equals y"
Not necessarily.  x==y does not mean mathematically equal, because if x 
and y are approximate numbers, it might mean "too close to distinguish". 
  Also x==y  has (at least) two semantic versions depending on its context.
In Solve[Sin[x]==Cos[x],x]   the == mark does not mean that the left and 
right sides are equal, but means something like constructing a 
hypothetical equation that is valid under some binding of x.  But in 
3==4 the == mark means "test the equal-ness of the lhs and rhs" and 
return True, False, or maybe unevaluated.

>     x ===y        "x same as y"
Same has essentially no operational definition in Mathematica 
documentation, so it is not clear what this means.  If it were defined 
in some formal way, perhaps this would lead to a way to express it in 
slightly less formal English.  Some languages allow for equality to be 
tested as "numeric" equality, eg.  3 == 3.0.   or as "occupies the same 
location in memory" equality, or structure equality (as arrays with 
equal elements)

>     x /. y        "x where y"

I don't care for this one, but I'm not sure why. Maybe that it looks too 
much like   abs(x)=x where x>=0.
There really is an essential part of the meaning that "y" is a rule or 
set of rules.  Maybe  x after replacement by rules y  ?

Note that in addition to ReplaceAll  there is ReplaceRepeated (//.) 
which might be "x after replacement by rules y until no more changes 
happen".


>
> Or something of the kind. It's a bit tricky, because the exact,
> syntactically correct, way to say it may depend on the context.

I agree, and it is more than a bit tricky unless you use the words in 
the Mathematica toolkit as defined in Mathematica. It is probably not 
worth doing, because you would be inaccurate.

  Not only do you have problems with ReplaceRepeated, but even with 
ArcTan.  You could say that ArcTan[x]  is  "The arc tangent of eks"  but 
ArcTan[x,y] is
"The two-argument arc tangent of eks and why with the meaning of the two 
arguments reversed from the convention mathematical notation".
>
> And, more significantly, to render meaningfully in speech implies
> "understanding" the meaning, that is, being able to parse the
> expression. This would seem to be a whole level of complexity beyond
> what the speech engine at present does.

In that sense, a speech engine would have to explain what the 
Mathematical parsing and evaluation process entails, and this would 
certainly be difficult, and probably not worthwhile.  That's why speech 
rendering Mathematica using Mathematica terms as in FullForm is so 
appealing.  If you are curious about what the speech "ReplaceAll of eks 
and List of Rules ...." means, you can simply refer to the documentation 
of ReplaceAll.  For good or evil.
  But if you say  "x where List of rules y"  you must define "where" and 
that is, in my view, not feasible for all of Mathematica.


>
> On 5/16/2011 3:34 AM, Richard Fateman wrote:
>> I was not proposing that a user should write a program using
>> Mathematica's bletcherous Hold, HoldForm, TextForm, etc.
>>
>> I was suggesting that there is a simple solution available to the
>> programmer of the Speak command, which is to take the expression that it
>> is given and speak it in FullForm.
>>
>> Naturally one cannot utter   x/.x->y   as a command and expect it to
>> remain unevaluated, so Hold[]  or perhaps HoldForm[x/.x->y] probably
>> plays a role.
>>
>> The speak program in version 7.0 on Windows (which is the latest I have
>> access to), does a really poor job on something like f[a,b,c].  It
>> doesn't know how to pronounce "a" (as someone noted) or even "f" in this
>> context. It doesn't know how to pronounce ReplaceAll, either.
>>
>> The idea that mathematics can be spoken out loud requires only a few
>> tricks to implement, at least most of the way.  For example a teacher
>> writing math on a blackboard will often speak while writing.
>>
>> This is the language of (some of) Mathematica's DATA.
>>
>> Infix Mathematica command notation, the language of Mathematica's many
>> symbols, does not have a natural rendering as speech in any existing
>> conventional form, except where it coincidentally overlaps with
>> Mathematica DATA as conventional math expressions. Someone could come up
>> with such additional conventions, but Speak doesn't do it.
>>
>> Consider Speak[Hold[...]]   of these expressions:
>> x=y
>> x==y
>> x===y
>>
>> Would you rather have them rendered as
>> x equals y
>> x equals equals y
>> x equals equals equals y
>>
>> or as
>>
>> Set x y
>> Equal x y
>> SameQ x y
>>
>> I think this latter set is better.  It is sort of what FullForm
>> produces, which was my point, though it's actually
>> Set[x,y]
>> Equal[x,y]
>> SameQ[x,y]
>>
>>     Now you must verbalize the brackets and commas, in general, or somehow
>> operator precedences must be taken into account.  It is unlikely that
>> the ordinary Mathematica user has an accurate internal model of the
>> precedence of all the symbolic notation, so the brackets may be
>> necessary anyway.
>>      If you want to combine this with (say) ordinary rules of spoken
>> mathematical formulas like eks plus why   for x+y,  instead of
>> Plus[x,y], I think that can be done.
>>
>> By the way, a program to x+y out loud is (most likely) written by
>> traversing the internal form Plus[x,y] to render eks plus why, mirroring
>> the display program which, when traversing the internal form Plus[x,y]
>> displays x+y.
>>
>> So the program I've suggested, which uses FullForm, is SIMPLER than the
>> existing Speak program.  Though to do it right, would require
>> substantial fixes, like using (<spell>   a)  to render "Ayh" instead of
>> "ah". and figuring out f[a,b,c] as perhaps eff on 3 arguments ayh
>> <pause?>   Bee<pause?>   and See.
>> [not really satisfactory, but you get the idea]
>>
>> RJF
>>
>>
>>
>>
>>     On 5/15/2011 4:06 AM, Murray Eisenberg wrote:
>>> No, what you will get from
>>>
>>>       FullForm[x/. x->y]
>>>
>>> is _not_
>>>
>>>       ReplaceAll[x,Rule[x,y]]
>>>
>>> but rather just:
>>>
>>>       y
>>>
>>> To start getting FullForm, you need to use some Hold first.
>>>
>>> So suppose you evaluate
>>>
>>>       FullForm[Hold[x /. x ->    y ]]
>>>
>>> so as to obtain:
>>>
>>>       Hold[ReplaceAll[x,Rule[x,y]]]
>>>
>>> If you now try to Speak as input that last output, perhaps surprisingly
>>> you'll get:
>>>
>>> "Hold of the quantity x slash dot x goes to y"
>>>
>>>
>>> On 5/14/2011 3:08 AM, Richard Fateman wrote:
>>>>
>>>> ...As for reading Mathematica out loud, there is a simple solution that,
>>>> however, exposes the cryptic nature of Mathematica's syntax.
>>>> Simply read out loud the FullForm. That gives "words" for notation like /.
>>>>
>>>> Thus  x/. x->y  is
>>>>
>>>> ReplaceAll[x,Rule[x,y]].
>>>>
>>>> So all you need is a verbalization of [, ], and ",".
>>>
>>
>>
>



  • Prev by Date: Re: Points conditionnal Coloring
  • Next by Date: Re: Formatting Question
  • Previous by thread: Re: How do you read Mathematica?
  • Next by thread: Noticed now much improved response at Wolfram demonstrations.