From: David Steuber
Subject: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <87ll0f4p64.fsf@david-steuber.com>
I thought this topic deserved its own dedicated thread.

I've already concluded to my own satisfaction that prefix notation is
superior to prefix notation for math operations in most cases.  About
the only exceptions I can think of have to do with the verbosity
penalty that is sometimes introduced by prefix notation.  In exchange,
there are never any precedence rules to worry about and (sin x) is
treated just like (+ x).

Mostly what I hear about infix notation is that it is "more natural".
Is infix notation really more natural?  I don't think it really is.  I
think it's just more popular.  There is a difference.

In my early days learning math, sums were the first thing taught after
counting.  Addition was typically represented something like this:

   123
  +456
   ---
   579

Subtraction and multiplication were similar.  Division got a bit weird
though with this odd notation:

     6
   -----
  7|42

Real infix didn't show up until stuff like, "figure out what x is."

3x + 4 = 10

At this point, we would be given a set of rules for solving such a
problem.  It doesn't seem to be an accident that the words algebra and
algorithm share common ancestry.

This is just the Arabic numbering system.  There have been others.  I
still see Roman numerals used (why do they do that?).  Other
civiliztions have had different numbering systems.  I don't know how
many are remembered by history and the sorts of operations that were
conducted in those systems.  But I think it is safe to say that there
is no "natural" way for humans to express math.

-- 
http://www.david-steuber.com/
The UnBlog: An island of conformity in a sea of quirks.
The lowest click through rate in Google's AdSense program.
----------------------------------------------------------------------

From: M Jared Finder
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <aYGdnTWa2JRszf3eRVn-3A@speakeasy.net>
David Steuber wrote:
> I thought this topic deserved its own dedicated thread.
> 
> I've already concluded to my own satisfaction that prefix notation is
> superior to prefix notation for math operations in most cases.  About
> the only exceptions I can think of have to do with the verbosity
> penalty that is sometimes introduced by prefix notation.  In exchange,
> there are never any precedence rules to worry about and (sin x) is
> treated just like (+ x).
> 
> Mostly what I hear about infix notation is that it is "more natural".
> Is infix notation really more natural?  I don't think it really is.  I
> think it's just more popular.  There is a difference.

I find it obvious that infix notation is inferior to prefix by just 
looking at what I actually write down.  I write infix notation for only 
one thing -- basic mathematics.  Everything else I write down in prefix.

That's enough proof for me that prefix is better.  There's nothing 
fundamentally different between (+ 1 3) and (paint widget window), so 
the only reason I can see myself using infix for one is out of habit.

   -- MJF
From: ·············@yahoo.com
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130395442.647574.58610@f14g2000cwb.googlegroups.com>
Not that I can provide a really good argument, but I must say that
having used for several years an HP RPN  calculator (which is something
like a postfix lisp without parenthesis on a pure stack machine),
whenever I need to go back to a "normal" infix calc I feel deeply
depressed because of the "unnaturality" and lack of power of a such
notation.

And sure, since as you say, there is no natural way for humans to
express math let's simply pick the most powerful notation or the most
easily parseable? I believe that that is exactly the prefix notation.

DT
From: Harald Hanche-Olsen
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <pcoslunctb0.fsf@shuttle.math.ntnu.no>
+ ·············@yahoo.com:

| And sure, since as you say, there is no natural way for humans to
| express math let's simply pick the most powerful notation or the
| most easily parseable? I believe that that is exactly the prefix
| notation.

