News Brief by Kip Hansen

There are two recent stories in the *NY Times* that bring up a curious seemingly inconsequential oddity of mathematical computing. They are both written by Steven Strogatz **— **in time order they were: “The Math Equation That Tried to Stump the Internet” and then, two days later, “That Vexing Math Equation? Here’s an Addition”. Steven Strogatz is a professor of mathematics at Cornell and the author of “Infinite Powers: How Calculus Reveals the Secrets of the Universe.”

So what’s this all about? A Tweet — that’s right — a Tweet on what Strogatz calls “Mathematical Twitter”. The tweet was this:

oomfies solve this

— em ♥︎ (@pjmdolI) July 28, 2019

That’s easy! The correct answer is:

Yes, that’s right, the correct answer is either 16 **or** 1, depending on an interesting point of mathematics. The featured image gives us some insight into what’s going on here. Strogatz explains it this way:

“The question above has a clear and definite answer, provided we all agree to play by the same rules governing “the order of operations.” When, as in this case, we are faced with several mathematical operations to perform — to evaluate expressions in parentheses, carry out multiplications or divisions, or do additions or subtractions — the order in which we do them can make a huge difference.”

* *When we resort to our handy electronic scientific calculators, we find that my answer is absolutely right!

(This image was supplied by a twitter participant…see the twitter thread).

The Texas Instruments *TI-84Plus C *returns an answer of “16” while our Casio *fx-115MS* returns “1”.

A quick survey of online scientific calculators returns mixed results as well:

And maybe a bit more accurate:

Math guys and gals know that the problem is ** order of operations** and there are conventions for which operations come first, second, third and so on. In high school we learn the convention as one of the following (depending on where you went to school):

**BODMAS** is an acronym and it stands for Bracket, Of, Division, Multiplication, Addition and Subtraction. In certain regions, PEDMAS (Parentheses, Exponents, Division, Multiplication, Addition and Subtraction) is the synonym of BODMAS.

**PEMDAS** is an acronym for the words parenthesis, exponents, multiplication, division, addition, subtraction. Given two or more operations in a single expression, the order of the letters in PEMDAS tells you what to calculate first, second, third and so on, until the calculation is complete. If there are grouping symbols in the expression, PEMDAS tells you to **calculate within the grouping symbols first**.

Strogatz says: “Strict adherence to this elementary PEMDAS convention, I argued, leads to only one answer: 16.” Ah, but ** his editor** ( and a slew of readers ) “…strenuously insisted the right answer was 1.”

To get Strogatz’s “16” one has to do this: 8/2 = 4 then do 4 x (2+2) or 4 x 4 = 16.

How to get “1” is explained in this quote from Strogatz:

“What was going on? After reading through the many comments on the article, I realized most of these respondents were using a different (and more sophisticated) convention than the elementary PEMDAS convention I had described in the article.

In this more sophisticated convention, which is often used in algebra, implicit multiplication is given higher priority than explicit multiplication or explicit division, in which those operations are written explicitly with symbols like × * / or ÷. Under this more sophisticated convention, the implicit multiplication in 2(2 + 2) is given higher priority than the explicit division in 8÷2(2 + 2). In other words, 2(2+2) should be evaluated first. Doing so yields 8÷2(2 + 2) = 8÷8 = 1. By the same rule, many commenters argued that the expression 8÷2(4) was not synonymous with 8÷2×4, because the parentheses demanded immediate resolution, thus giving 8÷8 = 1 again.”

So, if everyone followed exactly the same conventions, both when writing equations and in solving them, all would be well and we’d all get the answer we expected.

But…..

This [more sophisticated] convention is very reasonable, and I agree that the answer is 1 if we adhere to it. But it is not universally adopted. The calculators built into Google and WolframAlpha use the more elementary convention; they make no distinction between implicit and explicit multiplication when instructed to evaluate simple arithmetic expressions.

Moreover, after Google and WolframAlpha evaluate whatever is inside a set of parentheses, they effectively delete the parentheses and no longer prioritize the contents. In particular, they interpret 8÷2(2 + 2) as 8÷2×(2 + 2) = 8÷2×(4), and treat this synonymously with 8÷2×4. Then, according to elementary PEMDAS, the division and multiplication have equal priority, so we work from left to right and obtain 8÷2×4 = 4×4 and arrive at an answer of 16. For my article, I chose to focus on this simpler convention.

Our dear mathematician concludes:

* “Likewise, it’s essential that everyone writing software for computers, spreadsheets and calculators knows the rules for the order of operations and follows them.” *

But I have already shown that writers software do not all follow the same conventions….Strogatz points out that even sophisticated software like *WolframAlpha* and *Google’s built-in calculator in GoogleSearch* don’t follow the sophisticated rules and get “16”.

The final statement by Strogatz is: “Some spreadsheets and software systems flatly refuse to answer the question — they balk at its garbled structure. That’s my instinct, too, and that of most mathematicians I’ve spoken with. **If you want a clearer answer, ask a clearer question**.”

**Update Before Publication:** The NY Times’ Kenneth Change waded into the fray in today’s (Aug 7) Science section with “Essay: Why Mathematicians Hate That Viral Equation“.

**# # # # #**

I hope that you have found this essay either instructive or amusing. The real basic on this issue is that original problem written as “8 ÷ 2(2+2)” is intentionally badly formed so as to be ambiguous.

It does bring up a very serious question: If simple mathematical equations can be interpreted and solved to different answers, depending on the order of operations and given that even serious mathematical software differs in conventions followed, what of very sophisticated mathematical models, in which variables are all inter-dependent and must be solved iteratively?

In CliSci, do we get different projected future climates if one changes the **order of calculation**? I mean this not in the simple sense of the viral twitty equation, but in a much more serious sense: Should a climate model, a General Circulation Model, first solve for temperature? Or air pressure? Or first consider incoming radiation? Here’s the IPCC diagram:

I attempted to count up the number of variables acknowledged on this simplified diagram, getting to a couple of dozen before realizing that it was **too simplified** to give a real count. Each variable affects at least some of the other variables in real time. Where does the model start each iteration? Does it matter which variable it starts with? Does the order of solving the simplified versions of the non-linear equations make a difference in the outcomes?

It really **must — **I would think.

Do all of the western world’s GCMs use the same order? What about the mostly independent Russian models (INM-CM4 and 5)? Do the Russian models produce more realistic results because they use a different **order of operations**? Do *they* calculate in a different order?

I certainly don’t know — but it is a terrific question!

**# # # # #**

__Author’s Comment Policy:__

__ __There is always yet another really great question to be asked. Don’t ask me the one above, I don’t know the answer but I’d love to read your ideas. If you are involved in a deep way with GCMs, please try to give us all a better understanding of the order of operations/order of calculation issue.

Start you comment with “Kip…” if you’re speaking to me. I do read every comment that you post under any essay I write. I try to reply when appropriate and try to answer questions when I can.

**# # # # #**

Economists have forecast nine out of the last five recessions.

Any number to the power of 0 = 1.

‘Fraid they lost me right there!

That is a convention, not a literal calculation.

This whole supposed polemic is BS. and is NOT a question of BEDMAS vs hemorrhoids.

Both conventions state

exactlythe same thing in different words , neither states the multiplication has a higher priority than division.The key factor mostly ignored in this whole silliness is the rule that states you work from left to right when you have equal precedence operators. Once you remember that rule, there is no ambiguity.

Kip… : your second calculator image is a con-job since the reason they give different answers is because they are being given DIFFERENT calculations. Look again, closely. Using a full underline instead of a slash for the division implies a bracket around the denominator.

The problem I have with your version is: What if I distribute the 2 into the parenthesis? It is simply a badly written problem. When I see 2(2+2), it is the same whether I write it as 2(4) or (4+4). If the 2 is supposed to be separated from the parenths, it should either be written as 2*(2+2) or the problem should have been explicitly written $ latex \frac{8}{2(2+2)} $ or $ latex \frac{8}{2}(2+2)$ to give whichever answer is wanted. In physics problems the form is explicit.

or

messed up the latex, maybe this time I got it right.

Owen – I agree with you and, to me, the first version with the full underline for the division is the “more” correct one. My algebra training always told me to simplify as much as possible the divisor (the part at the bottom) FIRST. After that everything falls into place. We need the opinion of one of my old algebra teachers!

Correct! There’s a categorical difference between fundamental mathematics and supposed computational convention. What this viral “conundrum” shows unambiguously is that no competence in either is required for web-postings.

“In other words, 2(2+2) should be evaluated first. Doing so yields 8÷2(2 + 2) =”

The implicit rule is to simplify compound numbers- (2+2)=4.

Then the operations can proceed left to right. the mistake is that 2(4) is the same as 2*4.

Proceeding left to right: 8÷2*4-> 4*4-> 16.

The garbling of the problem is assuming 2(2+2) is different than 2*(2+2). The implicit rule requires simplifying within the parentheses but does not apply to operations outside the parentheses.

“The garbling of the problem is assuming 2(2+2) is different than 2*(2+2).”

And what if it was 2x instead of (2+2)? Would you do that implicit multiply first? Most people that learned algebra prior to digital computers would calculate 2x first.

How would you evaluate: 8y ÷ 2x in an algebra class?

x ^ ( a-b ) = x^a / x^b

let a=b and you find that “Any number to the power of 0 = 1″ is an identity , not a convention.

KIP… , I guess you used pathetic home made maths lessons to explain PODMAS et al on purpose.

Any reliable reference includes ” multiplication OR division” and “addition OR subtraction” in the hierarchy. There is no maths convention to split those groupings. Those that do probably failed school but know how to get click pennies by publishing any garbage they do not know.

Greg ==> I used quotes from published online sources for the definitions, and explanations from Strogatz — fussing about the definitions is not useful….

Strogatz makes the points of this essay, in a lot longer form, and if in doubt, read the links. For fun, you can read Ken Chang’s article in the Times too.

My old algebra teacher taught My Dear Aunt Sally. Multiply, Divide, Add and Subtract last. The answer is 1.

