Excel Math Bug

G

Guest

I do believe that most posters in this thread know that. However, while the
meaning of -x may be clear, the meaning of -x^2 is not.

Substitute x^2 for x.

'cid 'ooh[/QUOTE]

But you said yourself that -x is "...the number", suggesting
that -x can be thought of as a notation for a single object,
the - is tightly bound to the x, and hence -x^2 is really (-x)^2.

Similarly, in the number "-5", the - is not a unary operator,
it's just part of the imprecise alphabet used to name objects.
I'm not surprised that many people see -5^2 as (-5)^2.

APL uses "high minus" for "minus as part of the name of a number",
and J (son of APL) uses underline:
-5^2
_25
_5^2
25

This avoids ambiguity, not to mention unpleasant arguments.

\begin{cute quotes}
%
Then I realized that I had spelled '-' wrong.
John Whitmore [on learning APL]
%
We exchanged many frank words in our respective languages.
Peter Cook, Beyond the Fringe
%
\end{cute quotes}
 
D

Dave Seaman

If you assume the conclusion you wish to justify. AKA begging the question.

I am not assuming anything. I merely observe how symbols are used in
textbooks on mathematics.
If one asserts that unary minus has higher precedence, then
-x^2 = ((-1)x)^2

And one would be wrong.
It's consistent. It doesn't change the mathematics at all, it's simply
a matter of expression parsing.

Claiming that triangles have four sides doesn't change the mathematics,
either.
 
D

Dave Seaman

Thank you. The citation below to "Brief Calculus" is the first and only
one in this thread of a source, outside of programming, for the order of
precedence between negation and exponientation.

Only if you ignore Lang's _Algebra_, which I have cited twice in this
thread.
I appreciate your recognition of the distinction between a source
describing the convention for the order of precedence, on the one hand,
and examples of usage and tacit acceptance of that convention, on the
other.

Stating that the elements of a polynomial ring A[X] are linear
combinations of the basic monomials X^k is an example that describes the
convention for the order of precedence, not an example of usage and tacit
accpetance of that convention. It makes clear that -X^2 as a member of
A[X] can only mean (-1)*X^2, where X^2 is one of the primitive monomials
X^k, and -1 is a member of the ring A. It can't possibly mean (-X)^2,
because -X and (-X)^2 are not members of the set of primitive monomials
{ X^k : k in N }.
 
H

Harlan Grove

I suspected as much. Excel seems to have been Multiplan's offspring. Not
surprising no one caught this in Multiplan given its low market share.
Well, yes, but you're coming from the attitude that since it's listed a
certain way in the manual that it's okay. . . .

To the extent it's clearly documented, it *is* OK. Well, at least not a bug.
Just a really bad design decision.
 
M

Michel Hack

Harlan Grove said:
...

Maybe because computers aren't usually working with equations ...

A distinction non-programmers often don't appreciate is that a program (or a
programming language) have to PICK A FIXED DEFINITION. In mathematical prose
(for human consumption) there are usually context clues that resolve what would
otherwise be ambiguous, so -5^2 could be interpreted one way and -x^2 the other
way. Unfortunately operator precedence rules are not always well documented;
worse perhaps, many people don't realise that they need to be documented to a
level of detail that can only be appreciated by looking at various contrasting
examples, such as Dik Winter's 8 - 3 + 4 which a literal interpretation of the
often carelessly stated Aunt Sally rules renders as 8-(3+4) and not (8-3)+4.
In other words, both PRECEDENCE and ASSOCIATIVITY matter, and each class may
include SEVERAL operators, so a simple linear list like PEMDAS can't possibly
capture it all -- it must be seen as no more than a mnemonic device to help
recall the full definition.

Michel.
 
H

Harlan Grove

Dave Seaman said:
It doesn't matter. Both are correct, and both lead to the same conclusion.

-x^2 = (-1)x^2
= (0-1)x^2
= 0x^2 - 1x^2
= 0 - x^2
= -x^2
<= 0

You're fixated on needing to define negation in terms of
multiplication. That's one convention. Another completely consistent
one would be

-x^2 = (0-x)^2
= 0^2 - 2 * 0 * x + x^2
= x^2

HAND
 
D

Dave Seaman

You're fixated on needing to define negation in terms of
multiplication. That's one convention. Another completely consistent
one would be
-x^2 = (0-x)^2
= 0^2 - 2 * 0 * x + x^2
= x^2

