Couple of new HP-17bii solver programs in Articles - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Couple of new HP-17bii solver programs in Articles (/thread-209512.html) |
Couple of new HP-17bii solver programs in Articles - Don Shepherd - 01-19-2012 Link to a couple of new 17bii solver programs.
Re: Couple of new HP-17bii solver programs in Articles - y.miyata - 01-20-2012 Thank you very much for the nice solver programs. Both works quite nicely as you have described. The "LOG(0)" technique should be a good trick to stop the solver when required. In addition, they clearly show how magically a sigle line solver program does a complex calculation. In fact, now my main calculator is a HP-17BII. I have been using my favorite HP-42S for long for my daily work in biological scientific research field, where frequent calculations with many programs are necessary. However, because the 42S price became quite high, I'm afraid I might be unable to buy another 42S if I happen to break it. So, I tried to translate these 42S programs into 17BII solver forms. Surprisingly, almost all of programs I have written for 42S can be expressed as 17BII solver lines with similar user interfaces. Sometimes it resulted in a very tricky line, but in most cases my 42S program can be expressed as a short and smart equation. In addition, 17BII has a real time clock capability and financial functions which are also quite useful. I bought a couple of 17BII at low prices for backups, and keep the 42S for other purposes such as programming fun and really complicated calculations.
I'm sure that 17BII is a very powerful and "programmable" calculator.
Re: Couple of new HP-17bii solver programs in Articles - Don Shepherd - 01-20-2012 You're welcome, I enjoyed writing them. I changed the Hi-Lo program because it really didn't need to end a loop early. LOG(0) (or any illegal instruction, like divide by 0) is handy for exiting a loop early after storing a value of interest in a menu variable, and then RCL'ing the variable, but there are situations in which it won't work, especially if you need to do a lot of further processing after exiting the loop. But it is an interesting approach. I think most members of the forum aren't especially interested in the 17bii because (a) it's a financial calculator, and (b) it lacks trig functions. But I enjoy the challenge of seeing if the 17b and 17bii can be programmed to solve particular problems, and I'm constantly amazed at what a "non-programmable" calculator can do.
Re: Couple of new HP-17bii solver programs in Articles - Allen - 01-21-2012 Neat Programs, Don! I love the 17bii, and use it as often as I use all my other 42s/32sii/50g/48gx machines combined. It's a very capable and stylish machine!
Re: Couple of new HP-17bii solver programs in Articles - Don Shepherd - 01-21-2012 Thanks Allen. I agree, the 17b and 17bii are simply very handsome calculators. I really like the single shift key and an uncluttered key layout. You can print your equations via the infrared printer. The date arithmetic is nice. The solver with its programming-enabling commands is second to none. I wish I could congratulate the HP engineer who invented this solver and thank him or her for IF and . One subject I don't think I've seen discussed in the forum before is the use of HP programmable calculators to create programs that offer simple challenges that require you to engage your mind, like the Hi-Lo game. I know I've read that stimulating your brain is effective in preventing Alzheimer's disease, and as we all get older that becomes something that I think is important. A collection of programs (that can be implemented on HP programmable calculators) that provide brain stimulation would be a good thing.
As for me, I don't plan to run out of 17b's! Edited: 21 Jan 2012, 4:26 p.m.
Re: Couple of new HP-17bii solver programs in Articles - y.miyata - 01-22-2012 > I changed the Hi-Lo program because it really didn't need to end a loop early. I have also enjoyed the upgraded program. When I modify solver lines, I often need to store several "versions" of solver lines in the memory and I wish if I could save the older line and copy it to a new line to modify it (I mean it is often painful to re-enter a whole long line again). Do you think it is possible on 17BII? In case I need a serious debugging, I prefer to do so on the solver in 200LX where I can copy and paste the line. > (b) it lacks trig functions. Yes, this might be a major drawback of 17BII, although I rarely need the trig functions. Previously, I had been using 19BII, and it has trig functions. In addition, the separate alpha-keys are convenient to enter equations. However, 19BII is too large and heavy for my lab-coat pocket, and it was painful (and dangerous) to change the batteries of 19BII. I have 27S and this is also a very nice calculator with the same Pioneer form and the handsome solver with a lot of mathematical and financial functions. The problem is that it does't accept RPN input. Probably, "27SII" with an RPN option might be my ideal calculator.
Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-22-2012 Quote:
Equations for them can be written, however. Here is a compact one for sine: SIN=L(Y:SIGMA(N:0:5:1:(-1)^N*(X*PI/540)^(2*N+1)/FACT(2*N+1)))
Another one, longer but faster: SIN=L(Y:X*(5.81776417331E-3+L(X2:SQ(X))*(-3.2818376137E-8+G(
Others available here.
Re: Couple of new HP-17bii solver programs in Articles - Don Shepherd - 01-22-2012 Quote: Unfortunately, no. It would be nice if there was cut and paste available when editing solver equations, but I don't think even the 19bii can do that either. I played with the 19bii solver a few months ago and discovered something I really did not like: if you have an error in your solver equation somewhere, you can't save it until you fix the error, unlike the 17bii solver which does save it, even with the error. That's a huge problem when you get into longer equations, and for that reason I would not want to work on the 19bii, even with its convenient alpha keyboard.
It is ironic that L() and G() were not documented in the 17b or 17bii manuals, but the actual solvers on those machines had them and they worked fine. By the time HP got around to documenting L() and G() in the 17bii+ manuals, Kinpo changed the solver so it didn't work (correctly) like it did previously in the 17b and 17bii.
Re: Couple of new HP-17bii solver programs in Articles - y.miyata - 01-23-2012 Quote: Yes, in fact I remember that previously I have examined all of the equation listed in your link (quite impressive, I would like to take this opportunity to thank you for your very nice article), and I stored equation series No.2 in my HP17BII, which is useful to perform simple trig functions. But in most of the cases where I need trig functions, I would like to use them in more complicated solver equations such as COS(x)*(SIN(X))^2/(x*SIN(X+PI))=0.5.
In such cases, even with your trig equations, 17BII seems to be not that much convenient...
Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-23-2012 Thanks! I started converting them from the HP-12C Platinum program during a dull day at the beach. The longer equations were edited and tested first on the HP-200LX, which made the task easier. I personally prefer the first set, but I guess most will prefer the second one for its compactness.
Quote: Yes, you're right! After posting I realized you would need them for something like that. It's a pity the HP-17BII lacks trigs. It would be a great option in this form factor. Perhaps there would be space in ROM for these functions if an international option were not offered.
Gerson.
Re: Couple of new HP-17bii solver programs in Articles - Thomas Klemm - 01-23-2012
Quote: In this case even trigonometric functions wouldn't be of a help as the solutions turn out to be complex numbers: x ~ +/-2.17519+/-0.743742 i
Kind regards Re: Couple of new HP-17bii solver programs in Articles - y.miyata - 01-24-2012 Quote: I'm sorry, I made a mistake in writing the equation. The right one is
Thanks!
Re: Couple of new HP-17bii solver programs in Articles - Thomas Klemm - 01-24-2012 I simply copied the equation
x = 0.554572 From the result I used the alternate form to get: 1-cos(2x) = x. Now you could use the HP-17bii with the Taylor-series of this expression to solve the equation:
x = 2x^{2} - 2x^{4}/3 + 4x^{6}/45 - 2x^{8}/315
I didn't do that but according to WolframAlpha you should get: x = 0.554573 This might already be close enough to your needs. Otherwise add more terms of the Taylor expansion.
Cheers Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-25-2012 The equation has actually three real roots. It can be rewritten as (sin(x))^2 - 0.5*x = 0, since sin(x+pi/2) = cos(x). When submitting it to WolframAlpha we get x = 0The HP-42S solver gives X=0The initial estimates, 0.1, 0.5 and 2, respectively, have to be changed outside the solver, otherwise the solver may get stuck to the first root it finds.
The HP-200LX solver will always return X=0, no matter the initial estimates, for SQ(L(Y:SIGMA(N:0:5:1:(-1)^N*(X*PI/540)^(2*N+1)/FACT(2*N+1))) Cheers,
Gerson.
Re: Couple of new HP-17bii solver programs in Articles - Thomas Klemm - 01-25-2012 But the value x = 0 is not a solution of the initial equation. Instead it's added because we multiplied both sides of the equation with x. If that turns out to be a problem for the solver we can easily divide the Taylor series again by x and get the following instead:
1 = 2x - 2x^{3}/3 + 4x^{5}/45 - 2x^{7}/315 Just from looking at the graph I would not expect the solver to have problems to find these two solutions:
Best regards Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-25-2012 Quote: You're right! That's been quite a mistake of mine. What puzzles me now is the behavior of the HP-42S solver above. I don't remember another example that requires leaving the solver to change estimates. Regards,
Gerson.
Re: Couple of new HP-17bii solver programs in Articles - Thomas Klemm - 01-25-2012 Quote: I'm afraid I don't understand your problem. What exactly are you doing here?
Cheers Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-25-2012 Just follow these keystrokes considering, the program "EQ" above is in memory and the variable "X" contains 0: keystrokes display Strange, isn't it? Cheers, Gerson.
Edited: 25 Jan 2012, 7:03 p.m.
Re: Couple of new HP-17bii solver programs in Articles - Thomas Klemm - 01-26-2012 My understanding is that since you entered only one guess the previous solution is used as the other one. Thus it is stuck at x = 0. Instead of leaving the SOLVER environment you can simply enter two guesses:
[Shift] [SOLVER] [EQ] It might be that the solver just uses one of the initial guesses if the result is exactly 0, because there's no possible way to improve that result. Does this makes sense to you?
Regards Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-26-2012 Quote: Yes, it does. Thanks! That's exactly the procedure described in the manual. I had already tried [1] ENTER [2] [X] but it would not work. The procedure for the HP-200LX is slightly different and also not so intuitive: "to enter two guesses, key in the first guess and press the function key once, and then key in the second guess and press the function key twice." I haven't succeeded on the HP-200LX, however.
Gerson.
Re: Couple of new HP-17bii solver programs in Articles - y.miyata - 01-26-2012 Quote: Yes, you are right, the original equation I had was in fact (sin(x))^2/x=0.5, and I added cos(x) in the numerator (top) and sin(x+pi/2) in the denominator (bottom) [it added nothing mathematically] to emphasize the trig difficulty in 17BII. Next subjects you may be interested in will be: 1. Calculate the x value where (sin(x))^2/x reaches maximum. Looking at the graph Thomas kindly illustrated, you may agree that it should be somewhere between x=1 and x=2. 2. Calculate the integration [x=0 to x=pi] of (sin(x))^2/x. I have done these with HP-42S and HP-15LE (fast!). It was a good exercise to remember how to use these calculators (and also to prevent from Alzheimer's disease...). Cheers.
Re: Couple of new HP-17bii solver programs in Articles - y.miyata - 01-26-2012 Quote: On HP-15C, I have got the answer with this way by [1] [ENTER] [2] [f] [SOLVE] [label].
Quote: I believe it is almost the same in HP-200LX as in HP-42S. Store the equation: sin(x)*sin(x)/x-0.5 [calc] 1 [x] 2 [x] [x] x= 1.849076836438508 0.1 [x] 1 [x] [x] x=0.554572090829809 Often I prefer to get the answer after plotting the funcion. [Plot] [Auto] (or [Draw]), move the cursor near the point where the graph crosses the Y=0, then [Solve]
You see the answer in the upper left corner of the screen.
Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-27-2012 Quote: Duh! On plotting it I saw where I was going wrong. It turns out my equations assume X is in degrees, not radians! After editing, it works:
SQ(L(Y:SIGMA(N:0:6:1:(-1)^N*(X/3)^(2*N+1)/FACT(2*N+1))) Great advice! Thanks! Gerson.
Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-27-2012 Quote: Out of laziness, I've done these on my HP 50g :-)
1. 'SQ(SIN(X))/X' DERVX --> '(2*COS(X)*X-SIN(X))*SIN(X)/X^2'
Quote: I've heard studying a foreign language is good for this purpose too. I hope this applies also to languages I started to learn when I was young (and never finished, like German and Russian-- never went beyond lesson 3). Perhaps a good reason to start over :-) Cheers,
Gerson.
Re: Couple of new HP-17bii solver programs in Articles - Marcus von Cube, Germany - 01-27-2012 Gerson, mache weiter! :-)
Re: Couple of new HP-17bii solver programs in Articles - Gerson W. Barbosa - 01-27-2012 Hallo Marcus, Living in Curitiba, I am surrounded by German descendants (the string "german" appears at least 15 times in the wikipedia article on the city). My daughter studies in a Lutheran high-school and has been studying German for two years (but only two hours a week, which is less than adequate). As of me, there are no excuses :-) Regards,
Gerson.
OT. Curitiba - Marcus von Cube, Germany - 01-27-2012 Impressive!
Time to see Brazil... :-)
Re: OT. Curitiba - Gerson W. Barbosa - 01-27-2012 |