This is most certainly NOT by convention …….

If 1-1 = 0, the x^1-1 = x^0

or, written differently …

(x^1)(x^-1) …. or …. x^1/x^-1 …. Either of each = 1.

Therefore, x^0 = 1.

No convention, proof.

It’s more than a convention.

a^(x+y) = (a^x)(a^y) , for any real a, x, y

if x = 0, a^(0+y) = a^(y) = (a^0)(a^y)

for a^(y) = (a^0)(a^y) to be true, a^0 must equal 1.

Also, f(x) = a^x is a continuous, differentiable function, but it would not be if the value of a^0 was arbitrary.

The square root of -1?

If that doesn’t prove there’s something very wrong with the universe, I don’t know what would.

Showing glitches in man-made counting systems isn’t proof of universal issues, only that we make flawed systems and should expect such errors.

As for order of operations, yeah that’s a fun issue that can make long complicated calculations problematic, especially if you don’t notice them. (I.E. if it’s deep in the middle of a long equation)

The square root of -1 is a wonderful and very handy critter. A lot of the algorithms I work with would be a bear if we didn’t use complex numbers.

There are a number of conventions in mathematics and science that may have originally been employed as a shortcut to ease computation. However, as they found applications in more and more fields, they gained so much acceptance that they might as well be considered the true representation. The square root of -1 is likely the most important one of all, especially in its application to sinusoidal signals and how it so easily permits things like positive and negative frequencies. Those pretty much convincingly exist in the dual sidebands of AM radio.

I’ll go so far as to claim that a universe without the existence of the square root of -1 would be a very weird place.

Yes, consider the problem f(x) + f”(x) =0.

The solution is f(x) = C1 e^(ix) + C2 e^(-1x) + C3 + C4, which is equivalent to

f(x)= c5 six(x) + C6 cos(x) + C3 + C4

When you get an imaginary solution, you can be certain a trigonometric function is involved.

What does 0^0 evaluate to?

How about (0^2)/(0^2)?

Using the L’Hopital Rule, the limit of x^x as x approaches 0 from above is 1.

“Economists have forecast nine out of the last five recessions”

I think it depends which “economists” you are referring to. Central Bank economists NEVER see a recession coming – they are famous for it. On the other hand, Zerohedge has forecast at least 200 of the last 2 recessions, and then everyone else fits in somewhere in between.

As I have commented regarding this issue in other threads, the problem is that it is a poorly written equation if it has ambiguous interpretations. Add a couple of parentheses or brackets and the issue is solved.

It’s not poor mathematics, its poor programming.

Rocketscientist – Your point is well supported in practice.

If you type this into either the iPhone calculator or the calculator that’s built into Windows 10, you get 2.

It’s some kind of autocorrect effect, I think.

What happens in the Windows 10 calculator is that it doesn’ t reproduce what you enter if you try to do it as the equation is written.

When you enter 8/2 the calculator displays:

8/

The two is not displayed yet. When you type the first parenthesis it displays:

8/(2

Now it’s messed up, and it doubles down to the finish.

8/(2+2)

To make it work correctly, you have to type in the explicit multiplication:

8/2X(2+2)

and you get the correct answer of 16.

James Schrumpf

Wrong! To get the correct expression and answer you have to use nested parentheses. i.e.

8 / (2*(2+2)) =1

No the correct answer is 1

writing 2(2+2) has to work the same way as writing x(x+2).

There is IMPLIED bracketing.

“writing 2(2+2) has to work the same way as writing x(x+2).

There is IMPLIED bracketing.”

+10

My first impression of all this, having read about it elsewhere, was “any idiot knows that the correct answer is 1”. … Implied bracketing seemed obvious to me. My eye, thus, saw two terms, one on each side of the division sign.

2(2+2) is read like it is one side of the division sign. It could also be written as 4+4. It only becomes separated terms, when the indicated operation on the right side of the division sign is carried out. It’s like “2x”, where “x” is “2+2”. At least, that’s how I thought I was taught.

+1

What the heck is “implied bracketing”? 2(2+2) has plenty of bracketing, the implied multiplication is immaterial, as the issue is how division and multiplication relate in 8/2(2+2).

Ric: “the issue is how division and multiplication relate in 8/2(2+2).”

Except the expression is written as 8 / 2(2+2)

You left out the spaces. That’s what a computer programmer does. It changes the entire expression when you leave out the spaces.

Clyde Spencer is right. The equation has been poorly structured. To make it unambiguous, one should use nested brackets.

8/(2*(2+2)) unambiguously gives you 1.

(8/2)*(2+2) unambiguously gives you 16.

When creating formulae in spreadsheets, it is a very good idea to use brackets routinely, even when you don’t strictly need to, because you can’t be sure what convention the program may follow. It also helps you to structure your formulae correctly.

“There is IMPLIED bracketing.”

No, there is implied multiplication, not bracketing.

Bracketing changes the meaning.

Agreed!

I still write overly complex calculations to ensure most computers follow the calculations as I intend; though people frequently complain. Just another aged programmer stuck with certain conventions…

A statement that does not mean I get perfect results. All too often, it takes stepped calculations to identify where CPUs zigged where I coded zags.

Inside out,

Highest operand,

Which makes “original problem written as “8 ÷ 2(2+2)”;

2+2,

2 X (4),

8 ÷ 8 = 1.

Properly, the formula should be written as “8 ÷ 2(2+n), n=2”.

Otherwise, people who are mathematically proficient, immediately recognize 2(2+2) as 2³.

Which rather proves computers are not mathematically proficient, instead they require stepped language to reach their sums.

Again, proving what my COBOL and BAL Assembly teachers said many many times; “Never trust implicit commands! Program explicit commands.”

Apparently, this “Dan Cody” comments just to throw nonsense words into the thread.

Could it be that a bot is commenting?

How did you guess that I was an Android? My real name is Hal,made in 2001.Yes,It’s been a real odyssey since then.

The question unanswered is where unary minus comes. How does one evaluate -3^2 ?

Oh, that’s good.

How many IRS agents does it take to screw in a light bulb? Only one.But it really gets screwed.

An economist is an expert who will know tomorrow why the things he predicted yesterday did not happen today.

I learned that in college from a econ professor.

What is the difference between an Economics Professor and a Finance Professor?

An Economics Professor knows nothing about everything.

A Finance Professor knows everything about nothing.

He won’t know tomorrow because of flaws in the data that everyone “forgets” to mention when writing about it, researching, and getting tenure. It’s more a case of validation within a flawed data system.

“Are you a lawyer?”

“yes.”

“How much do you charge?”

“A hundred dollars for four questions.”

“Isn’t that awfully expensive?”

“Yes.What’s your fourth question?”

#Are you Human?” “Barely -I’m a lawyer.”

What did the lawyer name his daughter? Sue.

How do you tell the difference between a lawyer and a carp?

One is a bottom feeding scum sucker and the other is a fish..

Wat is the priority of division and muktiplication in 8/2*4?

(8/2)*4 or 8/(2*4)?

The Adam and Eve computer virus takes a couple of bytes out of your Apple.

Brackets first, division, then multiplication.

In order:

16, 16, 1

Archer

Division is the inverse operation of multiplication. Therefore, the order in which it is performed shouldn’t make any difference. That is, 8 / 2 = 8 * (1/2).

True, but since I learned BODMAS, division comes first.

🙂

In programming languages FORTRAN, C, R:

brackets first, then Left to Right, multiplication and division are equal, no priority.

16, 16, 1

(addition and subtraction are also equal, no priority, so also Left to Right)

Full order is:

1)Parens – innermost to outermost

2) Powers

3) Mult, Div – Left to Right

4) Add, Sub – Left to Right

This is hardly new, there are plenty of other problems with C especially because it adds priority to things like pointer operations and logic operators.

For those of interest this is C’s precedence operations

https://en.cppreference.com/w/c/language/operator_precedence

The answer from C will always be 16 .. The brackets are done first, the mult and divid have equal precedence and it’s simply left to right.

That is why many calculator programs and websites will give 16 because they don’t care about school rules they are using programming rules.

You want and even funnier which actually effects statistics ask what is the round of 1.5

Most programming languages will return 1, they don’t do round half to even rounding like you learn at school they simply take the floor value.

As an interesting aside climate change use a lot of rounding and I guarantee you that if you look at there code most don’t realize they have bias just based on there code as they are blissfully unaware how the language they use rounds.

LdB ==> The last bit can be a real problem in older temperature records where °F and °C are covet4ededback and forth, rounded to 0.5s….which are then processed modernly by software.

gads! “covet4ededback and forth” == “converted back and forth”….

Yes, good call LdB. I reckon most of the coders of the models have limited idea of how computers actually handle numbers. This discussion has dwelt on simple integer arithmetic, once we get into floating point representations of real numbers then the wheels well and truly fall off…

> Most programming languages will return 1

ISO 9989 (the C programming language) requires adherence to IEEE 754 (floating-point arithmetic), which has a number of configurable rounding modes (eg. towards zero, towards infinity, banker’s) that determine what the result of rounding 1.5 is. Fortran has similar requirements. I have a degree in math and safety-qualify computer language tool-chains for a living, I am quite familiar with this domain.

The language also specifies exactly what the operator precedence is, and what directional binding an operator has (eg. multiplication and division have the same precedence, and bind left). You can not write this ambiguous arithmetic statement in C, it’s just sloppy typography, like choosing your own spelling and grammar rules for English then asking the internet what you mean when you tweet nonsense.

The problem with the internet is that it allows anyone with a keyboard to get a lie to run around the world before the truth can even get its shoes tied.

“brackets first, then Left to Right” – Bingo!

The problem is when they draw it 8 over 2(2+2) so it should be 8 over 2 with (2+2) beside it

16 🙂

That isn’t actually the choice. This is a really simple problem. Implicit multiplication should always take precedence after parentheses (brackets) because that type of grouping, in this case 2(2+2), is implicitly a single number, it is not actually a multiplication as per 2 * (2 + 2), it is, to put it pedantically (and implicitly), (2(2+2)) which is 8. Thus it is always correctly 8/8.

