Post Reply 
negative number raised to even power
04-25-2015, 11:24 AM (This post was last modified: 04-25-2015 11:25 AM by DrD.)
Post: #1
negative number raised to even power
It seems technology and opinions differ on definitions for this case. I can't remember any of my math educators ever saying that -2 squared is -4. Perhaps they did when I was snoozing; not that I ever did that during class time!

I have several calculators, most are safely stored away without batteries, and so I can't readily verify which displays what. A few TI calcs, and my hp50g agree with the way I learned, though, that -2^2 = 4.

The Prime, and Wolfram Alpha both recognize that -2^2 are really two separate operations: negating 2, and raising to the even power. Consequently, the rules of hierarchy would have you to take the power first, and then negate the result, thus negative results for negative numbers, raised to even powers. If "they" say it, it must be so!

I just encountered this situation while working with a program, and even though this has been discussed before, I hope it's worthwhile to mention, "don't forget to enclose negative numbers in parentheses when raising to even powers!" You might get diminishing returns, otherwise!

-Dale-
Find all posts by this user
Quote this message in a reply
04-25-2015, 11:57 AM (This post was last modified: 04-25-2015 12:01 PM by Joe Horn.)
Post: #2
RE: negative number raised to even power
(04-25-2015 11:24 AM)DrD Wrote:  A few TI calcs, and my hp50g agree with the way I learned, though, that -2^2 = 4.

In RPN... but that's because you're negating first, then squaring, which is NOT what -2^2 means. Proof: type -2^2 into the EquationWriter (or inside single quote marks, or in algebraic mode) and evaluate it. You'll get -4, because the power is performed first, then the negation, by standard "order of operations".

