Order of operations



#17

I have a question for you. My brother, who is in the 6th grade, is learning about "Order of Operations" in his math class. In this section of his book, it has note about how an old calculator you have gives a different answer for a math equation than a new calculator. The example is: 2+3x4

The old calculator says the answer is 20, but the new calculator says the answer is 14 (due to the new order of operations). My question is what year makes a calculator a new one? The reason I am asking is because I have a new calculator that gives the answer to this equation as 20. Am I supposes to enter the equation differently? The note was vague as to if to get the correct answer of 14 you must enter the equation differently than left to right.

I would much appreciate a response as soon as possible so I may help my brother learn this new way of doing math.


#18

Dear Jessica,
Which calculator are and were you using?
2+3x4=2+(3x4)?!
I 'tested' this calculation on several machines:
Sharp PC-1360, 2+3x4=14
HP 200LX (algebric notation), idem
HP 49G (algebric notation), idem
The first calc. you used was really old...
Sincerely yours. Best regards from Normandy.

#19

I'm using a brand new Palm Pilot and it gives the answer of 20. I also tried a Sharp calculator and an Office Depot calculator and they give 20 too! Neither of those is very old. The Office Depot calculator is only a few months old.

I can't seem to get my mind or any calculator to think that the answer is 14.


#20

Dear Jessica,
I was joking ... of course.
Curious answer from your calcs. Please see below what Gene wrote.
Yours. Have a good night.
Emmanuel

#21

They probably mean that the VERY early 4 function calculators did not implement an order of operations for solving arithmetic problems. This was primarily due to the need to store numbers and operations until they could be evaluated...and memory was expensive early on. These old calculators just executed an operation whenever they could.

In reality, you are supposed to do multiplication and division before addition and subtraction.

Most calculators now are smart enough to do this.

Unfortunately, HP has for 10 years sold business calculators that give wrong answers to these types of problems.

That's why our university eventually gave up on them. Sadly, I agreed with it.

Wake up HP.
Gene

#22

Jessica,

Unfortunately, the book is wrong. There are many calculators you can buy today that will give the answer 20. Most of the people in this forum buy "scientific" calculators that will give the right answer but many -probably most- of the simple cheap 4 function calculators on the market still give an answer of 20. So your book is wrong and a lot of calculators are wrong too. This should be a lesson to your brother that he can't accept everything that gadgets and books tell him. He needs to think these things through for himself.

Here's a fun thing to do if you're using Windows. Use the Windows calculator in "standard" mode and it will give the answer of 20. Now set it to "scientific" mode (View/Scientific) and the same calculator will give you the answer of 14. (At least it does this in Windows XP.) Microsoft is probably doing the right thing here (even if it's wrong mathematically) because most of the cheap simple calculators in the world do the wrong thing. Their calculator simulator defaults to doing it wrong because that's what most people expect.

By the way, I like RPN calculators because they're more consistent about things like this. When you pick up a random calculator with an equals key, you just have to try it out to see what it does.


#23

This is very confusing. I tried Windows and got both 20 and 14. But 14 is the "right" answer even though 20 is the "standard" answer???? What is an RPN calculator and which answer does it give? I tried asking my parents and they said the answer was 20.

#24

Hi, Jessica.

I see that many contributors posted very good answers in here, and I'd like to add just a few other words.

Jessica, how old is your brother? I'm a lot concerned about it, because I teach math (basic high-school) and algebra (number theory, university classes) and I face many problems brought from my students about calculator usage.

I simply ask them to bring their calculator's manuals, and most of the times, they are lost somehow. I must agree with Jim, the book is completely wrong and you are also right when you say it is a vague affirmative.

If we face an expression like this - 2+3X4 - and we need to find an answer, we can do whatever we want to: add first, multiply later. What's the matter?

Anyway, math precedence is clear and objective when applied, and in this case we MUST multiply first and add later. If we need to change the order, we mu

#25

Hi, Jessica.

I see that many contributors posted very good answers in here, and I'd like to add just a few other words.

Jessica, how old is your brother? I'm a lot concerned about it, because I teach math (basic high-school) and algebra (number theory, university classes) and I face many problems brought from my students about calculator usage.

I simply ask them to bring their calculator's manuals, and most of the times, they are lost somehow. I must agree with Jim, the book is completely wrong and you are also right when you say it is a vague affirmative.

If we face an expression like this - 2+3X4 - and we need to find an answer, we can do whatever we want to: add first, multiply later. What's the matter?

Anyway, math precedence is clear and objective when applied, and in this case we MUST multiply first and add later. If we need to change the order, we must add parenthesis and precedence still prevails, because parenthesis MUST come first.

If we execute operations as they appear (e.g.: "add two and three than multiply by four" should not be expressed by 2+3X4, instead by (2+3)X4 ) we should use a calculator that
1) has parenthesis, and some of they don't or
2) executes operations as their equivalent keys are pressed, and that's what we have