Wait a minute! You expect a computer to think in abstracts like a human? You silly guy!!!

In the immortal words of HAL, “I’m sorry Dave, I’m afraid I can’t do that”.

No, but I expect all software students to be taught to envision every possible combination when coding for complex mathematical expressions, just as I was. Complete with metaphorical rapped knuckles when I did miss a possibility I might add. 😳😳

You are completely correct: the expression was deliberately composed in a way to be ambiguous.

Agree. “2(2+2)” is just another way to express the number 8.

If, on the other hand, it had been written as “8/2 x (2+2)” that would be 16.

Peter ==> This is the opposite of how Strogatz viewed the issue originally — after a lot of review and research, he discovered there is another convention used by many that differentiates between implicit and explicit multiplication — and agrees with you now — with the caveat that the original equation was intentionally ambiguous.

Just use RPN. Completely unambiguous. It was a reason HP used it on their pocket and programmable calculators – as well as being highly efficient in terms of operations required to calculate a sum.

My TI-85 graphing calculator knows how to handle parentheses as an implicit multiplication and returns “1” as the answer.

This is as it should be, because when factoring expressions, the common factor is shown typically as “x(x+x)” NOT as “x*(x+x)”. When shown in the second form, which is the only one Excel accepts, the association with the parenthetical expression is lost unless one adds another set of parentheses. This is adding complexity where is shouldn’t be necessary.

Another way of looking at this is as follows:

The original expression can be re-written as: x^3 / ( x^2 + x^2) or x^3 / x(x+x) or x^3 / x(2x)

or x^3 / 2x^2 or, simplifying, x/2

Let x = 2 . Substituting 2 for x; 2 / 2 = 1

If one realizes why the factor immediately precedes the parenthetical expression, then an extra set of parentheses shouldn’t be necessary. The interpretation or order of operations that leads to the most consistent result should be the preferred order.

But, your point about the veracity of what is probably millions of lines of code in GCMs, when something like this could be a bug, points to the need for vetting the code by other than the team that wrote it.

This so-called “implicit multiplication” is a typesetting convention used to beautify textbooks composed using movable type. It’s not a mathematical concept. The programming languages used in GCMs do not read typeset textbooks and more than they do cursive notebooks, so it’s not likely this particular kerfuffle is a source of inaccuracy in the GCMs.

It also probably makes a difference that I learned algebraic maths (I’m English) around 55 years ago.

Yes, I agree. I would differentiate between the equation

8 ÷ 2(2+2), and 8 ÷ 2 x (2+2).

The way 2(2+2) is written indicates that it is a single expression, not stand-alone terms.

Math is the symbolic representation if something, and how it is written can give clues to what an equation is representing.

I agree, jtom. If x is a variable, and I write 1/2x, I mean 1 divided by 2x, not one-half multiplied by x. In effect, “2x” means “2 of x.” So in BODMAS the implied multiplication has the precedence of the O, and binds tightest of all the operations after bracketing is taken into account.

8 / 2 of (2+2) = 1. No ambiguity at all in my mind.

1/2X looks a lot like “one-half X” on my screen.

jtom

+1

With you ! How can it possibly be any different ?!

Peter ==>

I’m with you Peter! I got “1” and was surprised that “16” was even possible! Implicit notation has a distinct meaning. There is no operator between the number and the bracketed expression. If you choose to ignore the notation and imagine that there is an invisible multiplication symbol you are going out of your way to create ambiguity!

I do appreciate that the formulation is largely ambiguous but it is also a test of mathematical rigour. That is to say, that to end up with “16” as the answer, you first have to break the rule of implicit notation buy plugging in an operator (Multiplication symbol in this case) that didn’t exist and then go about dutifully ignoring it, so that the terms can be rearranged – left to right – to priorities division! ;-(

No. The rule is if there is no operator, it is an implied multiply operator. That’s the rule. Follow it.

As far as implicit multiplication goes, it depends on the compiler writer. I just tried 8/2(2+2) in both Python and R, and they returned errors. There’s a missing operator/invalid function. However, the expression 8/2*(2+2) yields 16.0 in Python and 16 in R.

Jim

Peter;

“I reject your reality and substitute my own!”

Why should implicit multiplication take precedence? I say, NO!

but it is actually 8 / 2 * 4 so the answer really is 16 🙂

Not clearly expressed in the article is that you evaluate from left to right as well. It can be done in one pass or multiple passes. So the correct answer to your query is 8/2*4 = (8/2) * 4. Because / and * have the same precedence, and going left to right you encounter / first. It gets pretty complicated though, and if you lump in assignment operators, they go right to left. Here is a handy (reasonable) chart with all the operators you would typically see (Not including Trig functions). I didn’t vette this page thoroughly there could be a mistake.

https://www.swansontec.com/sopc.html

Nuts. That’s like saying 8/48= 8/4*8 =16. 2(2+2) is a single concept, you can’t split 2 away from (2+2) anymore than you can split the 4 from the 8 in 48.

Simply expanded 8/2(2+2) = 8/(2×2+2×2) = 8/((2×2)+(2×2)) = 1

WHY is my comment “awaiting moderation” ???

I have noticed that a lot of my comment do not make it publishing in the blog, WHY ?

TRM

I define the issue differently.

In the first TI calculation they entered the problem correctly and got 16.

In the second they (effectively) added a second set of parentheses:

8/(2(2 +2)) as is clear from the screenshot

There is no second set of imputed parentheses in

8/2(2+2)

The answer is 16. The only way to get 1 is to mis-program the calculator with parentheses that are not there. The “times” (x) is imputed by arithmetic convention. The second calculator requires that operands be provided. This is not even interesting.

8/2x(2+2) = 16

always multiply before divide. The division bar acts as a separator.

This fooled me for a moment until I realized that 2(2+2) is really 2*(2+2) at which point I could use the rules of precedence

1) Operations inside a brackets

2) Exponents

3) Division and Multiplication (same order of precedence)

4) Addition and Subtraction (same order of precedence)

If two operations are at the same order of precedence then it is calculated left to right

So its calculated per the orders of precedence

8/2(2+2_) =8/2(4)= 4(4) =16

What is 666?

That’s the number of the beast.

And 668?

The next-door neighbor of the beast.

What’s 666-point-00000?

That’s the high-precision beast.And zero-point-666 is the Millibeast.

And 1-900-666-6666 is when you can call and talk to a beast,live,one-on-one.

And $665.95 is the retail price of the beast.

$669.25 with 5 percent sales tax.

$769.95 with all accessories.

666b…lives upstairs from The Beast.

This is getting old.

Dan Cody

And Romans knew the beast as DCLXVI

Whereas for programmers the beast is 1010011010 (binary) or 29A (hexadecimal).

We all know that 666 is the Number of the Beast -, but did you know that: –

$665.99 = Recommended Retail Price of the Beast

$699.25 = Price of the Beast plus 5% sales tax

$1879.95 = Price of the Beast, with all accessories

$655.56 = Wal-Mart price of the Beast

$654.96 = Tesco price of the Beast – and you get Clubcard points!

$6666.66 = Harrods Price of a very Superior Beast

$666 = hourly rate of the Beast’s lawyer

£666 = hourly rate of the Beast’s London lawyer [plus VAT].

$333 = ‘Half off’ sale on the Sign of the Beast

6, uh. . . sorry, what was that number again? = Number of the Blonde Beast

1-900-666-0666 = Live Beasts! Call Now! Only $6.66/minute. Over 18 only please.

£666 666 = Income of the Beast

Route 666 = Highway of the Beast

B666 = by-way of the Beast

E-666 = European Autoroute du Beast/Beaststrasse

666 F = Oven temperature for succulent, well-roast Beast

666 C = Oven temperature for well-charred Beast

$66 = Small joint of Beast

666k = Retirement plan of the Beast

6.66 % = 5 year CD interest rate at First Beast National Bank, $666 minimum deposit.

666MHz = CPU of the Beast

666CSi = BMW of the Beast

668 = Next-door neighbour of the Beast

664 = Next-door neighbour of the Beast, also

667, 665, 663 = close neighbours of the Beast

UB-666 = unemployable Beast claim form

666A, 666B and 666C = Tenants of the beast

999 = Sign of the Australian Beast

333 = Number of the adolescent Beast

6-6-6 = Whyte notation wheel arrangement of the Beast’s Locomotive

6-66 = bowling analysis of the [cricketing] Beast

6-6-6-6 = wheel arrangement of the Big Beast’s Articulated Locomotive

00666 = Zip code of the Beast

HE66 6LL = Post Code of the Beast

BA666 = Flight of the Beast

666.000000 = Beast to 6 decimal places

670 = Beast to 2 significant figures

Some repeats, true.

Auto – with thanks to Dirty Jokes [RIP].

LOL! You sound like the Beastie Boys!

You forgot the following fact:

The sum of the first 144 digits of Pi is 666.

What’s a buccaneer? a helluva price for corn!

A hearing appendage on the side of your buccanhead.

What’s the difference between beer nuts and deer nuts?

Beer nuts are $1.69 and deer nuts are under a buck.

What’s the square root of 69?

8 something

LOL! 8 some hair pie.

If H2O is on the inside of a fire hydrant,What is on the outside? K9P.

Holy crap, I’m back in 5th grade!

Alcohol and calculus don’t mix.Never drink and derive.

Dan Cody:

You are over your head. You also seem to have nothing to contribute.

All of your comments are off topic. Off topic is against the rules, but are often well tolerated anyway. You are pushing it.

Do not treat this site as your own personal jokesters playground.

Tony,you don’t sound good.You sound too serious,lighten up.Life is too short to be too serious.There’s no excuse for your condescending attitude.If you ever even had an ounce of a sense of humor in your being,you wouldn’t have replied so negatively in your remarks toward me.It’s a shame that there are people like you around that turn others off with your complaining and negativity. If you disagree with someone about anything,please do it respectfully without bellyaching about it.Grow up.Lighten up and enjoy life.Feel better Tony. – DC

