ln and e^x on the 16C?

03222016, 05:44 PM
Post: #1




ln and e^x on the 16C?
I got a DM16L (to go with my 41L) to keep handy for integer math. It can do some floating point operations, but to say it's limited is an understatement; floating point mode has barely more functionality than a fourfunction with square roots and scientific notation.
If I could add some programs to calculate ln(x) or e^x, then I could at least get powers and roots in place for those occasions when it's needed. Before I go reinventing the wheel (with a clumsy Taylor series or something), has anybody already tackled this problem on the 16? 

03222016, 10:07 PM
Post: #2




RE: ln and e^x on the 16C?
(03222016 05:44 PM)Dave Britten Wrote: ... to say it's limited is an understatement; floating point mode has barely more functionality than a fourfunction with square roots and scientific notation. ..and yet HP managed to fill each and every key position with useful functions. I guess it would have had to acquire a third shift key in order to accommodate more floatingpoint stuff. Perhaps the WP34S is the calculator of choice in this case, since it contains all the 16C functionality within its firmware. In case it is of interest, a presentation was made at the HHC2011 conference in San Diego, mapping out all the 16C functions to the 34S. Info on that is available here and here. Jake 

03222016, 11:51 PM
Post: #3




RE: ln and e^x on the 16C?
(03222016 10:07 PM)Jake Schwartz Wrote: ..and yet HP managed to fill each and every key position with useful functions. I guess it would have had to acquire a third shift key in order to accommodate more floatingpoint stuff. Perhaps the WP34S is the calculator of choice in this case, since it contains all the 16C functionality within its firmware. I probably would use my 34S for that if the 30b keyboard weren't so unreliable. Mine has at least 2 keys that often don't respond without some extra force. It's a shame that such good software is held back by the mechanics of the package. And yes, HP definitely crammed a ton of functionality onto the 16C keyboard, and that's the functionality I mainly wanted the 16L for. It just would be nice to have a little bit more generalpurpose scientific functionality. Just some basic powers and logs, and maybe integer/fractional part functions. 

03232016, 12:25 AM
Post: #4




RE: ln and e^x on the 16C?
Hi Dave,
Here's a crude algo I developed for 4 bangers with memory. It might be a start. Natural log ln(v) 0.6 to 1.65, 6 digits, 39 keystrokes y = (v  1)/(v + 1) = ((v + 1)  2)/(v + 1) ln(v) = ((((5y^2/7)  1)^(1) X 42  8)y^2 / 75  2)y for v < 0.6 multiply by e n times until in range; subtract n at end for v > 1.65 divide by e n times until in range; add n at end Exponential e^v 1 to +1, 7 digits, 36 keystrokes e^v = ((((v^2 + 42)/98)^(1) X v + v  20)v/40 + 1)^(1) X v + 1 

03232016, 01:38 AM
Post: #5




RE: ln and e^x on the 16C?
(03232016 12:25 AM)Bob Patton Wrote: Here's a crude algo I developed for 4 bangers with memory. It might be a start. Since √x is available on the HP16C, the following might be an option, for this level of precision: Code:
0.600 GSB A > 0.510825830 1.125 GSB A > 0.117783552 1.650 GSB A > 0.500775424 

03262016, 06:31 AM
(This post was last modified: 03262016 06:37 AM by Tugdual.)
Post: #6




RE: ln and e^x on the 16C?
I was checking CORDIC but if the exponential is indeed there the log is missing.
Surprising, wonder how'it was done in early calculators. 

03262016, 08:41 AM
Post: #7




RE: ln and e^x on the 16C?
(03262016 06:31 AM)Tugdual Wrote: I was checking CORDIC but if the exponential is indeed there the log is missing. You'll find some detailed descriptions of the CORDIC algorithm used on hp 35 and the Briggs method to calculate logarithms at Jacques Laporte's site. 

03262016, 11:52 AM
Post: #8




RE: ln and e^x on the 16C?
(03262016 06:31 AM)Tugdual Wrote: I was checking CORDIC but if the exponential is indeed there the log is missing. I was thinking the Sinclair Scientific would be an excellent candidate, but the algorithm used there appears to require a means of separating the mantissa and exponent. 

03272016, 04:31 PM
Post: #9




