[-] SmartmanApps@programming.dev 2 points 8 months ago

PEMDAS isn’t obvious to “common people”?

Everyone is taught the rules of Maths

If “×” means “groups of,”

It means repeated addition actually

“2+2×4” means “two plus two groups of four”

No, it means 2+2+2+2+2

Sure the order of operations could be arbitrarily different

No they can't

I feel like we settled on that order because it simply makes more sense intuitively

It's because Multiplication is defined as repeated addition, so if you don't do it before addition you get wrong answers

1
1
3
1
1
3
3
2
4
3
4
3
[-] SmartmanApps@programming.dev 2 points 2 years ago

My high school taught Java, but I didn’t get OOP

Yes, the correct sequence of events - one thing at a time, basic programming, then OOP. :-)

Python is not that.

It's not a lot of things, which makes it poor for a teaching language.

[-] SmartmanApps@programming.dev 2 points 2 years ago

And now I am getting downvoted for asking an honest question

Welcome to programming.dev! 😂I've had the same happen (technical issue, looking for a solution or workaround, get downvoted). I take it as "I'm not interested in this - don't ever show me anything about this again" - well, just scroll on by then, not hard. 🙄

[-] SmartmanApps@programming.dev 2 points 2 years ago* (last edited 2 years ago)

Calculate 8 ÷ 2a where a = 4. Then,

Calculate 8 ÷ 2 × a where a = 4.

See how in the first form a is implied to be part of the fraction where in the second it isn’t?

It's not implied, it's explicitly because of the definition of Terms.

P.S. now substitute a=2 and you'll see why it matters.

A dot • could be between 2 and a and it would still follow the first example

No, it wouldn't. Inserting a dot (multiplication) makes it the same as your second example. i.e. 3 Terms, not 2 Terms.

In vector multiplication, dot and cross products produce different results.

This isn't vector multiplication. This is Year 7 algebra.

[-] SmartmanApps@programming.dev 2 points 2 years ago

TI calculators disobey The Distributive Law and give the wrong answer when a bracketed term has a coefficient.

[-] SmartmanApps@programming.dev 2 points 2 years ago

8÷2(2+2)=8×(1/2)×(2+2)

No, that's wrong. 2(2+2) is a single term, and thus entirely in the denominator. When you separated the coefficient you flipped the (2+2) into the numerator, hence the wrong answer. You must never add multiplication signs where there are none.

[-] SmartmanApps@programming.dev 2 points 2 years ago

Are you for real?

Yes, I'm a Maths teacher.

A fraction is a shorthand for division with stronger (and therefore less ambiguous) order of operations

I added emphasis to where you nearly had it.

½ is a single term. 1÷2 is 2 terms. Terms are separated by operators (division in this case) and joined by grouping symbols (fraction bars, brackets).

1÷½=2

1÷1÷2=½ (must be done left to right)

Thus 1÷2 and ½ aren't the same thing (they are equal in simple cases, but not the same thing), but ½ and (1÷2) are the same thing.

[-] SmartmanApps@programming.dev 2 points 2 years ago

The real answer is that anyone who deals with math a lot would never write it this way

Yes, they would - it's the standard way to write a factorised term.

but use fractions instead

Fractions and division aren't the same thing.

[-] SmartmanApps@programming.dev 2 points 2 years ago

And WolframAlpha did division before brackets (turned 6/2 into a fraction, thus making it a single term instead of separate terms, all before doing brackets), thus violating the order of operations rules.

[-] SmartmanApps@programming.dev 2 points 2 years ago

if it was 6÷2x(2+1) they suggested do division and mult from left to right, but 6÷2(2+1)

Correct! Terms are separated by operators and joined by grouping symbols, so 6÷2x(2+1) is 3 terms - 6, 2, and (2+1) - whereas 6÷2(2+1) is 2 terms - 6 and 2(2+1), and the latter term has a precedence of "brackets", NOT "multiplication". Multiplication refers literally to multiplication signs, which are only present in your first example (hence evaluated with a different order than your second example).

Also noted that the OP has ignored your comment, seeing as how you pointed out the unambiguous way to do it.

view more: ‹ prev next ›

SmartmanApps

0 post score
0 comment score
joined 2 years ago
MODERATOR OF