We like humor with wit and intelligence. Not the mindless regurgitation of cutesy, banal, adolescent-type jokes. Try to exercise that thing between your ears and weave your jokes in with the subject at hand, have the sense to limit your need for attention, and you’ll be better received here.

My comments have been well received by others who have a sense of humor.It seems like you don’t have one judging from your overly serious attitude.Your too caught up in the subject.Take a deep breath and relax.Loosen up and try to be flexible about things and try not to be so uptight about others actions.Life is good.Enjoy it without others getting to you just because your feelings are different from others.Feel better.

HAHAHAHAHA, Big Joke.

Drop Dead, punk. Grow up

Those stupid “jokes” of yours are three times older than you are.

You just proved my point with your childish attitude.Now you’re getting nasty when your backed into a corner.Tony,if you can’t take the heat,get out of the kitchen.Grow up and stop the name calling an act like an adult instead of having a mindset of a 10 year old.Feel better.

If it’s any compensation, Dan, I thought your series was funny.

Thanks Pat.It’s nice to hear someone with a pleasant reply towards my jokes,not like some people who are just so obnoxiously critical and just plain nasty with the wrong,negative attitude in life.I think some people underestimate the power of a sense of humor in life.It really helps you to enjoy life without taking things TOO seriously.It’s a healthy attribute that relieves stress.

People are trying to have a discussion about a specific topic. An on-topic joke is always appreciated, but yours are just stuff you’ve grabbed from a bad joke site, and are just over and over and over again. Why don’t you go to a forum where people appreciate your kind of “humor”?

Why don’t you go to a forum where people are taught not to take life too seriously and are taught that trying to have a sense of humor in life leads to a healthier life because humor is good for reducing stress and leads to having a better attitude towards others instead of the negative reply to my comments.Jeff,It sounds like you need to have a more flexible attitude and have a little fun instead of getting too wrapped up in the subjects of discussion here and criticizing others because they ‘go off the beaten path’ a little.Feel better Jeff.

When I first read Dan’s string of jokes I thought it was a commentary on how repetitive the discussion was becoming. The author of the article established that there were two ways to do the calculation and no amount of “I am right and you are wrong” adds anything further to that point. The article leaves us with the tantalizing question of how different rules might alter the output of models which are created by people who have repeatedly demonstrated themselves to be numerically challenged. That is interesting. Talking loudly and banging the table about which convention is more right, is not interesting. A string of pointless jokes was warranted.

Thanks BCBILL.Well said.It ‘s good to hear from someone with a good head on his shoulders.

Ah go for it Dan, you’re as sick as me

My two-penneth as an old mathematician is that 8/2(2+2) is ambiguous. For clarification I think you would present the question as (2.(2+2))/8 = 1. So the parenthesis dictates what is calculated first to force the multiplication before division takes place.

So I agree with the statement “If you want a clearer answer, ask a clearer question.” But it does open up interesting questions as to which operator (multiplication or division) takes precedence in applications used today.

Seems to be this is wholly contrived. Does such a question exist in the real universe? No.

Ouluman and Pheonix44 ==> The question

is contrived— andintentionally ambiguous.The larger point is that so much of our day lives depends on computers and software calculating all sorts of things that affect out lives — and the rules for doing so seem to be a little undecided.

I was a web programmer for years — and ultimately HTML Czar for some very major web sites. I knew the rules to within in inch of their lives — and heaven help those on the team who violated them. But programmers do violate rules, they do take shortcuts, and for all we know, there are errors abounding in ignorance — the order of operations rules, order of processing, rounding rules, etc etc.

So this essay hopes to point to what is acknowledged to be a real world problem, mostly ignored.

Hence the importance of unit tests and stringent QA procedures.

Unit tests, function tests, system test and we still expected 3 to 4 errors per thousand line of code once it reached the field.

Kip,

Indeed, Excel is known to have bugs and MS has ignored them for years.

MS don’t do Mathematics, they sell software. When using Excel and Access you can’t have too many parentheses.

Yes.

Go get the HARRY_READ_ME.txt file from the Climategate e-mail trove, available here: http://file.wikileaks.org/file/climactic-research-unit-foi-leaked-data.zip.

Independent Validation and Verification (IV&V) is required for software impacting public safety in most engineering disciplines. But politicians are willing to destroy the entire economy of the world based on nothing other than the kludgey, most assuredly non-IV&Vd crap run by climate “scientists.”

No need to drag down the .ZIP file, I have it at http://wermenh.com/climate/HARRY_READ_ME.txt

Thanks, Ric! I didn’t have an alternate source, but this is great.

Michael and Ric ==> Thanks, that’s the ClimateGate bit I was referring to.

Imagine now with copy-cat GCMs all churning out the more-or-less same dross — except the Russians! (Who are not so copy-cattish!)