Will you volunteer to rewrite every mathematics text ever written to
prefix notation?  (Hint: Next time you're visiting a major university
with a good math department (if you're not already in one), take a
look in the math library and let your mind boggle at the amount of
shelf space taken up by journals and monographs.)  We'd better leave
mathematics notation just the way it is, for the sake of backwards
compatibility. Yes, mathematicians routinely read papers more than 100
years old.

Occasionally, someone comes along to suggest much more modest changes
to mathematical notation, such as writing function application on the
right.  I.e., (x)f instead of the usual f(x).  It has the advantage
that the function composition operator ∘ can now be given a more
natural interpretation: f∘g now means "apply f first, then g", as in
the formula (x)(f∘g)= ((x)f)g.  But even that is too much: It never
caught on, and I'm glad it didn't.  There are enough minor annoying
differences of conventions in mathematics already, as in the various
constants used in the treatment of the exterior product.

[I apologize if my use of a Unicode character in the previous
 paragraph renders it unreadable for some.  If it happened to you,
 replace f∘g by fog, where the o really should be a small circle
 suspended above the baseline of the text.  I am posting this using
 the unicode branch of emacs right out of CVS, and I just couldn't
 resist showing off its capabilities.]

But of course, programming languages are another kettle of fish
altogether, and there at least I agree that the prefix notation seems
superior.  And I too, like my old HP calculator and its RPN notation.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
  than thinking does: but it deprives us of whatever chance there is
  of getting closer to the truth.  -- C.P. Snow
From: Harald Hanche-Olsen
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <pcomzkueot6.fsf@shuttle.math.ntnu.no>
+ ······@earthlink.net:

| Harald Hanche-Olsen wrote:
|> Will you volunteer to rewrite every mathematics text ever written to
|> prefix notation?
|
| Since programming isn't math,

which was my point too, at the end of my post.

| this a curious request.

I understood the previous poster as advocating that we change the math
notation, not only for programming but for all mathematics.  In this
context, it is not such a strange request.

| If you're going to insist that programming and math use a common
| notation system,

I'm not insisting.  I stated the opposite.

| Math is done with a fairly impoverished set of operators compared
| to programming AND programming is much less tolerant of ambiguity.
| It shouldn't be suprising that the "best" notations would be different.

I might quibble about the "fairly impoverished" bit, but find I am not
in the mood.  As for the rest, I totally agree.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
  than thinking does: but it deprives us of whatever chance there is
  of getting closer to the truth.  -- C.P. Snow
From: Cruise Director
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130495291.833561.70710@o13g2000cwo.googlegroups.com>
Harald Hanche-Olsen wrote:
> + ······@earthlink.net:
>
> | Harald Hanche-Olsen wrote:
> |> Will you volunteer to rewrite every mathematics text ever written to
> |> prefix notation?
> |
> | Since programming isn't math,
>
> which was my point too, at the end of my post.

But the problem is, in many problem domains, programming *is* math.
It's certainly math anytime I worry about 3D graphics.  People who are
used to doing their equations "the way they learned it in school" often
find prefix notation *very* annoying.  Maybe they can be retrained,
especially if they're forced, or for some reason decide that it's
"neato."  But we should be wary of preaching to the prefix choir here.
It's a training, adoption, and installed base issue.

It's similarly problematic to statements like, "Wow, I really like
Lisp!  Lisp is so cool!  Why don't more people like Lisp??  What is
wrong with them??!?"  Well, usually because would-be converts are
receiving no training whatsoever in Lisp's perceived advantages, and
are readily experiencing its liabilities.  Such as, they don't know how
to use it already, in some instances their platform tools are disparate
and underfeatured, and it may not immediately fit their problem
domains.  Sure, if they acquire guru programming knowledge they can
ultimately write their own Domain Specific Languages, solving that
conundrum.  But a lot of people don't actually want to; they want to
get on with their *real* problems.  I think it would be illuminating to
have this debate again in a Mathematica forum and see what
mathematicians have to say about prefix vs. infix vs. postfix notation.


Cheers,
Brandon Van Every
15 minute famous signature gatherer
http://www.thestranger.com/seattle/Content?oid=23827
From: Cameron MacKinnon
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <T7-dnc3HYOrr2P_eRVn-tA@rogers.com>
Cruise Director wrote:
> But the problem is, in many problem domains, programming *is* math.
> It's certainly math anytime I worry about 3D graphics.  People who are
> used to doing their equations "the way they learned it in school" often
> find prefix notation *very* annoying.  Maybe they can be retrained,
> especially if they're forced, or for some reason decide that it's
> "neato."  But we should be wary of preaching to the prefix choir here.
> It's a training, adoption, and installed base issue.

Other things such people may find annoying (and not just in Lisp):
   - having to use * rather than x, dot or mere adjacency for 
multiplication, != and == for equality tests, etcetera
   - having to swap the digit separator with the decimal point
   - machine integer overflow and wraparound
   - having to reorder operations to maintain FP precision

As others have pointed out, infix math notation is available for Lisp, 
for those who want it. And it's much simpler to implement than prefix or 
postfix math for other languages.

People who are annoyed at the prospect of notation changes and who want 
to believe that typical computer math is just like the math they learned 
in school may not be the best candidate programmers. Perhaps, by weeding 
them out before they go on to implement code that exhibits typical 
newbie computer-numerics lossage, we're doing software users everywhere 
a favour?
From: Cruise Director
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130535692.730453.5180@o13g2000cwo.googlegroups.com>
Cameron MacKinnon wrote:
>
> People who are annoyed at the prospect of notation changes and who want
> to believe that typical computer math is just like the math they learned
> in school may not be the best candidate programmers. Perhaps, by weeding
> them out before they go on to implement code that exhibits typical
> newbie computer-numerics lossage, we're doing software users everywhere
> a favour?

No, you'd be cutting your 3D graphics nose to spite your Lisp face.
One thing I find very tiring about FP communities in general, is the
provinciality of people's problem domains.  It's like, "Well, I bang on
text files, databases, and XML all day long.  What's so important about
math?"  There's a reason there aren't any open source Lisp or Scheme 3D
engines and so forth.  The attention went elsewhere... here I am
speaking of the provinciality problem, not prefix vs. infix per se.

You could substitute provinciality for arrogance, it's the same
problem.


Cheers,
Brandon Van Every
15 minute famous signature gatherer
http://www.thestranger.com/seattle/Content?oid=23827
From: Dr Jon D Harrop
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130540336.320712.141020@g49g2000cwa.googlegroups.com>
> As others have pointed out, infix math notation is available for Lisp,
> for those who want it. And it's much simpler to implement than prefix or
> postfix math for other languages.

In SML and OCaml, you do:

  (+) 1 2

In C, C++, Java, C# etc. you define a function

  int add(int i, int j) { return i+j; }
From: Pascal Bourguignon
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <873bmlvs7q.fsf@thalassa.informatimago.com>
"Cruise Director" <···········@gmail.com> writes:
> But the problem is, in many problem domains, programming *is* math.
> It's certainly math anytime I worry about 3D graphics.  People who are
> used to doing their equations "the way they learned it in school" often
> find prefix notation *very* annoying.  Maybe they can be retrained,
> especially if they're forced, or for some reason decide that it's
> "neato."  But we should be wary of preaching to the prefix choir here.
> It's a training, adoption, and installed base issue.

Of course.  That's why there's f2cl.


-- 
"I have challenged the entire quality assurance team to a Bat-Leth
contest.  They will not concern us again."
From: John Thingstad
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <op.szcwdcuopqzri1@mjolner.upc.no>
On Fri, 28 Oct 2005 12:28:11 +0200, Cruise Director  
<···········@gmail.com> wrote:

  But a lot of people don't actually want to; they want to
> get on with their *real* problems.  I think it would be illuminating to
> have this debate again in a Mathematica forum and see what
> mathematicians have to say about prefix vs. infix vs. postfix notation.
>
>
> Cheers,
> Brandon Van Every
> 15 minute famous signature gatherer
> http://www.thestranger.com/seattle/Content?oid=23827
>

Why don't you just write a infix parser?
It's only a day's work. Less if you use the guidelines of Peter Norvig.
Keep functions prefix and use infix for +-*/.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Arthur Lemmens
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <opszcxnmjqk6vmsw@news.xs4all.nl>
John Thingstad wrote:

> Why don't you just write a infix parser?
> It's only a day's work. Less if you use the guidelines of Peter Norvig.

Five minutes if you use one of the existing parsers, like the one
written by Mark Kantrowitz.
From: drewc
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <X0y8f.331247$oW2.312987@pd7tw1no>
Cruise Director wrote:
> Harald Hanche-Olsen wrote:
> 
>>+ ······@earthlink.net:
>>
>>| Harald Hanche-Olsen wrote:
>>|> Will you volunteer to rewrite every mathematics text ever written to
>>|> prefix notation?
>>|
>>| Since programming isn't math,
>>
>>which was my point too, at the end of my post.
> 
> 
> But the problem is, in many problem domains, programming *is* math.
> It's certainly math anytime I worry about 3D graphics.  People who are
> used to doing their equations "the way they learned it in school" often
> find prefix notation *very* annoying.

Oh c'mon .. this is bullshit. In school i learned that 1+1=2 . The 
computer thinks 1+1=11, because it operates in base 2, and i was taught 
base 10. And i sure as hell was never taught that A + B = 21.

While there is math involved in programming, it is very different from 
the maths i was taught in school. If anything, expecting the two to work 
the same is the cause of many errors (for example, (1.3 - 2) + 1.3 .. i 
was taught that this is equal to 0.6. my computer seems to think that 
0.59999999 is close enough.) People used to standard (fixed point) math 
would find this *very* annoying. Programming *is* math? Perhaps at the 
lowest levels, but i prefer HLLs to slinging bits around.

If the math is different, perhaps the notation should be as well.

And of course, here you are talking in the complete abstract. "people", 
"they"... who are these people? Why do you care what they think about 
prefix vs. infix? Why should we cater to these "people", when we believe 
that their (your?) opinion is wrong, or at least uninformed.

I personally find myself doing calculations (back-of-the-envelope type 
stuff) in prefix, simply because i am used to it. I get the same 
results. I actually find infix math *very* annoying now. Should i go 
troll the math forums now?

anyways, appeal to authority, tyranny of the majority ... i call bullshit.

-- 
Drew Crampsie
drewc at tech dot coop
  "... the most advanced use of lisp in the field of bass lure sales"
	-- Xach on #lisp
From: Dr Jon D Harrop
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130540675.835140.265750@g14g2000cwa.googlegroups.com>
> The computer thinks 1+1=11,

:-)

