Current task: —

E-028-traced-margin.py

Experiments: E-028 · script updated 08-19-2026

E-028-traced-margin.csv — 429.7 KB, updated 08-19-2026

← prev page 8 of 40 · 500/page · 20000 rows next →
# nmargin_traced_6_40
3502 70020 -19464.931964
3503 70040 -19394.071296
3504 70060 -19323.204291
3505 70080 -19252.330954
3506 70100 -19181.451285
3507 70120 -19110.565287
3508 70140 -19039.672963
3509 70160 -18968.774315
3510 70180 -18897.869345
3511 70200 -18826.958057
3512 70220 -18756.040451
3513 70240 -18685.116532
3514 70260 -18614.186300
3515 70280 -18543.249759
3516 70300 -18472.306911
3517 70320 -18401.357758
3518 70340 -18330.402303
3519 70360 -18259.440548
3520 70380 -18188.472495
3521 70400 -18117.498147
3522 70420 -18046.517507
3523 70440 -17975.530576
3524 70460 -17904.537357
3525 70480 -17833.537853
3526 70500 -17762.532066
3527 70520 -17691.519997
3528 70540 -17620.501651
3529 70560 -17549.477028
3530 70580 -17478.446132
3531 70600 -17407.408964
3532 70620 -17336.365528
3533 70640 -17265.315824
3534 70660 -17194.259857
3535 70680 -17123.197628
3536 70700 -17052.129140
3537 70720 -16981.054394
3538 70740 -16909.973394
3539 70760 -16838.886142
3540 70780 -16767.792639
3541 70800 -16696.692889
3542 70820 -16625.586894
3543 70840 -16554.474656
3544 70860 -16483.356177
3545 70880 -16412.231460
3546 70900 -16341.100508
3547 70920 -16269.963322
3548 70940 -16198.819904
3549 70960 -16127.670258
3550 70980 -16056.514386
3551 71000 -15985.352289
3552 71020 -15914.183971
3553 71040 -15843.009433
3554 71060 -15771.828679
3555 71080 -15700.641709
3556 71100 -15629.448527
3557 71120 -15558.249135
3558 71140 -15487.043536
3559 71160 -15415.831731
3560 71180 -15344.613723
3561 71200 -15273.389514
3562 71220 -15202.159107
3563 71240 -15130.922503
3564 71260 -15059.679706
3565 71280 -14988.430718
3566 71300 -14917.175540
3567 71320 -14845.914176
3568 71340 -14774.646627
3569 71360 -14703.372896
3570 71380 -14632.092985
3571 71400 -14560.806897
3572 71420 -14489.514633
3573 71440 -14418.216196
3574 71460 -14346.911589
3575 71480 -14275.600814
3576 71500 -14204.283872
3577 71520 -14132.960767
3578 71540 -14061.631501
3579 71560 -13990.296075
3580 71580 -13918.954493
3581 71600 -13847.606756
3582 71620 -13776.252867
3583 71640 -13704.892828
3584 71660 -13633.526641
3585 71680 -13562.154309
3586 71700 -13490.775834
3587 71720 -13419.391218
3588 71740 -13348.000464
3589 71760 -13276.603574
3590 71780 -13205.200549
3591 71800 -13133.791394
3592 71820 -13062.376108
3593 71840 -12990.954696
3594 71860 -12919.527159
3595 71880 -12848.093499
3596 71900 -12776.653720
3597 71920 -12705.207822
3598 71940 -12633.755809
3599 71960 -12562.297682
3600 71980 -12490.833444
3601 72000 -12419.363097
3602 72020 -12347.886643
3603 72040 -12276.404085
3604 72060 -12204.915425
3605 72080 -12133.420666
3606 72100 -12061.919808
3607 72120 -11990.412855
3608 72140 -11918.899810
3609 72160 -11847.380673
3610 72180 -11775.855448
3611 72200 -11704.324136
3612 72220 -11632.786741
3613 72240 -11561.243264
3614 72260 -11489.693707
3615 72280 -11418.138072
3616 72300 -11346.576363
3617 72320 -11275.008581
3618 72340 -11203.434728
3619 72360 -11131.854807
3620 72380 -11060.268820
3621 72400 -10988.676769
3622 72420 -10917.078656
3623 72440 -10845.474484
3624 72460 -10773.864255
3625 72480 -10702.247970
3626 72500 -10630.625633
3627 72520 -10558.997246
3628 72540 -10487.362810
3629 72560 -10415.722328
3630 72580 -10344.075802
3631 72600 -10272.423235
3632 72620 -10200.764628
3633 72640 -10129.099984
3634 72660 -10057.429305
3635 72680 -9985.752594
3636 72700 -9914.069851
3637 72720 -9842.381081
3638 72740 -9770.686284
3639 72760 -9698.985464
3640 72780 -9627.278622
3641 72800 -9555.565760
3642 72820 -9483.846881
3643 72840 -9412.121987
3644 72860 -9340.391080
3645 72880 -9268.654163
3646 72900 -9196.911236
3647 72920 -9125.162304
3648 72940 -9053.407368
3649 72960 -8981.646429
3650 72980 -8909.879491
3651 73000 -8838.106556
3652 73020 -8766.327625
3653 73040 -8694.542701
3654 73060 -8622.751786
3655 73080 -8550.954882
3656 73100 -8479.151992
3657 73120 -8407.343117
3658 73140 -8335.528261
3659 73160 -8263.707424
3660 73180 -8191.880609
3661 73200 -8120.047819
3662 73220 -8048.209055
3663 73240 -7976.364319
3664 73260 -7904.513615
3665 73280 -7832.656944
3666 73300 -7760.794307
3667 73320 -7688.925709
3668 73340 -7617.051149
3669 73360 -7545.170632
3670 73380 -7473.284158
3671 73400 -7401.391730
3672 73420 -7329.493350
3673 73440 -7257.589021
3674 73460 -7185.678744
3675 73480 -7113.762522
3676 73500 -7041.840357
3677 73520 -6969.912251
3678 73540 -6897.978205
3679 73560 -6826.038223
3680 73580 -6754.092307
3681 73600 -6682.140458
3682 73620 -6610.182678
3683 73640 -6538.218971
3684 73660 -6466.249337
3685 73680 -6394.273780
3686 73700 -6322.292301
3687 73720 -6250.304902
3688 73740 -6178.311586
3689 73760 -6106.312355
3690 73780 -6034.307210
3691 73800 -5962.296155
3692 73820 -5890.279190
3693 73840 -5818.256319
3694 73860 -5746.227543
3695 73880 -5674.192865
3696 73900 -5602.152286
3697 73920 -5530.105809
3698 73940 -5458.053435
3699 73960 -5385.995168
3700 73980 -5313.931009
3701 74000 -5241.860960
3702 74020 -5169.785024
3703 74040 -5097.703201
3704 74060 -5025.615496
3705 74080 -4953.521909
3706 74100 -4881.422443
3707 74120 -4809.317100
3708 74140 -4737.205882
3709 74160 -4665.088791
3710 74180 -4592.965829
3711 74200 -4520.836999
3712 74220 -4448.702302
3713 74240 -4376.561741
3714 74260 -4304.415317
3715 74280 -4232.263033
3716 74300 -4160.104891
3717 74320 -4087.940893
3718 74340 -4015.771041
3719 74360 -3943.595337
3720 74380 -3871.413783
3721 74400 -3799.226382
3722 74420 -3727.033135
3723 74440 -3654.834045
3724 74460 -3582.629113
3725 74480 -3510.418342
3726 74500 -3438.201734
3727 74520 -3365.979291
3728 74540 -3293.751014
3729 74560 -3221.516907
3730 74580 -3149.276970
3731 74600 -3077.031207
3732 74620 -3004.779619
3733 74640 -2932.522209
3734 74660 -2860.258978
3735 74680 -2787.989928
3736 74700 -2715.715062
3737 74720 -2643.434382
3738 74740 -2571.147889
3739 74760 -2498.855586
3740 74780 -2426.557475
3741 74800 -2354.253558
3742 74820 -2281.943837
3743 74840 -2209.628314
3744 74860 -2137.306991
3745 74880 -2064.979870
3746 74900 -1992.646953
3747 74920 -1920.308243
3748 74940 -1847.963741
3749 74960 -1775.613449
3750 74980 -1703.257370
3751 75000 -1630.895505
3752 75020 -1558.527857
3753 75040 -1486.154427
3754 75060 -1413.775218
3755 75080 -1341.390232
3756 75100 -1268.999470
3757 75120 -1196.602935
3758 75140 -1124.200629
3759 75160 -1051.792554
3760 75180 -979.378712
3761 75200 -906.959104
3762 75220 -834.533734
3763 75240 -762.102603
3764 75260 -689.665712
3765 75280 -617.223065
3766 75300 -544.774663
3767 75320 -472.320508
3768 75340 -399.860602
3769 75360 -327.394948
3770 75380 -254.923546
3771 75400 -182.446400
3772 75420 -109.963512
3773 75440 -37.474882
3774 75460 35.019486
3775 75480 107.519591
3776 75500 180.025430
3777 75520 252.537003
3778 75540 325.054305
3779 75560 397.577336
3780 75580 470.106094
3781 75600 542.640577
3782 75620 615.180782
3783 75640 687.726707
3784 75660 760.278351
3785 75680 832.835712
3786 75700 905.398787
3787 75720 977.967574
3788 75740 1050.542072
3789 75760 1123.122279
3790 75780 1195.708192
3791 75800 1268.299809
3792 75820 1340.897129
3793 75840 1413.500150
3794 75860 1486.108869
3795 75880 1558.723284
3796 75900 1631.343394
3797 75920 1703.969197
3798 75940 1776.600690
3799 75960 1849.237871
3800 75980 1921.880740
3801 76000 1994.529292
3802 76020 2067.183528
3803 76040 2139.843444
3804 76060 2212.509038
3805 76080 2285.180309
3806 76100 2357.857255
3807 76120 2430.539874
3808 76140 2503.228163
3809 76160 2575.922121
3810 76180 2648.621745
3811 76200 2721.327035
3812 76220 2794.037987
3813 76240 2866.754600
3814 76260 2939.476871
3815 76280 3012.204800
3816 76300 3084.938384
3817 76320 3157.677620
3818 76340 3230.422508
3819 76360 3303.173044
3820 76380 3375.929228
3821 76400 3448.691056
3822 76420 3521.458528
3823 76440 3594.231641
3824 76460 3667.010393
3825 76480 3739.794782
3826 76500 3812.584807
3827 76520 3885.380465
3828 76540 3958.181754
3829 76560 4030.988673
3830 76580 4103.801219
3831 76600 4176.619391
3832 76620 4249.443187
3833 76640 4322.272604
3834 76660 4395.107640
3835 76680 4467.948295
3836 76700 4540.794565
3837 76720 4613.646449
3838 76740 4686.503945
3839 76760 4759.367051
3840 76780 4832.235765
3841 76800 4905.110085
3842 76820 4977.990009
3843 76840 5050.875535
3844 76860 5123.766662
3845 76880 5196.663387
3846 76900 5269.565709
3847 76920 5342.473625
3848 76940 5415.387133
3849 76960 5488.306232
3850 76980 5561.230920
3851 77000 5634.161195
3852 77020 5707.097055
3853 77040 5780.038497
3854 77060 5852.985521
3855 77080 5925.938123
3856 77100 5998.896303
3857 77120 6071.860058
3858 77140 6144.829386
3859 77160 6217.804286
3860 77180 6290.784755
3861 77200 6363.770792
3862 77220 6436.762395
3863 77240 6509.759561
3864 77260 6582.762289
3865 77280 6655.770577
3866 77300 6728.784424
3867 77320 6801.803826
3868 77340 6874.828783
3869 77360 6947.859291
3870 77380 7020.895351
3871 77400 7093.936959
3872 77420 7166.984113
3873 77440 7240.036812
3874 77460 7313.095054
3875 77480 7386.158837
3876 77500 7459.228159
3877 77520 7532.303018
3878 77540 7605.383413
3879 77560 7678.469340
3880 77580 7751.560800
3881 77600 7824.657788
3882 77620 7897.760305
3883 77640 7970.868347
3884 77660 8043.981913
3885 77680 8117.101002
3886 77700 8190.225610
3887 77720 8263.355737
3888 77740 8336.491380
3889 77760 8409.632537
3890 77780 8482.779207
3891 77800 8555.931388
3892 77820 8629.089078
3893 77840 8702.252275
3894 77860 8775.420976
3895 77880 8848.595181
3896 77900 8921.774888
3897 77920 8994.960094
3898 77940 9068.150797
3899 77960 9141.346997
3900 77980 9214.548690
3901 78000 9287.755875
3902 78020 9360.968551
3903 78040 9434.186714
3904 78060 9507.410364
3905 78080 9580.639499
3906 78100 9653.874117
3907 78120 9727.114215
3908 78140 9800.359792
3909 78160 9873.610847
3910 78180 9946.867376
3911 78200 10020.129380
3912 78220 10093.396854
3913 78240 10166.669799
3914 78260 10239.948211
3915 78280 10313.232089
3916 78300 10386.521432
3917 78320 10459.816237
3918 78340 10533.116502
3919 78360 10606.422226
3920 78380 10679.733406
3921 78400 10753.050042
3922 78420 10826.372131
3923 78440 10899.699671
3924 78460 10973.032660
3925 78480 11046.371097
3926 78500 11119.714980
3927 78520 11193.064307
3928 78540 11266.419075
3929 78560 11339.779284
3930 78580 11413.144932
3931 78600 11486.516016
3932 78620 11559.892534
3933 78640 11633.274486
3934 78660 11706.661868
3935 78680 11780.054680
3936 78700 11853.452920
3937 78720 11926.856585
3938 78740 12000.265673
3939 78760 12073.680184
3940 78780 12147.100115
3941 78800 12220.525464
3942 78820 12293.956229
3943 78840 12367.392410
3944 78860 12440.834003
3945 78880 12514.281007
3946 78900 12587.733420
3947 78920 12661.191241
3948 78940 12734.654467
3949 78960 12808.123098
3950 78980 12881.597130
3951 79000 12955.076562
3952 79020 13028.561393
3953 79040 13102.051620
3954 79060 13175.547242
3955 79080 13249.048257
3956 79100 13322.554663
3957 79120 13396.066458
3958 79140 13469.583641
3959 79160 13543.106210
3960 79180 13616.634162
3961 79200 13690.167497
3962 79220 13763.706212
3963 79240 13837.250305
3964 79260 13910.799775
3965 79280 13984.354621
3966 79300 14057.914839
3967 79320 14131.480429
3968 79340 14205.051388
3969 79360 14278.627715
3970 79380 14352.209408
3971 79400 14425.796465
3972 79420 14499.388885
3973 79440 14572.986665
3974 79460 14646.589804
3975 79480 14720.198300
3976 79500 14793.812152
3977 79520 14867.431356
3978 79540 14941.055913
3979 79560 15014.685820
3980 79580 15088.321074
3981 79600 15161.961675
3982 79620 15235.607621
3983 79640 15309.258910
3984 79660 15382.915539
3985 79680 15456.577508
3986 79700 15530.244815
3987 79720 15603.917457
3988 79740 15677.595433
3989 79760 15751.278741
3990 79780 15824.967380
3991 79800 15898.661347
3992 79820 15972.360642
3993 79840 16046.065261
3994 79860 16119.775204
3995 79880 16193.490468
3996 79900 16267.211053
3997 79920 16340.936955
3998 79940 16414.668174
3999 79960 16488.404707
4000 79980 16562.146553
4001 80000 16635.893710