It’s not contrived. As an engineer I often write something like R3/R1(R1+R2) because way back when we were taught that with x(..) the x( takes precedence over multiplication and division.

After all (4+4) = 2(2+2) so 8/(4+4)=1 and having factorized it to 8/2(2+2) the answer must remain 1.

The ambiguity seems to have arisen more recently with acronyms that I’ve never heard of until this came up. Indeed if the intent is 8/2 *(2+2) then write it thus. Or to put it another way the implied multiplication is a higher priority than explicit multiplication.

It bothers me that people could pick up my algebra and mis-interpret something that used to be clear to everyone.

Or is there a US UK difference like with billions? 10^9 as opposed to the correct 10^12.

The whole trick is that if you have a number next to a parantheses it is a multiply but you don’t have to put in the *. If I wrote it 8/2*(2+2) most people would get it right, if they followed standard left to right operation.

In computer programming, we will put extra parentheses around things to make the intent clear rather than rely exclusively on the order of operations . It makes code easier to understand and more readable.

x = (8/2) * (2+2);

Is perfectly acceptable and makes the answer much more clear without having to go to the order of operations table in the beginning of some Stroustrup book.

marqu ==> Yes, but what if I meant was x = 8 / (2*(2+2))? That’s the rub here — which did the originator mean? Which did the software evaluate when the programmer wrote “8÷2(2 + 2)”?

This is NOT a question of which rules are the proper ones —

Kip…A number next to parentheses means multiplication, not another set of parentheses. What I learned nearly half a decade ago was to put a multiplication sign between the number and the parentheses. So x=8/2(2+2) is first clarified as x=8/2*(2+2). It boggles me how someone can come up with a different answer. But then again in today’s world there are lots of things that boggle me including the growing number of people who actually believe the earth is flat.

As for the harder and much more interesting question you pose, I am not nearly qualified enough to answer. What I do know is the science is not settled.

Chuck ==> To find out how some people can

Chuck ==> figure that differently, you need to read both Strogatz’ articles. He thought there was only 1 way too — and he is a maths professor at Cornell.

Why not ask Greta, I am sure she has an oppinion

Kip,

Very interesting, type it into Excel as written, =8/2(2+2) and Excel tells you there’s and error and suggest a correction, =8/2*(2+2) which it then answers as 16 !!!

ColA ==> Fascinating, isn’t it. Just when we are on the verge of massive parts of society being controlled by “AI” computers, we find they have such a basic unresolved issue.

I think there are numerous issues and areas in which machines are greatly inferior to even a simple minded organic intelligence.

Things that a person, and even animals like birds, dogs and cats can do instantly and easily, but machines are baffled by, or simply freeze up or ignore.

Random example:

Remember when that self driving car saw that lady crossing the street but did nothing because…um…it is a machine and only does what you tell it to do?

She was killed even though there was plenty of time to stop.

Machine was not programmed with an emergency override protocol or anything like it.

Which it seems to me ought to be at the most basic level of it’s instructions.

Like the things that we do automatically before we even think about it.

100+

Kip,

300 odd replies says everyone got something out of this, great work!

I always tell my Junior Engineers to work out the problem by hand before they program or work out the answer by hand because it is so easy with Excel to get your parenthesis wrong and your example proves that very well.

It is easy to see here the difference in results here between 8/(2(2+2))=1 and 8/2*(2+2), but if you get your bracket wrong in something like this it is a lot more difficult to sort it out if you don’t have some idea what the right answer is!!

=IF(LH<G,(F+I-Lth)/2*LH+(F+I-Lth)/2*LH/COS(RADIANS(90-Az))+(A+H-Lth)*LH/COS(RADIANS(90-Ay))+(I-Lth)*(H-Lth),(F+I-Lth)/2*G+(F+I-Lth)/2*G/COS(RADIANS(90-Az))+(A+H-Lth)*G/COS(RADIANS(90-Ay))+(I-Lth)*(H-Lth))

When I do stuff in Excel, I’m very explicit. I would have typed in =(8/2)*(2+2), if that’s the calculation I wanted to perform.

For years I’ve been adding brackets to all equations where there was any ambiguity … and I didn’t understand why there was ambiguity – and I did keep thinking “perhaps there’s a general rule I should learn to avoid this”.

Finally I understand … one enormous cock up by mathematicians!!!

Scottish ==> You got that right — it is really a programmers error though — an error in the writing out of an equation. My rule has always been “be explicit — don’t imply”.

Blame it on the teachers/lecturers.

There is no ambiguity as far as I am concerned, the answer is 1. No one during my education in the 60s saw an ambiguity. Sure we were told to use extra parentheses in the case of ambiguity or programming FORTRAN but the rule was clear implicit multiplication takes precedence or factoring doesn’t work.

+10 !!!!

This is really fascinating how we can have different rules for such a simple thing. During my education in the 60s I was taught that a number besides a parentheses mean multiplication. So to me the is no ambiguity either. x=8/2(2+2) is very simply clarified as x=8/2*(2+2). I’ve never heard of “implicit” when it comes to the order of operations. But I’m definitely not a mathematician.

I like the second question that was posed.

Scottish Sceptic,

I too have always added additional parentheses to clarify what was to be done in equations. Often I’ve been criticized for doing so but I as long as I got correct answers I never bothered changing.

Write the problem with the “8” being the numerator.

Draw a long line under the 8 to separate the numerator from the denominator.

The 2(2+2) term is written as the demominator.

Like any symbolic language, terms can be manipulated to appear paradoxical.

bwegher

August 8, 2019 at 12:13 am

Yes you’re right…my take is that it should be 8/(2(2+2))=1.

Kip, many thanks for another interesting post. Those climate “experts” that just let their computer do the thinking for them should take note (but they won’t).

“Those climate “experts” that just let their computer do the thinking for them should take note”

Definitely! Skeptics should also take note.

Kip asked some good questions about the Global Climate Computer Models that need to be answered.

‘experts’????

See https://wattsupwiththat.com/2011/11/24/crus-dr-phil-jones-world-renowned-climatologist-cant-even-plot-a-trend-in-excel/

Alastair ==> Yes, it is the greater question — the order of processing in the massively complex and complicated GCMs — that is important.

That is how I would have done it. The 2 outside the brackets in algebraic operations implies a distributive operation on the interior of the brackets before anything else was calculated. That would render 2(x+y) = 2x+2y, so 2(2+2) would be 8. Then the division yields 1. I never had a teacher that would have treated that as ambiguous. I don’t recall for certain, but I belive Reverse Polish notation would render it 22+2*8/ -> 4*2/8 -> 8/8 -> 1.

Computers changed all that. Pencil and paper were clear. Programming is not.

Sheri ==> Yah — you’d think that all that structure and “rules based” programming languages would have fixed something like this….

PEMDAS should always result in 1. The addition is inside parents so that is first. No exponents. Multiply next. That gives us 2*4 or 8 for the right side of the equation. Then the division, so 8/8 or 1. No other result is possible by that method. PEMDAS will always give an answer of 1. Anyone who says otherwise is not applying the rules correctly.

The issue is that the rule you are quoting is not the rule that everyone uses and/or was taught to use.

Any rule that ignores the spaces in the expression is an invalid rule. You can’t ignore the spaces in a handwritten expression. Replace the spaces with parenthesis or brackets and then evaluate it.

Disagree. The use of implied multiplication is just a lazy way to avoid writing down the multiplication sign. That’s all. It isn’t somehow a “higher” form of multiplication.

The ‘implied multiplication’ is a red herring. Multiplication is done before division in the rules I learned.

“The use of implied multiplication is just a lazy way to avoid writing down the multiplication sign. That’s all. It isn’t somehow a “higher” form of multiplication.”

Really? When my calculus books writes an equation as mx+b then it should actually be written as m*x+b?

I can show you all kinds of math books that will disagree with your view.

The original expression was not written in a computer language. It was written in the form that math expressions have used for generations.

It would seem that far too many people on here think all math expressions must be written in a form conducive to interpretation by a language compiler.

I doubt you can show me

onemath book that disagrees with my view.When evaluated according to the rule under discussion, “mX + b” will turn out the same as “m x X + b” every time, as in either case “mx” and “m x X” are evaluated before adding “b”.

mx + b was not an example of precedence of operators. It was an example of how elements of an equation are grouped in the written form, Which includes the implicit multiplication operator.

The example of x(x+x) has been offered up in this thread multiple times. In the written form of mathematical expression 8 / x(x+x) makes no sense unless x(x+x) is evaluated first because of the implicit operator of multiplication.

If I gave you the expression ʃ x2 / x(x + 1) exactly how would you evaluate it manually?

“The example of x(x+x) has been offered up in this thread multiple times.”

And that’s fine, but it doesn’t begin to answer what happens when a term and operator precedes it.

There is another serious issue when doing calculations on a computer and that is that usually you are allowed a limited number of significant digits. If you for example divide a number by 1000 it is quite possible that you are throwing away 3 significant digits. Any subsequent multiplication will be incorrect. Therefore multiplication should always come first so that BODMAS becomes BOMDAS.

You are starting to sound like a mozzie.

And then there’s RPN, reverse polish notation:

https://www.google.com/search?q=polish+reverse+notation+calculator&oq=Polish+reverse&aqs=chrome.

Simple answere is: know your tool. And know why you prefer THIS tool.

RPN is what was fed directly into Forth, when having something to parse infix expressions (in an interpreter) was considered too expensive computationally.

The shuntyard method can be used to write a simple infix expression parser. It uses operator priority to determine if something should be pushed onto a stack or if an operator and two operands should be popped off, evaluated and the result pushed back to the stack.

It’s been close to 40 years since I first wrote one (in COBOL – don’t ask)…

Johann Wundersamer ==> In the early days of Chaos Theory, it was discovered that different brands of computers returned wildly different tresults when processing non-linear equation iteratively.

Think of GCMs written for early computers being run, without re-writing thousands of lines of code, on modern computers….

I found there were some interesting “divergences” in solutions to Limits to Growth models that used 4th order Runge-Kutta methods in the DYNAMO programming language. Being a naive young student, I simply decided to play with the program a bit and soon managed to produce instabilities.

It doesn’t ==> This was in the early days of Chaos Theory?

And then there’s RPN, reverse polish notation:

https://www.google.com/search?q=polish+reverse+notation+calculator&oq=Polish+reverse&aqs=chrome.

Simple answere is: know your tool. And know why you prefer THIS tool.

https://www.umrechnung.org/hp-rpn-rechner-online/rpn-reverse-polish-notation-rechner.htm

The bane of programmers everywhere.

Should always explicitly include the braces/brackets then there’s no ambiguity and following maintainers are less inclined to make mistakes or misinterpret meaning.

So it should be expressed 8 / (2 * (2 + 2)).

Then the meaning is explicit….

This short arithmetic quandary reflects the centuries old conflict of two cultures European vs Arabic.

Ancient Greeks and Romans had impracticable numerals and wrote from left to right. Arabs invented present day use numerals but wrote from right to left.

If calculation is performed with the western method of reading from left to right result is 16

If calculation is performed in Arabic way result is 1.

“Ancient Greeks and Romans had impracticable numerals and wrote from left to right.”

____________________________________________

Ancient Greek Mathematics was based on Euclid and Pythagoras.

Euclid brought the Egyptian methods of calculation to Greece: the Egyptian calculation methods were actually based on the evaluation of the length determination and area determination from land surveying for the construction of temples.

When the “0” was introduced in India for administrative calculation problems and calculation tasks for commercial, business tasks, the basis for modern mathematics was laid.

No, the 2 on the front of the (2+2) is a component of the numbers inside the parenthesis, the correct western method is to resolve it to 8/(2×2+2×2), 8/(4+4), 8/8 = 1

You miss the point. There are number of ways to resolve the problem, some already discussed, but they all involve introducing additional elements, as you did by moving parenthesis about and introducing additional numeral 2, which fundamentally change the original equation.

What I have shown is that if original (not modified !) equation is performed step by step in its original form, the two results conform with western or alternatively arabic way of reading written text.

there are NO other ways to resolve the equation because it is not an equation it is a fraction… I changed nothing in the fraction… ((8))/(((((((2(2+2)))))))) is the same as 8/2(2+2).

The top is literally 2(2+2) to begin with. So what does 2(2+2)/2(2+2) come out to?

Parenthesis ARE the first step, they MUST be resolved first: standard algebraic rule.

So does (4+4) factorise to 2(2+2)?

If yes the answer is 1. Hint the answer is 1.

Again from above any programmer will tell you the answer is 16 and there programs will all agree because they don’t care about your method or what you were taught at school. It is why the websites and calculators are throwing that up because they just feed the mathematics to the language.

That is the issue there are a number of different standards to how to approach it and just because you were taught it one way does not make the correct answer. It is the old case don’t mix standards and the answer depends on the standard used, it isn’t the maths itself that is changing just the standard used.

No, programmers with a degree also have a mathematics degree and understand from *Grade School* algebra that the parenthesis must be resolved first prior to actions outside the parenthesis.

Yeap

Prjindigo, you keep harping about doing the parentheses first, (which is true), but that’s not the issue here. The issue is: In the absence of parentheses, what is the order of evaluation when you have a string of infix operators and operands that are all of the same priority. (Note: multiplication and division have the same priority which is higher than addition and subtraction which also have the same priority.)

So how do you evaluate the string 10/5*3/6*2?

Answer: Evaluate left to right to get 2 (because most western languages are read left to right.)

Notice that I am talking about mathematical expressions constrained to be written linearly as a string, which most computer language compilers/interpreters/etc. require.

When we relax this constraint by allowing mathematical expressions to be written as 2-dimensional expressions (as most mathematicians do) then the division operator may extend itself as a long line (called the vinculum) separating any expression in the numerator over any expression in the denominator. Essentially the vinculum imposes implicit parentheses around the numerator and around the denominator which mathematicians usually omit, but which must be used when linearizing that 2-dimensional expression to be evaluated in some computer language.

noaa: “The issue is: In the absence of parentheses”

The issue is that this expression was written as a manual expression like you would see in a math book, not as a line in a computer program.

“Notice that I am talking about mathematical expressions constrained to be written linearly as a string, which most computer language compilers/interpreters/etc. require.”

The expression given is not written linearly as a string.

“When we relax this constraint by allowing mathematical expressions to be written as 2-dimensional expressions (as most mathematicians do)”

Bingo! Everyone getting an answer of 16 is doing so by trying to REWRITE the expression into computer language.

Gormon: “The expression given is not written linearly as a string. ”

It most certainly is written as a string:

8÷2(2+2) = 16 is a mathematical expression written linearly as seen at the top of this particular blog. It matters not where it appears – a math book or a computer science book – the answer is always 16.

8

———- = 1 is a mathematical expression written 2-dimensionaly.

2(2+2)

There’s no mystery here. I’ve been teaching these conventions in university math and computer science courses since 1970.

noaaprogrammer,

8÷2(2+2)

Why do all programmers leave out the spaces provided in the original post?

8 ÷ 2(2+2) is not the same. The 2(2+2) is separated from the divide operator by a space. Spaces indicate grouping in any language I know, including math! Certainly “thesunisrising” is different than “the sun is rising”.

Early computer languages like FORTRAN, Algol, etc., required math expressions to be string-oriented for compilation into machine code, and spaces were used as syntactic delimiters – never as mathematical operators. However later computer languages capable of handling symbolic math expressions would allow implicit multiplication – e.g. 2(2+2) – but I am not aware of any of them using spaces to override the usual left-to-right evaluation of operators of the same priority. (Parentheses are used to do that.)

Neither am I aware of any authoritative, widely accepted rule among mathematicians to use spaces to override the left-to-right evaluation of operators of the same priority – mainly because it can be hard to detect the difference in a complex expression between one space and no space among the many different fonts that allow proportional spacing. Thus mathematicians use parentheses and/or vinculums (as in division and radicals) to denote the order of operator evaluation.

Cite me an authoritative source that states otherwise – e.g. 8(space)÷(space)2(2+2) = 1.

Note: Postfix and Prefix notations are used by some programming languages to simplify such ambiguities in infix notation.

Cite me an authoritative source that states otherwise – e.g. 8(space)÷(space)2(2+2) = 1.

How would you evaluate the expression 8y ÷ 2x on a manual basis, no computer, no programming language. Just a straight expression written on a blackboard using chalk with a value for y and a value for x given to you?

I can tell you how every algebra teacher I know would evaluate it.

You keep addressing this as if the expression given was part of a computer program. There was nothing in the original post to indicate such. It looks like an expression out of a basic algebra text.

Gorman: “How would you evaluate the expression 8y ÷ 2x on a manual basis…”

1) Multiply 8 times y,