"Contrariwise," continued Tweedledee, "if it was so, it might be; and if
it were so, it would be; but as it isn't, it ain't. That's logic."

I and others have asked repeatedly for a single instance in any
mathematical text where -x^2 was interpreted as (-x)^2, and not a single
instance has been cited.

There are not two conventions. There is only one. Case closed.
 
H

Harlan Grove

(e-mail address removed) (Acid Pooh) wrote...
....
Didn't you cover group theory? Exponential notation is quite common
for multiplicative groups, and multiplicative notation is quite common
in additive groups. Example:

My course and/or professor must have been more fundamentalist. We
didn't use the notational shorthand of exponentiation to represent
repeated multiplication of the same entry. And common doesn't mean
universal.
In (Z_7, +), x + x defines 2x, x + x + x defines 3x, etc. In (Z_7,
*), x*x defines x^2, x*x*x defines x^3, etc. That's how you're
justified to use things like the least integer property and modular
arithmetic when working with abstract groups.

Understood, but this is a convention for convenience. It's not
intrinsically necessary in the development of the subject. Repeated
addition and multiplication *could* be just as well expressed using
oversized capital sigma and pi, respectively, with iteration variable
and lower bound always below that letter and iteration upper bound
above. That would actually eliminate ambiguity in terms of the sign
character: if the sign character is to the left of the sigma or pi,
then the sign applies to the result of the repeated operation; if the
sigh appears to the right of the sigma or pi, so immediately to the
left of the symbol representing the element from the ring, the sign
would be considered an intrinsic part of the repeatedly used operand.

I did actually check my old textbook last night. I didn't see
exponential notation in any chapter prior to the introduction of
polynomials. I also didn't see any mention of operator precedence, but
that's very likely because the usual convention was assumed.
 
H

Harlan Grove

Bruce Ikenaga said:
. . . For instance, the example cited by someone
earlier of (the normal probability density function) y = ce^(-x^2/2)
occurs in nearly all calc books . . .
....

I doubt any math as opposed to programming text uses carets, ^, to
denote exponentiation. Typographically this particular ambiguity is
resolved by showing the minus sign to the left of the horizontal line
used to separate the x^2 numerator from the 2 denominator. No one
disagrees that exponentiation should precede division, and it's clear
that negation applies to the result of the division. Things would be
less clear if the minus sign immediately preceded the x in the
numerator term.
me that -3^2 is -9. So does maxima. So does gap. So does my TI
calculator.

As for your TI calculator, either you're pressing the key sequence

3 [+/-] [x^y] 2 [=] which returns +9

or

3 [x^y] 2 [=] [+/-] which returns -9

In either case you're applying an unambiguous and manual operator
precedence. If you turn on a TI calculator or clear the register so it
shows 0, then press [+/-], the register still displays and contains 0
(zero), not -0, and when you then key in 3, it displays and contains
3. There's no way to represent leading minus signs with a TI
calculator. Your arguments would be more persuasive if it weren't so
obvious you were dreaming some examples up on the fly.
For programmers, check out the yacc grammar on page 250 of "The UNIX
Programming Environment" by Brian Kernighan and Rob Pike. Note that
exponentiation has higher precedence than unary minus.
....

That was a grammar for a middle weight console calcuator named hoc.
The authors refer to the standard Unix bc tool which usese the
opposite precedence order for negation and exponentiation. I forget
whether the authors mentioned this difference between hoc and bc.
. . . Actually, I'm glad this came up --- the
stat people in our department were tossing around the idea of using Excel
in their courses instead of a stat package, but this is a reason for
rejecting that idea. If Excel doesn't follow such a standard mathematical
convention, I don't think I'd want students using it in our courses.

This shouldn't be a deciding factor. Once known, prophylactic measures
can be taken to handle this. There's a much better reason to use real
stats packages: they make incremental refinement of analysis much
easier. Why don't you ask some of your stats colleagues to compare the
ease of performing step-wise regression in Excel vs, say, R. Or using
logit or probit models in both.

However, more to the point may be

http://www.theregister.co.uk/2004/07/16/excel_vanishing_dna/
 
H

Harlan Grove

Dave Seaman said:
Stating that the elements of a polynomial ring A[X] are linear
combinations of the basic monomials X^k is an example that describes the
convention for the order of precedence, not an example of usage and tacit
accpetance of that convention. It makes clear that -X^2 as a member of
A[X] can only mean (-1)*X^2, where X^2 is one of the primitive monomials
X^k, and -1 is a member of the ring A. It can't possibly mean (-X)^2,
because -X and (-X)^2 are not members of the set of primitive monomials
{ X^k : k in N }.

