The Museum of HP Calculators

HP Forum Archive 17

[ Return to Index | Top of Index ]

17b2+ solver and the GCD/LCM formula (Don?)
Message #1 Posted by Gene Wright on 9 Aug 2007, 12:25 p.m.

Back in February, Don posted the reply below about the GCD/LCM formula from the 27s/19b Technical applications book not working on the 17b2+ model.

Did anyone ever figure out why that did not work? I know there had been an issue with the sum of digits formula which was worked out, but did anyone figure this one out?

The GCD portion seems to work, but the LCM portion diverges.

Gene

=====================================

unsuccessful with lcm/gcd and factor program Message #9 Posted by Don Shepherd on 20 Feb 2007, 12:57 a.m., in response to message #5 by Bruce Bergman

Bruce, I entered the two solver equations from the 27s/19b applications book for finding lcm/gcd and prime factors, and neither would work on the 17bii+. I double-checked to make sure I entered them correctly, but they do not give correct results. So I'm thinking maybe there are some differences in capability between the solver in the 27s/19b and 17bii+. Don't know, but disappointing.

      
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #2 Posted by Bruce Bergman on 9 Aug 2007, 2:20 p.m.,
in response to message #1 by Gene Wright

Don can pipe in here, but I think he didn't get it working either. Both of us spent a fair amount of time scratching our heads on why they didn't work. From what I understand, they work perfectly on the 17bii (not the + model), but for whatever reason, they don't fly on the + model.

Don and I have had several conversations about this. There appears to be either some flaws or design choice differences in the 17bii+ solver application. It doesn't behave exactly like the 17bii. You can tweak some of the programs and it does fine, but it does need tweaking. I don't know that I'd call it a bug, per se, but it behaves differently.

Don has examples of the SOD program for both models. He can probably explain more. Also, check article 712 for some additional data.

thanks, bruce

      
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #3 Posted by Peter A. Gebhardt on 9 Aug 2007, 3:03 p.m.,
in response to message #1 by Gene Wright

Besides the differences of the 17bII+ to the earlier models in handling G(et) and L(et), some other potential reasons could apply:

1. Ambiquity in "Evaluation Order" (see top of p.22 in 27s/19b TM)

2. Differences in 17bII+ ROMs

I'll try it out on serial #CNA42903649 and report later.

Best regards

Peter A. Gebhardt

(9:23pm GMT+1): Tried it - failed with LCM too. I keyed in the equation as in manual. GCD started iterating. Then I solved a "dummy" equation: a*b*a1*b1*z=0 first. GCD calculated correctly. LCM still failed "iterating". Got rid of "=if(..." by replacing "=" with "-" to put all G & L terms on one side of the equation. Tried again as described above - same "no go" result for LCM!

Edited: 9 Aug 2007, 3:24 p.m.

      
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #4 Posted by Don Shepherd on 9 Aug 2007, 3:43 p.m.,
in response to message #1 by Gene Wright

Gene, Bruce is right. I could never get the lcm/gcd program or the prime factor program (both from the 27s/19b Technical Apps Manual) to work on the +. There was some discussion by several folks about how the solver on the + does not really work like the solver on the original bii, and that is true. The recommendation was that if you want it to work like it really should, get a bii, which I did. And both equations work fine on the bii.

As to why they don't work on the +, I often wondered about that, but I never discovered the answer, at least explained to my satisfaction. I remember writing a little routine on the + and it would not give the obvious answer, but I can't remember exactly what that was (I guess I don't save things that DON'T work!).

I will say that the bii solver works as a programmer would expect it to. It is also faster than the + at solver equations containing the sigma function.

            
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #5 Posted by Peter A. Gebhardt on 9 Aug 2007, 3:56 p.m.,
in response to message #4 by Don Shepherd

Sigh ...

So we can only "pray" that the "new & improved" HP17bII plus does come with a functioning solver in place (I would like to see the full-fledged 19BII solver in "sheep's clothes" ... - "I have a dream" ... )

Best regards

Peter A. Gebhardt

                  
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #6 Posted by Thomas Okken on 9 Aug 2007, 4:32 p.m.,
in response to message #5 by Peter A. Gebhardt

What's the difference between the 17BII solver and the one in the 19BII? I thought they were identical (or so Craig Finseth's site claims).

Thanks!

- Thomas

                        
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #7 Posted by Peter A. Gebhardt on 9 Aug 2007, 4:59 p.m.,
in response to message #6 by Thomas Okken

Thomas,

The differences are the "missing" functions like RAND, TRIGs etc., the TVM(.) functions (with 5 variables like the ones in EXCEL) and Rectangle/Polar conversion. The interface of the Solver to the PLOT routines in the 19bII, is not applicable to the 17bII+ "plus", because of different screen/LCD characteristics.

Otherwise - you are right here - there are no differences to the SOLVER logic according to Finseth.

Sorry, that I was somewhat unspecific in my comment. Hope I covered it all, because I draw my knowledge mainly from the 27s/19b & 200LX manuals and from Coffin's "An Easy Course in Using the HP 19BII".