> If the math is different, perhaps the notation should be as well.

That is also a valid argument against the "numeric tower". Why try to
provide a consistent interface for the type "number" when different
numerical representations (e.g. int and float) have different
properties?
From: Cruise Director
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130567958.374689.65510@g14g2000cwa.googlegroups.com>
Dr Jon D Harrop wrote:
> > The computer thinks 1+1=11,
>
> :-)

BTW that's wrong.  The computer thinks 1+1=10.

In a possibly unrelated vein, I learned to multiply and divide binary
numbers at age 11, in 6th grade.  I had just moved to another part of
the country, they had misplaced me in a math class for dummies, and so
they got me a tutor.  Back then, "programming" meant learning all the
numbers in a 64K Atari 800 memory map, and what happened when you
PEEKed and POKEd to them.  I can of course recite powers of 2^0 through
2^16.  Assembly programming is still the only language I've really
loved.

Now given all of this, I still would much rather use infix notation for
most of my linear algebra.  When you've become very, very productive
scribbling things out on paper in a certain way, you don't like it when
people screw with your productivity.  I'll let you know if someday I
recant, if retraining due to Scheme eventually takes hold, but so far
it hasn't.  I'm more inclined to learn how to use macros properly, to
get rid of the problem.

The only other kind of operational notation I've been interested in, is
ASM scheduling on quad-ruled graph paper.  There it's usually * and +
laid out either horizontally or vertically, possibly with registers
running alongside them if the register packing is critical, but equally
often elided.  The point is, if I'm not interested in "linguistic
infix" expression, I'm interested in 2D layout expression.

