[R] Spreadsheet math problem (exponentiation)

John Kane jrkrideau at inbox.com
Fri Sep 18 19:23:09 CEST 2015


I  have no problem with -2^2 = 4 if we have consistency.
R  -2^2 = -4
Spreadsheets -2^2 = 4

Which is "TRUE"? (For some nebulous value of "TRUE")

For a relatively unsophisticated user this does not bode well if he or see is transferring work from one application to another.

John Kane
Kingston ON Canada


> -----Original Message-----
> From: erich.neuwirth at univie.ac.at
> Sent: Fri, 18 Sep 2015 18:06:23 +0200
> To: jrkrideau at inbox.com
> Subject: Re: [R] Spreadsheet math problem (exponentiation)
> 
> Methinks that any math teaching should make learners aware of the fact
> that
> math conventions are not laws of nature, and that ambiguous expressions
> may
> produce different values in different systems.
> 
> I think -2^2=4 is perfectly reasonable.
> 
> In my experience, most people after high school math do not know that
> binary - und unary - are very different operations.
> And that is the fault of the current way of teaching math!
> 
> 
> 
>> On Sep 18, 2015, at 18:00, John Kane <jrkrideau at inbox.com> wrote:
>> 
>> A very good point re RExcel   for sophisticated users.  The majority of
>> spreadsheet users, will never have heard of RExcel (or R for that
>> matter) and very likely will no  have the sophistication of knowing that
>> they need to use brackets.  Plus RExcel  is not available in  flavours
>> for Apache OpenOffice or gnumeric as far as I am aware.
>> 
>> If one actually learned the formal mathematical order of operations and
>> still remembers  them the expectation is that -2^2 will return -2.  In a
>> 20 sheet spreadsheet the error is likely to go completely undetected and
>> may or may not have significant effect on final results.
>> 
>> I, recently, was reading an education blog where the author was
>> bemoaning the fact that shiny new math teachers were teaching that -2^2
>> = 4. Presumably they are putting their faith in Excel, etc., rather than
>> the actual math conventions.
>> 
>> John Kane
>> Kingston ON Canada
>> 
>> 
>>> -----Original Message-----
>>> From: erich.neuwirth at univie.ac.at
>>> Sent: Fri, 18 Sep 2015 17:13:44 +0200
>>> To: r-help at r-project.org
>>> Subject: Re: [R] Spreadsheet math problem (exponentiation)
>>> 
>>> Let me add a little bit here:
>>> 
>>> When using math formulas, one should know about the parsing rules form
>>> complex expression
>>> which do not have all the necessary parenthesis.
>>> 
>>> Different systems do have different parings rules.
>>> In the case of a^b^c, the expression is ambiguus because
>>> (as mentioned in a previous mail) in general
>>> (a^b)^c != a^(b^c)
>>> To avoid unintended consequences, just us parentheses and you will get
>>> the right result.
>>> in the case of -a^b
>>> The question is the order of precedence of unary - and binary ^.
>>> 
>>> In Excel, -2^2=4, but 0-2^2=-4
>>> 
>>> Reason: For Excel, unary - is stronger than the power operator, but
>>> binary minus is weaker.
>>> 
>>> My feeling is that too many people are bashing spreadsheets for the
>>> wrong
>>> reason.
>>> Spreadsheets ca do things R cannot do: Automatic recalculation when
>>> input
>>> changes,
>>> and visual point and click modelling of dependencies.
>>> The calculation engine of Excel admittedly has some weak points.
>>> 
>>> That is the reason why I wrote RExcel which gives you all the
>>> advantages
>>> of the spreadsheet interface
>>> and allows you to use the R calculation within this interface whenever
>>> needed.
>> 
>> ____________________________________________________________
>> Send any screenshot to your friends in seconds...
>> Works in all emails, instant messengers, blogs, forums and social
>> networks.
>> TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if2 for
>> FREE
>> 
>>

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.



More information about the R-help mailing list