Try both -2^2 and (-2)^2 on Prime, in Home, with Textbook Display turned off (that's different from Textbook Entry!), and look at the history. It makes it evident what's happening.

Quote:"don't forget to enclose negative numbers in parentheses when raising to even powers!"

Not only even powers. ANY non-odd power (e.g. -2^pi or -2^i) needs parentheses if you want to perform the negation before the power.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
04-25-2015, 04:40 PM (This post was last modified: 04-25-2015 04:42 PM by Wes Loewer.)
Post: #3
RE: negative number raised to even power
(04-25-2015 11:24 AM)DrD Wrote:  I can't remember any of my math educators ever saying that -2 squared is -4.
That's good, cause the square of -2 isn't -4, but the negative of the square of two is -4, which is what -2^2 means.

Quote:A few TI calcs, and my hp50g agree with the way I learned, though, that -2^2 = 4.
I'm curious, which TI calculators do this? I know none of the graphing ones ever did. My memory isn't perfect, but I used the TI-30/35/55 as a kid and I think I would have remembered if they had such a bug.

The hp50 also evaluates -2^2 = -4. ('-2^2' is parsed in rpn as "2 2 ^ NEG")
Find all posts by this user
Quote this message in a reply
04-25-2015, 05:15 PM
Post: #4
RE: negative number raised to even power
2
chs
^
2
chs
y\x

yields .25 on my 41, error flash on the 55, error flash on the 45, error flash on the 80.


2
chs
^
2
chs
x\y

yields error flash on my 35


(-2)^(-2) endline on the 71 yields .25

2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80
Find all posts by this user
Quote this message in a reply
04-25-2015, 05:24 PM
Post: #5
RE: negative number raised to even power
(04-25-2015 11:57 AM)Joe Horn Wrote:  In RPN... but that's because you're negating first, then squaring, which is NOT what -2^2 means. Proof: type -2^2 into the EquationWriter (or inside single quote marks, or in algebraic mode) and evaluate it. You'll get -4,

Well understood, BUT:

The broader point is that MANY other calcs and technological computing devices will assert that -2^2 returns 4 as a result; which is quite contrary to the proof you have shared.

Your "Proof" that a negative number raised to a "non-odd" exponent CAN BE MADE to return a negative numerical result on an hp50g, which otherwise would not, invalidates the MANY other technologies and some textbooks, and (they) are just plain wrong on this point?

Just having fun with this as a discussion item, as I quite agree with {you, the Prime, and Wolfram}; even though my public education may have been incomplete, or my class time compromised at that moment this was etched into my pea-brain.

Parentheses are a good thing!

-Dale-
Find all posts by this user
Quote this message in a reply
04-25-2015, 05:35 PM
Post: #6
RE: negative number raised to even power
(04-25-2015 05:24 PM)DrD Wrote:  Parentheses are a good thing!

-Dale-

Isn't that a funny thing to say when one of the common refrains sung in praising RPN is the elimination of the need for parentheses? Sorry, couldn't resist a little tongue-in-cheek jab.

And I agree. If you leave the parentheses out of (-2)^2, a negative answer must result.

Brad
Find all posts by this user
Quote this message in a reply
04-25-2015, 06:02 PM
Post: #7
RE: negative number raised to even power
(04-25-2015 05:35 PM)Brad Barton Wrote:  
(04-25-2015 05:24 PM)DrD Wrote:  Parentheses are a good thing!

-Dale-

Isn't that a funny thing to say when one of the common refrains sung in praising RPN is the elimination of the need for parentheses? Sorry, couldn't resist a little tongue-in-cheek jab.

And I agree. If you leave the parentheses out of (-2)^2, a negative answer must result.

Brad

Not tongue in cheek, parentheses in logic & arithmetic are an abomination.

Consider CAAKpqrKKqpCprKqp - in Lukasiewicz notation - a glance tells you the expression is well-formed & what the top-level relationship is.
Find all posts by this user
Quote this message in a reply
04-26-2015, 06:37 AM
Post: #8
RE: negative number raised to even power
Quote:And I agree. If you leave the parentheses out of (-2)^2, a negative answer must result.
Definitely.
Find all posts by this user
Quote this message in a reply
04-26-2015, 06:38 AM
Post: #9
RE: negative number raised to even power
(04-25-2015 05:24 PM)DrD Wrote:  The broader point is that MANY other calcs and technological computing devices will assert that -2^2 returns 4 as a result; which is quite contrary to the proof you have shared.
Could you give a list of softwares/calcs that evaluate -2^2 (algebraic notation) to 4?
Find all posts by this user
Quote this message in a reply
04-26-2015, 07:20 AM
Post: #10
RE: negative number raised to even power
(04-26-2015 06:38 AM)parisse Wrote:  Could you give a list of softwares/calcs that evaluate -2^2 (algebraic notation) to 4?
MS Excel.
Find all posts by this user
Quote this message in a reply
04-26-2015, 10:04 AM
Post: #11
RE: negative number raised to even power
Using the 50g EQW I entered the sequence:
2
+/-
Y^x
2
Then pressed EVAL and indeed got -4
BUT... the 50g has a selection cursor, i.e. this reverse video marker that tells you the scope of the next entered operator. So the right sequence of operation is:
2
+/-
UP (selects 2)
UP (selects -2)
Y^x (adds parenthesis!)
2
which ends up with (-2)^2
Of course EVAL is now correct.

I find it redundant to enter () (I see so many people using parenthesis for multiplication and division which have the same priority, my trend is less parenthesis is better) and would rather recommend to always ensure that the right operator scope is selected.
Find all posts by this user
Quote this message in a reply
04-26-2015, 10:22 AM
Post: #12
RE: negative number raised to even power
(04-26-2015 07:20 AM)Thomas Radtke Wrote:  
(04-26-2015 06:38 AM)parisse Wrote:  Could you give a list of softwares/calcs that evaluate -2^2 (algebraic notation) to 4?
MS Excel.
MS Excel evaluates -2^2 to 4 but 4-2^2 to 0. Not very consistent IMHO.
Find all posts by this user
Quote this message in a reply
04-26-2015, 10:40 AM (This post was last modified: 04-26-2015 10:43 AM by parisse.)
Post: #13
RE: negative number raised to even power
Excel is not a scientific software.
The hp49g key sequence 2 +/- ^ 2 is equivalent to an implicit parenthesis.
A small list applying standard algebraic priority (-> -4):
TI nspire, hp ; maple, maxima, sage, Xcas, wolfram alpha, python (type -2**2 for python)
Find all posts by this user
Quote this message in a reply
04-26-2015, 10:49 AM
Post: #14
RE: negative number raised to even power
Here's a quickly prepared {sub-list} of the MANY technologies that return -2^2=4:

L1:=concat{{list of any calcs you have around that do this},TI-36X, MS-Calculator (Scientific Mode), hp50g, hp50g emulator,TI-25X, The funny calc in my wife's purse, no ... I'm not gonna go look in that thing to find the model(!), a really old version of MITS Altair 8K BASIC, Samsung Galaxy "Tools" scientific calculator};

I could also find several that return -2^2=-4

{Prime, Wolfram Alpha, hp50g (suitably configured), Python (3.x), wxMaxima (14.x.x), scilab (5.x.x};

In general, older technologies seem more likely to return -2^2=4, than newer ones, which probably has to do with more strict enforcement of the rules of precedence, as the demands on software evolved. I'm sure there are plenty more entries which could be included for either list, but these were handy.

What did the ancient Sumerian's have to say about this? Did they chisel -2^2=4 in clay anywhere, because if they did ... that settles it! Unless they weren't using scientific clay, or were in RSN mode (reverse Sumerian ...), oh well.

-Dale-
Find all posts by this user
Quote this message in a reply
04-26-2015, 10:58 AM
Post: #15
RE: negative number raised to even power
(04-26-2015 10:22 AM)Didier Lachieze Wrote:  MS Excel evaluates -2^2 to 4 but 4-2^2 to 0. Not very consistent IMHO.
MS is wrong of course, but I like Excel as an excuse to use my calculator for important calculations ;-).
Find all posts by this user
Quote this message in a reply
04-26-2015, 12:36 PM
Post: #16
RE: negative number raised to even power
-2^2
iPad, iOS;
PocketCas 3.6.4 -> -4
Codea 2.3.1 (LUA 5.3) -> 4
techBASIC 3.2.2 -> NaN !!!

— Dirk Hartland
Find all posts by this user
Quote this message in a reply
04-26-2015, 12:47 PM
Post: #17
RE: negative number raised to even power
(04-26-2015 06:38 AM)parisse Wrote:  Could you give a list of softwares/calcs that evaluate -2^2 (algebraic notation) to 4?

HP-20S returns 4
HP-17BII+ returns 4 (Algebraic mode)
HP-10B returns 4

...and so I assume all HP algebraic machines (Pioneers at least) will behave the same way.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-26-2015, 01:13 PM
Post: #18
RE: negative number raised to even power
(04-26-2015 10:40 AM)parisse Wrote:  Excel is not a scientific software.

Hey, wait a minute... I used to hear that there were two general classifications of calcs: standard 4 function devices, (because that's what most people used in the good old days, just after the dinosaur extinction), and scientific devices, (which added a memory register and some "advanced" things like square, square root, and basic trig functions, needed to calculate the vast amount of fossil fuel allegedly created by the dinosaur croakage).

To that rather lame definition, and since Excel includes them, Excel IS scientific software. Isn't it?
Find all posts by this user
Quote this message in a reply
04-26-2015, 02:32 PM (This post was last modified: 04-26-2015 02:51 PM by Marcio.)
Post: #19
RE: negative number raised to even power
(04-26-2015 01:13 PM)DrD Wrote:  To that rather lame definition, and since Excel includes them, Excel IS scientific software. Isn't it?

I think he meant Excel is nowhere near today's technical computing applications. Excel, however, can do lots of things such as parameter estimation and even solve ODEs and PDEs.
Find all posts by this user
Quote this message in a reply
04-26-2015, 02:57 PM
Post: #20
RE: negative number raised to even power
(04-26-2015 12:47 PM)rprosperi Wrote:  
(04-26-2015 06:38 AM)parisse Wrote:  Could you give a list of softwares/calcs that evaluate -2^2 (algebraic notation) to 4?

HP-20S returns 4
HP-17BII+ returns 4 (Algebraic mode)
HP-10B returns 4

...and so I assume all HP algebraic machines (Pioneers at least) will behave the same way.

I've been following this thread and I remember my school days in the 70's. All my math teachers in two different countries told us that:
a) 2^2 = 2 x 2
b) + and - signals gives -
c) - and - signals gives +
d) so, -2^2 = -2 x -2 = 4
That's the way I've learned.

And the calculator manufacturers of my school time agreed with mt teachers as well.
I had several machines, starting with a Casio fx-21, then a HP-25, then a Texas TI-57, and never got a different answer.

Until now, that is.
The new calculator generations tends to favor the common accepted rules these days and give me a different answer.


Some of my machines that also agrees that: -2^2 = 4
Casio fx-21
Texas TI-58C
Texas Galaxy 67
Texas TI-55II
NOVUS 4510
Sharp EL-8118
ELEKTRONIKA MK-52
HP-25
HP-11C
HP-15C
HP-21S
HP-27S
HP-35S (RPN and ALG modes)
HP-49g+ (RPN and ALG modes)

New fashion machines telling that: -2^2 = -4
Casio fx-730P
Casio fx-4500p
Casio fx-6300p
Casio Algebra FX 2.0 Plus
Texas TI-89
HP-300s+
HP-PRIME (Textbook, Alg, and RPN)

Jose Mesquita
RadioMuseum.org member

Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 9 Guest(s)