2) Divide the above result by 2,

3) Multiply the result of step 2 by x.

When any individual is doing a rough back-of-a-napkin calculation they are obviously free to use whatever notation they’re used to. However if I were a proof reader or editor of a book or article that wrote 8y ÷ 2x intending the semantic to be

8y

—

2x

I would make them write it as 8y ÷ (2x).

Gorman: “You keep addressing this as if the expression given was part of a computer program.”

Yes and No. Because the use of computers is so endemic nowadays, computer science has correctly forced mathematicians to avoid such ambiguities. Computer languages are necessarily designed with unambiguous grammars so that for any given mathematical expression, everyone everywhere will get the same answer every time.

noaa:

1) Multiply 8 times y,

2) Divide the above result by 2,

3) Multiply the result of step 2 by x.

So in the first element of the equation you follow the convention of implicit multiplication but for the second element you ignore it. That is being inconsistent and illogical. Either implicit multiplication works or it doesn’t.

“I would make them write it as 8y ÷ (2x).”

Why not make them write it as (8*y) ÷ (2*x)? If you are going to require explicit operators then require *all* elements to follow that rule.

“Because the use of computers is so endemic nowadays, computer science has correctly forced mathematicians to avoid such ambiguities.”

Sorry, even modern textbooks still use the implicit multiplication format.

“Computer languages are necessarily designed with unambiguous grammars so that for any given mathematical expression, everyone everywhere will get the same answer every time.”

This is true. That’s because computers are very literal and require very literal statements to evaluate. It is almost impossible to have them differentiate between various writing formats. You simply cannot write enough logical interpretation rules to cover all possible formats. Humans don’t suffer from that foible, at least not as much.

Algebraic expressions have been written in the form of 8y ÷ 2x since algebra was invented. Examples abound in academic, scientific, and engineering treatises, even today. Computer programmers may not like that but the world doesn’t revolve around the wants of computer programmers. Sorry.

Gorman “Why not make them write it as (8*y) ÷ (2*x)? If you are going to require explicit operators then require *all* elements to follow that rule.”

No, using the mathematical convention of juxtaposition of numeric coefficients with letters to implicitly denote multiplications as seen in the numerator is perfectly unambiguous and OK. That’s not the point – (unless you’re writing code in a language that requires a multiplication operator). It is only when you have a string of multiplicative operators (implicit or explicit) of the same priority without parentheses or vinculums, that one is forced to invoke some rule for their order of evaluation, which is left-to-right. So since (ab)/c = a(b/c), it is not necessary to use parentheses until encountering the third operator operating over the 4th operand. (Although not a requirement when programming mathematical expressions, I generally use the fewest symbols possible without compromising clarity.)

How would you evaluate the string: 2+3 – 6–7 ? (Notice the extra spaces around the central minus sign.)

“No, using the mathematical convention of juxtaposition of numeric coefficients with letters to implicitly denote multiplications as seen in the numerator is perfectly unambiguous and OK. That’s not the point”

In the numerator? But not in the denominator? Once again you are not being consistent. And that *is* the point.

8y ÷ 2x is the exact same form as the original example. Just set y=1 and x=4. Both expressions should deliver the same answer. If the answer isn’t the same then something is wrong with the way the expression is being read.

“How would you evaluate the string: 2+3 – 6–7 ? (Notice the extra spaces around the central minus sign.)”

Since addition (subtraction) is perfectly associative it doesn’t matter how you evaluate this expression.1: 2-7=-5, 3-6=-3, -5-3=-8. 2: 2-6=-4, 3-7=-4, -4-4=-8. Or 3: 5-13=8. You can do these in any order. You can even write this as 2x+3y-6c-7d and evaluate it as -8 if x=y=c=d=1.

So what? This still doesn’t explain you doing implicit multiplication with one element of the expression but refusing to do implicit multiplication with the second element.

Gorman: “In the numerator? But not in the denominator? Once again you are not being consistent. And that *is* the point.”

It is not a matter of consistency, it is a matter of order of applying the operators to operands. Because we read from left to right it is indeed unnecessary to put parentheses around the 8y which is the numerator. And to reiterate, if your semantic is

8y

—

2x

then you do need to put parentheses around the 2x: 8y ÷ (2x). Otherwise your semantic is:

8y

— x

2

regardless of how many math books show otherwise.

Gorman: “Since addition (subtraction) is perfectly associative it doesn’t matter how you evaluate this expression.1: 2-7=-5, 3-6=-3, -5-3=-8. 2: 2-6=-4, 3-7=-4, -4-4=-8. Or 3: 5-13= [sic -8] 8.”

Yes addition is associative, but subtraction is not associative (neither is division). Thus the order does matter in which you evaluate the string:

2+3 – 6–7

Again, since there are no parentheses and the operators + and – have the same priority, the rule is to evaluate from left-to-right to get:

2+3 – 6–7 = 5 – 6–7 = -1–7 = -8

Now if I do a right-to-left evaluation, I get:

2+3 – 6–7 = 2+3 – -1 = 2+4 = 6 ≠ -8

If I do the order of operations as you want to do for 8y ÷ 2x, I get:

2+3 – 6–7 = 5 – -1 = 6

So if you want a rule that says that extra spaces surrounding an operator requires that operation be carried out after the other operators, then you’re going to have to accept the result of 6, not -8 as you demonstrated in 3 different ways. And that IS a matter of being consistent.

“It is not a matter of consistency,”

Of course it is.

“f I do the order of operations as you want to do for 8y ÷ 2x, I get:”

There is no “implicit addition” or “implicit subtraction” rule. You are still showing your programmers bias.

“So if you want a rule that says that extra spaces surrounding an operator requires that operation be carried out after the other operators”

Stop putting words in my mouth. That is *NOT* what I said. I said the spaces in the original expression provide a grouping for the implicit multiplication. A totally different thing. Again, your are still showing your programmers bias.

Gorman: “There is no “implicit addition” or “implicit subtraction” rule. You are still showing your programmers bias.”

The implicit or explicit use of any operator has no bearing on the matter other than perhaps suckering a person into an incorrect evaluation of the expression – which is the raison d’être for this particular topic on WUWT. Whether writing the expression as 8y ÷ 2x or as 8*y ÷ 2*x, it should be evaluated the same way in mathematics as well as computer science – unless of course, a widely adopted rule is made which states otherwise, which I’m sure will never be made because it would continue to perpetuate the ambiguity and be inconsistent with current operator precedence rules.

Gorman: “There is no “implicit addition” or “implicit subtraction” rule. You are still showing your programmers bias. … Stop putting words in my mouth. That is *NOT* what I said. I said the spaces in the original expression provide a grouping for the implicit multiplication. “

I was not trying to put words in your mouth. I was merely pointing out your inconsistency of evaluating a string of multiplication and division operators (which have the same priority) from an analogous string of addition and subtraction operators (which have the same priority).

Again, in the absences of any parentheses, what numeric answers do you calculate for the following two expressions and still be consistent in your order of evaluating the two expressions:

1) 2*3 ÷ 2*3 Or, because implicit multiplication between two integers is indistinguishable from positional notation, evaluate:

2x ÷ 2x, where x = 3.

2) 2+3 – 2+3

Note: The linear use of the spacebar for indicating grouping and thus changing the order of operator evaluation without using parentheses is a very dangerous and ambiguous proposition because it is a “white space” operator – i.e. invisible, and unless sufficiently obvious, open to personal interpretation of various readers – as well as the translation of one file to another, particularly between files of different fonts. (For example, I put two spaces around every division operator as well as subtraction operator when typing this response; but I think that once this is posted on the WUWT site, it will be collapsed to just one spacebar.)

LdB,

Wrong, I have been programming in many languages since 1971 and I came up with “1”.

When you go to program an equation into a computer you must translate it from math (algebra, calculus, etc.) to the proper form for the computer language that you are using. If you don’t you get the wrong answer.

“the 2 on the front of the (2+2) is a component of the numbers inside the parenthesis”

The 2 on the front has an implied multiplication…of the numbers inside the parenthesis. Its not implied to grouped to them other than the so called “sophisticated convention”. If you can point to an actual mathematical rule that does so, I’d appreciate it.

The actual mathematical rule that gives the answer 16 is well defined.