E-028-traced-margin.json — 3.7 KB, updated 08-19-2026

JSON sidecar (click to expand)
{
  "experiment": "E-028",
  "task": "4.5a support: D-056 traced R-bound verification + margin rerun with A=10.5, B0=48 (honest C0 incl. log log term)",
  "script": "research/numerics/scripts/E-028-traced-margin.py",
  "checks": {
    "V_R_traced_bound_holds": {
      "pass": true,
      "points": [
        {
          "sigma": -2.5,
          "t": 10.0,
          "abs_R": 0.5364627998701963,
          "bound": 74.091519822774,
          "holds": true
        },
        {
          "sigma": -2.5,
          "t": 50.0,
          "abs_R": 1.8035543334872959,
          "bound": 89.48805904510499,
          "holds": true
        },
        {
          "sigma": -2.5,
          "t": 100.0,
          "abs_R": 2.726827160278793,
          "bound": 96.56221453948484,
          "holds": true
        },
        {
          "sigma": -2.5,
          "t": 500.0,
          "abs_R": 4.0305314954089475,
          "bound": 113.29530125676315,
          "holds": true
        },
        {
          "sigma": -2.5,
          "t": 1000.0,
          "abs_R": 4.7507714994958565,
          "bound": 120.5524094572705,
          "holds": true
        },
        {
          "sigma": 0.5,
          "t": 10.0,
          "abs_R": 0.232976073221556,
          "bound": 74.091519822774,
          "holds": true
        },
        {
          "sigma": 0.5,
          "t": 50.0,
          "abs_R": 1.0575019981720868,
          "bound": 89.48805904510499,
          "holds": true
        },
        {
          "sigma": 0.5,
          "t": 100.0,
          "abs_R": 1.3861083473172386,
          "bound": 96.56221453948484,
          "holds": true
        },
        {
          "sigma": 0.5,
          "t": 500.0,
          "abs_R": 2.191750394872167,
          "bound": 113.29530125676315,
          "holds": true
        },
        {
          "sigma": 0.5,
          "t": 1000.0,
          "abs_R": 2.535043296015203,
          "bound": 120.5524094572705,
          "holds": true
        },
        {
          "sigma": 2.0,
          "t": 10.0,
          "abs_R": 0.11614405022018243,
          "bound": 74.091519822774,
          "holds": true
        },
        {
          "sigma": 2.0,
          "t": 50.0,
          "abs_R": 0.47282316679931,
          "bound": 89.48805904510499,
          "holds": true
        },
        {
          "sigma": 2.0,
          "t": 100.0,
          "abs_R": 0.13345107201883163,
          "bound": 96.56221453948484,
          "holds": true
        },
        {
          "sigma": 2.0,
          "t": 500.0,
          "abs_R": 0.6914268199229783,
          "bound": 113.29530125676315,
          "holds": true
        },
        {
          "sigma": 2.0,
          "t": 1000.0,
          "abs_R": 0.6591087549534896,
          "bound": 120.5524094572705,
          "holds": true
        }
      ]
    },
    "V5_Z2_certified": {
      "pass": true,
      "partial": 0.5699599927023044,
      "tail": 1.4815510557964273e-05,
      "bound": 0.5699748082128623
    },
    "V2_margin_positive_convex": true
  },
  "key_values": {
    "M0_from_E023": 1.335180201468999,
    "N0_traced_10p5_48": 75451,
    "margin_N0": 2.396310426061973,
    "overlap_factor_vs_MV_5e5": 6.626817404673232,
    "margin_at": {
      "75451": 2.396310426061973,
      "100000": 92785.67601524561,
      "500000": 2006008.571308432,
      "1000000": 4755774.032035855,
      "1000000000": 8921657382.546026,
      "1000000000000": 12395765983564.96,
      "1000000000000000000": 1.9304326196882584e+19,
      "8999999999994000000000001": 2.4579625383799396e+26
    },
    "N1": 8999999999994000000000001
  },
  "elapsed_seconds": 3.7
}