Some people have observed that massaging the 2D layout, via extra
newlines and tabs, is how the unreadability of Lisp parentheses is
actually cleaned up.

So my question to prefix bigots is, whose training rituals are you
going to advocate?  I think the answer should be more inclusive than
"yours."


Cheers,
Brandon J. Van Every
    (cruise (director (of SeaFunc)
            '(Seattle Functional Programmers)))
http://groups.yahoo.com/group/SeaFunc
From: Cruise Director
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130566941.202812.302170@g14g2000cwa.googlegroups.com>
drewc wrote:
> Cruise Director wrote:
> >
> > But the problem is, in many problem domains, programming *is* math.
> > It's certainly math anytime I worry about 3D graphics.  People who are
> > used to doing their equations "the way they learned it in school" often
> > find prefix notation *very* annoying.

Note the qualifiers "people who..." and "...often...."

> Programming *is* math? Perhaps at the
> lowest levels, but i prefer HLLs to slinging bits around.

So what problem domains do you regularly engage in?  Mine are either 3D
graphics or game AI.  For 3D graphics, I would prefer that the syntax
of my language be as close to what I scribble in my quad-ruled
pen-and-paper notebooks as possible.  In fact, I would very much prefer
a tablet computer with aggressive symbol recognition so that I didn't
have to translate paradigms at all, but we aren't quite in that epoch
yet.

> anyways, appeal to authority, tyranny of the majority ... i call bullshit.

I'm thinking you aren't sensitive to standard liberal arts qualifiers,
such as I gave.


Cheers,
Brandon J. Van Every
    (cruise (director (of SeaFunc)
            '(Seattle Functional Programmers)))
http://groups.yahoo.com/group/SeaFunc
From: Vesa Karvonen
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <djudfo$aon$1@oravannahka.helsinki.fi>
drewc <·····@rift.com> wrote:
> [...] The computer thinks 1+1=11, because it operates in base 2 [...]

In base 2, 1+1=10.

-Vesa Karvonen
From: drewc
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <HXy8f.331306$oW2.290119@pd7tw1no>
Vesa Karvonen wrote:
> drewc <·····@rift.com> wrote:
> 
>>[...] The computer thinks 1+1=11, because it operates in base 2 [...]
> 
> 
> In base 2, 1+1=10.

Doh! (i gotta stop posting first thing when i wake up, esp. when waking 
up after a 16 hour hackathon :) )

drewc


> -Vesa Karvonen


-- 
Drew Crampsie
drewc at tech dot coop
  "... the most advanced use of lisp in the field of bass lure sales"
	-- Xach on #lisp
From: Ivan Boldyrev
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <kjih33-fle.ln1@ibhome.cgitftp.uiggm.nsc.ru>
On 9277 day of my life ·····@rift.com wrote:
>> But the problem is, in many problem domains, programming *is* math.
>
> Oh c'mon .. this is bullshit. In school i learned that 1+1=2.

But you studied just basic arithmetics.  It is part of math, but it is
not a whole math.

> While there is math involved in programming, it is very different from 
> the maths i was taught in school. If anything, expecting the two to work 
> the same is the cause of many errors (for example, (1.3 - 2) + 1.3 .. i 
> was taught that this is equal to 0.6. my computer seems to think that 
> 0.59999999 is close enough.)

You studied only tiny part of arithmetics.  You touched leg of
elephant in dark, and you conclude that elephant is just a pillar,
don't you?

Math is not about numbers.  It is much, much, much more general.

-- 
Ivan Boldyrev

                      Ok people, move along, there's nothing to see here.
From: Steven M. Haflich
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <QPh8f.22259$6e1.13978@newssvr14.news.prodigy.com>
M Jared Finder wrote:

> I find it obvious that infix notation is inferior to prefix by just 
> looking at what I actually write down.  I write infix notation for only 
> one thing -- basic mathematics.  Everything else I write down in prefix.

I believe the OP may be ignorant of the fact that arithmetic is a
solved problem, and has been for many hundreds of years.

Algorithms are not a completely solved problem (there are proofs
that they never will be) and this is evidence that the infix/prefix
questions should be considered with regard to algorithms, not
arithmetic.
From: Harald Hanche-Olsen
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <pcozmouno1f.fsf@shuttle.math.ntnu.no>
+ "Steven M. Haflich" <···@alum.mit.edu>:

| I believe the OP may be ignorant of the fact that arithmetic is a
| solved problem, and has been for many hundreds of years.

You might wish to inform the editors of Acta Arithmetica of this
fact.  (http://journals.impan.gov.pl/aa/)


(no! no! don't! this is a joke! (though perhaps not a funny one))

It's all a question of what you consider to be arithmetic, of
course. AA is about number theory, which is not arithmetic (in the
sense of algorithms to add and multiply numbers) but is very much
related to arithmetic.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
  than thinking does: but it deprives us of whatever chance there is
  of getting closer to the truth.  -- C.P. Snow
From: George Neuner
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <f2n0m1563548lccsv6g6d4q3g2b2947d5l@4ax.com>
On 26 Oct 2005 23:25:07 -0400, David Steuber <·····@david-steuber.com>
wrote:

>Mostly what I hear about infix notation is that it is "more natural".
>Is infix notation really more natural?  I don't think it really is.  I
>think it's just more popular.  There is a difference.

Regardless of a child's native language and regardless of how the
thought is verbally expressed, much of a child's early thinking is
done in infix form: "I want ..." 

Two thoughts ...

When dealing with young children, it is normal to first draw attention
to objects and then demonstrate actions.  Repetitive exposure to that
sequence may result in a learned bias toward "object verb" syntax
which does makes infix seem more natural.

In English [and also in German if my grandfather was an indication]
the prefix form is the one most often used for scolding and for
teenager interrogation.  Either may explain certain individuals'
reflexive aversion to that form ;-)

George
--
for email reply remove "/" from address
From: ·······@gmail.com
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130397859.078631.314590@g44g2000cwa.googlegroups.com>
The "I want ..." construct is a byproduct of the fact that English (and
German) are subject-verb-object (SVO) languages. I doubt it exists in
children raised with VSO likes like Hebrew. Of course, when dealing
with small children, I think its safe to say that the subject 'I' is
usually implied, in which case the constructs become VO ("want ball",
"want toy", "want ice cream"), which is quite Lisp-y :)
From: George Neuner
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <sij3m1lmt15iaqkhcvkh6chba95jel79rq@4ax.com>
On 27 Oct 2005 00:24:19 -0700, ·······@gmail.com wrote:

>The "I want ..." construct is a byproduct of the fact that English (and
>German) are subject-verb-object (SVO) languages. I doubt it exists in
>children raised with VSO likes like Hebrew. Of course, when dealing
>with small children, I think its safe to say that the subject 'I' is
>usually implied, in which case the constructs become VO ("want ball",
>"want toy", "want ice cream"), which is quite Lisp-y :)

The implied pronoun ("I" in the examples above) is what's known in
English grammar as an "understood subject".  When deconstructing the
sentence for meaning, the existence of the implied pronoun has to be
taken into consideration.  If the subject is implied, there is no way
to tell whether "want ball" is SVO or VSO ... all you say about it is
that the verb precedes the object.  

Besides which, I have doubts that either the kind or ordering of
abstraction in one's native language really affects thinking.  I'm not
a cognitive language expert, but I suspect many perceived differences
in thinking are caused after the fact by language determining the ways
in which thought can expressed.

In other words, I don't think I think in English ... I think I merely
express my thoughts in English.

George
--
for email reply remove "/" from address
From: Rob Warnock
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <14qdnQJOFfZ6UP_eRVn-iQ@speakeasy.net>
George Neuner  <·········@comcast.net> wrote:
+---------------
| The implied pronoun ("I" in the examples above) is what's known in
| English grammar as an "understood subject".  When deconstructing the
| sentence for meaning, the existence of the implied pronoun has to be
| taken into consideration.
+---------------

Ah, yezz... The (in)famous [in the U.S.] "Got milk?" adverts...  ;-}


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: vishnuvyas
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130496496.234392.180840@o13g2000cwo.googlegroups.com>
George Neuner wrote:

> which does makes infix seem more natural.
Except for yoda that is..
From: Cruise Director
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130536086.440462.298870@f14g2000cwb.googlegroups.com>
vishnuvyas wrote:
> George Neuner wrote:
>
> > which does makes infix seem more natural.
> Except for yoda that is..

For Yoda natural speech this is.  Explain you he can.  OSV it is.
Infix it is not.  Only infix in your mind!  You must unlearn, what you
have learned.


Yoda (I am)
From: David Steuber
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <87mzkutwjn.fsf@david-steuber.com>
David Steuber <·····@david-steuber.com> writes:

> I've already concluded to my own satisfaction that prefix notation is
> superior to prefix notation for math operations in most cases.

Ugh.  I meant "prefix notation is superior to infix notation"
obviously.  And I am of course just referring to notation used in
programming languages until some input device better than the keyboard
comes along.

-- 
http://www.david-steuber.com/
The UnBlog: An island of conformity in a sea of quirks.
The lowest click through rate in Google's AdSense program.
----------------------------------------------------------------------
From: Pisin Bootvong
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130470559.241589.63200@z14g2000cwz.googlegroups.com>
David Steuber wrote:
> I thought this topic deserved its own dedicated thread.
>
> I've already concluded to my own satisfaction that prefix notation is
> superior to prefix notation for math operations in most cases.  About
> the only exceptions I can think of have to do with the verbosity
> penalty that is sometimes introduced by prefix notation.  In exchange,
> there are never any precedence rules to worry about and (sin x) is
> treated just like (+ x).
>
> Mostly what I hear about infix notation is that it is "more natural".
> Is infix notation really more natural?  I don't think it really is.  I
> think it's just more popular.  There is a difference.
>
> In my early days learning math, sums were the first thing taught after
> counting.  Addition was typically represented something like this:
>
>    123
>   +456
>    ---
>    579
>
> Subtraction and multiplication were similar.  Division got a bit weird
> though with this odd notation:
>
>      6
>    -----
>   7|42
>
> Real infix didn't show up until stuff like, "figure out what x is."
>
> 3x + 4 = 10
>
> At this point, we would be given a set of rules for solving such a
> problem.  It doesn't seem to be an accident that the words algebra and
> algorithm share common ancestry.
>
> This is just the Arabic numbering system.  There have been others.  I
> still see Roman numerals used (why do they do that?).  Other
> civiliztions have had different numbering systems.  I don't know how
> many are remembered by history and the sorts of operations that were
> conducted in those systems.  But I think it is safe to say that there
> is no "natural" way for humans to express math.
>
> --
> http://www.david-steuber.com/
> The UnBlog: An island of conformity in a sea of quirks.
> The lowest click through rate in Google's AdSense program.
> ----------------------------------------------------------------------

I'm having a question if using infix notation to solve equation such
as:

3x + 4 = 10

is such a good idea after all.

When I was first taught about solving 1 variable equation, many student
made some silly mistake like forgetting to divide the whole expression,
but only part of expression.

So in stead of canceling out 3 by

(3x + 4)/3 = 10/3

sometimes the mistake is

3x/3 + 4 = 10/3

But if we use prefix notation the equation would become:

(+ (* 3 x) 4) == 10   ;;  == is still there to separate two side of the
equation.

And one can obviously see that (- 4) operation should be done first,
with the parentheses hilighting the precedence of expression.

Just my humble 2 cents.
From: Dr Jon D Harrop
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130492971.847296.83600@g43g2000cwa.googlegroups.com>
The superfluous parentheses resolved the apparent ambiguity, not prefix
notation.

Cheers,
Jon.
From: Pisin Bootvong
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130497741.271308.180720@z14g2000cwz.googlegroups.com>
Partly so, but you could also see the step of what to solve out first
clearer.
From: ··············@gmail.com
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130504275.486511.117210@g43g2000cwa.googlegroups.com>
Dr Jon D Harrop wrote:
> The superfluous parentheses resolved the apparent ambiguity, not prefix
> notation.

If the parenthese made the notation unambiguous and thus less error
prone, why are they superfluous?
From: Dr Jon D Harrop
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130540077.414692.327480@f14g2000cwb.googlegroups.com>
I said "apparent ambiguity" because the expression is not actually
ambiguous, i.e. the parentheses really are superfluous.
From: vishnuvyas
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <1130540456.246989.152890@g49g2000cwa.googlegroups.com>
Dr Jon D Harrop wrote:
> I said "apparent ambiguity" because the expression is not actually
> ambiguous, i.e. the parentheses really are superfluous.

so what does this expression supposed to mean without paranthesis
 + 3 5 * 7 8 9
 (+ 3 5 (* 7 8 9)) or (+ 3 5 (* 7 8) 9) ?

  or should we all be constrained with a binary + and * ?

cheers
Vishnu Vyas
From: Marcin 'Qrczak' Kowalczyk
Subject: Re: Please Excuse My Dear Aunt Sally: Prefix vs Infix Math Notation
Date: 
Message-ID: <87d5lozm3l.fsf@qrnik.zagroda>
David Steuber <·····@david-steuber.com> writes:

> Mostly what I hear about infix notation is that it is "more natural".
> Is infix notation really more natural?  I don't think it really is.
> I think it's just more popular.  There is a difference.

I noticed that CLISP uses infix math in an apparently ad-hoc notation
in comments where it explains algorithms independently from the language.
Sometimes it's a mixture of infix math and Lisp, but infix prevails.
An example from clisp-2.34/src/realtran.d:

# F_atanx_F(x) liefert zu einem Float x (betragsm��ig <=1) atan(x) als Float.
# can trigger GC
  local maygc object F_atanx_F (object x);
# Methode:
# e := Exponent aus (decode-float x), d := (float-digits x)
# Bei x=0.0 oder e<=-d/2 liefere x
#   (denn bei e<=-d/2 ist x^2/3 < x^2/2 < 2^(-d)/2 = 2^(-d-1), also
#   1 >= atan(x)/x > 1-x^2/3 > 1-2^(-d-1),
#   also ist atan(x)/x, auf d Bits gerundet, gleich 1.0).
# Bei e<=-sqrt(d) verwende die Potenzreihe
#   atan(x)/x = sum(j=0..inf,(-x^2)^j/(2j+1)):
#   a:=-x^2, b:=1, i:=1, sum:=0,
#   while (/= sum (setq sum (+ sum (/ b i)))) do i:=i+2, b:=b*a.
#   Ergebnis x*sum.
# Sonst setze y := x/(1+sqrt(1+x^2)), berechne rekursiv z:=atan(y)
#   und liefere 2*z = (scale-float z 1).
# Diese Rekursion wird entrekursiviert. Statt k mal hintereinander
#   x := x/(1+sqrt(1+x^2)) zu bilden, arbeitet man lieber mit den Kehrwerten,
#   setzt also x := 1/|x|, dann k mal x := x+sqrt(x^2+1), dann x := +- 1/x.
# Aufwand: asymptotisch d^2.5 .

-- 
   __("<         Marcin Kowalczyk
   \__/       ······@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/