This means that, if you translated 6÷2(1+2) into APL’s own notation, the interpreter would add 1+2 first (it’s both rightmost, and parentheses matter in APL), multiply that by 2, then divide 6 by the result of that. 1+2 is 3, 3*2 is 6, and 6÷6 is 1.
It works like this because Kenneth Iverson, its inventor, got sick to death of the kind of crap we’re all hashing out here.
No respected mathematical source would present the expression in that way. It is simply ambiguous. In other words, the convention you are missing is: “Avoid using adjacency to indicate multiplication if there is a division symbol to the left.”
I repeat my language analogy: “The book Jim did Bob give” probably means a particular thing (“Jim gave Bob the book”), but the deeply rooted convention in the language is that you simply shouldn’t write the sentence that way, even though a rigorous application of some set of rules will get you a specific interpretation.
In formal mathematical writing, you will not find 1/2x when x/2 is intended. This a syntactical convention that you probably won’t find stated anywhere, but it is present nonetheless. There are countless other unwritten syntactical conventions that you take without thinking about it, and we are just saying that this is another one that you might not be aware of.
When someone decides to write 1/2x anyway, they usually mean 1/(2x), but it is ambiguous. In particular contexts, the binding of the adjacent symbols is very strong. (For instance, “2[symbol]p[/symbol]” is often (though informally) treated as a single symbol, not to be broken apart.)
I encourage you to type “1 / 2 pi” into Google and see how it gets parsed. Then try “1 / 2 * pi” and see that the parsing is different.
As an aside, I’m finding it a little amusing that the posters who work most directly in mathematics are the ones arguing for ambiguity in adjacency operations.
Ummmmm . . . no
I’m saying it is unambiguous and I havn’t even mentioned that since the writer of the problem uses parentheses in one case, then its implied that had they meant to multiply before dividing, they would have used a grouping operator.
So if I write “The Conferderate States of America succeeded.” then my sentence is miswritten and does not say what I intended it to because I don’t want to say they won the Civil War? Just because something is miswritten doesn’t make it correct and if someone wrote 1/2x meaning 1/(2x) but it is properly parsed as (1/2)x, it is not ambiguous or correct anymore than the South won the war because I miswrote “seceeded”
All I know is that if I get math wrong, I could kill many of the animal patients I work with. I suck at math and have just the formulas I need in my head to calculate doses based on milligrams per kilograms. So maybe what’s in my head is completely unrelated to the discussion in this thread. I find this stuff fascinating, but my brain just doesn’t comprehend it, and by about a third of the way through this thread my eyes were already glazing over just like they did in high school and college!
The fact that math seems to be open to interpretation and two different answers could each possibly be right based on how you argue the equation, is making my brain leak out of my ears. I wish I could otherwise participate in the argument, I gotta go find some gray matter… :eek:
What do you mean by “the convention that has been explained in this thread already”? Multiple different conventions have been explained in this thread.
Quoth Great Antibob:
I wouldn’t exactly say that anyone’s arguing for ambiguity. Several posters (myself included) are arguing that the expression is ambiguous, but that just means that whoever wrote the expression should have made it clearer (by tossing in some more parentheses, or changing the order of the elements, or writing it in numerator-denominator form, or whatever).
Look, the very fact that we’re arguing about this ought to be an indisputable indication that there is ambiguity… sure, you can say “According to these rules, it must be parsed this way”, but if those rules do not accurately describe how mathematicians and mathematical tools in practice actually always read and write expressions, then it doesn’t matter; there is still ambiguity. That’s what ambiguity is; not knowing for sure, upon looking at an expression like that, what was intended or how it would be interpreted by someone else.
You could claim “I’d like to thank my parents, John and Sally” can only possibly mean “I’d like to thank my parents, who are John and Sally” and cannot possibly mean “I’d like to thank four people: my parents, John, and Sally” on some theory of the usage rules of the comma, but the truth is that, in practice, as an empirical fact, the interpretation of that sentence is ambiguous (and whatever theoretical usage rules of the comma were being appealed to to say otherwise would turn out not to be universally strictly adhered to). And the same thing here. (In a way, what’s going on in this thread is a clash of descriptivism and prescriptivism… some of us are advocating recognition of the realities of how mathematicians and mathematical tools read and write expressions, while others are advocating strict adherence to a particular set of passed-down rules regardless of whether these rules are universally adhered to in actual practice)
[On another note, too small to need a post of its own:
Oh, I have no doubt of this; I think PEMDAS is a terrible mnemonic precisely for not making the intended meaning clear in this way.]
When does anyone use a root operator (e.g., the square root operator) without the intended scope of the operator being explicitly indicated as just what falls under its upper bar? [And, if using a general “nth root” operator, the “n” will be all and only whatever expression is raised up and placed in the appropriate position on the left side of the operator, again explicitly delimited…]. You don’t need (and, indeed, can’t make any actual use of) precedence rules for operators with such explicit delimiting of their scope…
A representation of some thing is always ambiguous because it is not the thing. It is a symbol representing the thing, to some set of minds that agree to it. Any mind may chose to see it as a representation of something else. The written expressions aren’t the math, they are a representation of it. This is how language works, and mathematical expressions are written in languages. The common notations are probably interpreted by most mathematicians in the same way, but it is a sort of slang, because many relationships between the terms are assumed instead of explicit. And general conventions are assumed also, just as in English we assume words and sentences are read from left to right and downwards by line.
I’m a math idiot. But the subject here is the representation of mathematics, and I’ve spent decades dealing with that.
I don’t know why they teach PEMDAS at all. Just remember that the higher order operations come first, and that parentheses change that.
Oh, and I was always told to write, for example, y = 2x/3 rather than y = 2/3x. I was explicitly taught by every teacher I’ve ever had that implied multiplication provides its own scope.
Also, who uses both implied multiplication and the obelus (÷) in the same expression? That’s like using both the raised cross (×) and raised dot (·) or asterisk (*).
The biggest problem in this whole thread is that on paper or from math textbooks (where most of us learned to do math) equations are written properly. It is only the lack of total text editor functions that forces us to put what should be a multiple line division into a linear format.
A
BC
not to be confused with
AC
B
Add to that the “implied” multiplication, which is a shorthand we understand. Yes, we say 2x with the implication that stays together, but 2/3x in a linear script can just as easily mean (2/3)x and without the variable, 6/2(3)can just as easily mean (6/2)(3).
However, everything I learned in grade school and high school math in the 60’s and early 70’s. and 4 years of math after that in college, never once did anyone suggest you complete all the multiplications before all the divisions.
The fact that all programming languages also obey the rule of evaluating (add, subtract) from left to right and (multiply. divide) from left to right merely means those languages were constructed to follow what was established convention for mathematics.
There is NO RULE that says implied operations take precedence over explicit operations.
Yes, the problem as written is deliberately erronously ambiguous to trick those who are not looking closely or who have forgotten the fine print of the basic rules of order of precedence.
I’ve never heard of any of the acronyms - I just recall learning what the order of operations were, and needing to go from left to right (just like reading) whenever dealing with operations of equal precedence. Under this method, I don’t see any ambiguity. Of course, if someone said to me “no, I’d like you to go from right to left” or “do division before multiplication” then I guess I’d get a different answer. I never realised that some people do those things.
Just an FYI: Many kids today learn GEMS instead of PEMDAS. GEMS is Grouping symbols, Exponents, Multiplication/division, Subtraction/addition. I believe this change was to address the concerns that came up in this thread.
Following up on Jragon’s posts above, some interesting observations about Wolfram Alpha’s parser: “6/2x” is parsed as 6 / (2x), but “6 / 2 x” is parsed as (6 / 2) x. Yet “6 / 2e” is parsed as “(6 / 2)e”. But “6 / xy” is 6/(xy), while “6 / x y” is (6 / x)y. Furthermore, “6 / cos(8)x” is (6 / cos(8))x, and “6 / 2cos(8)” is (6 / 2) cos(8). However, …
That is, it’s willing to treat juxtaposition differently based on whether there’s spacing involved or not, whether the second argument is a variable as opposed to a constant or result of a function, whether the first argument is a numeric literal or variable as opposed to the result of a function, and a host of other itty-bitty details about its particular choices for lexical analysis.
And the fact that no one can be expected to be aware of all these rules going in to using Alpha, nor can they expect those same rules to be followed in the same way by other tools? That’s what one might call “ambiguity”…
Do you or anyone else have a cite that there is an accepted convention that multiplication should be evaluated before division? I see a lot of anecdotal evidence, but I don’t see a cite (maybe I missed it).