Post Reply 
[VA] SRC #017 - April 1st, 2024 Spring Special
04-07-2024, 11:10 PM (This post was last modified: 04-08-2024 03:12 AM by Gerson W. Barbosa.)
Post: #11
RE: [VA] SRC #017 - April 1st, 2024 Spring Special
(04-07-2024 03:01 AM)Valentin Albillo Wrote:    
[*] LOL the Fifth: Only Gerson offered some hints about this one but he posted neither code nor results, and no one else posted a thing.
  

Hello, Valentín,

Unusually busy week here. I'll try to fix that, even if only by a litte.

As I have suggested, that has to do with the Euler-Mascheroni constant, denoted by γ (lower-case gamma) .

The wp34s has γ built-in, but I guess Free42 should be more appropriate here. The following table, produced with help of one small RPN program, illustrates our attempt to get as many digits as possible on Free42, using that approach:

     γ = 0.5772156649015328606065120900824024 
          
 1 - γ = 0.4227843350984671393934879099175976 

      N     FRAC(Γ(10⁻ᴺ))         ABS(1 - γ - FRAC(Γ(10⁻ᴺ)))
    ---------------------------------------------------------
      1  0.51350769866873183629        9.07233635703E-02
      2  0.43258511915060371353        9.80078405214E-03
      3  0.42377248459546611498        9.88149496999E-04   
      4  0.42288323162419080574        9.89965257237E-05
      5  0.42279422556767349323        9.89046920635E-06
      6  0.42278532415355498927        9.89055087500E-07
      7  0.42278443400405759740        9.89055904580E-08
      8  0.42278434498902700193        9.89055986253E-09
      9  0.42278433608752313381        9.89055994420E-10
     10  0.42278433519737273892        9.89055995237E-11
     11  0.42278433510835769935        9.89055995288E-12
     12  0.42278433509945619539        9.89055997912E-13
     13  0.42278433509856604495        9.89055555121E-14
     14  0.42278433509847702999        9.89059651209E-15
     15  0.4227843350984681235         9.84106512090E-16
     16  0.422784335098467242          1.02606512090E-16
     17  0.42278433509846684           2.9939348791OE-16 
   ---------------------------------------------------------


From the table, we notice that the constant approaches 1 - γ as N increases. The maximum accuracy is reached when N = 16, when the first 15 digits are correct. From this point on, the accuracy degrades, as the Free42 precision is limited to 34 digits.

Here we also notice that the mantissas of the errors, the second column in the table, appear to tend to another constant. Regardless of any attempt to identify it, we can try to use it to get a few more correct digits, starting with N = 16 and down to N = 13, when the maximum accuracy is reached:
  
     16  0.422784335098467242 - 9.89055997912E-17 = 0.4227843350984671430944002088
     15  0.4227843350984681235 - 9.89055997912E-16 = 0.422784335098467134444002088
     14  0.42278433509847702999 - 9.89055997912E-15 = 0.42278433509846713943002088
     13  0.422784335098566044949 - 9.89055997912E-14 = 0.4227843350984671393492088                             
     12  0.4227843350994561953914 - 9.89055997912E-13 = 0.422784335098467139393488

Now we have about 50% more correct digits, 23. This scheme should give up to eight or nine correct digits on the HP-42S, but I have it to check it out.

Best regards,

Gerson.

------------------------------------------------------------

00 { 58-Byte Prgm }
01▸LBL "L5th"
02 1
03 0.5772156649015328606065120900824024
04 -
05 X<>Y
06 +/-
07 10↑X
08 GAMMA
09 FP
10 -
11 LASTX
12 X<>Y
13 ABS
14 END

------------------------------------------------------------

P.S.:

By using the constant 9.89055995288 we can get up to 7 correct digits of γ on the HP-42S and up to 23 on Free42:


00 { 38-Byte Prgm }
01▸LBL "E_M"
02 RCL ST X
03 +/-
04 10↑X
05 GAMMA
06 FP
07 X<>Y
08 NOT
09 10↑X
10 9.89055995288
11 ×
12 -
13 +/-
14 1
15 +
16 END

4 XEQ "E_M" ->

0.5772156756

11 XEQ "E_M" ->

0.57721566490153286060651

 ------------------------------------------------------------
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #017 - April 1st, 2024 Spring Special - Gerson W. Barbosa - 04-07-2024 11:10 PM



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