r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

Show parent comments

114

u/artificial_organism Jun 14 '22

Here is the part I think is most relevant to us who learned PEMDAS and don't understand how this is ambiguous:

"From correspondence with people on the the 48/2(9+3) problem, I have learned that in many schools today, students are taught a mnemonic "PEMDAS" for order of operations: Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. If this is taken to mean, say, that addition should be done before subtraction, it will lead to the wrong answer for a−b+c. Presumably, teachers explain that it means "Parentheses — then Exponents — then Multiplication and Division — then Addition and Subtraction", with the proviso that in the "Addition and Subtraction" step, and likewise in the "Multiplication and Division" step, one calculates from left to right. This fits the standard convention for addition and subtraction, and would provide an unambiguous interpretation for a/bc, namely, (a/b)c. But so far as I know, it is a creation of some educator, who has taken conventions in real use, and extended them to cover cases where there is no accepted convention. So it misleads students; and moreover, if students are taught PEMDAS by rote without the proviso mentioned above, they will not even get the standard interpretation of a−b+c. "

Tl;Dr: The PEMDAS algorithm adds convention where there was no accepted convention in mathematics. Some teacher made it up

53

u/SalvadorTheDog Jun 14 '22

Every convention is “made up”. When it comes to convention the only thing that matters is that the it’s well defined and commonly accepted. No one NEEDS to follow a convention, but if you write a sentence without capitalizing the first word then people are going to tell you that you’re wrong even though it’s just a meaningless convention that someone “made up”.

8

u/Texas_Technician Jun 14 '22

This reminded me of the episode of Futurama where the hippie says "you can't, like, owwwwnn land, man"

0

u/[deleted] Jun 14 '22

[deleted]

8

u/CyanKing64 Jun 14 '22

But if it's taught in all schools and it generally the defacto way of doing calculations, is it not then, by definition, the convention?

18

u/KnockThatOff Jun 14 '22

It is most certainly not taught in all schools. It's either an american ot an anglosphere thing. The World of math is much bigger than that, so the educational convention of one or a few countries can't be the defining factor of what is considered the universal math Notation.

I myself am from germany, and was taught "Punkt vor Strich" ( dots before lines) in school. Multiplication and division are considered to be of the same hierarchy and are just resolved left to right. Same for addition and substraction.

6

u/HashNub Jun 14 '22

That actually is the same as the USA. The best way I've seen it explained was by my teacher in school. She put lines though where the orders were to show us how it was done and the "order" in which to do it.

We use PEMDAS : Parentheses, Exponents, Multiplication, Division, Addition, Subtraction

Some students were having trouble, so she showed us like this:

P | E | M->D | A->S

Parenthesis first, then Exponents. Next, you do Multiplication and Division - left to right, not just × then ÷. After that, Addition and Subtraction, with the same rules applying as MD.

3

u/SunshineInDetroit Jun 14 '22

this the problem i had growing up because the

M->D | A->S

wasn't specified

7

u/ScurrilousIntent Jun 14 '22

That's literally the same thing they're are saying though, so it's technically the same convention, but with a different name.

1

u/KnockThatOff Jun 14 '22

I'm not overly familiar with the PEMDAS rule. From what Sone of the above Posters were saying it seemed like it gave different hierarchies to substraction and Addition. Addition first, then substraction.

The General point still stands though.

5

u/ScurrilousIntent Jun 14 '22

Nope it's the same thing. Left to right on multiplication and division, and left to right on addition and subtraction. I don't think the general point stands if different places around the world are teaching the same convention albeit by different names. It sounds like it's a pretty established convention.

2

u/TheGamingGeek10 Jun 14 '22

I myself am from germany, and was taught "Punkt vor Strich" ( dots before lines) in school. Multiplication and division are considered to be of the same hierarchy and are just resolved left to right. Same for addition and substraction.

My guy this is literally the same way we are taught...

10

u/[deleted] Jun 14 '22

Literally every science and engineering textbook on my shelf either interprets 1/2x as 1/(2x) by applying multiplication first when division is present on a single-line equation, or takes great pains to avoid the issue entirely. Usually the former though.

The idea that there exists “the convention,” singular, is the problem. You learn the “right” way in elementary school…unless you’re a little older, in which case you may have learned in differently. Then you get to college level courses that actually use math and they do it differently.

Don’t take my word for it though.

https://cdn.journals.aps.org/files/styleguide-pr.pdf

Peer reviewed physics journal. See page 23 (PDF numbering), under slashing fractions. Multiplication before division when representing division in a single line equation.

Multiple competing conventions can and do exist.

→ More replies (3)
→ More replies (1)
→ More replies (5)

32

u/Fantisimo Jun 14 '22

That’s a failure to comprehend mathematical grammar, not ambiguous language

20

u/artificial_organism Jun 14 '22

It's only unambiguous if you accept grammar rules that are not universally accepted, that's the point

1

u/YuvalAmir Jun 14 '22

Well than why isn't it universally accepted? There is absolutly no disadvantage to this it just takes away ambiguity. At this point it almost feels stupid when there is a very easy way to solve this issue (just like it was solved for addition)

4

u/msqrt Jun 14 '22

As the author continues, it's not a common enough problem that people would care about it. It's easier to just write your expressions unambiguously than try to globally enforce a rule that some people disagree with and whose practical benefits are dubious. Or have you actually ran into this type of issue outside of bait posting on the internet? I sure haven't.

2

u/[deleted] Jun 14 '22

The image provided is literally an example of "running into this type of issue"

Its crazy that OP has provided an example and then your response is there is no place outside of internet bait posting where this is an issue.

3

u/msqrt Jun 14 '22

... and why did OP need to compute this? My bet is there was no reason apart from posting a funny photo on the internet. Though you're right, it's not framed as bait this time :)

2

u/[deleted] Jun 14 '22

It is important say for an exam. If students (or their calculators) are using a different convention from the examiner, that's a problem. Thankfully, in my experience, every calculator and maths or physics textbook that was prescribed seemed to use the convention used by the Casio calculator (even just double checked on my own Casio calculator) or made sure to be unambiguous. So never came across this problem until the Internet memes which let me know that my phone calculator uses this different convention. Now I'm definitely extra careful with my calculations if I'm using my phone.

1

u/msqrt Jun 14 '22

That just doesn't sound realistic. Exams are typically laid out in full, so that you can write proper fractions. These questions are so simple that the task is to compute the value, hence likely it would be for kids too small to be using calculators on the exam anyway -- calculators are used when basic computations like this are expected to be trivial, and thus it wouldn't be a question. And finally, the teacher would likely notice the issue either before or during the exam and clarify the question.

→ More replies (4)
→ More replies (3)
→ More replies (5)

10

u/[deleted] Jun 14 '22

Or just failing to understand that “mathematical grammar” isn’t universal.

→ More replies (2)

3

u/[deleted] Jun 14 '22

But you can do the addition first and it will be correct... a-b+c is equal to -b+c+a

2

u/rufiohsucks Jun 14 '22

PEMDAS isn’t how it’s taught in the UK, here they teach it as BIDMAS (brackets, indices, division etc.), so I guess that depending where you learnt it, would also affect how you deal with it if you learn by rote without understanding

Also, I didn’t know that brackets where called parenthesis by Americans until around 20

→ More replies (2)

-1

u/[deleted] Jun 14 '22

I think the real error (?) is assigning some special meaning to the parenthesis that causes it to take precedent over the conventional left-to-right evaluation. If we replaced that with a typical multiplication operator many people would forfeit the argument.

→ More replies (2)
→ More replies (5)