First, (-) is the change sign key and (x2) is the square key.
If you hit (-) 2 x (-) 2 = the answer is 4 on most calculators. But if you hit (-) 2 (x2) = you probably end up with negative 4. As far as I know, the only non-HP calculator that gives the correct answer is this Sharp .
Do you know about any other non-HP, passing this test?
What about the algebraic HP10s and SmartCalc300s?
/Tommy
Which calculator passes the first test?
|
|
« Next Oldest | Next Newest »
|
▼
12-01-2010, 02:15 PM
▼
12-01-2010, 02:34 PM
Are you suggesting that HP calculators handle that wrong or that they all do it correctly? My 32SII and 30B both return 4 not -4.
12-01-2010, 02:56 PM
I believe -22 is -4. Unless you mean (-2)2, which is 4. It's not clear from what you wrote, what you expect the correct answer to be. ▼
12-01-2010, 04:22 PM
All my HP:s gives the correct answer 4, but most calcs gives the wrong answer -4. My question is: What other calcs gives the right answer. Negative 2 squared is +4. ▼
12-01-2010, 04:40 PM
Both wolfram alpha and google disagree. . . Just saying. :-) TW ▼
12-01-2010, 05:07 PM
Do you suggest that all HP are faulty? :-)
12-02-2010, 06:14 AM
But when entering on Wolfram Alpha, you use the minus key. Is there an equivalent "change sign"? When using the "change sign" on a calculator, are you not making the negative a part of the characteristic of the number? When using the minus sign, it is equivalent to "0 - number", in which case "0 - number^2" indeed results in a negative answer. Thus the Wolfram Alpha answer is correct, as you are entering a minus, not a "change sign".
12-01-2010, 04:58 PM
My HP 35s gives "Syntax Error" when I press +/- 2 x^2 ENTER in ALG mode. I can get either -4 or +4, depending on whether I calculate -SQ(2) or SQ(-2). ▼
12-02-2010, 06:16 AM
Restricting the input to -SQ(2) or SQ(-2) seems a clever way to avoid the controversy :)
Edited: 2 Dec 2010, 9:41 a.m.
12-01-2010, 05:14 PM
Quote:I am still not clear what you mean. Are you talking ALG or RPN calcs? Since you include the = key, I might assume ALG. But I don't understand your notation. You stated that (-) represents the CHS or +/- key. But then in your example, the CHS key precedes the argument, while to my knowledge it always follows the argument, whether ALG or RPN model. And does the "x" in your example represent the multiplication key, or the quantity x? I don't see the square appearing in your example.
12-01-2010, 05:28 PM
4 is the correct answer only if the expression is (-2)^2.
12-01-2010, 05:56 PM
The good old math standard precedence is "exponentiation > multiplication > addition" (in German: "hoch vor Punkt vor Strich" - we're more concise here :) ), so -2^2 = -4 (if no parentheses are set) regardless of whether you see the unary minus as a multiplication by -1 or something like 0 - ... (-2)^2 is a different cup of tea :) ▼
12-01-2010, 08:18 PM
English is even more concise:
I looked at this very problem in detail a few years ago. For most calculators and calculator users, the problem originates with a misunderstanding of the way each machine works and especially what the CHS or +/- key does, as compared to the - key.
Some calculators parse a command line. Others operate and never parse. An RPN machine operates, an RPL machine parses. Some ALG or SemiALG machines parse some things but operate with others. The traditional "Alg" machine (which is better described as infix arithmetic with postfix functions) is an operator not a parser. DAL and SVPAM etc are parsers. Then there are machines which have documented features which may be confusing. The 32sii equation list recognizes a "unary minus" with precedence over exponentiation, but it has a bug when it is in the initial position! See Craig Finseth's HPDatabase. The 33s and 35s eliminated this confusing unary minus feature and they are correctly documented. Then there is the confusion of the fact that some machines have more than one mode, where one mode has a line interpreter but the other operates (e.g. 17bii, 27s, 32sii, 33s, 35s). Some machines will allow the +/- key to work as an operator only, while others allow it to function as a toggling character key. Some machines treat both the - and the +/- as the same thing, others as different things. And then some machines such as the 35s have a "high" minus sign when you push the +/- and a low one with the - even if there is no functional difference.... It is very confusing and totally MACHINE SPECIFIC. I haven't found any machines that are perfect except for the 48G series and descendants, and the pure RPN machines. I haven't looked at the latest Sharp/Casio/Ti so it may be the case that some of them are clearcut now. In RPN, there is never an issue, as there is NO PRECEDENCE because there is only operation, not line interpretation/parsing.
[edit: small grammatical error and incorrect reference] Edited: 8 Dec 2010, 8:18 a.m. after one or more responses were posted ▼
12-02-2010, 12:38 AM
Thank you, Bill, for straighten this out for me! So my question remains: are there any other clear cut non-RPN calcs out there? /Tommy ▼
12-02-2010, 07:26 AM
Sure. The 20s is very clear cut. I expect that the old 21s and 22s were also clear. I can't speak to the non-hp because I don't have any modern ones in front of me at the moment.
The biggest problem is a lack of care in the use of the tools. When was the last time you saw a student follow RTFM41? Edited: 2 Dec 2010, 7:28 a.m.
12-02-2010, 08:14 AM
Quote: In ALG mode I get a SYNTAX ERROR when using the minus-key:
-2
On the other hand I get the expected result with the +/- key: -2 So to me there is a functional difference.
Quote: This is not quiet true as entering a number changes the behaviour of the CHS key. Just think of what happens after the EEX key. There's a peculiar behavior in the HP-35: when the key following the CHS is a number key the negative sign is considered part of this number. So the following example will give 3 instead of -3 what probably most of us would expext:
5 In addition to that the stack doesn't contain 5 in the Y-register. So you could enter negative numbers as you read them. However I think it was a wise decision to change that in later models. ▼
12-02-2010, 08:55 AM
Hi Thomas, I think I am mixing up the 32sii 33s and 35s wrt the high minus. Indeed the 35s is a completely different animal than even the 33s in how it handles entry and interpretation. As I remember, when in ALG mode, it is a parsing machine, whereas the 33s is an operation machine but with the added feature of a history reporting line that shows how it all comes together. (all three are of course parsers within the equation list mode). Later I'll pull the 33s out and have a look. Unfortunately one of my kids lost the 35s so I can't have a look at it!
Edited: 2 Dec 2010, 8:58 a.m.
12-02-2010, 09:36 AM
I can confirm this "feature" of the original 35. So I looked what happened to it:
Edited to add some Woodstocks and the HP-91 as first HP calculating the way we are expecting it today. Anybody having some more Woodstocks at hand for checking?
Edited: 2 Dec 2010, 10:07 a.m. ▼
12-02-2010, 10:47 AM
Interesting. Is the behavior the same if the steps are programmed, rather than from the keyboard? (I know I'm being lazy, but I also don't have most of the models to try it out.) ▼
12-02-2010, 11:22 AM
None of the above calculators are programmable. ▼
12-02-2010, 04:19 PM
Rubbish: the 55 and 65 are. But right now I don't have access to my calcs, so anyone may verify this instead d:-)
12-02-2010, 12:04 PM
Quote: It seems the stack isn't lifted after CHS thus -5 is overwritten by the following 2. I consider that a bug: the negative sign shouldn't be silently ignored. Was this already known before? ▼
12-03-2010, 01:42 PM
Quote:That's my guess, too. Still I don't have any information about the history of this "feature" (see my previous post) beyond the fact that it was dropped apparently early in 1976. Anyone of the old experts knowing something about the circumstances? ▼
12-03-2010, 01:58 PM
It is a bug. I remember reading about this ages and ages ago, and I thought I remembered seeing this behavior on the HP-25 as well. As luck would have it, I'm working from home at the moment, so I could get my HP-25 out of its drawer, and I confirmed, 5 ENTER CHS 2 + returns 7, both from the keyboard and in a program. ▼
12-03-2010, 04:25 PM
Thanks, Thomas. Your result fits well in the line since the HP-25 was made before the HP-22 according to the museum. Does anybody have a working HP-27 for checking? ▼
12-03-2010, 06:31 PM
You're welcome! For what it's worth, my HP-25 has a serial number that starts with 1605, i.e. made in February 1976. ▼
12-05-2010, 11:34 AM
OK, I have the results of some more models now. So the updated table looks like this:
I don't remember having read anything about this change of concepts here for some years - so let me ask: is this known for longer already?
TIA for enlightenment(s). Edited: 5 Dec 2010, 11:39 a.m. ▼
12-05-2010, 03:01 PM
Quote: I don't agree with you here: instead I assume that -123 is overwritten by 4 since CHS doesn't enable the stack lift. The CHS has two different modes of operation: either as part of the input of a number or to change the sign of the X-register. In the HP-35 it isn't clear which mode to use until after the next key-stroke. So first it changes the sign of X. But if the next key is a number, this change of X is reverted and instead the negative sign is considered part of the number. It is clear that CHS can't enable the stack lift. Otherwise the following two sequences leave a different number of elements on the stack:
5 ENTER CHS 2 + So I think this magic handling of the CHS was removed, but enabling the stack lift wasn't added. In addition to your tests I suggest the following variants:
Store 2 in the register (2 STO) and make sure the stack is empty:
5 5 5 5 I have verified these results only with online emulators of the HP-35/45/25. The results for the HP-91 are just my expectations.
Best regards Added the results for the HP-25.
Edited: 6 Dec 2010, 9:36 a.m. after one or more responses were posted ▼
12-05-2010, 05:30 PM
From Walter's original statement: Quote: From Thomas' post:
Quote: Yes, that's the crux of the matter. I believe that HP, in those early years, was still working out the important nuances of the CHS function. Its implementations on the HP-35 and HP-45 were flawed, in that user input could sometimes get completely changed during data entry.
Characteristics of proper CHS functionality in RPN:
The HP-91 and most subsequent models implemented CHS correctly. A few early models on the HP-45's software-development track retained its flawed CHS functionality. Also, a subtle bug got slipped into many (but not all) Spice-series and Voyager-series models: HP-15C bug -- CHS and Stack Lift -- Karl Clarified several statements, based in part on new information.
Edited: 6 Dec 2010, 10:29 p.m. after one or more responses were posted ▼
12-05-2010, 07:12 PM
Quote:Not quite. The timeline is as follows according to HPDATAbase: 1975 1976 1977So there was some overlap. Seems it took HP significantly more than 4 months to implement the new CHS-handling in new Woodstock models, though it was "only software".
Edited: 7 Dec 2010, 12:45 p.m.
12-09-2010, 02:00 AM
Thomas, FYI, I've checked your table using real calcs and almost everything met your expectations and emulator output, but the results on a real 25C are the same as on a 45, i.e. -3 7 -3 7.
12-05-2010, 05:19 PM
-3 on an HP-19C and 29C
Regards,
12-02-2010, 10:31 AM
Ha ha. A rare example of concision in German? ;-))
12-01-2010, 11:45 PM
Quote: The correct answer to what? -22=-4, and (-2)2=4. This is the convention that's universally used in mathematics textbooks, and yet you seem to imply that -22=-4 is "wrong". Given that you've also indicated that you actually teach this stuff, that makes me think that you really, really need to do your homework, before looking for calculators whose behavior matches your mis-informed idea of mathematical notation. BTW, as Hugh mentioned, this was discussed on this forum not too long ago. See here. If you really want to teach your students well, teach them how the notation works as it is used in textbooks, and, if this actually comes up in your course, also mention how certain calculators and programming languages differ from the textbook standard.
Edited: 2 Dec 2010, 12:18 a.m. ▼
12-02-2010, 07:21 AM
Sorry,Thomas, but you did not understand my question. /Tommy
12-02-2010, 05:34 AM
Quote:
I disagree, if I have -2 on the display, and square it, it is to be interpreted as (-2)^2, if I wanted -(2^2), I would enter 2^2, then (+/-). The negative is part of the number (I am talking about having used the change sign, not minus), I did not enter "0 - 2^2", in which case the 2 is separate of the minus. What calculator when squaring a real number only squares the fractional part?, or when given a proper fraction only squares the fractional part?
Edited: 2 Dec 2010, 6:19 a.m. ▼
12-02-2010, 07:14 AM
You are right, ANS^2 is positve 16. Intresting... /Tommy ▼
12-02-2010, 07:22 AM
Quite logical, since the actual numeric value of the variable ANS is squared. ▼
12-02-2010, 07:40 AM
That is logical. But the intresting part is that you can not rely on the results. ▼
12-02-2010, 09:13 AM
Quote:Why? You just have to know what you're doing. As Bill explained above, there are different ways calculators handle such problems. A major advantage of RPN is it acts in a very consistent way: number first, operation second - no need to care for precedences etc. So 17 +/- x^2 will always result in 289. OTOH 17 x^2 +/- equals -289. The world can be so simple ;) Exception (on my 42S): 17 +/- E +/- 2 will result in 0,17 as well as 17 +/- E 2 +/- while the second input is more in line with RPN principles. Side track: Remember STO12 being an operation in RPN, so 17 +/- STO12 will store -17 in register 12. IMHO one disadvantage of RPL is they got these things mixed up so you have to enter 17 +/- ENTER 12 STO to reach the same (if numeric registers were allowed). End of side track.
12-02-2010, 07:31 AM
Note my discussion of Operation versus Parse. Answer^2 is an operation on the answer. ▼
12-02-2010, 08:46 AM
My point is exactly that a negative number created with a "change sign" should be operated on in it's entirety and not parsed.
12-02-2010, 07:36 AM
Quote: Note my discussion of line interpreter/parser versus operation. If you have -2 on the display and you operate on it, of course you get +4. That is what an RPN machine will do, or an older "algebraic" because even the latter is postfix and operation-based (is the same as RPN). Newer machines line-line interpret *expressions* rather than operate on numerical entities. However, the "answer" function operates on the answer. This is always, first and foremost, a problem of not following RTFM41 rather than a machine defect or bug. However I do have opinions regarding good versus bad design, but even the "bad" designs work correctly if one bothers to learn how they work. ▼
12-02-2010, 08:53 AM
Quote: I would rather say that "bad" designs work as the designer intended, but not necessarily correctly. Of course correct being a bit subjective in the current topic :).
Quote:A case of "know your enemy"? ;) Edited: 2 Dec 2010, 9:06 a.m.
12-03-2010, 06:34 AM
HA! Even Microsoft agrees with ME :P
12-01-2010, 03:11 PM
this discussion came up a while back. it turns out that the operator precedence of unary minus is different for different manufacturers. we even found differences amongst different casio models. the problem is compounded when you allow two minus buttons, ie regular operator minus and (-).
12-01-2010, 11:10 PM
If you have a calculator, you should know how it works, so you can make it give you the answer you think it should. That's the only issue here. Let's put this a different way. Sin30 (in degrees) is 0.5. But do you have a calculator that lets you enter 30 Sin, you might get 0.5. But what's 30 Sin? That's 30 times the Sin of nothing! It's meaningless! That seems kind of like what you're saying. ▼
12-02-2010, 07:43 AM
That's right. GIGO. 30 SIN is postfix. sin(30) is line interpreted. sin 30 = is used in an infix machine, for instance, the old SHARP EL 5020. Of course the manuals don't necessarily bother to explain the inner workings, especially the cheap Non-HP designed machines with little fold out manuals. Even HP manuals won't always discuss the parse versus operation aspect--but note that until recently, no calculator parsed expressions! Edited: 2 Dec 2010, 7:44 a.m.
12-02-2010, 09:28 AM
Manufacturers seem to disagree about the interpretation of (-)2^2 even within their own product range: Sharp: None of my algebraic Sharp calculators returns +4. I do have the EL-9200/9300/9600 and an EL-5120. Are you sure, the EL-520WBBK does? Casio: None of my algebraic Casio calculators returns 4. I tried with a BASIC computer (PC-1262), some newer algebraics, and various graphics machines (old and recent). The Canon F-300P returns +4. Likewise the TI Galaxy 67, while all the TI graphics calculators, including the CAS machines, and also the TI-34 multiview return -4. Now to HP: The 30s and the 9g both return -4. Same for the 38G. The RPL machines lack the postfix ^2 operator as has already been mentioned. -2^2 returns -4. Return -4 seems to be the rule, +4 the exception. ▼
12-02-2010, 10:17 AM
Sorry, I disagree about the RPL-machines. You'll find x^2 on e.g. the HP-48SX easily (gold shifted square root). And it behaves mathematically correct, i.e. 2 +/- x^2 equals 4. ▼
12-02-2010, 03:02 PM
I should have elaborated. When you do that, using the stack, it is an operation on the -2, which is in the command line. If you do this: '-2^2' ENTER EVAL Then it is parsed.
12-02-2010, 01:50 PM
Danke!
12-02-2010, 12:56 PM
Tommy, why are you expecting RPN and non-RPN machines to give the same result for the same sequence of keystrokes? (-) 2 x^2 in algebraic is calculating the same result as 2 x^2 (-) in RPN. (-) 2 x^2 in RPN is ( (-) 2 ) x^2 in algebraic. I'll leave it to you to count the keystrokes and make any decisions about efficiency.
12-03-2010, 11:58 AM
Hi Tommy, Re-reading your question in light of all the commentary, please read the following.
The algebraic expression -2^2 is equal to -4. This is a fact of uniform notation. If you think this is incorrect, then that would be a problem. However, what I think is leading you to believing that calculators are giving incorrect answers is that you are used to the older style of machines, where you *operate* on what is displayed. In this case, the problem you are actually trying to figure out is the following: (-2)^2 An older machine such as a 1970s Ti SR70 or an HP 20s, or a 27s or an HP 33s set in ALG, or any RPN machine will work identically:
This type of machine OPERATES on the x-register. A currently available HP is used in the example below: expression: (-2)^2If you are using a more "modern" machine with a "textbook" type of interface, you will have to type in the expression correctly according to standard notation. (note however that there is variation from machine to machine even here--some allow implicit multiplication, some don't follow standard rules exactly etc [ex: equation list of 32sii which has a unary minus].
An example of a properly functioning PARSED LINE INTERPRETER is found in the currently available HP 33s Equation List: [note that you don't have to close the parenthesis here because the line interpreter will implicitly close it. Some machines would error at this. Every machine is different and you have to Read the F$#$#$#@ manual :-) ] I hope this helps you. Best regards,
Bill
Edited: 3 Dec 2010, 12:04 p.m. ▼
12-03-2010, 04:35 PM
Quote:Indeed. The Sharp EL-W506 Writeview manual states: Priority Levels in Calculation
Note: (-) = change sign. So one can see that as the x2 is defined as taking precedence over (-), thus entering: (-), 2, x2 will be evaluated as 2^2=4, (-), = -4. Whether we like it or not, it does what the manufacturer intended and specified. ▼
12-03-2010, 07:27 PM
Quote: or failed to implement and specified
12-03-2010, 07:44 PM
Hi Bill, ▼
12-03-2010, 09:01 PM
Hi Tommy: "The 35s would be ok, but it is a little bit too expensive (for the students)" I have to laugh at this. I guess it is priorities. IF you have to spend as little as it costs for one Hamburger and fries, then, yes, I guess $45 bucks or so is too much. Same kid thinks nothing of blowing $10 a week on iTunes. And people don't read the manuals because they are LAZY. I read my 11c manual cover to cover when I got it in 1982, and so did my brother even though it wasn't his. IT was fun to know how it worked. I think the 33s is a better choice than the 35s actually. It is more user friendly and has much better handling of rectangular to polar, and base arithmetic. And it is, as I showed, a postfix function/infix arithmetic and *operates* on the displayed number. The 35S does NOT do this the same way. The 35S is an infix machine (except for factorial.) You should download the manuals for the 33s and the 35s. Look at page C-1 in each one. I lost my 35s so I can't test it, but there is a "unary minus" ahead of multiplication on the 35S. I just don't remember how it works. All told, the 35s and 33s are totally different approaches in their Algebraic modes (as distinct from their equation modes, which are essentially identical (see p 6-13 through 6-15 of each manual. They have a unary minus ahead of multiplication, but this is to handle the issue such as -a X -b, which is I believe what is also the unary minus treatment in the 35s ALG mode). [The 32sii equation list had the unary minus given precedence over taking powers, which was the real problem there. Both the 33s and 35s have rectified this by moving the unary minus down.] Fortunately, I haven't much experience with current non-HP machines. I have 15 or 20 year old Sharps and a TI so that won't help you....
Edited: 3 Dec 2010, 10:05 p.m. ▼
12-04-2010, 04:14 AM
I totally agree with you. I enjoy reading the manuals. ▼
12-04-2010, 06:36 AM
Quote:On calculators beyond trivial calculations, "equal" means always "almost equal" within the tolerance (or accuracy) of the calculator. Your example, however, counts to the mathematically trivial applications, so I agree "almost equal" being not necessary there. Our American friends tend to forget sometimes the price policy of HP in the countries beyond God's own. I hate to repeat this, but e.g. a new 35S sells for 50 € (Euro) in Germany at least - look here for Hewlett Packard and enjoy your location since 50 € "almost equal" 66 US$ today :( ▼
12-04-2010, 09:38 AM
and don't forget the eurotaxes. I wonder if there is a cost of doing business aspect to european pricing nowadays. All items that we can buy here, and there, are more in eurozone. All. but this was not the case in the past. My father bought a couple pairs of binoculars, a camera, and a Rolex in Germany in the 60s for significantly less. In 98, I found that the dollar being strong, made the Mark really inexpensive. Chocolate bars were only 60% of what I paid here. But now, it hardly matters what the currency does--the Eruo pricing is always high, or higher...
12-04-2010, 09:49 AM
Hi Tommy, Your notation has me flummoxed. I thought I understood what you meant, but now I'm not so sure. The TI "maths cookbook" approach is also dominant here. That gets to another subject.
Nobody can write cursive, and the teachers don't care. "Just use the computer, they say. And the parents? I guess there must be an unspoken consensus among parents that this trend is good. And yet, Sweden is outperforming the US rather dramatically in Maths education. Only Massachusetts and Minnesota outrank Sweden. Evidently the calculators are only a minor issue... ▼
12-04-2010, 12:49 PM
Quote:In principle, human beings are curious and lazy. Scientists tell 20% of the energy consumption of an average (wo)man is consumed by (her) his brain. People tend to become overweigh - emmh, horizontally challenged in modern societies. Now, let's add 1+1+1 and guess the result ... ;) OTOH, already Sokrates complained about the youth in Athenai, calling them incapable and good-for-nothing some 2300 years ago - and their successors discovered America ;) ▼
12-04-2010, 02:02 PM
"OTOH, already Sokrates complained about the youth in Athenai, calling them incapable and good-for-nothing some 2300 years ago - and their successors discovered America ;) " Hahaha so true. Then again, somewhere along there, the Greeks lost to the Romans etc... What I find striking about the bible isn't the religious stuff, but the parables, the warnings of what can and does happen when decadence prevails. Never mind the god and hell stuff--the fact is that ancient cities perished because the youth were led astray... In the US, it is immigrants who keep us honest. They often show us the way when we lead ourselves astray. They show us that we shouldn't take our great society for granted--that freedom, liberty and justice do matter...
12-06-2010, 07:23 AM
Quote: Is the HP 10s a possibility? Calculators don't come much cheaper than that, and I don't just mean the price ;-) There's no RPN option. The algebraic parsing of
- 2 ^ 2 = returns -4 and
- 2 = returns 4 I've read all the posts and I'm still not 100% clear on whether or not this passes "the test", but I contend that its answers are correct, bearing in mind all that Bill Platt wrote about the critical difference between parsing an algebraic input string and the immediate operation of RPN on a stack.
12-06-2010, 12:49 PM
So, by your reasoning, you would expect an algebraic calculator to give the result 9 for the key sequence 1 + 2 x^2 = since the x^2 is to operate on the "1+2" in the display? ▼
12-07-2010, 05:02 AM
I think that's exactly what Tommy's not saying (am I right Tommy?), but rather that which I stated previously. To quote myself: Quote:And the 33s is a perfect example of this: Quote:Thus the answer to your key sequence would be the normally expected 5. When Tommy mentions "the number on the display" I think he is indeed talking about a number, not an equation - his examples illustrate this. (Tommy - please correct me if I am wrong).
12-07-2010, 08:45 PM
Quote:That is exactly what happens when one uses the type of algebraic mnechanized in business machiines such as the HP-10B, HP-17BII and HP-19BII. It is NOT what happens with the algebraic mechanizations in the HP-10s, HP-33s or HP-35s. |