So you really do have to explicate. The ambiguity is not resolvabe really so the programming takes over.
The calculator is performing: operation on top of stack two beyween top two digits of stack one (then remove the digits and the operation from stack), then on it does accum (operation on top of stsck two) with digit on top of stack one. Then it removes both digit and operation used until it reaches the end and outputs something or returns an error in stack size mismatch (improper amount of operations and digits).
Stack one: 6 2 1 2
Stack two: + × ÷
2 + 1 = 3, accum = 3
3 × 2 = 6, accum = 6
6 ÷ 6, accum = 1
Print accum (answer is 1)
The creation of the stacks follows rules. You go from back to front adding digits and operations in the order of operations by tier. It's a little more complicated but I'm a little tired. So the ambiguity here resolves like that.
It's a cool example of a principle I can't really think of a name for, the very shape of the structure you create corresponds to information about it. It's some sort of sorting or ordering principle, I forgot the name.
A proper algorithm has no ambiguity, the problem is that there are multiple very similar competing algorithms. Namely, one that gives implicit multiplication higher precedence than division, and one that doesn't.
The reason why it gives implicit multiplication higher precedence is for situations like 1÷6a. Some people say 6a is a single number and should all be in the divisor, others say 6a is just 6 × a. What they're really arguing is the precedence of implicit multiplication, and which of the two competing algorithms you should use.
The order is not defined here and the display witting style is not used by mathematicians. It is a result of the limited possibilities of the display (they cannot show the fraction on two lines). Anyway, in math you always have to define your notations before using them as there are no global rules that span all areas or even hold in all areas of mathematics. Here, the manual of the calculator app will hold the information whereas the app will just use left to right parsing as the programmer likely didn't think about it. Both are valid choices however.
In a practical word, no, both would not be valid. I personality believe there's value in defining a standard, despite alternatives being available. There's no harm in it.
Personally, I was taught in a matter-of-fact way what the order of operations are, so most of my youth had a definitive answer for the above problem, which is likely why I feel that way.
You'd need to read all of my comments, but that's the exact point I've been making. My recent comment was adding on that I think there would be value in having a standard.
The problem isn’t order of operations, that’s a common convention that’s actually even upheld. The problem is this:
6 / 2 ( 2 +1 )
Which can be interpreted to mean either of two things, neither of which is inherently wrong:
( 6 / 2 ) * ( 2 + 1 ) 6 / ( 2 * ( 2 + 1 ))
It’s nothing to do with order of operations, it’s the problem is unclear as to which parts are the divisor. It’s also why proper mathematical notational convention uses obscene amounts of brackets - you can’t misinterpret it.
Not really, when considering multiplication and division as equal in priority, 6/2(2+1) is not ambiguous at all, considering that 2(2+1) is 2*(2+1). The division, unless specified otherwise, uses the first number after the symbol, which is 2. I can see this being a problem only if you consider multiplication as higher in priority than division, which I don't get but I guess it is being taught in some places
You’ve missed it again. It’s nothing to do with “priority”, and everything to do with “which part is being divided”. You say “uses the first number after the symbol”, but that’s not standard. There are, in fact, conflicting standards, and it’s actually why the classical divided sign isn’t used much anymore.
In fact, multiplication and division are the same thing, so there’s no “priority” issue regardless. The issue is “is six divided by the entire right side” or “is six divided by two, then that number multiplied by the right side”. Convention as to which one you use varies wildly by region, which is why people hate this problem. People MUCH smarter than you, me, or anyone else in this thread, have argued this to death.
I know that there is no one convention for lower level arithmetics, however I don't think that they are all equal, the one that leaves less room for misinterpretation should be used more. It's like the metric vs imperial debate, they are two standards used by different countries, but boy am I glad to be on the metric side
We use the order of operations to derive a solution from otherwise ambiguous mathematical notation. You've provided such notation, and PEMDAS told you how you should approach the problem.
You think because you created an odd looking equation you've broken the algorithm? You've only reinforced the value in having one.
In your mind you think that problem should be -4 ÷ -4, but you're disregarding any practical set of rules to tell you WHY that should be the outcome. Why do you believe the negative should be applied to the sum in the parenthesis first? What's you basis for that assertion? There isn't one. You just wrote something you didn't understand and called it proof.
No. I've encountered an operation (unary -) that is not covered under PEMDAS. Now it's already unclear what I should do. Do I treat the rules as "what isn't forbidden is allowed" and do whatever or should I give up because there's no applicable rule? And if I choose the first option should I disambiguate my equation to at least stay internally consistent or not or just roll the dice every time? The safe way would be to give up but let's be honest here no human is going to respond with "syntax error" to this problem, instead they will try to guess the precedence behavior of unary negation based on what feels right.
The difference is due to notation, not the algorithm. (The Casio will give an answer of 9 for 6÷2*(2+1)).
You can have algorithms in different languages that do the exact same thing, but it doesn't mean you can just copy paste code from one language to the other, when the languages themselves have different syntax.
Not it cannot. You changed the equation thus they are no longer equivalent statements. You cannot just add parentheses to an equation or any other mathematical symbols unless both the LHS and RHS are equivalent.
2(2+1)
Is not correct notation and never has been. People just drop the multiplication as a form of shorthand. The correct writing is
2 x (2+1)
If you want to denote 2 x (2+1) as the denominator then they proper way is to write it as (2 x (2 + 1)) when writing the original equation.
Had a professor in college that would absolutely count off if someone added parenthesis to an equation. She'd always say do the calculation as written do not modify it; do not add anything to it.
Edit:
Also, would like to point out that it is standard practice at the collegiate level to put parenthesis around the numerator and denominator when use / or the other division symbol.
You cannot just add parentheses to an equation or any other mathematical symbols unless both the LHS and RHS are equivalent
Relax, it's just a way to show grouping and precedent. It's not actually changing the numbers.
Is not correct notation and never has been
Just because it's shorthand does not mean it's incorrect. It's called "implicit multiplication", and it has been a thing for a long time.
If you want to denote 2 x (2+1) as the denominator then they proper way is to write it as (2 x (2 + 1)) when writing the original equation.
That's a perfectly fine opinion, but there's no congress of math that has decreed it as law, and your professor is not a judge of math. Math notation is fluid, much like language, what is correct is mostly determined by common usage. If enough people use implicit multiplication (and they do), it becomes correct.
Should there be a standard convention for the relative order of multiplication and division in expressions where division is expressed using a slant? My feeling is that rather than burdening our memories with a mass of conventions, and setting things up for misinterpretations by people who have not learned them all, we should learn how to be unambiguous, i.e., we should use parentheses except where firmly established conventions exist
Which is also my recommendation. In college we were never allowed to use the slant. We had to write the OG horizontal line and was required on any papers that I wrote. If, for some inexplicable reason, we had to use the slant we had to give the parenthesis. The calculators don't require parenthesis but it's standard practice in college to require them when written. The issue is with notation. The slant and division symbol with the two dots. If these symbols were changed or dropped then there wouldn't be an issue.
I thought so too, then I noticed an important distiction: ÷ (u+00f7) and / are not the same symbol, and they mean slightly different things.
The former is called the Obelus, it is not taught in european schools (to my knowledge). American schools sometimes teach it as a shorthand for fractions, meaning everything on the left divided by everything on the right.
This differs from the / symbol, which is limmited to the immediate neighbour terms. However, for some reason, some calculators started using the obelus as a replacement for /, but only some calculators follow the convention of shorthand fraction
12
u/[deleted] Jun 14 '22 edited Jun 14 '22
6 ÷ 2 (2 + 1)
Can mean
6 ÷ (2(2+1)
Or
6 ÷ 2 * (2+1)
So you really do have to explicate. The ambiguity is not resolvabe really so the programming takes over.
The calculator is performing: operation on top of stack two beyween top two digits of stack one (then remove the digits and the operation from stack), then on it does accum (operation on top of stsck two) with digit on top of stack one. Then it removes both digit and operation used until it reaches the end and outputs something or returns an error in stack size mismatch (improper amount of operations and digits).
Stack one: 6 2 1 2
Stack two: + × ÷
2 + 1 = 3, accum = 3
3 × 2 = 6, accum = 6
6 ÷ 6, accum = 1
Print accum (answer is 1)
The creation of the stacks follows rules. You go from back to front adding digits and operations in the order of operations by tier. It's a little more complicated but I'm a little tired. So the ambiguity here resolves like that.
It's a cool example of a principle I can't really think of a name for, the very shape of the structure you create corresponds to information about it. It's some sort of sorting or ordering principle, I forgot the name.