I was bored and found a HP-27S
06-26-2014, 01:44 PM
Post: #41
 jebem Senior Member Posts: 1,343 Joined: Feb 2014
RE: I was bored and found a HP-27S
(06-26-2014 01:35 PM)Don Shepherd Wrote:  Don't forget Thomas Klemm, a true genius. See his article on the eight queens problem for an example of some brilliant solver code.

Thanks for the suggestion, Don!
I have it already on my HP-27S disk folder, along with a lot of your Solver programs as well
I'm doing a extensive research in the net on this calculator and download as much documents as I can find.

Jose Mesquita

06-26-2014, 02:14 PM
Post: #42
 Thomas Klemm Senior Member Posts: 1,773 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-26-2014 01:23 PM)rprosperi Wrote:  Then search the Forum (OLD & NEW) for great articles from Don Shepherd and then, when you think you have it mastered, search for an article w/title something like "Long Equation for HP17B Solver" from Gerson IIRC.
Link for the lazy: A very long HP-17BII equation.

Quote:Astounding stuff, implementing the Trig functions and much more.
You probably don't need these with the HP-27S.

Cheers
Thomas
06-26-2014, 03:57 PM
Post: #43
 jebem Senior Member Posts: 1,343 Joined: Feb 2014
RE: I was bored and found a HP-27S
(06-26-2014 02:14 PM)Thomas Klemm Wrote:
(06-26-2014 01:23 PM)rprosperi Wrote:  Then search the Forum (OLD & NEW) for great articles from Don Shepherd and then, when you think you have it mastered, search for an article w/title something like "Long Equation for HP17B Solver" from Gerson IIRC.
Link for the lazy: A very long HP-17BII equation.

Quote:Astounding stuff, implementing the Trig functions and much more.
You probably don't need these with the HP-27S.

Cheers
Thomas

Thanks, Thomas!

Jose Mesquita

06-26-2014, 10:34 PM
Post: #44
 rprosperi Super Moderator Posts: 5,439 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-26-2014 01:40 PM)jebem Wrote:  I don't have the MoHPC DVD yet, that will be one of my next acquisitions.

The Museum DVD set is the most bang for your buck, period.
Can't say enough good things about having this set. In fact, it's used so often, I had to move it from DVD -> SSD. About 5 clicks to almost any manual I want. Now I just live in fear that Dave will update the DVD set... whatever will we do???

--Bob Prosperi
06-26-2014, 10:41 PM
Post: #45
 rprosperi Super Moderator Posts: 5,439 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-26-2014 01:35 PM)Don Shepherd Wrote:  Don't forget Thomas Klemm, a true genius. See his article on the eight queens problem for an example of some brilliant solver code.
I could not forget Thomas. I was going to wait to hear the solver had been mastered, and then point him to some of Thomas' gems like that. But I can tell you from experience that looking at those pieces of Solver art before you've used it a lot is really confusing. Sometimes even after.

(06-26-2014 02:14 PM)Thomas Klemm Wrote:  Link for the lazy: A very long HP-17BII equation.

Guilty! Thanks for posting Thomas; I was close in topic, but not too useful as a search hint...

--Bob Prosperi
06-27-2014, 09:45 AM
Post: #46
 Thomas Klemm Senior Member Posts: 1,773 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-26-2014 10:41 PM)rprosperi Wrote:  But I can tell you from experience that looking at those pieces of Solver art before you've used it a lot is really confusing. Sometimes even after.