Best regards

Peter A. Gebhardt

                              
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #8 Posted by Thomas Okken on 9 Aug 2007, 8:17 p.m.,
in response to message #7 by Peter A. Gebhardt

Hi Peter,

Thanks for clearing that up! I was worried with the 17BII I would be missing something. :-)
But trig functions on a business calculator? That's neat. I wonder, is that a nod to the geeks in finance, or are there actual financial applications for those functions?

- Thomas

                                    
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #9 Posted by Peter A. Gebhardt on 10 Aug 2007, 3:10 a.m.,
in response to message #8 by Thomas Okken

Thomas,

Yes there could be financial applications, like using them for "on the fly" calculation of the "weights" for a Gaussian Quadrature in numerical integration and other stochastical applications.

http://www.voidware.com/gaussint.htm

Best regards

Peter A. Gebhardt

Edited: 10 Aug 2007, 3:13 a.m.

                  
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #10 Posted by Don Shepherd on 9 Aug 2007, 4:32 p.m.,
in response to message #5 by Peter A. Gebhardt

OK, this simple solver formula demonstrates the erroneous behavior of the solver on the hp-17bii+:

A=0xsigma(I:1:10:1:L(S:S+I))

Enter the formula into the solver, press CALC, do a Clear Data (to insure S is 0), press A softkey, it will (correctly) say that A=0, then press RCL S, it will show S=110. The correct answer is (or should be) S=55, which is what you get if you run it on the 17bii.

As to how S gets to be twice what it should be, I don't know!

                        
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #11 Posted by Bruce Bergman on 9 Aug 2007, 6:43 p.m.,
in response to message #10 by Don Shepherd

Don and I had some discussions about why this was happening. I don't know enough about the internals of the 17bii+, but I first noticed the unusual behavior doing the Sum Of Digits program. If you just changed around the variables, used another L() and G(), it seemed to work.

I suspect there is some difference in how variables are represented (or accessed) in the bii versus the bii+ models. I don't know if the 17bii behaves the same as the 19bii in this regard. It would be interesting to get the following calcs lined up and run the same programs on each:

19b 19bii 17b 17bii 17bii+ (and the new silver 17bii++?)

If we could somehow document the differences in how the solver functions on each machine, at least we could hand that out as a cheatsheet for those trying for portability amongst that family. I know it would have saved me a big headache a year or so ago...

thanks, bruce

      
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #12 Posted by Vincze on 9 Aug 2007, 7:44 p.m.,
in response to message #1 by Gene Wright

Gene, can you post original formula. I would like to see what it is to analyze what might be problem. I have been unable to find it in the archives.

            
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #13 Posted by Don Shepherd on 9 Aug 2007, 8:14 p.m.,
in response to message #12 by Vincze

Vincze, this is the formula that works on the hp-17bii, but not on the hp-17bii+. It calculates the sum of the digits of input n:

sod=sigma(i:0:log(n):1:mod(n:10)+0*L(n:idiv(n:10)))

                  
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #14 Posted by Vincze on 10 Aug 2007, 7:59 a.m.,
in response to message #13 by Don Shepherd

Thank you. I guess if I understood english better I would know what GCD/LCM mean. Can someone please explain.

Can you explain also the different parts of the formula. Also, what are the colons for?

                        
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #15 Posted by Don Shepherd on 10 Aug 2007, 8:05 a.m.,
in response to message #14 by Vincze

Vincze, GCD is greatest common divisor, and LCM is least common multiple. The GCD of two numbers is the largest number that divides into the numbers evenly, and the LCM is the smallest number that is a multiple of both numbers.

You need to look at the HP-17bii+ manual, which is on the museum DVD and probably HP's site, to understand the formula.

                              
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #16 Posted by Vincze on 10 Aug 2007, 9:33 a.m.,
in response to message #15 by Don Shepherd

Thank you... okay, I understand what greatest common divisor and least common multiple are. I was just not aware of the abbreviations.

                              
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #17 Posted by Vincze on 10 Aug 2007, 3:48 p.m.,
in response to message #15 by Don Shepherd

So I don't understand one thing. How does SOD tell me GCD or LCM, or is this part of another program that do that?

BTW, I ask friend if I can buy 17BII that he let me borrow. He tell me to go do something to myself that I don't think is possible. ;-)

Edited: 10 Aug 2007, 3:50 p.m.

                                    
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #18 Posted by Don Shepherd on 10 Aug 2007, 4:00 p.m.,
in response to message #17 by Vincze

The SOD (sum of digits) program has nothing to do with GCD or LCM. GCD/LCM is another solver program, available on the museum DVD in the HP 27S/19B Technical Applications manual.

                                          
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #19 Posted by Vincze on 10 Aug 2007, 5:08 p.m.,
in response to message #18 by Don Shepherd

Okay... I thought I was going stupid or something.

                        
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #20 Posted by Peter A. Gebhardt on 10 Aug 2007, 8:11 a.m.,
in response to message #14 by Vincze

