运算符优先级的由来

今天(2013.4.15)是我第二次想到这个问题,上次不知道什么时候也想到过这个问题,不过没有仔细研究。我估计优先级顺序是由复杂度决定的,乘法比加法复杂,乘方比乘法复杂。今天上网找到一篇文章应该可以解决心头疑问,于是翻译了下来。


原文地址

http://mathforum.org/library/drmath/view/52582.html


The Order of Operations rules as we know them could not have existed 
before algebraic notation existed; but I strongly suspect that they 
existed in some form from the beginning - in the grammar of how people 
talked about arithmetic when they had only words, and not symbols, to 
describe operations. It would be interesting to study that grammar in 
Greek and Latin writings and see how clearly it can be detected.
 
 
我们现在所知道的运算符优先级规则是在代数符号出现以后出现的;但是我
怀疑它们在一开始的时候就以某种方式存在--最开始的时候没有符号,只能使用
语言来描述运算符,语言的语法里面蕴含了运算符的优先级。为此研究希腊文和
拉丁文是一件很有趣的事。
 
At the other end, I think that computers have influenced the subject, 
so that it is taught more rigidly now than it used to be, since 
programming languages have had to define how every expression is to be 
interpreted. Before then, it was more acceptable to simply recognize 
some forms, like x/yz, as ambiguous and ignore them - something I 
think we should do more often today, considering some of the questions 
we get on such issues.
 
 
另一方面,我认为计算机影响了运算符优先级,现在比以前更严格执行运算
符优先级,因为程序语言需要确定它们表达的意思。以前,对于x/yz这样的
运算,我们会觉得有歧义并将其忽略,现在我们也应该这样考虑这类问题。
 
I spent some time researching this question, because it is asked 
frequently, but I have not found a definitive answer yet. We can't say 
any one person invented the rules, and in some respects they have 
grown gradually over several centuries and are still evolving.
 
由于这个问题经常被问到,我花了一些时间来研究这个问题,但是没有得到
一个明确的结果。这些规则应该不是某个人定义的,而且这些规则还在逐渐
增加,不断发展。

Here are my conclusions, perhaps in more detail than you want:
 
下面是我的结论,可能比你想要的还要详细

1. The basic rule (that multiplication has precedence over addition) 
appears to have arisen naturally and without much disagreement as 
algebraic notation was being developed in the 1600s and the need for 
such conventions arose. Even though there were numerous competing 
systems of symbols, forcing each author to state his conventions at 
the start of a book, they seem not to have had to say much in this 
area. This is probably because the distributive property implies a 
natural hierarchy in which multiplication is more powerful than 
addition, and makes it desirable to be able to write polynomials with 
as few parentheses as possible; without our order of operations, we 
would have to write

     ax^2 + bx + c
as
     (a(x^2)) + (bx) + c

1.1600年左右代数符号出现以后,由于相应的需求,基本规则(乘法优先
级高于加法)也就自然出现了,而且几乎没什么疑问。尽管有很多套符号,
很多作者在他们书的开始需要注明他们使用的符号,但是对于基本规则基
本都是默认的。这可能是由于分配率隐含了一个自然层次:乘法比加法更
强,而写多项式的时候希望能够少写括号,如果没有优先级,那么ax^2+
bx+c就要写为(a(x^2)) + (bx) + c
 
It may also be that the concept existed before the symbolism, perhaps 
just reflecting the natural structure of problems such as the 
quadratic.
 
也有可能符号化之前优先级的概念就存在,可能反映了类似二次方这样的问题的自然
结构

You can see an example of early notation in "Earliest Uses of Grouping 
Symbols" at:

   http://jeff560.tripod.com/grouping.html   

where the use of a vinculum (an early version of parentheses) shows, 
both in its presence (around an additive expression) and its absence 
(around the multiplicative term "B in D") that the rules were 
implicitly followed:
                                                 ________________
   In Van Schooten's 1646 edition of Vieta, B in D quad. + B in D
   is used to represent B(D^2 + BD). 

“最早的分组符号使用”中描述了早期符号,其中使用了vinculum(一种早期版本的
括号),加法的时候使用,乘法的时候不使用,这意味着如下的隐含规则:
     ________________
B in D quad. + B in D用来表示
B(D^2 + BD)
2. There were some exceptions early in this development; in 
particular, math historian Florian Cajori quotes many writers for 
whom, in the special case of a factorial-like expression such as

     n(n-1)(n-2)