What I would tell your brother is that calculators will NEVER dictate a new math approach, because they must follow math laws, not the opposite. Based on this concerns, I'd tell him that whatever calculator I have, I'd learn how to use it undoubtedly, because math does not allow the same expression to give more than one right answer, and that's what calculators MUST do: HELP users to get to these right answers, and it will ALWAYS happen if we use them correctly. So, the User's Guide, Owner's Manual or whatever name it has MUST be at hands. Ever.

But let's face the fact that should be exposed to your brother: use the calculator only to get to the numbers. Reasoning about the solution is our business, and calculator should never have an opinion about it.

Cheers. (my US$ 0,05)

#26

Jessica:

The mathematically correct answer is 14. That's because each operator (+, -, etc.) has a place in the hierarchy and those in higher levels must be processed before those in lower levels. Since x has a higher hierarchy level than +, multiplication comes first (3x4=12), then followed by addition (2+12=14).

Algebraic calculators come in two very distinct flavors. The first, or older, pays no attention to the operator hierarchy. Operations are simply carried out in the order in which they are entered -- from left to right, no exceptions -- and so often yield incorrect answers. The second, or newer, does pay attention to the operator hierarchy. Operations are carried out in the mathematically correct order, yielding correct answers. RPN calculators have never had this problem, since it's the user who supplies the order of the operations.

When I say "older" and "newer" I don't mean the age of the calculator, but of its operating system. Even today you can buy simple 4-function calculators that use the older version, without hierarchy. Usually -- but not always -- those algebraic calculators that have parenthesis keys are the ones that give the correct answers. WHEN IN DOUBT, USE PARENTHESES.

I don't agree with the assessment that the Calculator in Windows is OK because it follows the most common interpretation, even though it's the wrong one. A calculator is EXPECTED to provide the right answer; if it doesn't, its only place is the waste basket.

By the way, other games can be played with algebraic calculators of the old style. If you alter the order of the operands in commutative operations (+ and x), sometimes you get different answers if the expression includes other operations. For example:

2 + 3 x 4 = 20

2 + 4 x 3 = 18

Watch out for expressions that include powers of powers (such as 4^3^2). The "raising to power" operation (usually y^x in most calculators) is THE exception to the rules of order of operation -- even in mathematics. 4^3^2 must be calculated as 4 raised to the power 3^2 -- that is, 4 raised to the 9th. In other words, if you find a string of powers, they must be executed from right to left (!).

In these cases, you may have the same number several times (such as 3^3^3) and obtain two different answers depending on which ^ operator you execute first:

(3^3)^3 = 27^3 = 19,683

3^(3^3) = 3^27 = 7.63 E 12

The second one is the mathematically correct answer, if the parentheses were removed.

