LAST on HP20S
07-07-2016, 12:59 PM
Post: #1
 jbhp55 Junior Member Posts: 19 Joined: Jun 2015
LAST on HP20S
Just out of curiosity, can anyone explain to me what the 'LAST' function on the HP20S does (mine is 3014A31950). What the manual says seems not to cover what actually happens, unless I interpret it incorrectly.

Best wishes,

Jaap.
07-07-2016, 01:34 PM
Post: #2
 rprosperi Senior Member Posts: 4,022 Joined: Dec 2013
RE: LAST on HP20S
(07-07-2016 12:59 PM)jbhp55 Wrote:  Just out of curiosity, can anyone explain to me what the 'LAST' function on the HP20S does (mine is 3014A31950). What the manual says seems not to cover what actually happens, unless I interpret it incorrectly.

It returns the result of the LAST operation that was completed. The example in the manual is poor IMHO (at least poor to point out the purpose of LAST), but it is correct.

The idea is if you have the result of a complex calculation, which is needed in a subsequent calculation, you don't have to re-enter the long complex original one again, you can simply substitute LAST, much as you might use STO & RCL to save that intermediate result for re-use.

Perhaps you've found a situation where you think it does not work? If so, provide the example and your expected result; perhaps you have a misunderstanding or perhaps you've actually found a bug.

--Bob Prosperi
07-07-2016, 02:54 PM
Post: #3
 jbhp55 Junior Member Posts: 19 Joined: Jun 2015
RE: LAST on HP20S
Dear rprosperi,

that's what I thought it should do, and it sometimes does. However, if I type:
1
+
1
=
(result: 2)
LAST

then the result is not 2, but an older result. (in my case 36).

If I then start a new calculation:
1
+
LAST, the output is again 36, and not 2 (the manual says that the last result is available as soon as a new operation is started).

This behaviour may be intended, but to me it is not clear which number is stored in LAST. This is particularly problematic in programming.

It seems that = stores something in LAST, but not for immediate use. LAST itself stores its outcome in LAST, overwriting the last result after =. Functions like sin, cos, tan do not store their result in LAST.

I cannot discover the logic behind this behaviour.
Can you?

Best regards,

Jaap.
07-07-2016, 05:00 PM
Post: #4
 rprosperi Senior Member Posts: 4,022 Joined: Dec 2013
RE: LAST on HP20S
(07-07-2016 02:54 PM)jbhp55 Wrote:  Dear rprosperi,

that's what I thought it should do, and it sometimes does. However, if I type:
1
+
1
=
(result: 2)
LAST

then the result is not 2, but an older result. (in my case 36).

If I then start a new calculation:
1
+
LAST, the output is again 36, and not 2 (the manual says that the last result is available as soon as a new operation is started).

This behaviour may be intended, but to me it is not clear which number is stored in LAST. This is particularly problematic in programming.

It seems that = stores something in LAST, but not for immediate use. LAST itself stores its outcome in LAST, overwriting the last result after =. Functions like sin, cos, tan do not store their result in LAST.

I cannot discover the logic behind this behaviour.
Can you?

Best regards,

Jaap.

