Wikipedia:Reference desk/Archives/Mathematics/2013 October 19

= October 19 =

6-1*0+2/2=?
I see a big dispute on Facebook as to whether the answer is 1, obtained by evaluating the expression from left to right, or 7, when evaluating it per "PEMDAS, the universal rule for evaluating expressions," which neither my wife nor I ever heard of, which requires doing in order, parentheses, exponents, multiplication and division and last addition and subtraction. .Whence PEMDAS? Why not just evaluate left to right? What would the answer be if it were an expression in a computer program such in Fortran, Pascal or a more modern one? What do students in arithmetic class learn today? Absent parentheses, it seems sensible to just go left to right as numbers and operators are encountered. Edison (talk) 03:08, 19 October 2013 (UTC)
 * Well, this particular meme is a little silly &mdash; there's no reason to write this expression in this way except as a "trick question", to see whether people remember the so-called order of operations, and laugh at them when they get it "wrong".
 * However, when you use variables instead of numerals, it's a bit less silly. You have to be able to write x+yz without worrying about whether the reader will interpret it as (x+y)z.  --Trovatore (talk) 03:18, 19 October 2013 (UTC)


 * There is a nice explanation of the traditional order in which math expressions are evaluated at Order of operations, where PEDMAS is explained too. The order in which operations are evaluated is a social convention and tradition holds sway as much as anything else. You're correct that programming languages have definite orders of evaluation, too, and those orders can vary a bit from language to language. --Mark viking (talk) 03:22, 19 October 2013 (UTC)


 * I suppose that if the expression is presented on paper or onscreen complete the answer 7 is required by precedence of multiplication and division over addition and subtraction, but if someone states the problem one number or operator at a time the answer 1 is more likely to be given, especially if the person answering does not have a way of noting down the problem, the same as if the numbers and operators were being entered into a simple four banger calculator. Edison (talk) 03:29, 19 October 2013 (UTC)
 * If you're still talking about the Facebook meme, I would encourage you to just let it go. It really doesn't matter.  The importance of the order of operations is in how algebraic expressions are interpreted, not silly strings of numerals and operators; the latter never come up.  Most likely you already intuitively interpret x+yz the correct way, without having to think about order of operations.  (It does matter if you're writing computer code, though.) --Trovatore (talk) 03:35, 19 October 2013 (UTC)


 * All computer programming languages that I know about would evaluate that correctly as 7, but there might be some that use postfix notation. Some first-generation electronic calculators would evaluate that as 1, e.g. the Texas Instruments SR-10. Bubba73 You talkin' to me? 03:38, 19 October 2013 (UTC)
 * Just think about where all this would have came from - buying and selling. It would have been written as words originally, something like two packs of nails at 3 pence each plus four brackets at 2 pence each. This is written as 2×3+4×2. You don't add 6 pence to 4 brackets. Dmcq (talk) 11:04, 19 October 2013 (UTC)

And the result of https://www.google.com/?q=6-1*0%2B2%2F2%3D#q=6-1*0%2B2%2F2%3D is...? --CiaPan (talk) 20:37, 19 October 2013 (UTC)


 * You ask "What do students in arithmetic class learn today?". I used to give half the class basic (or financial) calculators and the other half scientific calculators, then ask them all to work out something simple like 2 + 3 x 4.  (Which calculator is "wrong" ... could they both be correct?  ... does it depend on where the numbers came from?)  This led on to the importance of brackets for clarity, to the concept of algebraic order of operations and the reason that scientific calculators use it, and also to the concept of separate terms in an expression or equation.     D b f i r s   21:36, 19 October 2013 (UTC)


 * There really isn't any confusion here. The PEDMAS evaluation order is "standard" across mathematics and most (but not quite all) computer programming languages.   The confusion relates only to things like pocket calculators - which (in effect) do left-to-right evaluation.  Nobody writes arithmetic in non-PEDMAS notation without making that VERY clear!  The problem comes with people who use a calculator to evaluate this without doing it in the right order. They get the wrong answer.


 * Calculators do that because if you enter "123+456+" you expect to see the result of 123+456 immediately - and it's confusing if "123+456x" doesn't do that because it's waiting for the next number. That's how people expect calculators to work.


 * There is some ancient history to that. - in order to evaluate something like: 1+(2x(3+(4x(5+(6x(7+(8x....))))))) using PEDMAS, the calculator needs enough memory to hold all of the numbers until the first closing parenthesis comes along and it can finally start doing the calculation. The early computer chips used in cheap pocket calculators machines only had around 64 bytes of memory - and that's not enough for even modestly complex calculations.  Pocket calculators like that don't have bracket keys - so you know they aren't going to be doing things "correctly".


 * Some higher priced calculators do actually have bracket keys and they do implement PEDMAS - my old Texas Instruments beast did that - and it generally didn't show any intermediate results until you hit the "=" button - which confused people who didn't know about that.


 * Other calculators (notably the Hewlett Packard scientific series) opt for an even more confusing evaluation order called "Reverse polish" - which actually turns out to be a pretty neat way of doing calculations because it avoids the need to have brackets in the first place. You can spot those calculators because they have an "ENTER" key.   Instead of saying "123+456=" - you say "123 ENTER 456 +" and hitting the + key gives you the result.  If you wanted to calculate 123+456x2, you'd have to enter "123 ENTER 456 ENTER 2 x +".   It's harder to learn - but when you get used to it, reverse polish is actually a really nice way to do arithmetic.


 * SteveBaker (talk) 21:45, 19 October 2013 (UTC)


 * Thanks for the insight into calculators. I seem to recall that the early Sinclair scientific calculators also used Reverse Polish.  The PEDMAS/PEMDAS/BODMAS/BIDMAS rule can be misleading when it is taught as a blind rule.  (For example, what is 8 - 3 + 2 ?)  Of course, Mathematics teachers don't teach it as a blind rule.    D b f i r s   21:59, 19 October 2013 (UTC)

Game theory and bike riding
"Game theory posits that bicyclists should always ride on the sidewalk rather than the roadway." Does this sentence make sense? Is it true? Allowing: Riding on the roadway is faster but increases that probability of death or severe injury. Riding on the sidewalk is slower (perhaps ethical riders dismount and push their bikes when approaching pedestrians), opens the cyclist to criminal fines if the "no riding on the sidewalk" law is enforced, but the relative probability of death or severe injury is minimized. — Preceding unsigned comment added by 108.240.77.215 (talk) 22:45, 19 October 2013 (UTC)


 * I'm not sure what game theory has to do with it. Game theory predicts what people will do in the presence of other people who are deciding what they will do taking into account what the other person will do, etc. In your example I don't see that anyone but the bicyclist is making decisions. Duoduoduo (talk) 22:59, 19 October 2013 (UTC)
 * Game theory has a notion of playing against "God" or "Nature", essentially a way of choosing a maximally risk-averse strategy in the face of unknown risks. Conceivably such a thing could be applied here, but I don't see any canonical way of doing so.
 * You could possibly apply some sort of pseudo-game-theoretic analysis to argue for riding on the blacktop, as cyclists are allowed to do in most places. If they don't, then motorists may well adopt a strategy of assuming that there are no cyclists, and the opportunity to ride on the blacktop could then be lost.  I'm not sure if this is exactly game theory; it might be more like drama theory (let's see if that comes up blue). --Trovatore (talk) 23:07, 19 October 2013 (UTC)


 * And if the other "player" is the pedestrian, their best outcome is always for the cyclist to ride on the road. It's actually an illustration of decision theory, where the criterion for the cyclist could be to maximise the expected benefit, minimise the maximum loss, or any of various others.31.54.112.70 (talk) 23:07, 19 October 2013 (UTC)
 * I certainly agree that there is a real risk of death or injury on the road. There are so many reckless idiots driving around at high speed just trying to go places as fast as possible with no regard for others. Your best bet is to spend as little time as possible on the road. I jam down the accelerator so I can finish journeys as quickly as I can and minimise my chances of a crash and so maximise my chance of arriving safe and sound. Dmcq (talk) 23:56, 19 October 2013 (UTC)


 * Probability of death is 100% whatever decisions you make, so it doesn't make sense to consider only one very specific contribution to this probability. What does make sense is to e.g. consider life expectancy and then look at how this is affected by the decisions you can make. But you also have to consider what it would require for you to consistently make a certain decision. So, to always ride on the sidewalk would require you to get an extreme risk adverse type of mentality that borders on being paranoid. That's not going to increase your life expectancy. A good example is Kurt Gödel: "I called Gödel again and he gave me an appointment! As you can imagine I was delighted. I figured out how to go to Princeton by train. The day arrived and it had snowed and there were a few inches of snow everywhere. This was certainly not going to stop me from visiting Gödel! I was about to leave for the train when the phone rang. It was Gödel's secretary, who said that Gödel was very careful about his health and because of the snow he wasn't coming to the Institute that day. Therefore, my appointment was canceled."
 * This is how he died "In later life, Gödel suffered periods of mental instability and illness. He had an obsessive fear of being poisoned; he would eat only food that his wife, Adele, prepared for him. Late in 1977, Adele was hospitalized for six months and could no longer prepare Gödel's food. In her absence, he refused to eat, eventually starving to death.[19] He weighed 65 pounds (approximately 30 kg) when he died. His death certificate reported that he died of "malnutrition and inanition caused by personality disturbance" in Princeton Hospital on January 14, 1978.[20]" Count Iblis (talk) 00:43, 20 October 2013 (UTC)


 * The obvious Q here is why he couldn't prepare his own meals. I'd think most men, facing starvation, could manage to make a peanut butter sandwich. StuRat (talk) 13:04, 20 October 2013 (UTC)
 * It wasn't a question of cooking ability. Sadly, by then, Goedel was seriously mentally ill.  --Trovatore (talk) 02:09, 21 October 2013 (UTC)

In truth I use a mixed strategy. Let's just imagine I'm a P.T. boat in a big ocean. — Preceding unsigned comment added by 108.240.77.215 (talk) 15:42, 20 October 2013 (UTC)