Source code

Python script (click to expand)
"""E-028 — task 4.5a support: D-056 traced R-bound verification + margin rerun.

Components:
  V-R. Verify the traced reference-point R-bound (D-056 Theorem R)
       |R(s)| <= 6.0 log(|t|+2) + 40,  sigma in [-5/2, 3], |t| >= 10
       at sample points sigma in {-2.5, 0.5, 2}, t in {10,50,100,500,1000}
       (R(s) = zeta'/zeta(s) - sum_{|gamma-t|<1} 1/(s-rho), zeta'/zeta
       via the E-021 xi-route at dps 30; zeros from the E-027 cache).
  V5.  Certified Z2 = -zeta'/zeta(2) <= 0.5699: partial sum to 1e4 plus
       tail bound (log N + 1)/N.
  S3'. Margin rerun with the TRACED constants A = 6.0, B0 = 40 (was:
       measured 0.9/1.0, first-estimate 2.0/2.0) and the I_I length fix
       2(sqrt(n)+1). Recompute N0, contiguity to 4e5, convexity grid to
       N1, margin references. M0 = 1.3352 imported from E-023 (S1).

Outputs: research/numerics/data/E-028-traced-margin.csv (+ .json)
"""
import csv as csvmod
import json
import sys
import time
from pathlib import Path

