Re: How do you read Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg118927] Re: How do you read Mathematica?
- From: Richard Fateman <fateman at cs.berkeley.edu>
- Date: Mon, 16 May 2011 03:34:53 -0400 (EDT)
- References: <iqoc3v$mb8$1@smc.vnet.net>
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 ",". >