This may be the core of the problem. Those with a thorough
mathematical background would think of variables first: -x^2 ->
polynomials, so the - and x are separate tokens -> -(x^2). On the
other hand, those who avoided math classes after they'd satisfied
whatever minimal requirements were imposed upon them would likely
think of numbers first: -3^2 -> -3 is an atomic whole -> (-3)^2. Both
are reasonable. Both are consistent. Both address the unfortunate fact
that mathematicians are unspeakably lazy and choose to represent
arithmetic sign in numbers with the same character they use to
represent the diadic subtraction operator and the monadic negation
operator. The same is mercifully not the case with the multiplicative
analog since, e.g., 1/4 can be represented by 0.25. Just think what
fun we'd have if it were commonly written as /4.

That the variables-inspired convention is standard among
mathematicians is/was, unfortunately, not immediately relevant or
persuasive to many programmers who write/wrote programming languages
or spreadsheets. This state of affairs may be unfortunate, but it's
about time mathematicians, statisticians, scientists, engineers and
any other nonprogrammers who use computers to calculate realize that
there are lots of languages and programs that have adopted other
operator precedence rules than those with which they're familiar.
 
A

Acid Pooh

...

But you said yourself that -x is "...the number", suggesting
that -x can be thought of as a notation for a single object,
the - is tightly bound to the x, and hence -x^2 is really (-x)^2.

Uhm, sure. -x is "the number" in the relevant sense. But the "x" in
the expression "-x" is a variable. You can substitute one variable
for another and obtain a legal expression. Notice that I didn't say
"square x," or that if I were to have said "substitute x by y^2," this
would be a non-issue.

'cid 'ooh
 
S

Stephen J. Herschkorn

Harlan said:
That the variables-inspired convention is standard among
mathematicians is/was, unfortunately, not immediately relevant or
persuasive to many programmers who write/wrote programming languages
or spreadsheets. This state of affairs may be unfortunate, but it's
about time mathematicians, statisticians, scientists, engineers and
any other nonprogrammers who use computers to calculate realize that
there are lots of languages and programs that have adopted other
operator precedence rules than those with which they're familiar.

As I have noted before, this is incredible hubris on your part.
Software professionals create tools to serve the client. It is *not*
the responsbility of the client to adapt to the programmers' sloppy
design. Excel is *not* a programming language for at least 90% of its
users.

In all other aspects, Excel conforms to *the* standard order of
precedence which you will find in *any* math book or science or
engineering book or article which uses mathematical notation.
Documentation of this one exception does *not* excuse its
implementation, which surely causes undetected errors and/or generates
many hours spend on debugging.
 
J

JE McGimpsey

Uhm, sure. -x is "the number" in the relevant sense. But...

But only the relevant sense said:
the "x" in the expression "-x" is a variable. You can substitute one
variable for another and obtain a legal expression. Notice that I
didn't say "square x," or that if I were to have said "substitute x
by y^2," this would be a non-issue.

It wouldn't be a non-issue - your statements still depend on an
implicit order of operator precedence.

Using your logic, strictly typographically, substitute x by y*2 in the
expression x^2.

Are you arguing that the result is y*2^2 ==> y*4 (since I believe
everyone agrees that exponentiation has a higher precedence than
multiplication)??? If not, what would you do differently and why?

When you have a linear typographic notation with operators of different
precedence (e.g., Excel), one MUST use parentheses (or their equivalent)
to apply operations in the proper order.

Substitution of x by y^2 in the expression -x to produce -y^2 is *ONLY*
valid in a typographic system where exponentiation has a higher
precedence than monadic negation. If negation has higher precedence that
exponentiation, then the typographic substitution above is *only* valid
as

-x ==> -(y^2)

Both are consistent typographical systems. Neither has any inherent
advantage over the other. Which you choose is, again, a matter of
convention.

To use that typography to argue for an implicit order of operator
precedence, that somehow your example resolves an ambiguity, is a
tautology, nothing more.
 
F

fred

That the variables-inspired convention is standard among
mathematicians is/was, unfortunately, not immediately relevant or
persuasive to many programmers who write/wrote programming languages
or spreadsheets. This state of affairs may be unfortunate, but it's
about time mathematicians, statisticians, scientists, engineers and
any other nonprogrammers who use computers to calculate realize that
there are lots of languages and programs that have adopted other
operator precedence rules than those with which they're familiar.