The actual mathematical rule is that the / sign means it’s a fraction, on the left the enumerator and on the right the denominator and the two are separate numbers… that means the stuff to the right is ALL one denominator and must be resolved prior to any math involving the enumerator.

The fact that some badly programmed calculator comes up with a wrong answer is a symptom of stupidity, don’t let yourself get infected by groupthink and massmoron.

The rules for that “problem” are and have been set out in Algebra books for several hundred years.

*My* Ti85 graphing gets the answer of 1 correctly. It wasn’t manufactured by the lowest bidder in a foreign country. It *is* 28 years old.

The “/” sign is not necessarily a fraction. And it certainly isn’t as you claim in the current case because the whole following string isn’t in parenthesis. The “/” is a lazy shorthand for the divisor symbol.

Yeap

“Arabs invented present day use numerals”

This is a stubborn myth. They are in fact from India. link: [url]https://en.m.wikipedia.org/wiki/Hindu%E2%80%93Arabic_numeral_system[/url]

It has always bothered me that we call them Arabic numerals. Then, when you are actually in an Arabic country, they use a different set of numerals. Their numerals look similar the Arabic language symbols.

“Arabic” numerals aren’t Arabic!

Adapted from Arabic notification

https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS5bCGUEovtcR5BFOUsHgDY9zZCTKfvsPG18dwrPuaLbiXOb7smCg

Mathematics, like English, is a language. Math is a lot more precise, but it’s still possible to be ambiguous. In English, if you actually want to convey a precise meaning, you will be careful to create a sentence that avoids ambiguity. That’s also the case with math.

Presumably the equation in question was written with some purpose. That should guide the way you write the equation. If you end up with something ambiguous, you should write the equation a different way.

If I’m programming, I tend to add brackets if there is a problem with readability.

In the English language, word order is important. A good example is the use of the word “only.” Here’s a short sentence with “only” in four different places:

Only I love you. (No one else could possibly love you.)

I only love you. (I don’t like you much, I don’t do anything else to you, but I love you. That’s it.)

I love only you. (I love you, but I don’t love anyone else.)

I love you only. (Same as I love only you, as far as I can tell.)

Four simple sentences, three quite different meanings.

You missed out punctuation.

Only, I love you

Only I love. You?

Only I! Love you?

etc…

And stress. As in:

WHAT is this thing called love?

What IS this thing called love?

What is THIS thing called, love?

Dodgy;

I highly recommend

Eats, Shoots & Leavesif you have not already come across it.Benny Hill used to do a routine on how the same words, with different intonation, completely changes the meaning. So, it isn’t just word order!

Benny Hill: “What is this thing called love.”

And then, even though Yoda mangles usual English, understand him we do.

commie ==> There is no doubt that the original equation was intentionally written to be ambiguous and to create a stir — which I think is a grand idea as it points out an interesting and disturbing problem within the programming and computing arena.

I agree that somebody is simply trading on the inherent ambiguity of the order of operations. As others have noted the statement is inherently ambiguous and because the order of operations is fundamentally arbitrary these debates will come up again and again. The answer would probably be unambiguous if the expression was written to reflect a real situation as opposed to an abstract statement.

bernie1815 ==> Yes, that is the conclusion of this essay correctly stated.

The problem lies is the bigger issue in “order of calculation” in GCMs.

Kip,

The expression is no more ambiguous than the expression mx+b which can be found in every advanced math book I own.

There is no difference between 2(2+2) and mx.

The image given shows an expression written on a black board and nothing indicates it is part of a computer program meant to be interpreted by a language compiler.

I agree with Kip, the answer can be 1 or 16. Depending, of course.

HoweverThe

Correctanswer, of course is 16.All other answers are Wrong. Not faulty, not flawed, Just Plain Wrong.It should be noted that the question itself is

In Error.The construct:

8/2(2+2)

is correctly interpreted as a function call, but 8/2 is not a legitimate function pointer, so an error is generated.

The correct form is:

8/2*(2+2)

Now it is unambiguous. The multiplication and division are equal priority, and so proceeds left to right.

This order is very, very important. Without this standard, modern computer programming and computation would be impossible.

Both factors, the pointer error, and the calculation order are reflected in such vastly different languages as C and R, and probably many others as well.

As ColA notes, exactly the same 2 issues apply in Excel, which means something extraordinary has occurred. That is, that Microsoft actually got something right!

The fact that somebody, somewhere got some old fringe “standard” from out of the past and scraped the mold off of it hardly makes a worthwhile controversy.

TonyL ==> Strogatz, professor of mathematics at Cornell and author of deep mathematics books, thought as you did, then changed his mind.

Things that seem very certain to us can be seen in a different light with enough effort.

The most correct thing is to re-write the question to eliminate the ambiguity.

Just having fun with getting a bit dogmatic. I note below that the standard in Algebra is great because there are so many to choose from.

Interesting, that in *math*, multiple answers were obtained and defended.

In computer languages, the question was universally rejected with an error.

I found that to be interesting.

Every platform I’ve tried so far yields an error for 8/2(2+2) or won’t even let me enter anything past the first 2.

Every platform I’ve tried so far yields 16 for 8/2*(2+2)… Granted, I don’t have any of my 1970’s vintage calculators handy.

I used my 1970’s vintage pencil and paper and the answer is unequivocally 1.

The equation uses algebraic notation, so must be resolved using algebraic rules. The 2 outside the parentheses applies to the values inside the parentheses, and expansion must be done before resolution, 2(2+2) = (2*2)+(2*2)

Thanks for another very interesting post and a good discussion of a topic that is probably under addressed.

It does suggest that too many people may be just letting the computer do the thinking for them…especially those in climate science.

My take is that it should be written as 8/(2(2+2))=1; but others may differ.

“Thanks for another very interesting post and a good discussion of a topic that is probably under addressed.”

More mathematics please!

It’s not a matter of should.

8/(2*(2+2))=1 Correct

8/2*(2+2)=16 Correct

(8/2)*(2+2)=16 Correct

8/2(2+2) = Malformed expression

David,

Note that you have introduced a multiplication symbol for your first three equations. That symbol was not present in the original formulation. You have made an assumption that the multiplication symbol should be used. Your introduced parentheses for the first and third equations are forcing the hierarchy of calculation because operations with parentheses take precedence over all other operations.

When the original formula (without the multiplication symbol!) is entered into a TI-85, it recognizes the implied multiplication associated with the parenthetical expression, and returns “1” as the answer.

I would say that the platform that returned “malformed expression” was not sophisticated enough to recognize and properly handle the implied multiplication.

See my remark above with the algebraic justification.

The ambiguity only lies in computer programming of it. It is not ambiguous in math. Not all math equations can be directly typed into a calculator or into a computer program.

John Dilks: “The ambiguity only lies in computer programming of it. It is not ambiguous in math. Not all math equations can be directly typed into a calculator or into a computer program.”

+1

8 ÷ 2(2+2) = ?

Maybe it should be (8÷2)*(2+2)=16 , though to me it is as valid to write it as 8÷(2(2+2))=1

How to interpret ? Without the context of what these number are supposed to represent I can’t tell.

tom0mason

It may well be that the formula is written improperly if the intent was to represent something real. However, the absence of an explicit multiplication symbol tells me that the multiplication is an implicit association of the multiplier with the contents of the parentheses. Adding explicit multiplication that was not originally present is a leap too far and more of a change than simply adding another set of parentheses to make the implied association explicit for those calculators that aren’t sophisticated enough to handle parentheses in the absence of an additional set of parentheses.

Just think of how serious this could be in Science and Engineering when you could have a error factor of 16 to 1.

The problem is how it is written if it was written as 8 over 2(2+2) which is what the / symbol actually specifies it always comes out as 1.

Which is the way I was taught in the dim and distant days before primary school pupils had access to keyboards, computers, and smart phones.

We didn’t use the / sign; anything that involved division had a part above the — and a part below. The only reason for using the / is that it is virtually impossible for any keyboard to handle division using a —!

All elements of both numerator and denominator are calculated according to the principle of brackets first but thereafter operands should be equal l to r as they should be in the absence of brackets. I would expect 8+3*4 to resolve as 44; 8+(3*4) should resolve as 20. Unfortunately simple calculators even on smart phones can’t handle this because they lack the bracket and you’re reduced to 8+3=11*4=44. But whichever way you do it where division is involved the two parts need to be resolved first.

I don’t have access to any 1970’s vintage calculators at the moment… But every digital platform in my office (Wndows PC calculator , Linux, Droid smart phone calculator app, Mircosoft Excel) yields one answer.

8/2*(2+2)=16

8/2(2+2) = Malformed expression or some other error indication

The * is implicit by 2(2+2) = 2*(2+2)

I will explain.

To those that are getting 16 they are using;

8/2(2+2)=16

So the first part is 8/2 = 4

Then this is replaced in the equation

4(2+2) = 16

But look! 4(2+2) the * is implicit again as 4*(2+2) so the same must be true for 2(2+2)

Kip,

Google Scholar has nearly two millions hits for “numerical solution of nonlinear partial

differential equations” including a large number textbooks. If you want to know how to

numerically integrate differential equations involving non-commuting variables (which is

still a subject of a lot of research) then a trip to the library is going to be more helpful

than a snarky comment on a blog.

The short answer is you calculate the Jacobian of the equations and solve the resulting

system of linear equations in which the operators all commute. You then get an error

term that size of which depends on the commutator and can be minimised by taking small

steps.

Izaak ==> You have misunderstood the point, I think. GCMs are made up of many many simplified non-linear equations, each containing dependent variables from the other simplified non-linear equations — all having to be calculated and fed into one another at each time step iteration……

It is not a question of how to solve the equations (though some are known to not prone to solution) but in what order they should be solved.

Kip,

Mathematicians have long ago worked out how to numerically solve equations that

involve non-commuting operators. Which is a hard problem but one which does have

various solutions mainly involving taking many small steps on very fine grids. Which

is one reason why climate models require so much memory to run correctly.

Also since the equations only permit one solution given a set of inital conditions there is