RE: ln and e^x on the 16C?
(03262016 11:52 AM)Dave Britten Wrote:Interesting reading.(03262016 06:31 AM)Tugdual Wrote: I was checking CORDIC but if the exponential is indeed there the log is missing. However 10^x = 10*.99^(229.15*(1x)) appears to be wrong. I think it is a typo cuz the "magic" constant is 1/log(.99) that is 229.105 

01282018, 08:52 PM
(This post was last modified: 01282018 08:54 PM by Gerson W. Barbosa.)
Post: #10




RE: ln and e^x on the 16C?
(03222016 05:44 PM)Dave Britten Wrote: If I could add some programs to calculate ln(x) or e^x, then I could at least get powers and roots in place for those occasions when it's needed. Before I go reinventing the wheel (with a clumsy Taylor series or something), has anybody already tackled this problem on the 16? If you haven’t come up with anything better and you’re still interested, you might want to try this, if reduced accuracy isn’t a problem: 01 LBL A ; ln(x) 02 1 03 EEX 04 CHS 05 3 06 CF 1 07 1 08 + 09 STO I 10 CLx 11 LASTx 12 x<>y 13 x<=y 14 GSB 2 15 LBL 0 16 √x 17 RCL I 18 x>y 19 GTO 1 20 Rv 21 x<>y 22 ENTER 23 + 24 x<>y 25 GTO 0 26 LBL 1 27 Rv 28 ENTER 29 + 30 1 31  32 √x 33 x<>y 34 ENTER 35 + 36 * 37 LASTx 38  39 F? 1 40 CHS 41 RTN 42 LBL 2 43 SF 1 44 1/x 45 RTN 46 LBL B ; e^x 47 1 48 3 49 STO I 50 Rv 51 8 52 1 53 9 54 2 55 + 56 LASTx 57 / 58 ENTER 59 * 60 1 61 + 62 2 63 / 64 LBL 4 65 ENTER 66 * 67 DSZ 68 GTO 4 69 RTN Examples: 2 GSB A > 0.693148000 GSB B > 2.000013165 12345 GSB A > 9.42101000 GSB B > 12345.12104 6.789 EEX 79 GSB A > 183.8196 GSB B > 6.687315E79 0.12345 GSB A > 2.091921000 GSB B > 0.123449622 230 GSB B > 7.496895E99 GSB A > 229.9703000 1 GSB A > 0.000000000 GSB B > 1.000000000 GSB B > 2.718292170 GSB B > 15.15444181 GSB A > 2.718294000 GSB A > 1.000005000 GSB A > 0.000005000 0.693147181 CHS GSB B > 0.50000016 0 GSB A > Error 0 2 CHS GSB A > Error 0 

01292018, 04:00 AM
Post: #11




RE: ln and e^x on the 16C?
(03222016 10:07 PM)Jake Schwartz Wrote: In case it is of interest, a presentation was made at the HHC2011 conference in San Diego, mapping out all the 16C functions to the 34S. Info on that is available here and here. Gene: And this is still one of my favorite things you have done (out of SO many) at HHC conferences. Useful, concise and something no one else had thought to do until you did it. bravo! 

01292018, 03:17 PM
Post: #12




RE: ln and e^x on the 16C?
(01292018 12:47 PM)Mike (Stgt) Wrote: Do not try to show your profound math knowledge on an HP12C, that exp(n*ln(10)) is 10^n. Of course it is, but try with n=7. What is wrong with 9999999.990? The absolute error might look high, but the relative error is very low. If 6.999999998 is acceptable for 1/(1/7) on all 10digit HP calculators then that and all your other results surely are as well. Incidentally that’s exactly the same example I’d already tried on the HP16C yesterday, having stored ln(10) to full accuracy in register 9. I have to say I was pleased with the result ( 7 RCL 9 * GSB B > 9 999 939.859 ). I was pleased even with my previous result ( 10 GSB A 7 * GSB B > 9 999 776.098 ). BTW, I don’t claim a math knowledge beyond a skindeep level (I wish I had been a braver math student, though). Regards, Gerson. 

01292018, 03:27 PM
Post: #13




RE: ln and e^x on the 16C?
(03222016 10:07 PM)Jake Schwartz Wrote: In case it is of interest, a presentation was made at the HHC2011 conference in San Diego, mapping out all the 16C functions to the 34S. Info on that is available here and here. I must have missed this when it originally came up, but this could prove quite useful since I just recently cleaned up the keyboard on my 34S to make it reliable enough for daily use. 

« Next Oldest  Next Newest »

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