the multiplication sign seems to have had some of the effect of an 
aggregation symbol; they would write

     n * n - 1 * n - 2

(using a dot or cross where I have the asterisks) to express this. Yet 
Cajori points out that this was an exception to a rule already 
established, by which "nn-1n-2" would be taken as the quadratic 
"n^2 - n - 2." 

There was also an early notation in which a multiplication would be 
replaced by a comma to indicate aggregation: 

     n, n - 1 

would mean
     
     n (n - 1) 

whereas 
     
     nn-1 

meant

     n^2 - 1.
 
2.这方面研究也有例外,特别是数学家
Florian Cajori引用了很多作者的写法,在写
n(n-1)(n-2)
这样的阶乘的时候,乘法似乎有聚合符号的作用,他们会写成n*n-1*n-2。
(采用点或叉表示乘法,我这儿采用*)。Cajori指出这是一个规则的例外,“nn-1n-2”
被描述为"n^2-n-2"。
早期有一种记法,采用都好来表示乘法表示聚合,n,n-1意思是n(n-1),nn-1意思是n^2-1
3. Some of the specific rules were not yet established in Cajori's own 
time (the 1920s). He points out that there was disagreement as to 
whether multiplication should have precedence over division, or 
whether they should be treated equally. The general rule was that 
parentheses should be used to clarify one's meaning - which is still 
a very good rule. I have not yet found any twentieth-century 
declarations that resolved these issues, so I do not know how they 
were resolved. You can see this in "Earliest Uses of Symbols of 
Operation" at:

   http://jeff560.tripod.com/operation.html   

3.在Cajori生活的时代(1920年),一些特定的规则尚未建立。他指出乘法除法优先级
有分歧:乘法该优先于除法还是相同的优先级。达成一致意见的是使用括号可以确定一个
表达式的含义,这至今也是一个很好的规则。目前为止我还没有发现20史记解决这些问
题的声明,所以不知道这些问题是怎么解决的,详细内容可以参考“符号操作的早期使用”:
http://jeff560.tripod.com/operation.html
4. I suspect that the concept, and especially the term "order of 
operations" and the "PEMDAS/BEDMAS" mnemonics, was formalized only in 
this century, or at least in the late 1800s, with the growth of the 
textbook industry. I think it has been more important to text authors 
than to mathematicians, who have just informally agreed without 
needing to state anything officially.
 
4. 我怀疑这些概念是在本世纪(20史记)或最在是19世纪由于增长的书本产业发展
形成的,尤其是“运算符优先级”和“PEMDAS/BEDMAS”助记符。我觉得这些东西对书
本作者比数学家更重要,后者非正式地认为这些东西没必要有正式定义
5. There is still some development in this area, as we frequently hear 
from students and teachers confused by texts that either teach or 
imply that implicit multiplication (2x) takes precedence over 
explicit multiplication and division (2*x, 2/x) in expressions 
such as a/2b, which they would take as a/(2b), contrary to the 
generally accepted rules. The idea of adding new rules like this 
implies that the conventions are not yet completely stable; the 
situation is not all that different from the 1600s.

5. 这个领域有一些发展,我们经常听到老师和学生会被一些规则迷惑,因为有些书
说明或暗示在类似a/2b这样的算式中,乘法优先级高于明确的乘法和除法,所以被
当做a/(2b),与常识不同。像这样增加规则意味着规则还不稳定,而且这与17世纪
的情况不同。
In summary, I would say that the rules actually fall into two 
categories: the natural rules (such as precedence of exponential over 
multiplicative over additive operations, and the meaning of 
parentheses), and the artificial rules (left-to-right evaluation, 
equal precedence for multiplication and division, and so on). The 
former were present from the beginning of the notation, and probably 
existed already, though in a somewhat different form, in the geometric 
and verbal modes of expression that preceded algebraic symbolism. The 
latter, not having any absolute reason for their acceptance, have had 
to be gradually agreed upon through usage, and continue to evolve.

总之,我想说的是,规则分为两类:自然规则(例如指数>乘法>加法,括号类似)和
人为规则(从左到右计算,乘法除法优先级关系等)。前者在有符号的时候就出现并
且可能已经形成,尽管可能是与现在不同的形式来表示,比如采用几何符号或口头约定。
而后者则没有必须接受的绝对的理由,需要逐步约定使用,并不断改进。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值