Though hard to articulate precisely (the manual isn't great either) LAST returns the value of the LAST result, before the current result.

Doing 1 [+] 1 [=] => 2

If you want to operate on this latest result, just treat it like the first item you would have typed in; for example, to triple the above result, continue by typing:

[*] 3 [=] => 6.

There is no need to use LAST here, since you can easily operate on the current result.

The trig functions also do save to last, as follows:

60 [SIN] => 0.87

2 [*] LAST = => 1.73

The simplest way to think of how it works, to me, is LAST is a way to get at the last result that is no longer directly available, which is exactly what it's purpose is.

If this doesn't help, please show some additional examples where LAST does not provide the expected result, for cases when you cannot operate on the most current result.

HTH

--Bob Prosperi
07-07-2016, 09:05 PM
Post: #5
 jbhp55 Junior Member Posts: 19 Joined: Jun 2015
RE: LAST on HP20S
Thanks for the excellent explanation.
I still don't think it works well.

60
SIN -> 0.87
2
*
LAST (0.87)
= -> 1.73
+
3
*
LAST (here I'd expect 1.73, but 0.87 comes up!)
= -> 4.33 (instead of 5.20)

It is probably possible to formulate an algorithm to describe this behavior (indeed, that's in the calculator!), but it is not easy to understand for the poor user. So, it's back to STO en RCL for such calculations (or, better still, to RPN)
07-07-2016, 10:55 PM (This post was last modified: 07-07-2016 10:57 PM by Dave Frederickson.)
Post: #6
 Dave Frederickson Senior Member Posts: 1,744 Joined: Dec 2013
RE: LAST on HP20S
(07-07-2016 09:05 PM)jbhp55 Wrote:  Thanks for the excellent explanation.
I still don't think it works well.

60
SIN -> 0.87
2
*
LAST (0.87)
= -> 1.73
+
3
*
LAST (here I'd expect 1.73, but 0.87 comes up!)
= -> 4.33 (instead of 5.20)

It is probably possible to formulate an algorithm to describe this behavior (indeed, that's in the calculator!), but it is not easy to understand for the poor user. So, it's back to STO en RCL for such calculations (or, better still, to RPN)

The manual states that a copy of the last result is stored in the LAST register when you start a new calculation. After pressing SIN you enter 2 * ... which is a new calculation and 0.87 was stored in the LAST register. After pressing = you continue with + 3 *, which is a continuation of the last equation, not a new calculation, consequently LAST is not updated.

Dave
07-07-2016, 11:23 PM
Post: #7
 rprosperi Senior Member Posts: 4,022 Joined: Dec 2013
RE: LAST on HP20S
(07-07-2016 10:55 PM)Dave Frederickson Wrote:  The manual states that a copy of the last result is stored in the LAST register when you start a new calculation. After pressing SIN you enter 2 * ... which is a new calculation and 0.87 was stored in the LAST register. After pressing = you continue with + 3 *, which is a continuation of the last equation, not a new calculation, consequently LAST is not updated.

Thanks Dave, you beat me to it.

In fairness to jaap, I did not include that important qualifier in the explanation, so apologize for oversight in the explanation.

But, if RPN is a choice, definitely go that way (32S or 32SII are fairly similar in scope and nearly the same h/w as a 20S). With RPN, no need to understand these odd little rules, it's always up to you to manage the stack, and the stack is always just the way you left it.

--Bob Prosperi
07-08-2016, 09:33 AM
Post: #8
 jbhp55 Junior Member Posts: 19 Joined: Jun 2015
RE: LAST on HP20S
Dear Bob and Dave,

thanks for the extended explanation.
I think HP has a very high opinion of the IQ of their customers, because this is quite a complicated function to remember.
I have a 32SII as well. It's a better calculator (RPN, integrate, solve, etc.), but also much more expensive in the current market, and the display is slightly less clear.

One extra remark about LAST: it does not always give the result of the last completed calculation after you start a new one, as described by you.

1
+
1
= -> 2
2
+
2
= -> 4
LAST -> 2
3
+
LAST (2, not 4)
= -> 5

By inspecting the value of LAST, the algorithm is disturbed. The outcome of the last calculation before the new calculation (3+LAST) was 4 (2+2), but LAST returns 2 instead.
Some would call this a feature, some a bug, some might call it a user error, but to me it makes LAST an unreliable function.

An example where LAST performs according to the rules described, but not necessarily very intuitively:
1+1= (->2)
2+2= (->4)
LAST + LAST = (->6), or: LAST + LAST + LAST (->10)

Luckily, the HP20S offers the SWAP function, which can be used to replace LAST, and which works very simply and elegantly.
07-08-2016, 10:14 AM
Post: #9
 jbhp55 Junior Member Posts: 19 Joined: Jun 2015
RE: LAST on HP20S
Forget what I wrote about SWAP, it works entirely differently. Sorry, I didn't check.
07-08-2016, 02:49 PM
Post: #10
 rprosperi Senior Member Posts: 4,022 Joined: Dec 2013
RE: LAST on HP20S
(07-08-2016 09:33 AM)jbhp55 Wrote:  One extra remark about LAST: it does not always give the result of the last completed calculation after you start a new one, as described by you.

1
+
1
= -> 2
2
+
2
= -> 4
LAST -> 2
3
+
LAST (2, not 4)
= -> 5

This is because using LAST changes the new value of LAST as you noted earlier.

In your example above, if you had not accessed LAST after getting the result of 4, you would have the expected result:

1
+
1
= -> 2
2
+
2
= -> 4
3
+
LAST (4)
= -> 7

So if you only use LAST to access the "LAST" result, it will behave as expected, but you must keep in mind the using LAST changes the "new" value of LAST.

I agree, go with the 32SII, for me a far better and easier to understand machine. The algebraic Pioneers intrigued me so I played with them a lot to try to understand this system. Then went back to RPN, where I had think a lot less. Programming with the algebraic system was very tedious, though Gene says it's because I didn't use my TI machines enough....

--Bob Prosperi
07-08-2016, 03:54 PM
Post: #11
 jbhp55 Junior Member Posts: 19 Joined: Jun 2015
RE: LAST on HP20S
There was a post #11 which I cannot find anymore, was it retracted?
The point it made was that LAST recalls the content of the LAST register. The question would be: what is stored in it, and when?

I think we can conclude that the use of LAST on the HP20S is subject to an unnecessarily complex set of rules. Unless used in exactly the intended way, the result may be surprising.
I think it would be much easier to understand if it would just retain the last value displayed as a result. I had a Casio which had an 'ANS' key which worked like that.

But ultimately, I agree that RPN (or RPL) gives much better functionality in this respect. (including the LAST x command).

Thanks for all the reactions!
07-08-2016, 05:47 PM
Post: #12
 rprosperi Senior Member Posts: 4,022 Joined: Dec 2013
RE: LAST on HP20S
(07-08-2016 03:54 PM)jbhp55 Wrote:  I think we can conclude that the use of LAST on the HP20S is subject to an unnecessarily complex set of rules. Unless used in exactly the intended way, the result may be surprising.
I don't agree that it's unnecessarily complex, it just takes research to understand it's full scope. You should search here on the forum archives, I'm sure someone has done this a documented it in a way that will help to better grasp just what is does, when, and how.

I think most commands will give you surprising results if not used in exactly the way intended, the difference is some have less subtle effects than LAST.

(07-08-2016 03:54 PM)jbhp55 Wrote:  I think it would be much easier to understand if it would just retain the last value displayed as a result. I had a Casio which had an 'ANS' key which worked like that.

With no disrespect intended, I think the problem you are having is that you want to use LAST the way ANS worked, and it just doesn't work the same way.

But again, RPN/RPL avoids all this, so that's probably the best answer. Thanks for a good reason to take out my 20S.

--Bob Prosperi
07-08-2016, 07:18 PM
Post: #13
 jbhp55 Junior Member Posts: 19 Joined: Jun 2015
RE: LAST on HP20S
Dear Bob,

my pleasure! I quite like that features like this can lead to interesting searches and discussions. I am still a little puzzled as to how HP could let loose this function with so little explanation in the manual; this could easily lead to disappointments. As to the Casio, I never liked that, I only bought it because it was compulsory to do so when I started at university. To think I might have bought an HP15C instead!
It was not well made, and although it had good specs, it wasn't a pleasure to work with.
Once again, I have been impressed with the prompt and knowledgeable reactions from the forum!

Best regards,

Jaap.
07-08-2016, 07:20 PM
Post: #14
 Dave Frederickson Senior Member Posts: 1,744 Joined: Dec 2013
RE: LAST on HP20S