import mpmath as mp
import numpy as np

REPO = Path(__file__).resolve().parents[3]
DATA = REPO / "research" / "numerics" / "data"
E021 = DATA / "E-021-sinf-sf-curve.csv"
E023J = DATA / "E-023-assembly.json"
ZCACHE = DATA / "E-027-zeros-cache.npy"
CSV = DATA / "E-028-traced-margin.csv"
JSON = DATA / "E-028-traced-margin.json"

GAMMA = 0.577215664901532860606512090082402431
C1L = (GAMMA - 1 - np.log(2 * np.pi)) / 2 - GAMMA / 2
A_TR, B0_TR = 10.5, 48.0
T0_PLATT = 3.0e12


def zeta_logder(s):
    sm = mp.mpc(s.real, s.imag)

    def xi_mp(u):
        return 0.5 * u * (u - 1) * mp.pi ** (-u / 2) * mp.gamma(u / 2) \
            * mp.zeta(u)

    xi_log = mp.diff(xi_mp, sm) / xi_mp(sm)
    return complex(xi_log - 1 / sm - 1 / (sm - 1)
                   + mp.mpf(0.5) * mp.log(mp.pi)
                   - mp.mpf(0.5) * mp.digamma(sm / 2))


def check_R_bound(zeros):
    mp.mp.dps = 30
    out = []
    for sigma in (-2.5, 0.5, 2.0):
        for t in (10.0, 50.0, 100.0, 500.0, 1000.0):
            s = complex(sigma, t)
            val = zeta_logder(s)
            near = [g for g in zeros if abs(g - t) < 1.0]
            r = val - sum(1.0 / (s - complex(0.5, g)) for g in near)
            bound = 10.5 * np.log(t + 2) + 48.0
            out.append({"sigma": sigma, "t": t, "abs_R": abs(r),
                        "bound": bound, "holds": bool(abs(r) <= bound)})
    return out