no difference between knowing how to solve the equations and knowing what order they

should be solved in. If two different numerical methods give two different answers to the

same question then at least one of them is wrong.

Izaak ==> well, at least we know your opinions on the matter. can’t say I agree though.

Hi Kip,

Do not get me wrong. You have hit on a very important point — how do

mathematicians and physicists demonstrate that their numerical solutions to

equations are correct. And how do you demonstrate that the algorithm used will produce the correct answer. Neither question is trivial nor easy to solve but

there are solutions and there is an extensive literature about how to do it for

particular cases. It should be noted for example that the uniqueness and existence of solutions for the Naiver Stokes equation has not been proved in general (it is an open Millennium problem).

However if you want to advance the claim that the numerical solutions found

by global climate models depend on the order in which the equations are solved you need some actual evidence before people will take you seriously. Again all of the code for various global climate models is freely available online so if you want to have a look then you are free to do so. And then you can point out exactly which lines of code can be changed to produce a different answer.

The difference is how the compilers handle the expressions used in the program and the sequence of chained calculations. You can have a real problem if you suddenly divide a largish number by a very small one. You can easily run out of integers, or have overflows that wouldn’t be an issue if calculations were done by hand.

Strogatz says: “Strict adherence to this elementary PEMDAS convention, I argued, leads to only one answer: 16.” Ah, but his editor ( and a slew of readers ) “…strenuously insisted the right answer was 1.”

People hate to be wrong the correct answer is 16 if there is no reason to group the 2(2+2) term.

However, and I think Kip missed this important point, if 2(2+2) is a logical grouping …say it represents a value like “cups of flour” or “tiles per square meter”, then you

wouldgroup them together and ultimately get the value 1. But ONLY if the context of the equation warrants it.TimTheToolMan ==> First, it is not my issue — the three NY Times articles discuss the whole bag of monkeys exhaustively. so, any fault is not mine….

And your point is well taken, if the writer of the equation knew what was being described by the formula, then he would know how to make it explicit and not leave it ambiguous.

Well,

Do you agree that 4+4 = 2(2+2) ?

This is basic math.

So, starting from an initial expression 8 : (4+4) can be written as 8 : 2(2+2)

How can than 8 : 2(2+2) be equal to 16 ! or may I have to write 8: (4+4) = 16 !!

The right answer is not correct expression but at least, the right result could be 1 isn’t it ?

The problem is in your head. That is, you are internally grouping the numbers as “(2(2+2)”, which is not what is written. Understand that (a) x (b), (a)(b), and ab are all equivalent. So, the fully expanded version looks like 8 ÷ 2 x (2+2) = ?

but 2(a+b) = (2a+2b), hence 8/2(2+2) = 8/(4+4) = 1

QED

Really? You just proved my point. This is not algebra, it’s arithmetic with chained calculations. Sure, you do the parenthesis first, but then you go back to the beginning of the expression.

8/2(2+2) = ?

8/2(4) = ?

NOW BACK TO THE BEGINNING. FOLLOW THE LEFT TO RIGHT CONVENTION.

8 ÷ 2 x 4 = 16

Quod Erat Demonstrandum

D.J.: “8/2(2+2) =”

That is not how the expression is written. In essence this is a red herring argument. You are solving something other than what is at issue.

8 ÷ 2(2+2) is how it is written.

If this was written 8y ÷ 2x then how would you evaluate it? Would you do the implicit multiplication of 8y but ignore the implicit multiplication of 2x?

“That is not how the expression is written.”

Spaces aren’t part of the rules of order of precedence. Your convention is based on assumption. When your example expression is more correctly written…

8y

—

2x

…then there is a grouping formed by the divisor symbol. That’s what you’ll find in exams and text books. If you follow the rules then there is no ambiguity and no assumptions needed.

“Spaces aren’t part of the rules of order of precedence.”

Spaces are indicators of grouping. It’s always been that way. Spaces indicate groupings of letters to form words. The elements in a math expression are the equivalent of words. It’s *always* been that way. Its only changed since computer programmers began ignoring that simple fact.

“Spaces are indicators of grouping.”

That’s what parentheses are for. To assume spaces “group” is asking for trouble when most fonts are proportional these days.

“That’s what parentheses are for. To assume spaces “group” is asking for trouble when most fonts are proportional these days.”

Equations have been written with spaces to indicate grouping since algebra was invented. Proportional fonts on computers are a recent development.

The picture at the start of the thread was obviously handwritten on a blackboard. Hard to use proportional fonts on a blackboard!

You are reaching for something, anything, to back up rewriting this expression to get an answer other than what the handwritten expression actually gives based on traditional writing of math expressions.

Hardly. You’re saying assumption trumps the rules. Good luck with that.

TTTM

-1

There IS a reason to group them. It is the presence of the multiplier (or factor 2) outside the parentheses, with no multiplication symbol. That implies 2 was a common factor for everything inside the parentheses and was extracted, as is commonly done when trying to find the root of an equation.

“That implies 2 was a common factor for everything inside the parentheses and was extracted, as is commonly done when trying to find the root of an equation.”

+1

” It is the presence of the multiplier (or factor 2) outside the parentheses, with no multiplication symbol.”

The “sophisticated convention”

The actual mathematical rules say otherwise because multiplication and division have the same precedence. It is more correct and more defendable to add the implied multiplication and proceed with left to right as the defined rules state.

But it certainly rubs a lot of people up the wrong way 🙂

The correct order is ;;;;;;;

Russian models produce more realistic results NOT because they use a different order of operations, but because they do NOT use cooked CO2 sensitivity factors (like the 110 erroneous IPCC GCM models do).

As simple as that.

Telehiv ==> Is your statement made on the basis of knowledge of the details of the Russian model? or just a guess?

Note that the mathematician uses 8 over 2 to get 16 and not 8 over 2(2+2) to get 1.

That has very serious connotations about how formula are written, which version does the originator mean.

As commented above there is also a gulf between programmers and mathematicians. Most programming languages will return 16 because they have a very specific and single specification for precedence order. It doesn’t match any of the standards taught at school.

actually in oracle sql 2(2+2) returns an error … it only does the math with 2*(2+2) … and written as 8/2*(2+2) it returns 16 … but if I was writing it I would have used 8/(2*(2+2)) which returns 1 … not sure about sql server …

Kaiser ==> yes,

oneof the online calculators CORRECTLY returns ERROR — because the equation is ambiguous. Others return 16 (mostly) and some 1.Thanks for the detail on Oracle’s SQL.

What do you get when you combine fifty female pigs with fifty male deer? A hundred sows and bucks.

A damn good dinner…

I have never liked relying on precedence rules. I have always made liberal use of brackets. Some of the formulae given in text books are far from being clear.

1 or 16 ???

The difference is only 1600% ….. well within the margin of error for “climate science”!

Thanks for the interesting post and discussion thread. But I still don’t know the right answer.

The difference, 15, is 1400% greater than 1, and 6.25% less than 16.

This is not a good post to avoid unambiguity in the comments. 🙂

Sharp eye Ric …… I stand corrected! Still within the margins of error in ‘climate science’! lol

I believe that IBM clarified this when Ken Iverson devised a notation which became the programming language APL. It has always surprised me that APL was not taken up by more people.

It has been ages since I used APL, but I remember that it evaluated expressions right to left. So in APL the order of operations would be:

eval the parentheses (2+2) returns 4

then 2*4 returns 8

then 8 divide 8 returns 1

I used to love coding in APL, but after a week the code was unrecognizable. It is unlike any other programming language that I’m aware of. It needed a special character set implemented on terminals that were very difficult to find/buy. I used it for a while in the mid 1980’s.

There is just 1 answer.

. . . unless multiverses exist.

There is only one correct answer and that is 8/(2(2+2) because the calculator’s manual states that you must put parenthesis around any equations in the denominator to indicate that it should be completed first. Math also has the same kind of rule on paper.

https://www.wolframalpha.com/input/?i=8%2F(2(2%2B2))

Calculators must be correctly programmed.

Syntax Error!

8/(2(2+2)

You have an unmatched paren.

You could have also have said:

(8/2)(2+2) !!!!

This resolves the issue just as well.

That is stupid and like saying there is only one number system … newsflash there are multiple number systems.

The correct answer is 16; if 1 is the desired answer, an extra pair of brackets is needed (square brackets are more legible when written, but parentheses are used in FORTRAN). However, in Chemistry/Physics BODMAS is not strictly followed by convention in the decreasing exponential Boltzmann function exp(-E/kT). Any program that does not actually calculate exp[-E/(kT)] would quickly produce numbers that are way, way off (so MODTRAN or HITRAN calculations of infrared spectra are undoubtedly OK).

Unless your in Israel where right to left is the way

If presented as 8 over all of 2(2*2) instead of the divide sign or / then there’s no ambiguity, and this is how I read the question with implied parentheses. However if I were programming it in FORTRAN it would be result = 8.0/(2.0 * ( 2.0 * 2.0)) to obtain the same answer, 1.0, as result = 8.0/2.0 * (2.0*2.0) would give 16.0. A factor of 0x10 (16 )difference, how would people react if they were paid 6% of their salary?

It would be interesting to see the demographic breakdown of the different answers based on age and geographic location.

However, as pointed out if such ambiguity exists in the interpretation of a simple expression then how can the development of computer models be assured, they will always produce an output, but whether that is the “right” answer is debatable. All of the statistical manipulation of the data is unlikely to overcome these types of errors. You are dependent on the quality control used, and as some chunks of software are common to all models then this has to be very stringent in its application.

John ==> some of the ClimateGate emails discussed a programmer trying to make sense out of the code bing used at the time in CliSci (the details escape me — someone here help me out and post a link to the essays discussing this — thanks — kh)

I believe you’re thinking about the HARRY_READ_ME file. It wasn’t Email, it is a long, sad diary written by someone doing his best with an impossible task.

http://wermenh.com/climate/HARRY_READ_ME.txt

It kept me up until 3 AM.

Thanks Ric. –kh