HP Forums
Curiosity about HP 50 and x^2 vs x^y - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Curiosity about HP 50 and x^2 vs x^y (/thread-20802.html)



Curiosity about HP 50 and x^2 vs x^y - Camionsauro - 11-08-2023 08:39 PM

Hi to all and sorry for my English.

I’m not a mathematician but I like to Collect old Calculators. I’ve found a HP 50g and I’m playing with it… I’ve got a question:

Why the x^2 command evoke the SQ function and not a classic power of 2 (with the X^y I’ve got i.e. 3^2 written in the Classic way)? Sale result, no problem about that, it’s Just a bit difficult to identify a power of two written in this way but I suppose it’s Just a matter of habit… Smile

Thanks and have a nice day!


RE: Curiosity about HP 50 and x^2 vs x^y - cdmackay - 11-09-2023 07:22 PM

welcome to the forum!

I'm not sure…

The SQ() function has been around since the 28C, which also had the ^ power function.

The reason for having both may relate to on which objects they operate.

For example, the 28S manual suggests that SQ may be used on arrays/matrices, but ^ may not. I don't have batteries in my 28S right now, so can't test that. So that might be why a separate SQ function was introduced for ^2, versus ^n.

The 50g ^ function will operate on matrices, so the distinction may no longer be required, but the SQ function would be retained for backward compatibility with older RPL programs.

Or there may be better reasons I'm forgetting…


RE: Curiosity about HP 50 and x^2 vs x^y - cdmackay - 11-09-2023 07:25 PM

Also, of course the SQ function needs only one stack level, versus 2 for the ^ power function. But that's not a big deal on RPL units.


RE: Curiosity about HP 50 and x^2 vs x^y - John Keith - 11-09-2023 07:51 PM

One major reason seems to be speed. On my 50g, applying SQ to a list of approximate numbers from 1..100 takes about 180 ms. Applying 2. ^ to the same list takes about 790 ms. This tells me that SQ is using a different method than the ^ function. I would guess that SQ is simply DUP * internally.

Edit: I just checked by changing 2. ^ to 3.1416 ^ and execution time only increased by about 5%. Thus I am guessing here that ^ uses exponentiation for any real arguments.


RE: Curiosity about HP 50 and x^2 vs x^y - Johnh - 11-09-2023 08:32 PM

Just from the user's perspective, for most people, x^2 is used much more often than x^y, so more direct access to it is valuable. That being said, with x^2 as a shifted function, and y^x as a primary function on a button, both may be two key strokes. (eg on a 15c and many others, it's g, x^2, compared to 2, y^x)


RE: Curiosity about HP 50 and x^2 vs x^y - carey - 11-09-2023 11:59 PM

(11-09-2023 07:25 PM)cdmackay Wrote:  Also, of course the SQ function needs only one stack level, versus 2 for the ^ power function. But that's not a big deal on RPL units.

The above sounds reasonable.

A different option of a superscript 2 would have used only one stack level and only one character, but would have needed 5 vertical pixels to be readable so wouldn't be clearly identifiable as a superscript on the screen in a program. SQ is an efficient two-character one stack level option on a screen with limited pixel character height.


RE: Curiosity about HP 50 and x^2 vs x^y - DavidM - 11-10-2023 02:59 AM

There's lots of potential questions being answered here, but I'm wondering if we may have missed the meaning of what Camionsauro was actually asking

If the 50g is still set to the default algebraic mode (or you start editing an algebraic expression in either mode), pressing the \(x^2\) key results in "SQ()" being added to the command line instead of "^2" being appended to the previous object. Since SQ is a function, it places "SQ()" in the command line and leaves the cursor flashing between the parentheses.

To see how different the treatment of the \(x^2\) and \(y^x\) keys are, try putting your 50g in algebraic mode, or simply start building an algebraic expression (using tick marks) with those keys.

Since most of us use RPN mode instead of algebraic, we aren't as likely to see the effect that Camionsauro is referring to.

Then again, I may be the one who is confused here. Smile But I believe Camionsauro may either have his 50g in algebraic mode, or perhaps he’s editing an algebraic.