New empirical fit for ln(x) « Next Oldest | Next Newest »

 ▼ Namir Posting Freak Posts: 2,247 Threads: 200 Joined: Jun 2005 12-11-2012, 12:49 PM Hello All, I used my latest best polynomial program to determine the best empirical-polynomial model to fit ln(x) for 1 <= x <= 10. The Excel VBA program performs power-value transformations on x and y (= ln(x)) before using these transformed values in polynomial fits. Thus, the program goes through a large number of transformed-polynomial models. The result is an 8th order polynomial: ln(x) = a0 + a1*y + a2*y^2 + ... + a8*y^8 Where y = sqrt(x). Here is the pseudo code with the values for the coefficients a0 through a8. The maximum absolute error for the fit I obtained is 1.54E-5. I took the values of x using the sequence 1, 1.01, 1.02, 1.03, ..., 9.99, 10.0. ```function ln(x) if x<=0 then raise error and exit if x=1 then return 0 ln10 = 2.302585093 if x=10 then return ln10 n=0 if x>10 do while x>10 x=x/10 n=n+1 loop elseif x<1 do while x<1 x=10*x n=n-1 loop end y = sqrt(x) z = -1.17472578289386e-03 z = z * y + 2.23235477256564e-02 z = z * y - 0.186434305125544 z = z * y + 0.899792871812638 z = z * y - 2.77773142836752 z = z * y + 5.74716024426924 z = z * y - 8.20298398274567 z = z * y + 8.74732523658923 z = z * y - 4.2482580027248 return z + n*ln10 end function ``` Enjoy! Namir Edited: 12 Dec 2012, 6:09 a.m.

 Possibly Related Threads... Thread Author Replies Views Last Post Best statistical fit Richard Berler 8 1,817 10-30-2013, 11:25 PM Last Post: Walter B HP15c continued fraction for Ln(Gamma) Tom Grydeland 0 713 09-30-2013, 05:48 AM Last Post: Tom Grydeland WP34s program submission: Quadratic fit Andrew Nikitin 2 871 06-13-2013, 02:44 AM Last Post: Paul Dale e^pi - pi + 9/10^4 + 1/(10^4*ln(2) + sqrt(10)/6)^2 Gerson W. Barbosa 47 8,143 08-08-2012, 10:58 PM Last Post: Les Koller Where does the 17B-II fit in? Matt Agajanian 22 3,856 03-25-2012, 10:52 AM Last Post: Don Shepherd Where does the 38G fit in? Matt Agajanian 5 1,157 03-10-2012, 01:08 PM Last Post: Marcus von Cube, Germany HP35 exp(ln(x)) bug, a new number found. Kiwi Geoff 4 1,047 08-27-2010, 08:45 AM Last Post: Dieter Will a micro sd card fit Hp 50g? ferroburak 6 1,543 11-24-2009, 10:17 AM Last Post: Brian Walsh LOG function or ln CaribbeanHP12c 21 3,428 04-09-2008, 05:47 PM Last Post: CaribbeanHP12c HP-50G CASE FIT designnut 3 886 03-17-2008, 11:28 AM Last Post: Namir

Forum Jump: 