This is an equivalent program written for Python:
Code:
for I in range(1, 9):   for J in range(1, 9):     if I != J and abs(I - J) != 1:       for K in range(1, 9):         if I != K and abs(I - K) != 2 and \            J != K and abs(J - K) != 1:           for L in range(1, 9):             if I != L and abs(I - L) != 3 and \                J != L and abs(J - L) != 2 and \                K != L and abs(K - L) != 1:               for M in range(1, 9):                 if I != M and abs(I - M) != 4 and \                    J != M and abs(J - M) != 3 and \                    K != M and abs(K - M) != 2 and \                    L != M and abs(L - M) != 1:                   for N in range(1, 9):                     if I != N and abs(I - N) != 5 and \                        J != N and abs(J - N) != 4 and \                        K != N and abs(K - N) != 3 and \                        L != N and abs(L - N) != 2 and \                        M != N and abs(M - N) != 1:                       for O in range(1, 9):                         if I != O and abs(I - O) != 6 and \                            J != O and abs(J - O) != 5 and \                            K != O and abs(K - O) != 4 and \                            L != O and abs(L - O) != 3 and \                            M != O and abs(M - O) != 2 and \                            N != O and abs(N - O) != 1:                           for P in range(1, 9):                             if I != P and abs(I - P) != 7 and \                                J != P and abs(J - P) != 6 and \                                K != P and abs(K - P) != 5 and \                                L != P and abs(L - P) != 4 and \                                M != P and abs(M - P) != 3 and \                                N != P and abs(N - P) != 2 and \                                O != P and abs(O - P) != 1:                               print I, J, K, L, M, N, O, P

The index parameters I-O are local variables and therefore can't be used directly to display the result. Thus the variables A-H are used to propagate the result. They must be used or they won't show up in the menu. But we're not really interested in the sum of them. It's only for this side-effect that they are used here:
Code:
Q=A+B+C+D+E+F+G+H+