A few calculators (such as TI's SR-51A) have no parenthesis keys, yet do follow the hierarchy, but only up to a certain point. In my opinion, that's the worst kind of calculator there is. Some HP business calculators are the opposite: they have the parenthesis keys but do not pay attention to operator hierarchy.

Again, when in doubt, use parentheses.

Happy calculating.

-EM


#27

As you quote this model, the SR-51 actually doesn't have parenthesis keys, the probable reason being that it has only a single register to hold one intermediate value so that you can mix + or - with * or / operations.
The number of registers on the algebraic stack dictates the number of pending operations possible. In this one case, parentheses would have been useless.
A lot of old algebraic models allowed one, two or a few levels of parentheses. A very strange example is the Sinclair Cambridge Programmable.


#28

GE; is it my imagination or do the phrases "strange example" and "sinclair calculator" pop up a lot together? - db

#29

Hi GE,

If I recall, [I'm not sure how many intermediate value registers I still have :)], the ti sr50 and sr51 series had 2 registers that were accessible, the X & Y. The X and Y registers could be swapped using the X<->Y key as on an RPN calculator [SWAP]. They also had a hidden/inaccessible Z register that they referred to in the detailed explanations in the manual when referring to expressions involving combinations of multiplication, division, addition, and subtraction.

However, there was a 3 level hierarchy including exponentiation, so they must have had at least one additional hidden/inaccesible register. They did evaluate mixed expressions involving these operations correctly, but as you stated, they did not have parenthesis. You had to use 1 storage memory in the case of the 50 and you had the choice of 3 with the 51.

I believe the sr52 was the first ti model with parenthesis. After that, I believe every ti scientific calculator came with parenthesis including the infamous ti30 models that were, essentially, updated sr50 models with parenthesis, but with a lower "build quality". Also they were practically giving these away relative to the original prices on the original 50 and 51 models. They also produced several variants of the 51 in later years, some with limited programmability.

It seems like they made a decision to give the basic models, a 3X designation and the more advanced models, a 5X designation. They seem to have kept the 3X designation for variants of their low level non-programmable scientifics, i.e., basic school models, to this day including the various versions of the 30, 34, and 36 available currently.

I had, both, the 50 and the 51, but these became, largely obsolete, once they added parenthesis. Strangely enough, the baIIplus is the only current ti model that retains the feel and operation of these models, with appropriate updating. The hp 20s also has a similar feel if you're into this sort of nostalgia.


#30

Hi;

would you include the TI financial models, at least BA55 and BA54 did not have parenthesis, too.

But I see that most financial calculators, based upon facts mentioned here, perform operations as they are requested, i.e., the adding of parenthesis is not exactly to allow the user to change the existing precedence order, instead to dictate an specific execution order.

Cheers.

#31

Jessica,

Operator precedence is a very important subject in math. Unfortunately it seems that this is not getting enough attention. See <http://puzzlemaker.school.discovery.com/MathSquareForm.html> for a educational simulator on this subject. They explain the difference between "Natural Operator Precedence" x "Left-to-right".

Another issue is how calculators work. This is a very important issue for this forum, as it is the FIRST reason for HP calculators becoming a tool for scientists and engineers. I explain: in the 60s, eletronics could not create a calculator that would use "Natural Operator Precedence", only "left-to-right" would be possible. So *very* old algebraic calculators would do "left-to-right", or use parenthesis (usually with a limit on how many open parenthesys you could enter). HP approach was use RPN system for calculus. RPN does not create ambiguities like you found, and could be included for calculators since the 60s. Try a HP RPN calculator yourself - learn to use it and, please tell us what you think. Many scientific users from the 60s, 70s and 80s found that RPN calculators would be a better choice.


This ambiguity also happens in Microsoft Excell see: <http://support.microsoft.com/default.aspx?scid=KB;en-us;q132686> for an example of ambiguity in excell formulas. See also
<http://www.ecu.edu/si/cd/excel/tutorials/basic_math.html> and you´ll learn that this goes deeper than you´d expect.


In <http://mathforum.org/library/drmath/view/53194.html> you can find more information on operator precedence - it can be a bit complex, but useful.


As this is a professional forum, I find it appropriate to tell you what every other forum member would tell you : It is very important to know your tool. A calculator that replies "14" is not RIGHT OR WRONG - it was designed like that. It is up to you to know your tools and do not let them fool you ;-)

Regards from Brazil

Renato

#32

Jessica,

All comments to point, especially "14 is not right or wrong _necessarily_, but the calculator user is on the hook to know the theory" (a collective statement if ever there was one!) are accurate.

On a more practical note, most programming languages, including the very commonly used C and C++, obey the Algebraic Operating System (AOS) when there are no parentheses, meaning that first parentheses are executed, then ALL multiplication and division in left-to-right order, then addition and subtraction in left to right order. As an example, follow the execution stated below:

(1) 6 / 2 + 2 * 4 - 12 / 3
(2) 3 + 8 - 4
(3) 7

I am not suggesting that this is the "right" or "only" way, but is probably the "de facto" standard in higher algebra and calculus theory and classes.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime Stack operations from within a program John Colvin 1 315 11-08-2013, 09:45 PM
Last Post: Helge Gabert
  3rd order ODE diff eq Richard Berler 0 198 10-23-2013, 09:53 PM
Last Post: Richard Berler
  HP Prime: Operations with Large Numbers Eddie W. Shore 0 180 10-19-2013, 12:24 AM
Last Post: Eddie W. Shore
  Rearanging the "Fixed" sort order of Prime's Apps icons Joe Horn 3 354 10-02-2013, 10:24 AM
Last Post: Han
  [HP-Prime xcas] operations with complex numbers + BUGs + Request CompSystems 9 776 09-08-2013, 10:40 PM
Last Post: CompSystems
  WP-34S Matrix operations with routine-local registers? Tom Grydeland 1 269 09-04-2013, 10:46 AM
Last Post: Marcus von Cube, Germany
  HP 10S+ order on DeRekenwinkel.nl Mic 2 236 12-06-2012, 04:44 AM
Last Post: Klaas Kuperus
  more question regarding complex operations using complex number on wp34s wildpig 22 1,074 09-02-2012, 12:54 PM
Last Post: Walter B
  DM-15CC family is available to order Jeff Johnson 35 1,704 07-07-2012, 05:20 AM
Last Post: Pascal
  Examples for matrix operations on WP34S?? Namir 6 452 06-18-2012, 10:04 PM
Last Post: Palmer O. Hanson, Jr.

Forum Jump: