negative number raised to even power
|
04-26-2015, 03:33 PM
Post: #21
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 12:47 PM)rprosperi Wrote: HP-20S returns 4 It depends on whether ^2 is a postfix function key that is executed directly on some displayed register value or if its entered on an algebraic command line. All the machines mentioned in your list work in the first way. But You can enter X=-2^2 in equation mode on the 17B and its successors and you should get -4 if you solve of X then. Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basic-compare.html |
|||
04-26-2015, 04:01 PM
Post: #22
|
|||
|
|||
RE: negative number raised to even power
I found this thread interesting for two reasons. The first of which is that it is device (or emulator) dependent as to which answer you will receive when raising negative numbers to an even power. And, the second is the variety of old calculators that some of the members of this board have in their inventory.
I used this thread as a teaching moment with my son, who is in his first year of High School and will be using an HP prime going forward. I think we can all agree that in so far as this topic is concerned the safest thing to do going forward is to assume that the order of operations will be followed by a calculator, and therefore enter any equations using negative numbers in this context within parentheses (the obvious exception is RPN). Now if they would just cover this topic even briefly in the classroom... |
|||
04-26-2015, 04:52 PM
Post: #23
|
|||
|
|||
RE: negative number raised to even power
It's been a long time since I was in a math class for this topic, but, like rprosperi, I recall exactly the scheme he posted. Later on, in a computer science class, this theme was again discussed, with emphasis on the order of operations, and used in exam problems.
It generated a lot of debate then, and I thought it might be fun to try to gain current wisdom from members of this group, given all the latest tools, resources and intellectual power that resides here. This subject emphasizes how machine results may differ, even though the external human-interface problem solving steps are the same. |
|||
04-26-2015, 05:33 PM
Post: #24
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 12:47 PM)rprosperi Wrote: ...and so I assume all HP algebraic machines (Pioneers at least) will behave the same way.Are you using the +/- key? If so, a negative number is placed on the stack, and your result doesn't make me wonder. If I type - 2 ^2 into my 10BII+ (initial value displayed is zero), it returns -4. Same with the 17BII in ALG mode.. |
|||
04-26-2015, 06:18 PM
Post: #25
|
|||
|
|||
RE: negative number raised to even power
I was thunderstruck the 41 and 71 handle the example I tried (both #s neg) differently from the 35, 45, 55 and 80.
Not sure where my 25 has run off to this week, 2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80 |
|||
04-26-2015, 06:22 PM
Post: #26
|
|||
|
|||
RE: negative number raised to even power
+++++++++++++++++++++++++++++++++++++++
25 was stuck in seat cushion. 2 chs ^ 2 chs y\x yields 'error' 2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80 |
|||
04-26-2015, 06:57 PM
Post: #27
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 06:22 PM)TASP Wrote: 2 You are computing (-2)^(-2) (not the original expression!) which is most probably computed as exp(ln(-2)*(-2)). A calculator that only handles real numbers cannot compute ln(-2). Try the x² key instead. Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basic-compare.html |
|||
04-26-2015, 08:02 PM
Post: #28
|
|||
|
|||
RE: negative number raised to even power
I don't see any inconsistencies here. If -2^2 is evaluated as an expression, then the precedence rules apply and the result is always -4. If however if the number -2 is operated on by the x^2 or y^x functions/keys then as expected, the result is
always 4. I don't see the confusion here. |
|||
04-26-2015, 08:17 PM
Post: #29
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 05:33 PM)Thomas Radtke Wrote:(04-26-2015 12:47 PM)rprosperi Wrote: ...and so I assume all HP algebraic machines (Pioneers at least) will behave the same way.Are you using the +/- key? If so, a negative number is placed on the stack, and your result doesn't make me wonder. Yes, I'm using +/-, as in [2] [+/-] [shift] [Y^X] [2] [=] produces 4 on both 10BII+ and 17BII. Playing further however, I've discovered that: Starting with 0.00 in display, I type: [-] [2] [shift] [Y^X] [2] [=] yields 4 whereas [-] [2] [x^2] [=] yields -4 While one can argue the relative correctness of interpreting the order of precedence, one would not expect different results between [Y^X] [2] and [X^2]. If you watch as you type, you can see how and why, since the [X^2] returns its result immediately, which is then subtracted (from 0), while the former must wait for the final [=] to evaluate the full algebraic line following the precedence rules. Very interesting, thanks for questioning my comments Thomas, it lead to another surprising discovery. --Bob Prosperi |
|||
04-26-2015, 09:39 PM
Post: #30
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 08:17 PM)rprosperi Wrote: Playing further however, I've discovered that: Are you using chain mode? [Y^X] is an operator with two arguments and thus completes the pending operation [-] before being executed. [x^2] just squares what is in the display, 2 actually, and the [-] operation is carried out with the result of this operation. Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basic-compare.html |
|||
04-27-2015, 12:19 AM
Post: #31
|
|||
|
|||
RE: negative number raised to even power
Yeah, I was just playing with the calculators I have handy and noticed the difference between the 41/71 and all the others, and thought it very weird. Wasn't the OP problem, but close. I was more surprised about the differing results, the 25 actually flashings 'Error' was something I hadn't seen in a very long time either.
2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80 |
|||
04-27-2015, 01:42 AM
Post: #32
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 09:39 PM)Marcus von Cube Wrote:(04-26-2015 08:17 PM)rprosperi Wrote: Playing further however, I've discovered that: These subtle cases are useful to see how even consistent rules of precedence can lead to unintuitive and even seemingly inconsistent results. I didn't realize the 2-arg operator needed to complete the pending operation prior to being evaluated. Like many things, once you see it, it makes sense, but as noted earlier, one wouldn't expect different results using these 2 different function methods. I would not have guessed this original topic/question could lead to such an interesting and revealing discussion. Thanks for the additional comments Marcus. --Bob Prosperi |
|||
04-27-2015, 02:11 AM
(This post was last modified: 04-27-2015 02:11 AM by Mark Hardman.)
Post: #33
|
|||
|
|||
RE: negative number raised to even power
(04-27-2015 01:42 AM)rprosperi Wrote: I would not have guessed this original topic/question could lead to such an interesting and revealing discussion. Thanks for the additional comments Marcus. I agree. I thought we had already discussed PEMDAS to the point that there was nothing new to explore. Ceci n'est pas une signature. |
|||
04-27-2015, 06:44 AM
(This post was last modified: 04-27-2015 07:07 AM by Dirk..)
Post: #34
|
|||
|
|||
RE: negative number raised to even power
One has to distinguish between (-), the reverse of the addition (+), and the (+/-) key which multiplies a number by -1. The Prime seems to do this sometimes/somehow, since the - in the display is sometimes a little bit longer or shorter(?). So 2(+/-) ² has to lead to 4 since the meaning is (-1*2)² (by convention) and not 0-(2²). As simple as this may sound, it might not be easy to implement this behaviour correctly/consequently.
Thus 2(+/-)² -> -4 is simply wrong and needs to be corrected. At the Prime there are inconsistent things happening: 2(+/-)² -> -4 (WRONG) Press ² again -> ANS² -> 16 (CORRECT) 2(+/-)² -> -4, now tap the -2² and the input line shows -(2²) which is not what you entered and therefore it is wrong. |
|||
05-03-2015, 04:47 PM
Post: #35
|
|||
|
|||
Checked three algebraic calculators
Hi,
checking three "algebraic" calculators for the -2²-bug leads to interesing results: CASIO CFX-9850GB PLUS: There is no (+/-)-key but a special (-)-key to change sign. The algebraic (-)-sign of a number can be distinguished from the (-)-operation by a shorter symbol in front of the number. *) 2(-)² -> Syn ERROR *) -2² -> -4 SHARP EL-512S and SHARP EL-520V: Both also have a special character so distingusih subtration from negarive numbers when pressing (+/-) to change sign. *) 2(+/-)² -> -2² -> 4 at the EL-512 *) 2(+/-)² -> (-2)² -> 4 at the EL-520 *) (+/-)2² -> -2² -> 4 Pressing the (-)-key as the first key of a calculation leads to "0-" in the algebraic line of the display (on the prime it leads to "ANS-") *) -2² -> 0-2² -> -4 -> On SHARP calculators it works like expected. The 520 even adds the brackets automatically to make this point even more clear. |
|||
05-03-2015, 07:21 PM
Post: #36
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 10:22 AM)Didier Lachieze Wrote:(04-26-2015 07:20 AM)Thomas Radtke Wrote: MS Excel.MS Excel evaluates -2^2 to 4 but 4-2^2 to 0. Not very consistent IMHO. In one case, the minus sign is negation, in the other, it's subtraction, not inconsistent at all. Two different uses, two different outcomes. Tom L Cui bono? |
|||
05-04-2015, 04:46 AM
Post: #37
|
|||
|
|||
RE: negative number raised to even power
Hello,
Unfortunately, this is another area where Math is un, or badly defined. There is a clearly defined order of priority for power, mul/div, add/sub and (), but after that, there is no 'universally' agreed upon order of priority, thus leading to that type of issues. Honestly, coming from a RPN world, for me the sign is 'part' of the number, not an prefix operator, and I would have parsed it as such had I been the one making the decision, but it seems that it is more 'customary' to do it the other way around (although not an absolute rule). One thing is sure, when doing anything more that purely basic math, it is a good idea to verify with the people around you if indeed you have the same definition of basic math concepts in order to avoid fights! Degenerate triangles are another example of such poorly defined math concept. Cyrille |
|||
05-04-2015, 06:10 AM
Post: #38
|
|||
|
|||
RE: negative number raised to even power
Dear Cyrille,
there is no unclear or bad definition at all: The (+/-) key is supposed to change the sign of the number and it does change the sign of the number. (-2)² is 4. So pressing 2(+/-)² has to give 4 and not -4. You can try 2(+/-)*2(+/-). The result is 4. In addition you can try 2(+/-) ENTER, press ANS² and get 4 again. So how do you explain your students that 2(+/-)² is -4 at the prime when entering it using the keyboard? In my opinion this is simply a bug which needs to get fixed as soon as possible. (Sorry for my harsh tone, since I'm German, I can't do better :-) ) |
|||
05-04-2015, 06:29 AM
Post: #39
|
|||
|
|||
RE: negative number raised to even power
(04-26-2015 02:57 PM)jebem Wrote:(04-26-2015 12:47 PM)rprosperi Wrote: HP-20S returns 4 RPN mode gives whatever priority YOU give it. You can easily get either -4 or 4 2 +/- Enter 2 y^x Ans: 4 or 2 Enter 2 y^x +/- Ans: -4 Tom L Cui bono? |
|||
05-04-2015, 07:22 AM
Post: #40
|
|||
|
|||
RE: negative number raised to even power
(05-04-2015 04:46 AM)cyrille de brébisson Wrote: Honestly, coming from a RPN world, for me the sign is 'part' of the number, not an prefix operator, and I would have parsed it as such had I been the one making the decision, but it seems that it is more 'customary' to do it the other way around (although not an absolute rule).Have a look here. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)