Monday, May 15, 2023

ECO - Electron Charge Only - Fixing Other Constants - Root Algorithm & Results


https://spark.iop.org/perrin-tube-sign-electron-charge

Solving for the electron charge only (part of step 2 of The Algorithm), here is a simple BASIC routine and results.  BASIC is being used so the algorithm is easily viewable and verifiable. 

Here is the BASIC code (online interpreter - https://www.calormen.com/jsbasic/):
1 REM variables only recognize first two characters thus xx1 and xx2 are same variable
10 PRINT "Hello World"
100 Rem New Algorithm 1.1 5/15/2023 MR
102 count = 0
106 print "error, dx, q"
110 Dim x2(7),sign(7), dx(7)
120 Rem Init some vars
125 aminerr=1.0
132 res = 1e-10
200 xpi=3.14159265358979323846
250 rem 8 coefs here
255 Rem elementary charge (e)-0
260 x2(0)=1.60217662e-19
263 xorig(0)=x2(0)
265 Rem Planck's constant (h)-1
300 x2(1)=6.62607004e-34
325 xorig(1)=x2(1)
350 rem eletron mass (Me)-2
400 x2(2)=9.109383560899034e-31
425 xorig(2)=x2(2)
450 Rem Proton radius (Rp)-3
500 x2(3)=8.41235640479985e-16
525 xorig(3)=x2(3)
550 Rem Rydberg Constant (R_H or R_{\infty})-4
600 x2(4)=10973731.5685083
605 xorig(4)=x2(4)
610 Rem Permittivity of free space (e0)-5
620 x2(5)=8.854187817e-12
650 xorig(5)=x2(5)
701 Rem Speed of Light (c)-6
702 x2(6)=299792458.0
704 xorig(6)=x2(6)
706 Rem fine-structure constant (\alpha)-7
708 x2(7)=0.00729735256
709 xorig(7)=x2(7)
710 For i = 0 to 7
720 sign(i)=0
730 dx(i) = 0.001e-19
740 next i
750 Rem define bit to be twiddled here
1030 eold = err
1050 gosub 1600
1075 x2(0)=1.602e-19
1100 print err;", ";dx(0);", ";x2(0)
1150 rem Main Loop1 
1210 z1=x2(0)+dx(0)
1220 z2=x2(0)-dx(0)
1230 xsave=x2(0)
1240 x2(0)=z1
1250 eold = err
1260 gosub 1600
1270 e1=err
1280 x2(0)=z2
1290 gosub 1600
1300 e2=err
1310 x2(0)=xsave
1320 err = eold
1325 rem print x2(0),z1,z2
1327 rem print err,e1,e2
1330 if abs(e1) < abs(err) then x2(0)=z1
1332 if abs(e1) < abs(err) then aminerr=e1
1340 if abs(e2) < abs(err) then x2(0)=z2
1342 if abs(e2) < abs(err) then aminerr=e2
1350 if (abs(e1) >= abs(err)) and (abs(e2) >= abs(err)) then dx(0)=dx(0)/10.0
1360 if abs(aminerr) < res then goto 1500
1370 gosub 1600
1380 goto 1100
1500 gosub 1600
1510 print err;", ";dx(0);", ";x2(0)
1525 end
1550 REM Subroutines:
1600 rem starting error
1700 xerr1=x2(2)*x2(0)^4/(8*x2(6)*x2(5)^2*x2(1)^3*x2(4))
1800 yerr2=-xpi*x2(3)*x2(4)/(x2(7)^2)
1900 err = xerr1 + yerr2 - 1.0
2000 return

Here are the results for a resolution of the error of the polynomial from ideal, res = 1e-10 case:
error, dx, q
-0.0005446185946568205, 1e-22, 1.60217662e-19*
-0.0009854958223842747, 1.0000000000000001e-23, 1.602e-19
-0.0007358946446630599, 1.0000000000000001e-23, 1.6021e-19
-0.0004862467236895762, 1.0000000000000001e-23, 1.6022e-19
-0.0002365520536283805, 1.0000000000000001e-23, 1.6023000000000001e-19
0.000013189371356858715, 1.0000000000000001e-23, 1.6024000000000002e-19
0.000013189371356858715, 1.0000000000000001e-24, 1.6024000000000002e-19
-0.000011786875279473641, 1.0000000000000001e-24, 1.6023900000000003e-19
-0.000011786875279473641, 1.0000000000000002e-25, 1.6023900000000003e-19
-0.000009289271657997311, 1.0000000000000002e-25, 1.6023910000000003e-19
-0.000006791663360261602, 1.0000000000000002e-25, 1.6023920000000003e-19
-0.000004294050386932646, 1.0000000000000002e-25, 1.6023930000000004e-19
-0.0000017964327371222666, 1.0000000000000002e-25, 1.6023940000000004e-19
7.011895886144259e-7, 1.0000000000000002e-25, 1.6023950000000005e-19
7.011895886144259e-7, 1.0000000000000002e-26, 1.6023950000000005e-19
4.5142714544255114e-7, 1.0000000000000002e-26, 1.6023949000000004e-19
2.0166474912208798e-7, 1.0000000000000002e-26, 1.6023948000000003e-19
-4.8097600902075044e-8, 1.0000000000000002e-26, 1.6023947000000002e-19
-4.8097600902075044e-8, 1.0000000000000002e-27, 1.6023947000000002e-19
-2.3121367820344574e-8, 1.0000000000000002e-27, 1.6023947100000003e-19
1.8548658164974086e-9, 1.0000000000000002e-27, 1.6023947200000003e-19
1.8548658164974086e-9, 1.0000000000000002e-28, 1.6023947200000003e-19
-6.427575138800989e-10, 1.0000000000000002e-28, 1.6023947190000004e-19
-6.427575138800989e-10, 1.0000000000000002e-29, 1.6023947190000004e-19
-3.92995080922276e-10, 1.0000000000000002e-29, 1.6023947191000005e-19
-1.43232647964453e-10, 1.0000000000000002e-29, 1.6023947192000005e-19
1.0653011806027735e-10, 1.0000000000000002e-29, 1.6023947193000006e-19
1.0653011806027735e-10, 1.0000000000000003e-30, 1.6023947193000006e-19
8.155409680909997e-11, 1.0000000000000003e-30, 1.6023947192900007e-19

The algorithm requires each constant to be solved for minimum error, using original NIST/CODATA as starting point.  The initial error is about -0.00054, so each constant is iterated until the error is zero to the specified res(olution), then a new error is calculated with the new set of constants.  Check to see if the error from the new set of constants is less than the starting error.  If it is, continue and check if converging.

Therefore, this is only 1 of 8 constants. 

*Also, note, some work for initial and final printing of the values is needed for completeness. Bold initial value is hand entered...

All bugs are not worked out as this is early code.  This code is being written with future consideration of iterating ALL 8 constants, however, to make progress, I will be blogging about each constant individually just like the electron charge here.

CSV, Comma Separated Variables, format is used for output for easy importing into Excel or most common spreadsheet tools.  Will be showing plots of error & vaules converging later. Soon, however, moar than 2 weeks...

The Surfer, OM-IV

No comments:

Post a Comment

Watch the water = Lake πŸ‘© πŸŒŠπŸ¦†