def certified_Z2(N=10 ** 6):
    """-zeta'/zeta(2) = sum Lambda(n)/n^2; partial sum + tail bound
    (log N + 1)/N. True value 0.569955...; certify <= 0.5700."""
    lam = np.zeros(N + 1)
    sieve = np.zeros(N + 1, dtype=np.int64)
    for p in range(2, N + 1):
        if sieve[p] == 0:
            sieve[p::p] = p
    for n in range(2, N + 1):
        p = sieve[n]
        if p > 0 and abs(p ** round(np.log(n) / np.log(p)) - n) < 0.5:
            lam[n] = np.log(p)
    part = float(np.sum(lam[2:] / np.arange(2, N + 1) ** 2))
    tail = (np.log(N) + 1) / N
    return part, tail, part + tail


def F_count(T):
    return (T / (2 * np.pi)) * np.log(T / (2 * np.pi)) - T / (2 * np.pi) \
        + 7 / 8


def S_bound(T):
    return 0.137 * np.log(T) + 0.443 * np.log(np.log(T)) + 1.588


def C0(t):
    return (F_count(t + 1) - F_count(t)) + S_bound(t + 1) + S_bound(t)


def H_bound(T):
    return 3 * C0(T) ** 2 + A_TR * np.log(T + 2) + B0_TR