Instead of a for-loop the $$\Sigma$$ function is used. We don't have ABS but we can use SQ (square) instead:
Code:
Σ(M:1:8:1: IF(I<>M AND SQ(I-M)<>16 AND J<>M AND SQ(J-M)<>9 AND K<>M AND SQ(K-M)<>4 AND L<>M AND SQ(L-M)<>1:

Code:
for M in range(1, 9):   if I != M and abs(I - M) != 4 and \      J != M and abs(J - M) != 3 and \      K != M and abs(K - M) != 2 and \      L != M and abs(L - M) != 1:

As we can't display all 92 solutions an error (division by zero) is used to stop the program:
Code:
L(A:I)xL(B:J)xL(C:K)xL(D:L)xL(E:M)xL(F:N)xL(G:O)xL(H:P)/0
And here's where the local variables are copied to the corresponding menu variables using the let-function. Again we're not interested in that product but we have to use a single expression where everything is used.

While the Python program prints all solutions the solver stops with the 1st one. A counter could be used to stop with the n-th solution.

HTH
Thomas
06-27-2014, 12:43 PM
Post: #47
 rprosperi Super Moderator Posts: 5,439 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-27-2014 09:45 AM)Thomas Klemm Wrote:
(06-26-2014 10:41 PM)rprosperi Wrote:  But I can tell you from experience that looking at those pieces of Solver art before you've used it a lot is really confusing. Sometimes even after.

This is an equivalent program written for Python:
Code:
for I in range(1, 9):   for J in range(1, 9):     if I != J and abs(I - J) != 1:       for K in range(1, 9):         if I != K and abs(I - K) != 2 and \            J != K and abs(J - K) != 1:           for L in range(1, 9):             if I != L and abs(I - L) != 3 and \                J != L and abs(J - L) != 2 and \                K != L and abs(K - L) != 1:               for M in range(1, 9):                 if I != M and abs(I - M) != 4 and \                    J != M and abs(J - M) != 3 and \                    K != M and abs(K - M) != 2 and \                    L != M and abs(L - M) != 1:                   for N in range(1, 9):                     if I != N and abs(I - N) != 5 and \                        J != N and abs(J - N) != 4 and \                        K != N and abs(K - N) != 3 and \                        L != N and abs(L - N) != 2 and \                        M != N and abs(M - N) != 1:                       for O in range(1, 9):                         if I != O and abs(I - O) != 6 and \                            J != O and abs(J - O) != 5 and \                            K != O and abs(K - O) != 4 and \                            L != O and abs(L - O) != 3 and \                            M != O and abs(M - O) != 2 and \                            N != O and abs(N - O) != 1:                           for P in range(1, 9):                             if I != P and abs(I - P) != 7 and \                                J != P and abs(J - P) != 6 and \                                K != P and abs(K - P) != 5 and \                                L != P and abs(L - P) != 4 and \                                M != P and abs(M - P) != 3 and \                                N != P and abs(N - P) != 2 and \                                O != P and abs(O - P) != 1:                               print I, J, K, L, M, N, O, P

The index parameters I-O are local variables and therefore can't be used directly to display the result. Thus the variables A-H are used to propagate the result. They must be used or they won't show up in the menu. But we're not really interested in the sum of them. It's only for this side-effect that they are used here:
Code:
Q=A+B+C+D+E+F+G+H+

Instead of a for-loop the $$\Sigma$$ function is used. We don't have ABS but we can use SQ (square) instead:
Code:
Σ(M:1:8:1: IF(I<>M AND SQ(I-M)<>16 AND J<>M AND SQ(J-M)<>9 AND K<>M AND SQ(K-M)<>4 AND L<>M AND SQ(L-M)<>1:

Code:
for M in range(1, 9):   if I != M and abs(I - M) != 4 and \      J != M and abs(J - M) != 3 and \      K != M and abs(K - M) != 2 and \      L != M and abs(L - M) != 1:

As we can't display all 92 solutions an error (division by zero) is used to stop the program:
Code:
L(A:I)xL(B:J)xL(C:K)xL(D:L)xL(E:M)xL(F:N)xL(G:O)xL(H:P)/0
And here's where the local variables are copied to the corresponding menu variables using the let-function. Again we're not interested in that product but we have to use a single expression where everything is used.

While the Python program prints all solutions the solver stops with the 1st one. A counter could be used to stop with the n-th solution.

HTH
Thomas

I imagine this was to highlight my point above: Sometimes even after!!

To quote Joe Horn, just looking at the above code makes my eyes bleed.

This stuff is truly amazing Thomas, clearly well beyond what the Solver designers ever imagined, and I would guess well beyond what it was tested for, but it seems solid.

I really enjoy these kinds of creative abuses of tools like the Solver as they really dramatically show how creative, smart folks like yourself can bend tools to their own will, and teach us all new ways to use the tools.

Entering some of these long equations on a 17B or 27S, I don't enjoy so much (e.g. I cannot claim to have entered Gerson's long equation succesfully. 2 hours was my limit, or perhaps it was my eyesight).

Thanks for continuing to shine a light into dark corners, its interesting and entertaining, even if I don't follow all the math involved.

Jebem - You've got some catching up to do with your newest toy

--Bob Prosperi
06-27-2014, 01:15 PM
Post: #48
 jebem Senior Member Posts: 1,343 Joined: Feb 2014
RE: I was bored and found a HP-27S
(06-27-2014 12:43 PM)rprosperi Wrote:  Jebem - You've got some catching up to do with your newest toy

Sure, I got the idea... the way Thomas and others took advantage of the Solver feature and managed to twist it into a kind of a programming environment was the reason why I did chase for a HP-27S... I just had to have it!

Actually I was chasing a HP-42S since long time ago (I got it As-New-in-the-Box just yesterday evening!), and I found the HP-27S by accident by reading the related intriguing publications from Thomas, Don, Bob, Luiz and many others here in the MoHPC archives... Thank you all for that!

But even using the Solver in the formal documented way, it is amazing on how easy and fast is to type in a formula with basic logic conditions to solve common problems, without the need to spend time creating programs (as in the other calculator paradigms of the time), and this was available from HP in the 80's!

Jose Mesquita

06-27-2014, 01:32 PM
Post: #49
 Thomas Radtke Senior Member Posts: 780 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-27-2014 01:15 PM)jebem Wrote:  [...] and this was available from HP in the 80's!
HP was quite inventive before they coined the 'HP invent' claim or whatever that is.
06-27-2014, 02:20 PM
Post: #50
 walter b On Vacation Posts: 1,957 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-27-2014 01:32 PM)Thomas Radtke Wrote:  HP was quite inventive before they coined the 'HP invent' claim or whatever that is.

If (and when) you've got to talk about a particalar item a lot, you don't have enough of it. Old rule of experience. Applies for money, love, inventions, etc. IMHO.

d:-)
06-27-2014, 02:21 PM
Post: #51
 Don Shepherd Senior Member Posts: 749 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-27-2014 01:15 PM)jebem Wrote:
(06-27-2014 12:43 PM)rprosperi Wrote:  Jebem - You've got some catching up to do with your newest toy

Sure, I got the idea... the way Thomas and others took advantage of the Solver feature and managed to twist it into a kind of a programming environment was the reason why I did chase for a HP-27S... I just had to have it!

Actually I was chasing a HP-42S since long time ago (I got it As-New-in-the-Box just yesterday evening!), and I found the HP-27S by accident by reading the related intriguing publications from Thomas, Don, Bob, Luiz and many others here in the MoHPC archives... Thank you all for that!

But even using the Solver in the formal documented way, it is amazing on how easy and fast is to type in a formula with basic logic conditions to solve common problems, without the need to spend time creating programs (as in the other calculator paradigms of the time), and this was available from HP in the 80's!

I read in an old HP Journal somewhere a few years ago that Paul McClellan was the principal designer at HP responsible for the solver in the 17b/27s series. I had always wondered if the designers of the solver had put in a hidden command to write to a sum list. You can read from a sum list via the ITEM command, but you can't write to a sum list from an equation. If you could, it would open up the solver to all kinds of additional applications.

I wrote to Mr. McClellan and he responded. I don't think he would mind if I showed his response here, because I think many of us would find this very interesting.

My letter to him:
Quote:Paul, while reading an old HP Journal, I came across your name as the principal developer of the HP Solve application which is used in the HP-18c, 28s, 17b, 19b, and 27s I believe. I'm a big fan of that app, and my hobby is to see how solve can be used as a programming language in those calculators.

Can you answer a question for me? I've wondered for years now why the L() and G() commands were not included in the respective calculator manuals; instead they were described in the Technical Applications Manual for the 27s/19b. I've theorized that maybe L and G were created for debugging the solver and were left in the production code by accident, and then people found out about them. Can you shed any light on that?

Also, for years I've wished that there was a hidden solver function for writing to a sum list. I figure you'd be the guy to know if there was one.

Thanks Paul.

Paul's response:

Quote:Hi Don,

It has been decades since I helped design and implement HP Calculators, but it was one of my favorite times while working at Hewlett-Packard – we put a lot of craft into those little machines and hopefully they delighted many thousands of our customers.

I must credit Prof. William H. Kahan (former Professor of Mathematics and Computer Science at UC Berkeley) as the author of the HP calculator numerical solver algorithm. I and others implemented and tested the numerical solver function across several calculators. This numerical solver algorithm was also used with argument and function scaling in the financial functions. I have attached two PDFs, both written by Prof. Kahan. One is an HP Journal article describing the HP-34C’s solver function (the first implementation of the algorithm on an HP calculator). The other “Mathematics Written in Sand” gives more background on the numerical solver project.

Charles Patton designed and implemented our symbolic solver, and I recollect he had a lot of input into the user interface for the combined symbolic/numeric solver functionality. Charles likely created the L() and G() functions you refer to – I don’t recollect having much direct experience using them. I have cc’ed Charles using what email address I have at this time.

Can you describe more fully what you mean by a solver function for writing to a sum list?

Thank you for your inquiry. I have recently retired from HP and am pursuing personal interests, including writing computational software, exploring website development technologies, and especially enjoying outdoor recreation in the western US.

Best regards,

Paul McClellan

These guys were brilliant to have built a solver with so many advanced capabilities. My hat is off to them.
06-27-2014, 02:56 PM (This post was last modified: 06-27-2014 02:57 PM by HP67.)
Post: #52
 HP67 Senior Member Posts: 660 Joined: Dec 2013
RE: I was bored and found a HP-27S
Don, I was just asking about this in another thread- vis a vis the 30b and after seeing this discussion and having my mind blown off by Thomas Klemm's mathematical genius- and not for the first time either btw!

You seem to have collected a lot of info on the solve application and history. Would you mind posting a bibliography and/or any links to info on this? I'm trying to find reading material on the subject and I'm sure many people would find it useful.

I do have the Museum DVD so I am putting the HP-27S/19B Technical Applications doc you referenced on my reading list.