I agree on a pragmatic level "math people beware",
but on principle, the programmers didn't do it right.

If you dear Aunt Sally died and left a will that said
"I leave all my money to Harlan
and all my property to his sister"
and you knew she had $100,000 in the bank
and a huge chest of coins in the attic
and the lawyer told you that in your state
the term "money" includes "paper bills" only
and that coins and bank accounts are considered "property"
and you were left with the $78 she had laying on her dresser,
how easily would you accept lack of convention then?

or if you bought a car and noticed it was low on oil
and you topped it off and the pistons seized
and you later found out that this particular car
only uses synthetic oil and you should have checked
that out before you put oil in it.

or you bought an instant lottery ticket and
scratched off the boxes with a quarter
and won $20,000
and took it in, and they said you were supposed to
scratch if off with an "approved scratcher"
so your ticket is invalid.

Maybe you are not saying "it's fine", or are you?
 
A

Acid Pooh

Dik T. Winter said:
How does that clarify the meaning?


Good. Substitute x+3 for x and we get -x+3. And so what?
It only shows that substitution without surrounding braces leads to
an expression that is quite different.

Well, my point here was that "x + 3" isn't strictly speaking a term in
the FOL, whereas "(x+3)" is. Neither is x^2, for that matter, but x^2
is usually taken to be abbreviated notation for (x*x). We can come up
with some nice abbreviated notation for (x + 3)--say, "z"--and
substitution yields -z.

So what do you get if you substitute x^2 for x in "-x" ? Notice that
I didn't say "square x." For all it matters, I could have said
substitute y^2 for x. Or, if you'll allow me the convenience of
working in the reals, consider that x = "Sqrt(x)^2". More formally:
this is a substitution of _variables_ in the sense of the first order
logic. It doesn't matter what 'x' is in the formula x + (-x) = 0 is.
It might as well be "x^2." Kind of slippery, huh?

'cid 'ooh
 
D

Dik T. Winter

Well, my point here was that "x + 3" isn't strictly speaking a term in
the FOL, whereas "(x+3)" is. Neither is x^2, for that matter, but x^2
is usually taken to be abbreviated notation for (x*x). We can come up
with some nice abbreviated notation for (x + 3)--say, "z"--and
substitution yields -z.

So you substitute just one convention by another to clarify?
So what do you get if you substitute x^2 for x in "-x" ? Notice that
I didn't say "square x." For all it matters, I could have said
substitute y^2 for x. Or, if you'll allow me the convenience of
working in the reals, consider that x = "Sqrt(x)^2". More formally:
this is a substitution of _variables_ in the sense of the first order
logic. It doesn't matter what 'x' is in the formula x + (-x) = 0 is.
It might as well be "x^2." Kind of slippery, huh?

Yup, very slippery.
 
H

Harlan Grove

Dave Seaman said:
I and others have asked repeatedly for a single instance in any
mathematical text where -x^2 was interpreted as (-x)^2, and not a single
instance has been cited.

There are not two conventions. There is only one. Case closed.

There's one convention in mathematics that's used consistently in
mathematics texts and in classrooms. Science, engineering and most other
disciplines also adhere to that convention.

Then there's Computer Science and programming. I haven't argued that those
languages that depart from the standard math convention do the right thing,
but I have argued that once done it won't be undone. So live with it.
 
K

Kevin O'Neill

Dave Seaman said:
"Contrariwise," continued Tweedledee, "if it was so, it might be; and if
it were so, it would be; but as it isn't, it ain't. That's logic."

I and others have asked repeatedly for a single instance in any
mathematical text where -x^2 was interpreted as (-x)^2, and not a single
instance has been cited.

There are not two conventions. There is only one. Case closed.

=================================================

Well said.


Kevin O'Neill

=================================================
 
K

Kevin O'Neill

Stephen J. Herschkorn said:
As I have noted before, this is incredible hubris on your part.
Software professionals create tools to serve the client. It is *not*
the responsbility of the client to adapt to the programmers' sloppy
design. Excel is *not* a programming language for at least 90% of its
users.

In all other aspects, Excel conforms to *the* standard order of
precedence which you will find in *any* math book or science or
engineering book or article which uses mathematical notation.
Documentation of this one exception does *not* excuse its
implementation, which surely causes undetected errors and/or generates
many hours spend on debugging.

=================================================

Well said.


Kevin O'Neill

=================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top