def B_bound(n, m0):
    n = np.asarray(n, dtype=np.float64)
    T = np.sqrt(n) + 1.0
    twoN = 2 * (F_count(T) + S_bound(T))
    I3_long = 4 * T * ((2 / 3) * C0(T) + A_TR * np.log(T + 2) + B0_TR)
    I3_short = 40.0 * m0
    I24 = 2 * (np.e ** 4 + 1) * (7 * H_bound(T) + 3.3)
    r = np.sqrt(n)
    # I_I length fix: 2T = 2(sqrt(n)+1)
    logI1 = np.log(2 * (r + 1) * 0.5700) + r / 2 - (2 * r - 2) * np.log(2)
    I1 = np.where(logI1 > -700, np.exp(np.maximum(logI1, -745)), 0.0)
    return twoN + I3_long + I3_short + I24 + I1 + 1.0


def margin(n, m0):
    n = np.asarray(n, dtype=np.float64)
    return 0.5 * n * np.log(n) + C1L * n - 4.0 - B_bound(n, m0) + 1.0


def main() -> int:
    if JSON.exists() and "--force" not in sys.argv:
        print(f"cached: {JSON} (use --force to recompute)")
        return 0
    t0 = time.time()

    m0 = json.loads(E023J.read_text())["key_values"]["M0_use"]
    print(f"M0 imported from E-023: {m0}")

    print("V-R: traced R-bound verification ...", flush=True)
    zeros = np.load(ZCACHE)
    rpts = check_R_bound(zeros)
    vr = all(p["holds"] for p in rpts)
    worst = max(rpts, key=lambda p: p["abs_R"] / p["bound"])
    print(f"  all {len(rpts)} points hold: {vr}; worst ratio "
          f"{worst['abs_R']/worst['bound']:.3f} at "
          f"sigma={worst['sigma']}, t={worst['t']}", flush=True)

    print("V5: certified Z2 ...", flush=True)
    part, tail, z2 = certified_Z2()
    v5 = bool(z2 <= 0.5700)
    print(f"  partial {part:.6f} + tail {tail:.6f} = {z2:.6f} "
          f"<= 0.5700: {v5}", flush=True)

    print("S3': margin rerun with traced constants ...", flush=True)
    ngrid = np.arange(20, 400001)
    marg = margin(ngrid, m0)
    pos = ngrid[(marg > 0) & (np.gradient(marg, ngrid) > 0)]
    N0 = int(pos[0]) if len(pos) else -1
    cont = bool(np.all(marg[ngrid >= N0] > 0)) if N0 > 0 else False
    margN0 = float(marg[ngrid == N0][0]) if N0 > 0 else float("nan")
    print(f"  N0 (traced 6.0/40) = {N0} (contiguous to 4e5: {cont}, "
          f"margin(N0) = {margN0:.1f})", flush=True)

    logn = np.unique(np.logspace(np.log10(max(N0, 20)), np.log10(9e24),
                                 4000).astype(np.float64))
    bmarg = margin(logn, m0)
    conv = bool(np.all(np.diff(bmarg, 2) > -1e-6 * bmarg[:-2].max()))

    N1 = int(3_000_000_000_000 - 1) ** 2
    refs = {int(n): float(margin(n, m0)) for n in
            [N0, 100000, 500000, 10 ** 6, 10 ** 9, 10 ** 12, 10 ** 18,
             N1]}
    for k, v in refs.items():
        print(f"  margin({k:.3e}) = {v:.4e}", flush=True)
    v2 = bool(N0 > 0 and cont and conv and N0 < 500000)
    print(f"  convexity grid: {conv}; N0 < 5e5 (MV coverage): "
          f"{N0 < 500000}", flush=True)

    with open(CSV, "w", newline="") as f:
        w = csvmod.writer(f)
        w.writerow(["n", "margin_traced_6_40"])
        for n in range(20, 400001, 20):
            w.writerow([n, f"{float(margin(n, m0)):.6f}"])

    meta = {
        "experiment": "E-028",
        "task": "4.5a support: D-056 traced R-bound verification + "
                "margin rerun with A=10.5, B0=48 (honest C0 incl. log log term)",
        "script": "research/numerics/scripts/E-028-traced-margin.py",
        "checks": {
            "V_R_traced_bound_holds": {"pass": vr, "points": rpts},
            "V5_Z2_certified": {"pass": v5, "partial": part,
                                "tail": tail, "bound": z2},
            "V2_margin_positive_convex": v2,
        },
        "key_values": {
            "M0_from_E023": m0,
            "N0_traced_10p5_48": N0,
            "margin_N0": margN0,
            "overlap_factor_vs_MV_5e5": 500000 / N0 if N0 > 0 else None,
            "margin_at": {str(k): v for k, v in refs.items()},
            "N1": N1,
        },
        "elapsed_seconds": round(time.time() - t0, 1),
    }
    JSON.write_text(json.dumps(meta, indent=2))
    print(f"  wrote {CSV.name}, {JSON.name}; elapsed "
          f"{meta['elapsed_seconds']}s")
    return 0 if (vr and v5 and v2) else 1


if __name__ == "__main__":
    sys.exit(main())