Naked Science Forum

Non Life Sciences => Geek Speak => Topic started by: syhprum on 01/09/2012 21:28:28

Title: One of the three R's
Post by: syhprum on 01/09/2012 21:28:28
I wonder how many correspondents can do simple arithmetic I saw this question on FaceBook and most of the replies were wrong !

Evaluate 6-1*0+2/2 = ?.

PS my calculator gives the correct answer moral never do arithmetic in your head !
Title: Re: One of the three R's
Post by: RD on 01/09/2012 22:52:55
clue ...
Quote
... in the expression 2 + 3 × 4, the answer is 14, the ... expression may also be rendered 2 + (3 × 4), but the brackets are unnecessary as multiplication still has precedence without them.
https://en.wikipedia.org/wiki/Order_of_operations
Title: Re: One of the three R's
Post by: SeanB on 02/09/2012 08:42:18
7

Title: Re: One of the three R's
Post by: syhprum on 02/09/2012 08:56:51
The basic calculator provided with windows 7 gives the wrong answer but the scientific version gives the correct one also it can cope with cube root minus one that many software calculators cannot.
Title: Re: One of the three R's
Post by: RD on 02/09/2012 20:59:21
(https://www.thenakedscientists.com/forum/proxy.php?request=http%3A%2F%2F&hash=3cd4f4119996b42d10f5ed9eb0e8d712)  [ Invalid Attachment ]
Title: Re: One of the three R's
Post by: syhprum on 02/09/2012 21:34:00
Try it with the basic calculator in accessaries on win 7 64bit it consistantly gives the wrong answer
Title: Re: One of the three R's
Post by: nicephotog on 27/10/2012 07:52:02
I thought operator precedence was in comp languages whereas anything multiplied by zero "*" is 0 zero. so 2/2 is 1.
To obtain multiplication first required the brackets or it is done inline left to right?

Which rule-set(not a computer lang) does operator precedence and where is its statement docs?
Title: Re: One of the three R's
Post by: syhprum on 27/10/2012 08:41:48
I wanted to know the value of my car assuming it depreciates 25 percent each year  so I entered .75^10 *30000 into mathematica but I got a funny answer but on my calculator it comes out as a correct if disappointing £1689.41.
I tried 30000*.75^10 and that came out correct.
Title: Re: One of the three R's
Post by: CliffordK on 27/10/2012 12:22:38
Evaluate 6-1*0+2/2 = ?.
Operator precedence (http://en.wikipedia.org/wiki/Order_of_operations)
Exponents and roots first
* & ÷ second
+ & - last.

So, the above is equivalent to:

6 - (1*0) + (2/2) = 6 - 0 + 1 = 7

I like to use parentheses when I'm doing calculations...  just to be sure.

I'm surprised that Microsoft has problems with the simple calculations...  well, not too surprised.  [xx(]
gcalctool & SpeedCrunch in Linux both did it correctly.

Of course, if we all just used Reverse Polish (http://en.wikipedia.org/wiki/Reverse_Polish_notation), it wouldn't be an issue.

Anybody have an old HP calculator laying around?

Anyway, so your equation:
 6-1*0+2/2
simply becomes
6 1 0* - 2 2 / +
No need to worry about operator precedence or parentheses. 
Title: Re: One of the three R's
Post by: syhprum on 31/10/2012 15:31:20
Facebook posses another seeming simple sum that seems to defeat both the windows scientific calculator and my TI machine.

 6/2(1+2)=? 

Mathematica gives what I consider the correct answer And I swear by this high grade program but I would like other opinions.
Title: Re: One of the three R's
Post by: CliffordK on 31/10/2012 18:49:34
Hmmm
Perhaps that is a more "interesting" equation.  And, a reason why I like to put in lots of parenthesis. 

I came up with 9 in my head...  And, in Linux, gcalc also gives 9.
Speedcrunch gives an error as written.  With the modification: 6/2*(1+2), it also gives 9.

The problem, of course, is that visually, one might want to group everything after the division sign to give 1.  But, that is not how the equation is written.
Title: Re: One of the three R's
Post by: nicephotog on 02/11/2012 04:40:16
Rules are only properly accountable in side a language or stipulated ruleset anyhow.
If you look at "view" on the Calc menu in Windows you get scientific mode but that does not change the answer from 7.
It's finally a non question here because its a bit alike any language itself, in context and that unspecific undefined you can't want an accurate answer.
However, if you want an answer in a ruleset , apply it that way because it was all done on paper in an operator template of "Delimiters".

Database Error

Please try again. If you come back to this error screen, report the error to an administrator.
Back