Thank you.

It ain't OVER 'till it's 2 PICK
06-27-2014, 03:10 PM (This post was last modified: 06-27-2014 03:22 PM by Don Shepherd.)
Post: #53
 Don Shepherd Senior Member Posts: 749 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-27-2014 02:56 PM)HP67 Wrote:  Don, I was just asking about this in another thread- vis a vis the 30b and after seeing this discussion and having my mind blown off by Thomas Klemm's mathematical genius- and not for the first time either btw!

You seem to have collected a lot of info on the solve application and history. Would you mind posting a bibliography and/or any links to info on this? I'm trying to find reading material on the subject and I'm sure many people would find it useful.

I do have the Museum DVD so I am putting the HP-27S/19B Technical Applications doc you referenced on my reading list.

Thank you.

The Solve function on the vanilla 30b (and many other HP calcs) is not the same as the Solver on the 17b/17bii/19b/19bii/27s/and others. As I think the other thread mentioned, the solve function that started out on the 34c (I believe) requires you to write a little RPN program and then "solve" the program. I know very little about that solver, my interest has always been in the 17b-type solver that includes programming things like loops, decisions, variables, and so on.

I don't really have a bibliography or a list of references, but the HPMuseum forum (and its original forum) have plenty of discussions about the 17b-type solver.
06-27-2014, 03:28 PM
Post: #54
 HP67 Senior Member Posts: 660 Joined: Dec 2013
RE: I was bored and found a HP-27S
Thanks. Looking over the link Massimo posted I realized it's not what I had thought. Similar, but totally different. Sorry for the interruption.

It ain't OVER 'till it's 2 PICK
06-27-2014, 08:50 PM
Post: #55
 jebem Senior Member Posts: 1,343 Joined: Feb 2014
RE: I was bored and found a HP-27S
(06-27-2014 02:21 PM)Don Shepherd Wrote:  I read in an old HP Journal somewhere a few years ago that Paul McClellan was the principal designer at HP responsible for the solver in the 17b/27s series. I had always wondered if the designers of the solver had put in a hidden command to write to a sum list. You can read from a sum list via the ITEM command, but you can't write to a sum list from an equation. If you could, it would open up the solver to all kinds of additional applications.

I wrote to Mr. McClellan and he responded. I don't think he would mind if I showed his response here, because I think many of us would find this very interesting.
(...)
These guys were brilliant to have built a solver with so many advanced capabilities. My hat is off to them.

Thanks for sharing that interesting information, Don.

Jose Mesquita

06-27-2014, 10:18 PM (This post was last modified: 06-27-2014 10:43 PM by jebem.)
Post: #56
 jebem Senior Member Posts: 1,343 Joined: Feb 2014
RE: I was bored and found a HP-27S

Jose Mesquita

06-27-2014, 10:28 PM
Post: #57
 Katie Wasserman Super Moderator Posts: 637 Joined: Dec 2013
RE: I was bored and found a HP-27S
(06-27-2014 10:18 PM)jebem Wrote:  Because I felt the need to do it, I have put together this small listing with links to HP-27S references here in the MoHPC:

Wow! Lot's of interesting stuff, all the way back to 2000.
Thank you for this collection.

-katie

06-27-2014, 10:40 PM
Post: #58
 Dave Frederickson Senior Member Posts: 2,127 Joined: Dec 2013
RE: I was bored and found a HP-27S
Hi Jose,

I was recently offered a 27S in trade, but I declined. Now I'm kind of interested. Do you have a ROM dump for use with the 42S emulator?

Dave
06-27-2014, 10:46 PM
Post: #59
 jebem Senior Member Posts: 1,343 Joined: Feb 2014
RE: I was bored and found a HP-27S
(06-27-2014 10:40 PM)Dave Frederickson Wrote:  Hi Jose,

I was recently offered a 27S in trade, but I declined. Now I'm kind of interested. Do you have a ROM dump for use with the 42S emulator?

Dave

Hi Dave!
I can't find the 27S ROM image anywhere... it was nice to run it in the emulator as well, but from my research in the Net, apparently no one could dump it...

Jose Mesquita