Vincze,

GCD == Greatest Common Denominator (Größtes gemeinsames Vielfaches)

LCD == Least Common Denominator (Kleinstes gemeinsames Vielfaches)

The colons (:) are delimiters to separate the parameters of the function call properly - like in f(a,b, ...,z).

Best regards,

Peter A. Gebhardt

PS: Excuse me for offering a German translation as well, but I suppose German could have been part of your education, because of the historical relations between Hungary and Austria.

                              
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #21 Posted by Vincze on 10 Aug 2007, 9:45 a.m.,
in response to message #20 by Peter A. Gebhardt

Guten Morgen Peter und danke. Es ist mir bekannt welche Deutsch, aber nicht jene menge noch mehr. {I hope I said that correctly;) I guess I remember more than thought I did. }

I have not used it for very long. An older man in village where I grew up spoke it, and I learned from him and others. Believe it or not, many people now speak English, at least in larger cities like Budapest. Main language is still Hungarian, but most people know enough English.

                  
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #22 Posted by Vincze on 10 Aug 2007, 12:02 p.m.,
in response to message #13 by Don Shepherd

When I try on 28C, it says invalid equation. Friend have 17BII and I try there and same issue.

You have equation as:

sod=sigma(i:0:log(n):1:mod(n:10)+0*L(n:idiv(n:10)))

Does it need to be sod=sigma(i:0:log(n):1:mod(n:10)+0*L*(n:idiv(n:10)))

Actually, after it says error, it goes right after sigma and flash on the left (

Edited: 10 Aug 2007, 12:15 p.m.

                        
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #23 Posted by Peter A. Gebhardt on 10 Aug 2007, 12:21 p.m.,
in response to message #22 by Vincze

Vincze,

According to Graig Finseth, the 28c DOES NOT have L() & G() commands available in it's solver - only the 27s, 19b, 17b, (the palmtops) 95,100,200LX.

Sorry for you :-((

Quote:
For the 28c:

RPL28:

Similar to algebraic, except that different keystrokes are used:

<value> stores the value in the variable <value> '<name>' STO stores the value in the variable Shift-<name> solves for the variable '<name>' RCL recalls a value from the variable '<name>' EVAL recalls a value from the variable and evaluates it


For the "Business Line":

Quote:
Algebraic:

This solver is similar to TVM5, except that it has been generalized to handle any equation.

<name> stores the value in the variable STO <name> stores the value in the variable <name> (2nd in a row), solves for the variable RCL <name> recalls a value from the variable

The solvers on the 17BII, 19B, 19BII, and -27S also have L(et) and G(et) functions.

The solvers on the -17B, 17BII, -18C, 19B, and 19BII do algebraic simplification: this feature was removed from the -27S in order to save space.

The solver on the 17BII / 19B / 19BII is the best one of the set.


http://www.finseth.com/hpdata/solvers.html

Why it doesn't work on the 17bII is not clear to me. I tried your first equation on an 200LX (my reference, because I don't posess any other "reference" besides a 17bII+) and it works fine. The 200LX solver is being regarded as a perfect clone of the 19bII solver.

Best regards

Peter A. Gebhardt

Edited: 10 Aug 2007, 12:57 p.m. after one or more responses were posted

                              
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #24 Posted by Vincze on 10 Aug 2007, 12:31 p.m.,
in response to message #23 by Peter A. Gebhardt

On 17BII, it look like Error right after Sigma. Do I just spell Sigma out, or is the symbol someplace that I need to enter? I apologize for being such stupid Hungarian.

Edited: 10 Aug 2007, 12:33 p.m.

                                    
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #25 Posted by Peter a. Gebhardt on 10 Aug 2007, 12:40 p.m.,
in response to message #24 by Vincze

Vincze,

Never ever regard yourself as stupid when asking questions - there are no stupid questions - only stupid answers!

Your suspicions are right: Very often we post Solver programming examples (for the business line) using "sigma" instead of the greek symbol for sigma.

So pls. press the right-most soft-menu button (alpha) 4 times (when in EDIT mode on the 17bII) and you wil see the required symbol.

Best regards

Peter A. Gebhardt

                                          
Re: 17b2+ solver and the GCD/LCM formula (Don?)
Message #26 Posted by Vincze on 10 Aug 2007, 12:50 p.m.,
in response to message #25 by Peter a. Gebhardt

Thank you so much my friend! It now work.

Again, I sorry for dumbing down group. I know you say I no stupid, but I wish I was smart like rest of you. I am more programmer, and not as fancy with math and physics. My Papa was big shot physics person. Back in 1970's men come for him to have him help them with something very secret. Papa would not help them and they bound him up, and my mother up and laid them on train tracks. They kept asking for his help, and he say NEM! to them. So they kill Papa and my mother by driving train very slowly over them. He was very smart man, but I swore that I would not go into physics because of what happen to him. Computer science seem more safe that physics and nuclear things.

Thank you again for putting up with me. I consider you all very good friends.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall