Re: Inconsistent formulas
- From: joeu2004 <joeu2004@xxxxxxxxxxx>
- Date: Sat, 5 Jan 2008 06:49:46 -0800 (PST)
On Jan 5, 5:03 am, Jerry W. Lewis <post_a_reply@xxxxxxxxxxxxx> wrote:
If you look at a broader range of mathematical literature and computer
languages, I think you will find this to be very unusual operator precedence.
Unless you consider complex numbers, (-x)^y is not defined if y is not an
integer, and the '-' accomplishes nothing if y is even. That may be part of
the thinking behind the more common precedence (not followed by Excel)
where unary minus has lower priority than exponentiation.
I have looked at a lot of mathematical literature in my lifetime, and
I do not recall any that uses "^" for exponentiation. In fact, "^" is
not even used universally in programming languages to mean
exponentiation. Of course, "^" means bitwise XOR in C and its
derivatives; it means "pointer to" in Pascal. In the first IBM
Mathematical FORmula TRANSlating System (FORTRAN), "**" is used for
exponentiation. In the original Dartmouth BASIC, an up-arrow was used
for exponential. (Up-arrow was actually a key -- shift-N -- on ASR-33
teletypes, which did not have "^".)
(Admittedly, I am not familiar with specifically mathematical
programming languages and libraries and their associated
documentation, which might be what Jerry intended to refer to.)
In mathematics, exponentiation is represented by a superscripted
expression. Of course, superscripting disambiguates the meaning of -x
(superscript) y because of the convention in mathematics of applying
the superscripted expression to the constant or variable immediately
to the left. And I am sure that __that__ is the "thinking behind"
giving exponentiation higher precedence than unary minus in those
programming languages that do and that use "^" (or up-arrow),
presumably being interpreted as "superscript".
Arguably, another possible explanation is that -x^y is mathematically
equivalent to 0 - x^y. In that case, "^" almost universally has
higher precedence over the binary "-", at least in programming
languages that have precedence. But that reasoning would not readily
lead to a reasonable interpretation of x^-y. On the contrary, using
similar reasoning, that would have to be explained as x^(0 - y); and
by extension, -x^y might then be explained as (0 - x)^y, which leads
to the Excel interpretation. Klunk! Ergo, advocates of -(x^y) as the
only "right" interpretation would do well to stick with the first
(hieroglyphical) explanation above.
FYI, in Dartmouth BASIC, x^y^z (using "^" here to mean up-arrow) was
interpreted as (x^y)^z, just as it is in Excel. (This comment is
really in reference to a comment that Dana DeLouis made.)
Interestingly, in Dartmouth BASIC, exponentiation was defined for only
non-negative values. What I really mean is: x^y was defined to mean
abs(x)^y. I'm sure the reason has more to do with the ease of
implementation of the BASIC interpreter than with any mathematical
principle ;-).
.
- References:
- Inconsistent formulas
- From: Piotrek
- Re: Inconsistent formulas
- From: Tyro
- Inconsistent formulas
- Prev by Date: Re: Print range question
- Next by Date: Beginner's question on adding up and plotting multiple time series
- Previous by thread: Re: Inconsistent formulas
- Next by thread: Re: Inconsistent formulas
- Index(es):
Relevant Pages
|