Even faster quadratic formula for the HP41C

06042014, 04:25 AM
(This post was last modified: 06042014 04:52 AM by Gerson W. Barbosa.)
Post: #1




Even faster quadratic formula for the HP41C
This is yet another attempt at finding a shorter (but not necessary faster) quadratic formula program for the HP41C, while preserving the stack register T (Thanks to Jeff Kearns  if it were not because of his interest, I wouldn't have taken a second look at this old thread)
Code: 01 LBL 'Q x₂ is computed using this wellknown property: \[x_{1}+x_{2}=\frac{b}{a}\] Real roots only, but since the stack register T is preserved it will solve the first example for the HP42S program here. I'd rather present it here first, before submitting it to the HP41C Software Library, as any issue I might have overlooked would surely be pointed out soon. Thanks! Gerson. PS.: The title should read ...faster quadratic formula program...  as the formula is essentially the same, but I cannot edit it. 

06042014, 05:32 AM
Post: #2




RE: Even faster quadratic formula program for the HP41C
Code: 00 { 22 BytePrgm } x₂ is computed using this wellknown property: \[x_{1}\cdot x_{2}=\frac{c}{a}\] Cheers Thomas 

06042014, 05:59 AM
(This post was last modified: 06042014 06:25 AM by Gerson W. Barbosa.)
Post: #3




RE: Even faster quadratic formula for the HP41C
(06042014 05:32 AM)Thomas Klemm Wrote: Thomas, I fear there might be trouble when c = 0. Also, the HP41 lacks recall arithmetic. Anyway, records exist to be broken. I won't be surprised if you or someone else comes up with a shorter (or a lower bytecount) HP41 or 42S program. Cheers, Gerson. P.S.: On the HP42S, replace line 10 with 10 + P.P.S.: This won't solve the case when both b and c are zero, however. 

06042014, 07:11 AM
(This post was last modified: 06042014 07:12 AM by Thomas Klemm.)
Post: #4




RE: Even faster quadratic formula program for the HP41C
(06042014 05:59 AM)Gerson W. Barbosa Wrote: I fear there might be trouble with c = 0.I know. But then who is going to use this program to solve \(ax^2+bx=0\)? Quote:Also, the HP41 lacks recall arithmetic.I tend to forget this. Quote:P.S.: On the HP42S, replace line 10 withShould this solve the problem with the division by zero? In case of \(c=0\) this depends on the sign of \(b\). So it doesn't really matter whether we use + or . I prefer to have \(x_1\) in register X. Cheers Thomas 

06042014, 07:33 AM
Post: #5




RE: Even faster quadratic formula for the HP41C
The same program for a 34S is very very tiny
 Pauli 

06042014, 08:52 AM
Post: #6




RE: Even faster quadratic formula for the HP41C  
06042014, 10:14 AM
Post: #7




RE: Even faster quadratic formula for the HP41C  
06042014, 10:22 AM
Post: #8




RE: Even faster quadratic formula for the HP41C  
06042014, 01:07 PM
Post: #9




RE: Even faster quadratic formula for the HP41C
(06042014 07:11 AM)Thomas Klemm Wrote:(06042014 05:59 AM)Gerson W. Barbosa Wrote: Also, the HP41 lacks recall arithmetic.I tend to forget this. I relearn this every time I come back to using my 41. Which I suppose means I never really learn it all... Very nice Gerson. Short AND sweet. Bob Prosperi 

06082014, 02:55 AM
Post: #10




RE: Even faster quadratic formula for the HP41C
(06042014 07:33 AM)Paul Dale Wrote: The same program for a 34S is very very tiny It won't solve this one, however, unlike the HP42S programs (mine and Thomas's). But what would CSLVQ (SSIZE8 mode only) be useful for anyway? Gerson. 

06082014, 03:00 AM
Post: #11




RE: Even faster quadratic formula for the HP41C
(06042014 08:52 AM)walter b Wrote:(06042014 07:33 AM)Paul Dale Wrote: The same program for a 34S is very very tiny In another post, about two years ago, I said "nothing beats SLVQ on the WP 34S, however". Definite a killjoy, but very useful :) (I remember having used SLVQ in a program once). Gerson. 

06082014, 03:41 AM
(This post was last modified: 06082014 03:41 AM by Gerson W. Barbosa.)
Post: #12




RE: Even faster quadratic formula for the HP41C
(06042014 01:07 PM)rprosperi Wrote: Very nice Gerson. Short AND sweet. Thanks, Bob! For the sake of documentation I should have mentioned that I have used the quadratic formula in this form, valid when a = 1: \[x_{1}= \frac{b}{2}+\sqrt{\left ( \frac{b}{2} \right )^{2}+c}\] Please see Allen's post in this thread from 2007. Regards, Gerson. 

06082014, 09:26 AM
(This post was last modified: 06082014 09:38 AM by Ángel Martin.)
Post: #13




RE: Even faster quadratic formula for the HP41C
(06082014 02:55 AM)Gerson W. Barbosa Wrote: It won't solve this one, however, unlike the HP42S programs (mine and Thomas's). But what would CSLVQ (SSIZE8 mode only) be useful for anyway? ZQRT in the 41Z module does too ;) 

06082014, 06:25 PM
Post: #14




RE: Even faster quadratic formula for the HP41C
(06082014 09:26 AM)Ángel Martin Wrote:(06082014 02:55 AM)Gerson W. Barbosa Wrote: It won't solve this one, however, unlike the HP42S programs (mine and Thomas's). But what would CSLVQ (SSIZE8 mode only) be useful for anyway? ...with no native complex number support, you might have said! Sorry for my ignorance! Gerson. 

06092014, 02:24 PM
(This post was last modified: 06092014 02:25 PM by Ángel Martin.)
Post: #15




RE: Even faster quadratic formula for the HP41C
Yes, quadratic and cubic equations with complex coefficients and obviously results. Interestingly, I took the opportunity to review the code in the 41Z  finding a typo (a.k.a. bug) on the Spherical Hankel functions (not in the Bessel functions, those were ok). It appears that, like rust, bugs never sleep!


« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)