R Under development (unstable) (2024-08-21 r87038 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > #### Testing 1) dbinom_raw(), dnbinomR() and dnbinom.mu() > #### 2) log1pmx(), logcf() etc > require(DPQ) Loading required package: DPQ > > source(system.file(package="DPQ", "test-tools.R", + mustWork=TRUE))# ../inst/test-tools.R > ## => showProc.time(), ... list_() , loadList() , readRDS_() , save2RDS() > > (doExtras <- DPQ:::doExtras() && !grepl("valgrind", R.home())) [1] FALSE > > if(!dev.interactive(orNone=TRUE)) pdf("dnbinom-log1pmx.pdf") > > > ### 1. Testing dbinom_raw(), dnbinomR() and dnbinom.mu() >>> ../R/dbinom-nbinom.R <<< > ### ---------- ../man/dbinom_raw.Rd & ../man/dnbinomR.Rd > > ## "FIXME:" use sfsmisc :: relErrV() already here > > ### dbinom() vs dbinom.raw() : > > for(n in 1:20) { + cat("n=",n," ") + for(x in 0:n) + cat(".") + for(p in c(0, .1, .5, .8, 1)) { + stopifnot(all.equal(dbinom_raw(x, n, p, q=1-p, log=FALSE), + dbinom (x, n, p, log=FALSE)), + all.equal(dbinom_raw(x, n, p, q=1-p, log =TRUE), + dbinom (x, n, p, log =TRUE))) + } + cat("\n") + } n= 1 .. n= 2 ... n= 3 .... n= 4 ..... n= 5 ...... n= 6 ....... n= 7 ........ n= 8 ......... n= 9 .......... n= 10 ........... n= 11 ............ n= 12 ............. n= 13 .............. n= 14 ............... n= 15 ................ n= 16 ................. n= 17 .................. n= 18 ................... n= 19 .................... n= 20 ..................... > showProc.time() Time (user system elapsed): 0.1 0 0.09 > > ### dnbinom*() : > stopifnot(exprs = { + dnbinomR(0, 1, 1) == 1 + }) > > ### exploring 'eps' == "true" tests must be done with Rmpfr !! > > ### 2. Testing log1pmx(), logcf() etc > ### ---------- > > ### 2a: logcf() > ## == ======= > x <- c((-20:3)/4, (25:31)/32) # close (but not too close) to upper bound 1 > > (lC <- logcf (x, i=2, d=3, eps=1e-9)) [1] 0.2225364 0.2273165 0.2323964 0.2378089 0.2435921 0.2497910 0.2564582 [8] 0.2636564 0.2714610 0.2799634 0.2892758 0.2995378 0.3109259 0.3236668 [15] 0.3380584 0.3545014 0.3735507 0.3960035 0.4230578 0.4566237 0.5000000 [22] 0.5595850 0.6503112 0.8221318 0.8574109 0.8989257 0.9490572 1.0118259 [29] 1.0948318 1.2152882 1.4286636 > lCt <- logcf (x, i=2, d=3, eps=1e-9, trace=TRUE) ; stopifnot(identical(lCt, lC)) it= 0: ==> |b2|=162720 it= 1: ==> |b2|=1.68458e+08 it= 2: ==> |b2|=3.02689e+11 it= 3: ==> |b2|=8.40216e+14 it= 4: ==> |b2|=3.33607e+18 it= 5: ==> |b2|=1.79478e+22 it= 6: ==> |b2|=1.25703e+26 it= 7: ==> |b2|=1.11146e+30 it= 8: ==> |b2|=1.21086e+34 it= 9: ==> |b2|=1.5936e+38 it=10: ==> |b2|=2.49268e+42 logcf(*) used 11 iterations. it= 0: ==> |b2|=151400 it= 1: ==> |b2|=1.519e+08 it= 2: ==> |b2|=2.64707e+11 it= 3: ==> |b2|=7.12814e+14 it= 4: ==> |b2|=2.74588e+18 it= 5: ==> |b2|=1.4333e+22 it= 6: ==> |b2|=9.73998e+25 it= 7: ==> |b2|=8.35605e+29 it= 8: ==> |b2|=8.83286e+33 it= 9: ==> |b2|=1.12795e+38 it=10: ==> |b2|=1.71192e+42 logcf(*) used 11 iterations. it= 0: ==> |b2|=140480 it= 1: ==> |b2|=1.36437e+08 it= 2: ==> |b2|=2.30332e+11 it= 3: ==> |b2|=6.0102e+14 it= 4: ==> |b2|=2.24367e+18 it= 5: ==> |b2|=1.135e+22 it= 6: ==> |b2|=7.47503e+25 it= 7: ==> |b2|=6.21522e+29 it= 8: ==> |b2|=6.3674e+33 it= 9: ==> |b2|=7.88061e+37 it=10: ==> |b2|=1.15921e+42 logcf(*) used 11 iterations. it= 0: ==> |b2|=129960 it= 1: ==> |b2|=1.22034e+08 it= 2: ==> |b2|=1.99336e+11 it= 3: ==> |b2|=5.03394e+14 it= 4: ==> |b2|=1.81889e+18 it= 5: ==> |b2|=8.90621e+21 it= 6: ==> |b2|=5.67763e+25 it= 7: ==> |b2|=4.56957e+29 it= 8: ==> |b2|=4.53158e+33 it= 9: ==> |b2|=5.429e+37 logcf(*) used 10 iterations. it= 0: ==> |b2|=119840 it= 1: ==> |b2|=1.08655e+08 it= 2: ==> |b2|=1.71497e+11 it= 3: ==> |b2|=4.18587e+14 it= 4: ==> |b2|=1.46194e+18 it= 5: ==> |b2|=6.91963e+21 it= 6: ==> |b2|=4.26415e+25 it= 7: ==> |b2|=3.31759e+29 it= 8: ==> |b2|=3.18042e+33 it= 9: ==> |b2|=3.68336e+37 logcf(*) used 10 iterations. it= 0: ==> |b2|=110120 it= 1: ==> |b2|=9.62637e+07 it= 2: ==> |b2|=1.46601e+11 it= 3: ==> |b2|=3.45334e+14 it= 4: ==> |b2|=1.16411e+18 it= 5: ==> |b2|=5.31835e+21 it= 6: ==> |b2|=3.16349e+25 it= 7: ==> |b2|=2.37577e+29 it= 8: ==> |b2|=2.19845e+33 it= 9: ==> |b2|=2.45771e+37 logcf(*) used 10 iterations. it= 0: ==> |b2|=100800 it= 1: ==> |b2|=8.48232e+07 it= 2: ==> |b2|=1.24442e+11 it= 3: ==> |b2|=2.82452e+14 it= 4: ==> |b2|=9.17519e+17 it= 5: ==> |b2|=4.03952e+21 it= 6: ==> |b2|=2.3156e+25 it= 7: ==> |b2|=1.67591e+29 it= 8: ==> |b2|=1.49457e+33 logcf(*) used 9 iterations. it= 0: ==> |b2|=91880 it= 1: ==> |b2|=7.42974e+07 it= 2: ==> |b2|=1.04819e+11 it= 3: ==> |b2|=2.28837e+14 it= 4: ==> |b2|=7.15064e+17 it= 5: ==> |b2|=3.02848e+21 it= 6: ==> |b2|=1.67007e+25 it= 7: ==> |b2|=1.1628e+29 it= 8: ==> |b2|=9.97611e+32 logcf(*) used 9 iterations. it= 0: ==> |b2|=83360 it= 1: ==> |b2|=6.46501e+07 it= 2: ==> |b2|=8.75389e+10 it= 3: ==> |b2|=1.83464e+14 it= 4: ==> |b2|=5.50387e+17 it= 5: ==> |b2|=2.23803e+21 it= 6: ==> |b2|=1.18496e+25 it= 7: ==> |b2|=7.92152e+28 it= 8: ==> |b2|=6.52535e+32 logcf(*) used 9 iterations. it= 0: ==> |b2|=75240 it= 1: ==> |b2|=5.58449e+07 it= 2: ==> |b2|=7.24171e+10 it= 3: ==> |b2|=1.45381e+14 it= 4: ==> |b2|=4.17809e+17 it= 5: ==> |b2|=1.6276e+21 it= 6: ==> |b2|=8.25594e+24 it= 7: ==> |b2|=5.28764e+28 logcf(*) used 8 iterations. it= 0: ==> |b2|=67520 it= 1: ==> |b2|=4.78456e+07 it= 2: ==> |b2|=5.92745e+10 it= 3: ==> |b2|=1.13708e+14 it= 4: ==> |b2|=3.12287e+17 it= 5: ==> |b2|=1.16261e+21 it= 6: ==> |b2|=5.6361e+24 it= 7: ==> |b2|=3.44989e+28 logcf(*) used 8 iterations. it= 0: ==> |b2|=60200 it= 1: ==> |b2|=4.06158e+07 it= 2: ==> |b2|=4.79397e+10 it= 3: ==> |b2|=8.76351e+13 it= 4: ==> |b2|=2.2937e+17 it= 5: ==> |b2|=8.13827e+20 it= 6: ==> |b2|=3.76013e+24 it= 7: ==> |b2|=2.19363e+28 logcf(*) used 8 iterations. it= 0: ==> |b2|=53280 it= 1: ==> |b2|=3.41194e+07 it= 2: ==> |b2|=3.82483e+10 it= 3: ==> |b2|=6.64186e+13 it= 4: ==> |b2|=1.6515e+17 it= 5: ==> |b2|=5.56707e+20 it= 6: ==> |b2|=2.44378e+24 logcf(*) used 7 iterations. it= 0: ==> |b2|=46760 it= 1: ==> |b2|=2.83198e+07 it= 2: ==> |b2|=3.0043e+10 it= 3: ==> |b2|=4.93794e+13 it= 4: ==> |b2|=1.16224e+17 it= 5: ==> |b2|=3.70875e+20 it= 6: ==> |b2|=1.54119e+24 logcf(*) used 7 iterations. it= 0: ==> |b2|=40640 it= 1: ==> |b2|=2.3181e+07 it= 2: ==> |b2|=2.31738e+10 it= 3: ==> |b2|=3.59e+13 it= 4: ==> |b2|=7.96488e+16 it= 5: ==> |b2|=2.39588e+20 logcf(*) used 6 iterations. it= 0: ==> |b2|=34920 it= 1: ==> |b2|=1.86664e+07 it= 2: ==> |b2|=1.74976e+10 it= 3: ==> |b2|=2.5422e+13 it= 4: ==> |b2|=5.29017e+16 it= 5: ==> |b2|=1.49263e+20 logcf(*) used 6 iterations. it= 0: ==> |b2|=29600 it= 1: ==> |b2|=1.474e+07 it= 2: ==> |b2|=1.28785e+10 it= 3: ==> |b2|=1.74436e+13 it= 4: ==> |b2|=3.38438e+16 logcf(*) used 5 iterations. it= 0: ==> |b2|=24680 it= 1: ==> |b2|=1.13653e+07 it= 2: ==> |b2|=9.18785e+09 it= 3: ==> |b2|=1.1517e+13 it= 4: ==> |b2|=2.06815e+16 logcf(*) used 5 iterations. it= 0: ==> |b2|=20160 it= 1: ==> |b2|=8.50608e+06 it= 2: ==> |b2|=6.30386e+09 it= 3: ==> |b2|=7.24564e+12 logcf(*) used 4 iterations. it= 0: ==> |b2|=16040 it= 1: ==> |b2|=6.12601e+06 it= 2: ==> |b2|=4.11202e+09 logcf(*) used 3 iterations. logcf(*) used 0 iterations. it= 0: ==> |b2|=9000 it= 1: ==> |b2|=2.65815e+06 it= 2: ==> |b2|=1.38218e+09 logcf(*) used 3 iterations. it= 0: ==> |b2|=6080 it= 1: ==> |b2|=1.49776e+06 it= 2: ==> |b2|=6.50656e+08 it= 3: ==> |b2|=4.39124e+11 it= 4: ==> |b2|=4.24985e+14 logcf(*) used 5 iterations. it= 0: ==> |b2|=3560 it= 1: ==> |b2|=671330 it= 2: ==> |b2|=2.24237e+08 it= 3: ==> |b2|=1.16565e+11 it= 4: ==> |b2|=8.69636e+13 it= 5: ==> |b2|=8.80714e+16 it= 6: ==> |b2|=1.16246e+20 it= 7: ==> |b2|=1.93847e+23 it= 8: ==> |b2|=3.98491e+26 logcf(*) used 9 iterations. it= 0: ==> |b2|=3273.12 it= 1: ==> |b2|=589700 it= 2: ==> |b2|=1.88377e+08 it= 3: ==> |b2|=9.36959e+10 it= 4: ==> |b2|=6.68994e+13 it= 5: ==> |b2|=6.48488e+16 it= 6: ==> |b2|=8.19327e+19 it= 7: ==> |b2|=1.30789e+23 it= 8: ==> |b2|=2.57381e+26 it= 9: ==> |b2|=6.12129e+29 logcf(*) used 10 iterations. it= 0: ==> |b2|=2992.5 it= 1: ==> |b2|=512650 it= 2: ==> |b2|=1.55894e+08 it= 3: ==> |b2|=7.3859e+10 it= 4: ==> |b2|=5.02475e+13 it= 5: ==> |b2|=4.64164e+16 it= 6: ==> |b2|=5.58911e+19 it= 7: ==> |b2|=8.50347e+22 it= 8: ==> |b2|=1.595e+26 it= 9: ==> |b2|=3.61574e+29 it=10: ==> |b2|=9.74479e+32 logcf(*) used 11 iterations. it= 0: ==> |b2|=2718.12 it= 1: ==> |b2|=440109 it= 2: ==> |b2|=1.26644e+08 it= 3: ==> |b2|=5.68225e+10 it= 4: ==> |b2|=3.66244e+13 it= 5: ==> |b2|=3.20598e+16 it= 6: ==> |b2|=3.65864e+19 it= 7: ==> |b2|=5.27587e+22 it= 8: ==> |b2|=9.37997e+25 it= 9: ==> |b2|=2.01557e+29 it=10: ==> |b2|=5.14924e+32 it=11: ==> |b2|=1.54257e+36 logcf(*) used 12 iterations. it= 0: ==> |b2|=2450 it= 1: ==> |b2|=372006 it= 2: ==> |b2|=1.00485e+08 it= 3: ==> |b2|=4.23633e+10 it= 4: ==> |b2|=2.56713e+13 it= 5: ==> |b2|=2.11343e+16 it= 6: ==> |b2|=2.26869e+19 it= 7: ==> |b2|=3.07772e+22 it= 8: ==> |b2|=5.14811e+25 it= 9: ==> |b2|=1.04082e+29 it=10: ==> |b2|=2.50192e+32 it=11: ==> |b2|=7.05238e+35 it=12: ==> |b2|=2.30384e+39 logcf(*) used 13 iterations. it= 0: ==> |b2|=2188.12 it= 1: ==> |b2|=308271 it= 2: ==> |b2|=7.72745e+07 it= 3: ==> |b2|=3.02658e+10 it= 4: ==> |b2|=1.70531e+13 it= 5: ==> |b2|=1.30605e+16 it= 6: ==> |b2|=1.30466e+19 it= 7: ==> |b2|=1.64734e+22 it= 8: ==> |b2|=2.56499e+25 it= 9: ==> |b2|=4.82765e+28 it=10: ==> |b2|=1.08039e+32 it=11: ==> |b2|=2.83535e+35 it=12: ==> |b2|=8.62389e+38 it=13: ==> |b2|=3.00926e+42 it=14: ==> |b2|=1.19409e+46 it=15: ==> |b2|=5.34632e+49 logcf(*) used 16 iterations. it= 0: ==> |b2|=1932.5 it= 1: ==> |b2|=248832 it= 2: ==> |b2|=5.68734e+07 it= 3: ==> |b2|=2.03226e+10 it= 4: ==> |b2|=1.04577e+13 it= 5: ==> |b2|=7.32086e+15 it= 6: ==> |b2|=6.68834e+18 it= 7: ==> |b2|=7.72653e+21 it= 8: ==> |b2|=1.10096e+25 it= 9: ==> |b2|=1.89662e+28 it=10: ==> |b2|=3.88536e+31 it=11: ==> |b2|=9.33474e+34 it=12: ==> |b2|=2.59938e+38 it=13: ==> |b2|=8.30457e+41 it=14: ==> |b2|=3.01718e+45 it=15: ==> |b2|=1.23692e+49 it=16: ==> |b2|=5.68258e+52 it=17: ==> |b2|=2.90768e+56 it=18: ==> |b2|=1.64796e+60 logcf(*) used 19 iterations. it= 0: ==> |b2|=1683.12 it= 1: ==> |b2|=193619 it= 2: ==> |b2|=3.91439e+07 it= 3: ==> |b2|=1.23338e+10 it= 4: ==> |b2|=5.59551e+12 it= 5: ==> |b2|=3.4562e+15 it= 6: ==> |b2|=2.78868e+18 it= 7: ==> |b2|=2.84748e+21 it= 8: ==> |b2|=3.58854e+24 it= 9: ==> |b2|=5.4701e+27 it=10: ==> |b2|=9.91885e+30 it=11: ==> |b2|=2.10987e+34 it=12: ==> |b2|=5.20269e+37 it=13: ==> |b2|=1.47211e+41 it=14: ==> |b2|=4.73732e+44 it=15: ==> |b2|=1.72036e+48 it=16: ==> |b2|=7.00164e+51 it=17: ==> |b2|=3.17394e+55 it=18: ==> |b2|=1.59374e+59 it=19: ==> |b2|=8.8205e+62 it=20: ==> |b2|=5.35623e+66 it=21: ==> |b2|=3.5541e+70 it=22: ==> |b2|=2.56724e+74 it=23: ==> |b2|=2.01172e+78 Lrg |b2| it=24: ==> |b2|=147221 it=25: ==> |b2|=1.34508e+09 it=26: ==> |b2|=1.32142e+13 it=27: ==> |b2|=1.39232e+17 logcf(*) used 28 iterations. > (lR <- logcfR(x, i=2, d=3, eps=1e-9)) [1] 0.2225364 0.2273165 0.2323964 0.2378089 0.2435921 0.2497910 0.2564582 [8] 0.2636564 0.2714610 0.2799634 0.2892758 0.2995378 0.3109259 0.3236668 [15] 0.3380584 0.3545014 0.3735507 0.3960035 0.4230578 0.4566237 0.5000000 [22] 0.5595850 0.6503112 0.8221318 0.8574109 0.8989257 0.9490572 1.0118259 [29] 1.0948318 1.2152882 1.4286636 > all.equal(lC, lR, tol = 0) # to see if .. [1] TRUE > stopifnot(all.equal(lC, lR, tol = 4e-15)) # 1.08295e-15 (Apple clang 14.0.3) > lRt <- logcfR(x, i=2, d=3, eps=1e-9, trace=TRUE) ; stopifnot(identical(lRt, lR)) logcf(x[ 1]= -5, i=2, d=3, eps=1e-09) logcf(*) end: after 11 iterations. logcf(x[ 2]= -4.75, i=2, d=3, eps=1e-09) logcf(*) end: after 11 iterations. logcf(x[ 3]= -4.5, i=2, d=3, eps=1e-09) logcf(*) end: after 11 iterations. logcf(x[ 4]= -4.25, i=2, d=3, eps=1e-09) logcf(*) end: after 10 iterations. logcf(x[ 5]= -4, i=2, d=3, eps=1e-09) logcf(*) end: after 10 iterations. logcf(x[ 6]= -3.75, i=2, d=3, eps=1e-09) logcf(*) end: after 10 iterations. logcf(x[ 7]= -3.5, i=2, d=3, eps=1e-09) logcf(*) end: after 9 iterations. logcf(x[ 8]= -3.25, i=2, d=3, eps=1e-09) logcf(*) end: after 9 iterations. logcf(x[ 9]= -3, i=2, d=3, eps=1e-09) logcf(*) end: after 9 iterations. logcf(x[10]= -2.75, i=2, d=3, eps=1e-09) logcf(*) end: after 8 iterations. logcf(x[11]= -2.5, i=2, d=3, eps=1e-09) logcf(*) end: after 8 iterations. logcf(x[12]= -2.25, i=2, d=3, eps=1e-09) logcf(*) end: after 8 iterations. logcf(x[13]= -2, i=2, d=3, eps=1e-09) logcf(*) end: after 7 iterations. logcf(x[14]= -1.75, i=2, d=3, eps=1e-09) logcf(*) end: after 7 iterations. logcf(x[15]= -1.5, i=2, d=3, eps=1e-09) logcf(*) end: after 6 iterations. logcf(x[16]= -1.25, i=2, d=3, eps=1e-09) logcf(*) end: after 6 iterations. logcf(x[17]= -1, i=2, d=3, eps=1e-09) logcf(*) end: after 5 iterations. logcf(x[18]= -0.75, i=2, d=3, eps=1e-09) logcf(*) end: after 5 iterations. logcf(x[19]= -0.5, i=2, d=3, eps=1e-09) logcf(*) end: after 4 iterations. logcf(x[20]= -0.25, i=2, d=3, eps=1e-09) logcf(*) end: after 3 iterations. logcf(x[21]= 0, i=2, d=3, eps=1e-09) logcf(*) end: after 0 iterations. logcf(x[22]= 0.25, i=2, d=3, eps=1e-09) logcf(*) end: after 3 iterations. logcf(x[23]= 0.5, i=2, d=3, eps=1e-09) logcf(*) end: after 5 iterations. logcf(x[24]= 0.75, i=2, d=3, eps=1e-09) logcf(*) end: after 9 iterations. logcf(x[25]= 0.78125, i=2, d=3, eps=1e-09) logcf(*) end: after 10 iterations. logcf(x[26]= 0.8125, i=2, d=3, eps=1e-09) logcf(*) end: after 11 iterations. logcf(x[27]= 0.84375, i=2, d=3, eps=1e-09) logcf(*) end: after 12 iterations. logcf(x[28]= 0.875, i=2, d=3, eps=1e-09) logcf(*) end: after 13 iterations. logcf(x[29]= 0.90625, i=2, d=3, eps=1e-09) logcf(*) end: after 16 iterations. logcf(x[30]= 0.9375, i=2, d=3, eps=1e-09) logcf(*) end: after 19 iterations. logcf(x[31]= 0.96875, i=2, d=3, eps=1e-09) logcf(*) end: after 28 iterations. > lRt2 <- logcfR(x, i=2, d=3, eps=1e-9, trace= 2) ; stopifnot(identical(lRt2,lR)) logcf(x[ 1]= -5, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 162720 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0168627 it= 2: ==> B2= 1.68458e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00303811 it= 3: ==> B2= 3.02689e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000541327 it= 4: ==> B2= 8.40216e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.60626e-05 it= 5: ==> B2= 3.33607e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.70167e-05 it= 6: ==> B2= 1.79478e+22 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.01154e-06 it= 7: ==> B2= 1.25703e+26 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.32664e-07 it= 8: ==> B2= 1.11146e+30 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.4179e-08 it= 9: ==> B2= 1.21086e+34 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.66472e-08 it=10: ==> B2= 1.5936e+38 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.942e-09 it=11: ==> B2= 2.49268e+42 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.19854e-10 logcf(*) end: after 11 iterations. logcf(x[ 2]= -4.75, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 151400 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0157061 it= 2: ==> B2= 1.519e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00271234 it= 3: ==> B2= 2.64707e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000463242 it= 4: ==> B2= 7.12814e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.88006e-05 it= 5: ==> B2= 2.74588e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.33808e-05 it= 6: ==> B2= 1.4333e+22 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.26999e-06 it= 7: ==> B2= 9.73998e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.84872e-07 it= 8: ==> B2= 8.35605e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.52292e-08 it= 9: ==> B2= 8.83286e+33 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.10523e-08 it=10: ==> B2= 1.12795e+38 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.8723e-09 it=11: ==> B2= 1.71192e+42 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.1713e-10 logcf(*) end: after 11 iterations. logcf(x[ 3]= -4.5, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 140480 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.014539 it= 2: ==> B2= 1.36437e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00239872 it= 3: ==> B2= 2.30332e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000391409 it= 4: ==> B2= 6.0102e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.36152e-05 it= 5: ==> B2= 2.24367e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.03211e-05 it= 6: ==> B2= 1.135e+22 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.67293e-06 it= 7: ==> B2= 7.47503e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.71005e-07 it= 8: ==> B2= 6.21522e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.38843e-08 it= 9: ==> B2= 6.3674e+33 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.10431e-09 it=10: ==> B2= 7.88061e+37 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.14987e-09 it=11: ==> B2= 1.15921e+42 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.86085e-10 logcf(*) end: after 11 iterations. logcf(x[ 4]= -4.25, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 129960 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0133641 it= 2: ==> B2= 1.22034e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00209863 it= 3: ==> B2= 1.99336e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000325959 it= 4: ==> B2= 5.03394e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.04302e-05 it= 5: ==> B2= 1.81889e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.78852e-06 it= 6: ==> B2= 8.90621e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.20172e-06 it= 7: ==> B2= 5.67763e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.85309e-07 it= 8: ==> B2= 4.56957e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.85641e-08 it= 9: ==> B2= 4.53158e+33 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.40173e-09 it=10: ==> B2= 5.429e+37 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.78171e-10 logcf(*) end: after 10 iterations. logcf(x[ 5]= -4, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 119840 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0121853 it= 2: ==> B2= 1.08655e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00181353 it= 3: ==> B2= 1.71497e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000266983 it= 4: ==> B2= 4.18587e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.91528e-05 it= 5: ==> B2= 1.46194e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.73167e-06 it= 6: ==> B2= 6.91963e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 8.38266e-07 it= 7: ==> B2= 4.26415e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.22525e-07 it= 8: ==> B2= 3.31759e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.79016e-08 it= 9: ==> B2= 3.18042e+33 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.6148e-09 it=10: ==> B2= 3.68336e+37 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.81854e-10 logcf(*) end: after 10 iterations. logcf(x[ 6]= -3.75, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 110120 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0110067 it= 2: ==> B2= 9.62637e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00154491 it= 3: ==> B2= 1.46601e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00021452 it= 4: ==> B2= 3.45334e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.96738e-05 it= 5: ==> B2= 1.16411e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.0975e-06 it= 6: ==> B2= 5.31835e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.65252e-07 it= 7: ==> B2= 3.16349e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.79297e-08 it= 8: ==> B2= 2.37577e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.07396e-08 it= 9: ==> B2= 2.19845e+33 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.47962e-09 it=10: ==> B2= 2.45771e+37 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.03808e-10 logcf(*) end: after 10 iterations. logcf(x[ 7]= -3.5, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 100800 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00983372 it= 2: ==> B2= 8.48232e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00129431 it= 3: ==> B2= 1.24442e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000168553 it= 4: ==> B2= 2.82452e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.18673e-05 it= 5: ==> B2= 9.17519e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.83198e-06 it= 6: ==> B2= 4.03952e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.66405e-07 it= 7: ==> B2= 2.3156e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.73767e-08 it= 8: ==> B2= 1.67591e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.12337e-09 it= 9: ==> B2= 1.49457e+33 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.91207e-10 logcf(*) end: after 9 iterations. logcf(x[ 8]= -3.25, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 91880 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00867282 it= 2: ==> B2= 7.42974e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00106327 it= 3: ==> B2= 1.04819e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000128994 it= 4: ==> B2= 2.28837e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.55909e-05 it= 5: ==> B2= 7.15064e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.88109e-06 it= 6: ==> B2= 3.02848e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.26734e-07 it= 7: ==> B2= 1.67007e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.7312e-08 it= 8: ==> B2= 1.1628e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.28859e-09 it= 9: ==> B2= 9.97611e+32 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.95855e-10 logcf(*) end: after 9 iterations. logcf(x[ 9]= -3, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 83360 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00753175 it= 2: ==> B2= 6.46501e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000853254 it= 3: ==> B2= 8.75389e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.5671e-05 it= 4: ==> B2= 1.83464e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.06874e-05 it= 5: ==> B2= 5.50387e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.19178e-06 it= 6: ==> B2= 2.23803e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.32765e-07 it= 7: ==> B2= 1.18496e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.47808e-08 it= 8: ==> B2= 7.92152e+28 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.64484e-09 it= 9: ==> B2= 6.52535e+32 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.82987e-10 logcf(*) end: after 9 iterations. logcf(x[10]= -2.75, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 75240 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00641978 it= 2: ==> B2= 5.58449e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000665641 it= 3: ==> B2= 7.24171e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.83222e-05 it= 4: ==> B2= 1.45381e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.98689e-06 it= 5: ==> B2= 4.17809e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.13234e-07 it= 6: ==> B2= 1.6276e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.27338e-08 it= 7: ==> B2= 8.25594e+24 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.41242e-09 it= 8: ==> B2= 5.28764e+28 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.55083e-10 logcf(*) end: after 8 iterations. logcf(x[11]= -2.5, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 67520 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00534792 it= 2: ==> B2= 4.78456e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0005016 it= 3: ==> B2= 5.92745e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.65818e-05 it= 4: ==> B2= 1.13708e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.31004e-06 it= 5: ==> B2= 3.12287e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.98074e-07 it= 6: ==> B2= 1.16261e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.67278e-08 it= 7: ==> B2= 5.6361e+24 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.38642e-09 it= 8: ==> B2= 3.44989e+28 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.12099e-10 logcf(*) end: after 8 iterations. logcf(x[12]= -2.25, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 60200 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00432911 it= 2: ==> B2= 4.06158e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00036199 it= 3: ==> B2= 4.79397e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.99753e-05 it= 4: ==> B2= 8.76351e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.47309e-06 it= 5: ==> B2= 2.2937e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.03667e-07 it= 6: ==> B2= 8.13827e+20 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.67549e-08 it= 7: ==> B2= 3.76013e+24 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.37743e-09 it= 8: ==> B2= 2.19363e+28 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.13188e-10 logcf(*) end: after 8 iterations. logcf(x[13]= -2, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 53280 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00337838 it= 2: ==> B2= 3.41194e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00024722 it= 3: ==> B2= 3.82483e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.79187e-05 it= 4: ==> B2= 6.64186e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.29399e-06 it= 5: ==> B2= 1.6515e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.32713e-08 it= 6: ==> B2= 5.56707e+20 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.71575e-09 it= 7: ==> B2= 2.44378e+24 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.83216e-10 logcf(*) end: after 7 iterations. logcf(x[14]= -1.75, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 46760 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00251277 it= 2: ==> B2= 2.83198e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000157067 it= 3: ==> B2= 3.0043e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.72602e-06 it= 4: ==> B2= 4.93794e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.00029e-07 it= 5: ==> B2= 1.16224e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.69475e-08 it= 6: ==> B2= 3.70875e+20 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.27255e-09 it= 7: ==> B2= 1.54119e+24 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.39681e-10 logcf(*) end: after 7 iterations. logcf(x[15]= -1.5, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 40640 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.001751 it= 2: ==> B2= 2.3181e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.04805e-05 it= 3: ==> B2= 2.31738e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.63221e-06 it= 4: ==> B2= 3.59e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.36258e-07 it= 5: ==> B2= 7.96488e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.20265e-08 it= 6: ==> B2= 2.39588e+20 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.11497e-10 logcf(*) end: after 6 iterations. logcf(x[16]= -1.25, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 34920 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00111245 it= 2: ==> B2= 1.86664e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.53708e-05 it= 3: ==> B2= 1.74976e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.8334e-06 it= 4: ==> B2= 2.5422e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.38016e-08 it= 5: ==> B2= 5.29017e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.96486e-09 it= 6: ==> B2= 1.49263e+20 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.18968e-10 logcf(*) end: after 6 iterations. logcf(x[17]= -1, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 29600 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000614941 it= 2: ==> B2= 1.474e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.84647e-05 it= 3: ==> B2= 1.28785e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.49306e-07 it= 4: ==> B2= 1.74436e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.62767e-08 it= 5: ==> B2= 3.38438e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.81303e-10 logcf(*) end: after 5 iterations. logcf(x[18]= -0.75, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 24680 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000270385 it= 2: ==> B2= 1.13653e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.33194e-06 it= 3: ==> B2= 9.18785e+09 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.04153e-07 it= 4: ==> B2= 1.1517e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.02617e-09 it= 5: ==> B2= 2.06815e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.93312e-11 logcf(*) end: after 5 iterations. logcf(x[19]= -0.5, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 20160 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.69704e-05 it= 2: ==> B2= 8.50608e+06 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 8.02466e-07 it= 3: ==> B2= 6.30386e+09 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 8.28445e-09 it= 4: ==> B2= 7.24564e+12 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 8.51583e-11 logcf(*) end: after 4 iterations. logcf(x[20]= -0.25, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 16040 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.26392e-06 it= 2: ==> B2= 6.12601e+06 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.30773e-08 it= 3: ==> B2= 4.11202e+09 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.25571e-11 logcf(*) end: after 3 iterations. logcf(x[21]= 0, i=2, d=3, eps=1e-09) iterations: logcf(*) end: after 0 iterations. logcf(x[22]= 0.25, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 9000 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.04918e-05 it= 2: ==> B2= 2.65815e+06 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.08623e-07 it= 3: ==> B2= 1.38218e+09 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.68393e-10 logcf(*) end: after 3 iterations. logcf(x[23]= 0.5, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 6080 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000659523 it= 2: ==> B2= 1.49776e+06 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.00942e-05 it= 3: ==> B2= 6.50656e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.02264e-07 it= 4: ==> B2= 4.39124e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.79273e-08 it= 5: ==> B2= 4.24985e+14 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.3174e-10 logcf(*) end: after 5 iterations. logcf(x[24]= 0.75, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 3560 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00856402 it= 2: ==> B2= 671330 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00100335 it= 3: ==> B2= 2.24237e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000114482 it= 4: ==> B2= 1.16565e+11 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.2922e-05 it= 5: ==> B2= 8.69636e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.45089e-06 it= 6: ==> B2= 8.80714e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.62421e-07 it= 7: ==> B2= 1.16246e+20 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.81486e-08 it= 8: ==> B2= 1.93847e+23 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.02539e-09 it= 9: ==> B2= 3.98491e+26 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.25837e-10 logcf(*) end: after 9 iterations. logcf(x[25]= 0.78125, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 3273.12 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0116683 it= 2: ==> B2= 589700 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00162549 it= 3: ==> B2= 1.88377e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000220072 it= 4: ==> B2= 9.36959e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.94426e-05 it= 5: ==> B2= 6.68994e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.9163e-06 it= 6: ==> B2= 6.48488e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.19244e-07 it= 7: ==> B2= 8.19327e+19 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.87066e-08 it= 8: ==> B2= 1.30789e+23 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.07922e-09 it= 9: ==> B2= 2.57381e+26 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.19866e-09 it=10: ==> B2= 6.12129e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.58143e-10 logcf(*) end: after 10 iterations. logcf(x[26]= 0.8125, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 2992.5 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0159401 it= 2: ==> B2= 512650 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00265674 it= 3: ==> B2= 1.55894e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000429426 it= 4: ==> B2= 7.3859e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.84941e-05 it= 5: ==> B2= 5.02475e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.08546e-05 it= 6: ==> B2= 4.64164e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.71404e-06 it= 7: ==> B2= 5.58911e+19 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.70071e-07 it= 8: ==> B2= 8.50347e+22 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.2492e-08 it= 9: ==> B2= 1.595e+26 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.6788e-09 it=10: ==> B2= 3.61574e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.04899e-09 it=11: ==> B2= 9.74479e+32 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.64668e-10 logcf(*) end: after 11 iterations. logcf(x[27]= 0.84375, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 2718.12 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0218736 it= 2: ==> B2= 440109 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00440022 it= 3: ==> B2= 1.26644e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000856838 it= 4: ==> B2= 5.68225e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000164362 it= 5: ==> B2= 3.66244e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.12964e-05 it= 6: ==> B2= 3.20598e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.93505e-06 it= 7: ==> B2= 3.65864e+19 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.12276e-06 it= 8: ==> B2= 5.27587e+22 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.12056e-07 it= 9: ==> B2= 9.37997e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.00067e-08 it=10: ==> B2= 2.01557e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.54162e-09 it=11: ==> B2= 5.14924e+32 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.42081e-09 it=12: ==> B2= 1.54257e+36 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.67552e-10 logcf(*) end: after 12 iterations. logcf(x[28]= 0.875, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 2450 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0302147 it= 2: ==> B2= 372006 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00742718 it= 3: ==> B2= 1.00485e+08 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00176572 it= 4: ==> B2= 4.23633e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000412688 it= 5: ==> B2= 2.56713e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.56191e-05 it= 6: ==> B2= 2.11343e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.20491e-05 it= 7: ==> B2= 2.26869e+19 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.0698e-06 it= 8: ==> B2= 3.07772e+22 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.16356e-06 it= 9: ==> B2= 5.14811e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.66706e-07 it=10: ==> B2= 1.04082e+29 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.10778e-08 it=11: ==> B2= 2.50192e+32 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.39778e-08 it=12: ==> B2= 7.05238e+35 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.19721e-09 it=13: ==> B2= 2.30384e+39 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.31016e-10 logcf(*) end: after 13 iterations. logcf(x[29]= 0.90625, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 2188.12 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0421192 it= 2: ==> B2= 308271 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0128742 it= 3: ==> B2= 7.72745e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00381265 it= 4: ==> B2= 3.02658e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00110791 it= 5: ==> B2= 1.70531e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000318587 it= 6: ==> B2= 1.30605e+16 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 9.10705e-05 it= 7: ==> B2= 1.30466e+19 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.5941e-05 it= 8: ==> B2= 1.64734e+22 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.37247e-06 it= 9: ==> B2= 2.56499e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.09206e-06 it=10: ==> B2= 4.82765e+28 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.93012e-07 it=11: ==> B2= 1.08039e+32 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.6796e-07 it=12: ==> B2= 2.83535e+35 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.75428e-08 it=13: ==> B2= 8.62389e+38 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.34511e-08 it=14: ==> B2= 3.00926e+42 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.80425e-09 it=15: ==> B2= 1.19409e+46 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.07559e-09 it=16: ==> B2= 5.34632e+49 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.04032e-10 logcf(*) end: after 16 iterations. logcf(x[30]= 0.9375, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 1932.5 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0594391 it= 2: ==> B2= 248832 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.02317 it= 3: ==> B2= 5.68734e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00882488 it= 4: ==> B2= 2.03226e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00329775 it= 5: ==> B2= 1.04577e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00121712 it= 6: ==> B2= 7.32086e+15 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000445765 it= 7: ==> B2= 6.68834e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00016248 it= 8: ==> B2= 7.72653e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.90414e-05 it= 9: ==> B2= 1.10096e+25 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.14101e-05 it=10: ==> B2= 1.89662e+28 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.7527e-06 it=11: ==> B2= 3.88536e+31 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.80437e-06 it=12: ==> B2= 9.33474e+34 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.01363e-06 it=13: ==> B2= 2.59938e+38 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.6615e-07 it=14: ==> B2= 8.30457e+41 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.32201e-07 it=15: ==> B2= 3.01718e+45 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.77137e-08 it=16: ==> B2= 1.23692e+49 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.72154e-08 it=17: ==> B2= 5.68258e+52 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.20986e-09 it=18: ==> B2= 2.90768e+56 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.23951e-09 it=19: ==> B2= 1.64796e+60 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 8.07503e-10 logcf(*) end: after 19 iterations. logcf(x[31]= 0.96875, i=2, d=3, eps=1e-09) iterations: it= 1: ==> B2= 1683.12 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0852619 it= 2: ==> B2= 193619 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0440308 it= 3: ==> B2= 3.91439e+07 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0227933 it= 4: ==> B2= 1.23338e+10 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.0116823 it= 5: ==> B2= 5.59551e+12 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00592272 it= 6: ==> B2= 3.4562e+15 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00297607 it= 7: ==> B2= 2.78868e+18 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00148555 it= 8: ==> B2= 2.84748e+21 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.00073801 it= 9: ==> B2= 3.58854e+24 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000365396 it=10: ==> B2= 5.4701e+27 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 0.000180472 it=11: ==> B2= 9.91885e+30 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 8.89791e-05 it=12: ==> B2= 2.10987e+34 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.38122e-05 it=13: ==> B2= 5.20269e+37 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.15512e-05 it=14: ==> B2= 1.47211e+41 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.05929e-05 it=15: ==> B2= 4.73732e+44 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 5.20351e-06 it=16: ==> B2= 1.72036e+48 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.55486e-06 it=17: ==> B2= 7.00164e+51 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.25391e-06 it=18: ==> B2= 3.17394e+55 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 6.15209e-07 it=19: ==> B2= 1.59374e+59 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.0176e-07 it=20: ==> B2= 8.8205e+62 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.47979e-07 it=21: ==> B2= 5.35623e+66 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 7.25526e-08 it=22: ==> B2= 3.5541e+70 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 3.55657e-08 it=23: ==> B2= 2.56724e+74 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.7432e-08 it=24: ==> B2= 2.01172e+78 Lrg m.B2 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 8.54292e-09 it=25: ==> B2= 147221 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.18617e-09 it=26: ==> B2= 1.34508e+09 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 2.05108e-09 it=27: ==> B2= 1.32142e+13 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 1.00487e-09 it=28: ==> B2= 1.39232e+17 --> crit. |A2*b1 - a1*B2|/|b1*B2| = 4.92273e-10 logcf(*) end: after 28 iterations. > > lR. <- logcfR.(x, i=2, d=3, eps=1e-9) > lR.t <- logcfR.(x, i=2, d=3, eps=1e-9, trace=TRUE) ; stopifnot(identical(lR.t, lR.)) logcf(x[], i=2, d=3, eps=1e-09) iterations: it= 1: needIt: 30 TRUE, and 1 F.; length(x[])=30, m.B2= 23307.2 it= 2: needIt: 30 TRUE; length(x[])=30, m.B2= 1.01159e+07 it= 3: needIt: 30 TRUE; length(x[])=30, m.B2= 7.70605e+09 it= 4: needIt: 28 TRUE, and 2 F.; length(x[])=28, m.B2= 1.00852e+13 it= 5: needIt: 27 TRUE, and 1 F.; length(x[])=27, m.B2= 1.76419e+16 it= 6: needIt: 24 TRUE, and 3 F.; length(x[])=24, m.B2= 4.75316e+19 it= 7: needIt: 22 TRUE, and 2 F.; length(x[])=22, m.B2= 1.2798e+23 it= 8: needIt: 20 TRUE, and 2 F.; length(x[])=20, m.B2= 3.63581e+26 it= 9: needIt: 17 TRUE, and 3 F.; length(x[])=17, m.B2= 6.8674e+29 it=10: needIt: 13 TRUE, and 4 F.; length(x[])=13, m.B2= 1.03776e+33 it=11: needIt: 9 TRUE, and 4 F.; length(x[])= 9, m.B2= 3.09233e+35 it=12: needIt: 5 TRUE, and 4 F.; length(x[])= 5, m.B2= 2.27357e+35 it=13: needIt: 4 TRUE, and 1 F.; length(x[])= 4, m.B2= 4.04868e+38 it=14: needIt: 3 TRUE, and 1 F.; length(x[])= 3, m.B2= 7.16537e+41 it=15: needIt: 3 TRUE; length(x[])= 3, m.B2= 2.57468e+45 it=16: needIt: 3 TRUE; length(x[])= 3, m.B2= 1.04393e+49 it=17: needIt: 2 TRUE, and 1 F.; length(x[])= 2, m.B2= 1.99468e+52 it=18: needIt: 2 TRUE; length(x[])= 2, m.B2= 9.60666e+55 it=19: needIt: 2 TRUE; length(x[])= 2, m.B2= 5.12487e+59 it=20: needIt: 1 TRUE, and 1 F.; length(x[])= 1, m.B2= 8.8205e+62 it=21: needIt: 1 TRUE; length(x[])= 1, m.B2= 5.35623e+66 it=22: needIt: 1 TRUE; length(x[])= 1, m.B2= 3.5541e+70 it=23: needIt: 1 TRUE; length(x[])= 1, m.B2= 2.56724e+74 it=24: needIt: 1 TRUE; length(x[])= 1, m.B2= 2.01172e+78 Lrg m.B2 it=25: needIt: 1 TRUE; length(x[])= 1, m.B2= 147221 it=26: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.34508e+09 it=27: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.32142e+13 it=28: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.39232e+17 logcf(*) end: after 28 iterations. > > all.equal(lC, lR., tol = 0) # TRUE !! (every where ?) [1] TRUE > all.equal(lR, lR., tol = 0) # TRUE !! " " [1] TRUE > stopifnot(all.equal(lC, lR., tol = 1e-14)) > ## (even though they used eps=1e-9 .. i.e., are not *so* accurate) > showProc.time() Time (user system elapsed): 0.04 0 0.05 > > ##--- now with improved logcfR.() {<< will become the new logcfR() at least for MPFR !}: > > ##require(Rmpfr) may be not, see if NS loading (via "::") is sufficient: > requireNamespace("Rmpfr") || quit("no") Loading required namespace: Rmpfr [1] TRUE > ## ----- ---------- > xM <- Rmpfr::mpfr(x, 512) > (ct.14 <- system.time(lR.14 <- logcfR.(xM, i=2, d=3, eps=1e-20, trace=TRUE))) # 0.55 sec logcf(x[], i=2, d=3, eps=1e-20) iterations: it= 1: needIt: 30 TRUE, and 1 F.; length(x[])=30, m.B2= 23307.2 it= 2: needIt: 30 TRUE; length(x[])=30, m.B2= 1.01159e+07 it= 3: needIt: 30 TRUE; length(x[])=30, m.B2= 7.70605e+09 it= 4: needIt: 30 TRUE; length(x[])=30, m.B2= 9.10781e+12 it= 5: needIt: 30 TRUE; length(x[])=30, m.B2= 1.54287e+16 it= 6: needIt: 30 TRUE; length(x[])=30, m.B2= 3.54543e+19 it= 7: needIt: 30 TRUE; length(x[])=30, m.B2= 1.06137e+23 it= 8: needIt: 29 TRUE, and 1 F.; length(x[])=29, m.B2= 4.19177e+26 it= 9: needIt: 28 TRUE, and 1 F.; length(x[])=28, m.B2= 2.26761e+30 it=10: needIt: 27 TRUE, and 1 F.; length(x[])=27, m.B2= 1.33011e+34 it=11: needIt: 27 TRUE; length(x[])=27, m.B2= 9.0823e+37 it=12: needIt: 26 TRUE, and 1 F.; length(x[])=26, m.B2= 7.15387e+41 it=13: needIt: 25 TRUE, and 1 F.; length(x[])=25, m.B2= 6.21918e+45 it=14: needIt: 24 TRUE, and 1 F.; length(x[])=24, m.B2= 9.51187e+49 it=15: needIt: 23 TRUE, and 1 F.; length(x[])=23, m.B2= 1.04428e+54 it=16: needIt: 22 TRUE, and 1 F.; length(x[])=22, m.B2= 1.19866e+58 it=17: needIt: 21 TRUE, and 1 F.; length(x[])=21, m.B2= 1.40641e+62 it=18: needIt: 20 TRUE, and 1 F.; length(x[])=20, m.B2= 1.64566e+66 it=19: needIt: 19 TRUE, and 1 F.; length(x[])=19, m.B2= 1.86787e+70 it=20: needIt: 17 TRUE, and 2 F.; length(x[])=17, m.B2= 9.5095e+73 it=21: needIt: 15 TRUE, and 2 F.; length(x[])=15, m.B2= 2.07684e+78 Lrg m.B2 it=22: needIt: 14 TRUE, and 1 F.; length(x[])=14, m.B2= 122830 it=23: needIt: 11 TRUE, and 3 F.; length(x[])=11, m.B2= 3.76273e+08 it=24: needIt: 10 TRUE, and 1 F.; length(x[])=10, m.B2= 7.77428e+11 it=25: needIt: 7 TRUE, and 3 F.; length(x[])= 7, m.B2= 4.17254e+13 it=26: needIt: 6 TRUE, and 1 F.; length(x[])= 6, m.B2= 1.55243e+15 it=27: needIt: 5 TRUE, and 1 F.; length(x[])= 5, m.B2= 2.47748e+15 it=28: needIt: 4 TRUE, and 1 F.; length(x[])= 4, m.B2= 1.06982e+19 it=29: needIt: 4 TRUE; length(x[])= 4, m.B2= 1.40477e+23 it=30: needIt: 4 TRUE; length(x[])= 4, m.B2= 1.9693e+27 it=31: needIt: 3 TRUE, and 1 F.; length(x[])= 3, m.B2= 7.6538e+30 it=32: needIt: 3 TRUE; length(x[])= 3, m.B2= 1.16488e+35 it=33: needIt: 3 TRUE; length(x[])= 3, m.B2= 1.88175e+39 it=34: needIt: 3 TRUE; length(x[])= 3, m.B2= 3.22081e+43 it=35: needIt: 3 TRUE; length(x[])= 3, m.B2= 5.83159e+47 it=36: needIt: 3 TRUE; length(x[])= 3, m.B2= 1.11521e+52 it=37: needIt: 2 TRUE, and 1 F.; length(x[])= 2, m.B2= 3.51533e+55 it=38: needIt: 2 TRUE; length(x[])= 2, m.B2= 7.10714e+59 it=39: needIt: 2 TRUE; length(x[])= 2, m.B2= 1.51138e+64 it=40: needIt: 2 TRUE; length(x[])= 2, m.B2= 3.37644e+68 it=41: needIt: 2 TRUE; length(x[])= 2, m.B2= 7.91477e+72 it=42: needIt: 2 TRUE; length(x[])= 2, m.B2= 1.94455e+77 Lrg m.B2 it=43: needIt: 2 TRUE; length(x[])= 2, m.B2= 43197.4 it=44: needIt: 2 TRUE; length(x[])= 2, m.B2= 1.16214e+09 it=45: needIt: 1 TRUE, and 1 F.; length(x[])= 1, m.B2= 2.11103e+12 it=46: needIt: 1 TRUE; length(x[])= 1, m.B2= 5.83147e+16 it=47: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.68004e+21 it=48: needIt: 1 TRUE; length(x[])= 1, m.B2= 5.04365e+25 it=49: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.57649e+30 it=50: needIt: 1 TRUE; length(x[])= 1, m.B2= 5.12638e+34 it=51: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.7329e+39 it=52: needIt: 1 TRUE; length(x[])= 1, m.B2= 6.08495e+43 it=53: needIt: 1 TRUE; length(x[])= 1, m.B2= 2.21796e+48 it=54: needIt: 1 TRUE; length(x[])= 1, m.B2= 8.38622e+52 it=55: needIt: 1 TRUE; length(x[])= 1, m.B2= 3.28706e+57 it=56: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.33476e+62 it=57: needIt: 1 TRUE; length(x[])= 1, m.B2= 5.61156e+66 it=58: needIt: 1 TRUE; length(x[])= 1, m.B2= 2.44114e+71 it=59: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.0982e+76 it=60: needIt: 1 TRUE; length(x[])= 1, m.B2= 5.10636e+80 Lrg m.B2 it=61: needIt: 1 TRUE; length(x[])= 1, m.B2= 2.1182e+08 it=62: needIt: 1 TRUE; length(x[])= 1, m.B2= 1.05047e+13 it=63: needIt: 1 TRUE; length(x[])= 1, m.B2= 5.37602e+17 logcf(*) end: after 63 iterations. user system elapsed 0.78 0.00 0.79 > (ct14 <- system.time(lR14 <- logcfR (xM, i=2, d=3, eps=1e-20, trace=TRUE))) # 4 sec logcf(x[ 1]= -5, i=2, d=3, eps=1e-20) logcf(*) end: after 26 iterations. logcf(x[ 2]= -4.75, i=2, d=3, eps=1e-20) logcf(*) end: after 25 iterations. logcf(x[ 3]= -4.5, i=2, d=3, eps=1e-20) logcf(*) end: after 24 iterations. logcf(x[ 4]= -4.25, i=2, d=3, eps=1e-20) logcf(*) end: after 24 iterations. logcf(x[ 5]= -4, i=2, d=3, eps=1e-20) logcf(*) end: after 23 iterations. logcf(x[ 6]= -3.75, i=2, d=3, eps=1e-20) logcf(*) end: after 22 iterations. logcf(x[ 7]= -3.5, i=2, d=3, eps=1e-20) logcf(*) end: after 22 iterations. logcf(x[ 8]= -3.25, i=2, d=3, eps=1e-20) logcf(*) end: after 21 iterations. logcf(x[ 9]= -3, i=2, d=3, eps=1e-20) logcf(*) end: after 20 iterations. logcf(x[10]= -2.75, i=2, d=3, eps=1e-20) logcf(*) end: after 19 iterations. logcf(x[11]= -2.5, i=2, d=3, eps=1e-20) logcf(*) end: after 19 iterations. logcf(x[12]= -2.25, i=2, d=3, eps=1e-20) logcf(*) end: after 18 iterations. logcf(x[13]= -2, i=2, d=3, eps=1e-20) logcf(*) end: after 17 iterations. logcf(x[14]= -1.75, i=2, d=3, eps=1e-20) logcf(*) end: after 16 iterations. logcf(x[15]= -1.5, i=2, d=3, eps=1e-20) logcf(*) end: after 15 iterations. logcf(x[16]= -1.25, i=2, d=3, eps=1e-20) logcf(*) end: after 14 iterations. logcf(x[17]= -1, i=2, d=3, eps=1e-20) logcf(*) end: after 12 iterations. logcf(x[18]= -0.75, i=2, d=3, eps=1e-20) logcf(*) end: after 11 iterations. logcf(x[19]= -0.5, i=2, d=3, eps=1e-20) logcf(*) end: after 9 iterations. logcf(x[20]= -0.25, i=2, d=3, eps=1e-20) logcf(*) end: after 7 iterations. logcf(x[21]= 0, i=2, d=3, eps=1e-20) logcf(*) end: after 0 iterations. logcf(x[22]= 0.25, i=2, d=3, eps=1e-20) logcf(*) end: after 8 iterations. logcf(x[23]= 0.5, i=2, d=3, eps=1e-20) logcf(*) end: after 13 iterations. logcf(x[24]= 0.75, i=2, d=3, eps=1e-20) logcf(*) end: after 20 iterations. logcf(x[25]= 0.78125, i=2, d=3, eps=1e-20) logcf(*) end: after 22 iterations. logcf(x[26]= 0.8125, i=2, d=3, eps=1e-20) logcf(*) end: after 24 iterations. logcf(x[27]= 0.84375, i=2, d=3, eps=1e-20) logcf(*) end: after 27 iterations. logcf(x[28]= 0.875, i=2, d=3, eps=1e-20) logcf(*) end: after 30 iterations. logcf(x[29]= 0.90625, i=2, d=3, eps=1e-20) logcf(*) end: after 36 iterations. logcf(x[30]= 0.9375, i=2, d=3, eps=1e-20) logcf(*) end: after 44 iterations. logcf(x[31]= 0.96875, i=2, d=3, eps=1e-20) logcf(*) end: after 63 iterations. user system elapsed 7.03 0.05 7.08 > > all.equal(lR.14, lR14, tol=0) # TRUE [1] TRUE > identical(lR.14, lR14) # TRUE !! (not sure if on all platforms!) [1] TRUE > > SS <- function(ch, digits=7) + sub(paste0("([0-9]{1,",digits,"})[0-9]*e"), "\\1e", ch) > ## double prec <--> MPFR: vvvv (same eps) > lR.9 <- logcfR.(xM, 2,3, eps=1e-9) > ## show: > SS(Rmpfr::all.equal(Rmpfr::roundMpfr(lR.9, 64), lR, tol=0))# .. 5.1138e-16 [1] "Mean relative difference: 5.113806e-16" > stopifnot(Rmpfr::all.equal(lR.9, lR , tol=1e-15)) > SS(Rmpfr::all.equal(lR.14, lR.9, tol=0))# .. 3.701..e-10 [1] "Mean relative difference: 3.701317e-10" > stopifnot(Rmpfr::all.equal(lR.14, lR.9, tol=1e-9)) > showProc.time() Time (user system elapsed): 8.74 0.08 8.81 > > > ### 2b: log1pmx() > ## == ========= > > ## The first part is from original ../man/log1pmx.Rd > > e <- if(doExtras) 2^-12 else 2^-8; by.p <- 1/(if(doExtras) 256 else 64) > xd <- sort(c(seq(-1+e, 0+100*e, by=e), seq(by.p, 5, by=by.p))) # length 676 or 5476 if do.X. > plot(xd, log1pmx(xd), type="l", col=2, main = "log1pmx(x)") > abline(h=0, v=-1:0, lty=3) > > xM <- Rmpfr::mpfr(xd, 512) > asNumeric <- Rmpfr::asNumeric > ## for MPFR numbers, really need more than tol_logcf = eps = 1e-14 (default) > if(doExtras) { + print( system.time( # the logcfR() completely unvectorized is *slow* + lg1pM <- log1pmx(xM, tol_logcf = 1e-25, eps2 = 1e-4, trace=TRUE) + )) # 2 sec [new logcfR.()] if(doExtras), otherwise 0.43s, but ??s (!) on winbuilder! + lines(xd, asNumeric(lg1pM), col=adjustcolor(4, 1/4), lwd=3) + } > lg1pdR <- log1pmx(xd, trace=TRUE, logCF=logcfR) logcf(x[ 1]=0.424599, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 2]=0.417707, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 3]=0.410914, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 4]= 0.40422, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 5]=0.397623, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 6]=0.391121, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 7]=0.384714, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 8]= 0.3784, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[ 9]=0.372177, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[10]=0.366044, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[11]= 0.36, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[12]=0.354044, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[13]=0.348173, i=3, d=2, eps=1e-14) logcf(*) end: after 7 iterations. logcf(x[14]=0.342388, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[15]=0.336686, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[16]=0.331067, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[17]= 0.32553, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[18]=0.320072, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[19]=0.314694, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[20]=0.309393, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[21]=0.304169, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[22]=0.299021, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[23]=0.293947, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[24]=0.288947, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[25]=0.284019, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[26]=0.279162, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[27]=0.274376, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[28]= 0.26966, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[29]=0.265012, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[30]=0.260431, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[31]=0.255917, i=3, d=2, eps=1e-14) logcf(*) end: after 6 iterations. logcf(x[32]=0.251468, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[33]=0.247085, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[34]=0.242764, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[35]=0.238507, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[36]=0.234312, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[37]=0.230178, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[38]=0.226104, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[39]= 0.22209, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[40]=0.218134, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[41]=0.214237, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[42]=0.210396, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[43]=0.206612, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[44]=0.202883, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[45]=0.199208, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[46]=0.195588, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[47]=0.192021, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[48]=0.188507, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[49]=0.185044, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[50]=0.181633, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[51]=0.178272, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[52]= 0.17496, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[53]=0.171698, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[54]=0.168484, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[55]=0.165318, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[56]=0.162199, i=3, d=2, eps=1e-14) logcf(*) end: after 5 iterations. logcf(x[57]=0.159127, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[58]= 0.1561, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[59]=0.153119, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[60]=0.150183, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[61]= 0.14729, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[62]=0.144441, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[63]=0.141635, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[64]=0.138871, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[65]=0.136149, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[66]=0.133468, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[67]=0.130828, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[68]=0.128229, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[69]=0.125668, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[70]=0.123147, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[71]=0.120665, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[72]= 0.11822, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[73]=0.115814, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[74]=0.113444, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[75]=0.111111, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[76]=0.108814, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[77]=0.106553, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[78]=0.104327, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[79]=0.102136, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[80]=0.0999795, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[81]=0.0978567, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[82]=0.0957673, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[83]=0.093711, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[84]=0.0916872, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[85]=0.0896957, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[86]=0.0877359, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[87]=0.0858076, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[88]=0.0839102, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[89]=0.0820434, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[90]=0.0802068, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[91]= 0.0784, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[92]=0.0766227, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[93]=0.0748744, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[94]=0.0731548, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[95]=0.0714636, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[96]=0.0698003, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[97]=0.0681647, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[98]=0.0665564, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[99]=0.064975, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[100]=0.0634202, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[101]=0.0618917, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[102]=0.0603892, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[103]=0.0589122, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[104]=0.0574606, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[105]=0.056034, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[106]=0.054632, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[107]=0.0532544, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[108]=0.0519009, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[109]=0.0505712, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[110]=0.0492649, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[111]=0.0479819, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[112]=0.0467217, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[113]=0.0454842, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[114]=0.044269, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[115]=0.0430758, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[116]=0.0419045, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[117]=0.0407547, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[118]=0.0396262, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[119]=0.0385186, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[120]=0.0374319, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[121]=0.0363656, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[122]=0.0353196, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[123]=0.0342936, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[124]=0.0332873, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[125]=0.0323005, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[126]=0.0313331, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[127]=0.0303846, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[128]=0.029455, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[129]=0.028544, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[130]=0.0276514, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[131]=0.0267769, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[132]=0.0259203, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[133]=0.0250814, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[134]= 0.02426, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[135]=0.0234559, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[136]=0.0226689, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[137]=0.0218987, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[138]=0.0211452, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[139]=0.0204082, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[140]=0.0196874, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[141]=0.0189827, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[142]=0.0182939, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[143]=0.0176208, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[144]=0.0169632, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[145]=0.0163209, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[146]=0.0156938, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[147]=0.0150816, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[148]=0.0144841, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[149]=0.0139013, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[150]=0.013333, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[151]=0.0127788, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[152]=0.0122388, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[153]=0.0117127, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[154]=0.0112003, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[155]=0.0107015, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[156]=0.0102162, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[157]=0.00974415, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[158]=0.0092852, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[159]=0.00883921, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[160]=0.00840604, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[161]=0.00798551, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[162]=0.0075775, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[163]=0.00718184, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[164]=0.0067984, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[165]=0.00642703, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[166]=0.00606759, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[167]=0.00571994, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[168]=0.00538393, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[169]=0.00505944, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[170]=0.00474632, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[171]=0.00444444, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[172]=0.00415368, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[173]=0.0038739, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[174]=0.00360497, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[175]=0.00334677, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[176]=0.00309916, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[177]=0.00286203, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[178]=0.00263525, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[179]=0.0024187, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[180]=0.00221227, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[181]=0.00201583, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[182]=0.00182926, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[183]=0.00165246, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[184]=0.0014853, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[185]=0.00132767, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[186]=0.00117947, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[187]=0.00104058, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[188]=0.000910898, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[189]=0.00079031, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[190]=0.000678712, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[191]=0.000576, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[192]=0.00048207, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[193]=0.000396819, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[194]=0.000320147, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[195]=0.000251953, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[196]=0.000192138, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[197]=0.000140605, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[198]=9.72577e-05, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[199]=6.20001e-05, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[200]=3.47382e-05, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[201]=3.39335e-05, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[202]=6.00925e-05, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[203]=6.00925e-05, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[204]=9.35317e-05, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[205]=0.000134166, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[206]=0.000181912, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[207]=0.000236686, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[208]=0.000236686, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[209]=0.000298407, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[210]=0.000366994, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[211]=0.000442366, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[212]=0.000524445, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[213]=0.000524445, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[214]=0.000613152, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[215]=0.00070841, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[216]=0.000810142, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[217]=0.000918274, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[218]=0.000918274, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[219]=0.00103273, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[220]=0.00115344, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[221]=0.00128032, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[222]=0.00141331, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[223]=0.00141331, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[224]=0.00155233, i=3, d=2, eps=1e-14) logcf(*) end: after 1 iterations. logcf(x[225]=0.00169732, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[226]=0.0018482, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[227]=0.0020049, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[228]=0.0020049, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[229]=0.00216736, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[230]=0.00233551, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[231]=0.00250929, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[232]=0.00268861, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[233]=0.00268861, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[234]=0.00287344, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[235]=0.00306368, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[236]=0.0032593, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[237]=0.00346021, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[238]=0.00346021, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[239]=0.00366636, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[240]=0.00387769, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[241]=0.00409413, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[242]=0.00431563, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[243]=0.00431563, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[244]=0.00454212, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[245]=0.00477355, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[246]=0.00500986, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[247]=0.005251, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[248]=0.005251, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[249]=0.0054969, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[250]=0.0057475, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[251]=0.00600276, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[252]=0.00626262, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[253]=0.00626262, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[254]=0.00652702, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[255]=0.0067959, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[256]=0.00706923, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[257]=0.00734694, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[258]=0.00734694, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[259]=0.00762898, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[260]=0.0079153, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[261]=0.00820585, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[262]=0.00850058, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[263]=0.00850058, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[264]=0.00879944, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[265]=0.00910237, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[266]=0.00940934, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[267]=0.00972029, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[268]=0.00972029, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[269]=0.0100352, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[270]=0.010354, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[271]=0.0106766, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[272]=0.011003, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[273]=0.011003, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[274]=0.0113331, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[275]=0.011667, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[276]=0.0120045, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[277]=0.0123457, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[278]=0.0123457, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[279]=0.0126904, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[280]=0.0130386, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[281]=0.0133904, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[282]=0.0137455, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[283]=0.0137455, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[284]=0.0141041, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[285]=0.0144661, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[286]=0.0148313, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[287]=0.0151998, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[288]=0.0151998, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[289]=0.0155716, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[290]=0.0159466, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[291]=0.0163247, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[292]=0.016706, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[293]=0.016706, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[294]=0.0170903, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[295]=0.0174777, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[296]=0.0178681, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[297]=0.0182615, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[298]=0.0182615, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[299]=0.0186578, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[300]=0.019057, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[301]=0.0194591, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[302]=0.019864, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[303]=0.019864, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[304]=0.0202717, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[305]=0.0206821, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[306]=0.0210953, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[307]=0.0215111, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[308]=0.0215111, i=3, d=2, eps=1e-14) logcf(*) end: after 2 iterations. logcf(x[309]=0.0219296, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[310]=0.0223507, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[311]=0.0227745, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[312]=0.0232007, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[313]=0.0232007, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[314]=0.0236295, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[315]=0.0240608, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[316]=0.0244946, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[317]=0.0249307, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[318]=0.0249307, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[319]=0.0253693, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[320]=0.0258103, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[321]=0.0262535, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[322]=0.0266991, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[323]=0.0266991, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[324]=0.028504, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[325]=0.0303434, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[326]=0.0322156, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[327]=0.034119, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[328]=0.0360519, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[329]=0.0380127, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[330]= 0.04, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[331]=0.0420123, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[332]=0.0440482, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[333]=0.0461064, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[334]=0.0481856, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[335]=0.0502847, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[336]=0.0524024, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[337]=0.0545376, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[338]=0.0566893, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[339]=0.0588565, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[340]=0.0610381, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[341]=0.0632331, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[342]=0.0654408, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[343]=0.0676601, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[344]=0.0698903, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[345]=0.0721306, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[346]=0.0743802, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[347]=0.0766383, i=3, d=2, eps=1e-14) logcf(*) end: after 3 iterations. logcf(x[348]=0.0789042, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[349]=0.0811772, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[350]=0.0834568, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[351]=0.0857422, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[352]=0.0880328, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[353]=0.0903282, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[354]=0.0926276, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[355]=0.0949306, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[356]=0.0972367, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[357]=0.0995453, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[358]=0.101856, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[359]=0.104168, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[360]=0.106482, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[361]=0.108796, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. logcf(x[362]=0.111111, i=3, d=2, eps=1e-14) logcf(*) end: after 4 iterations. > lines(xd, lg1pdR, col=adjustcolor(5, 1/4), lwd=5) > ## > lg1pM. <- log1p(xM) - xM > xM2k <- Rmpfr::mpfr(xd, 2048) # even more bits > lg1pM2k <- log1p(xM2k) - xM2k > relErrV <- sfsmisc::relErrV > reE00 <- asNumeric( relErrV(lg1pM2k, lg1pM.) ) > print(signif(range(reE00)), 2) # [-1.5e-151, 4.8e-151] ==> 512 bits is sufficient [1] -1.7e-152 8.1e-153 > plot(reE00 ~ xd, type="l") > plot(abs(reE00) ~ xd, type="l", log="y") Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > plot(reE00 ~ xd, type="l", subset = abs(xd) <= 1/64) > plot(abs(reE00) ~ xd, type="l", log="y", subset = abs(xd) <= 1) Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > if(doExtras) { ## the error of the log1pmx() "algorithm" even for "perfect" mpfr-accuracy: + rE.log1pm <- asNumeric(relErrV(lg1pM2k, lg1pM)) + print(summary( rE.log1pm ) ) # -1.1e-26 7.9e-28 {"matching" tol_logcf = 1e-25 above} + } > showProc.time() Time (user system elapsed): 0.16 0.01 0.17 > reR <- asNumeric(relErrV(lg1pM., log1pmx(xd))) > > re <- asNumeric(relErrV(lg1pM., log1pmx(xd))) > ## MM: From around here, "move" to vignette <<<<<<<<<<<<<<<<<<<<<<<<< ../vignettes/log1pmx-etc.Rnw <<<<<< > > plot(xd, re, type="b", cex=1/4, + xlab=quote(x), main="relErrV(log1p(xM) - xM, log1pmx(x)), xM <- mpfr(x, 2048)") > abline(h = (-2:2)*2^-52, lty=2, col=adjustcolor("gray20", 1/2)) > xl <- -0.84; xr <- -0.4 ## the "relevant x-range": > colR <- adjustcolor("tomato", 1/2) > abline(v= c(xl,xr), col=colR, lty=2, lwd=2) > axis(1,at=c(xl,xr), labels=NULL, col.axis="tomato", col=colR, lwd=2, cex.axis=3/4) > text(xl, adj=c(0,-1/2), par("usr")[3], "zoom in", col=colR) > showProc.time() Time (user system elapsed): 0.04 0.02 0.06 > > # only "relevant" x-range: values inside (xl, xr) > iN <- xl < xd & xd < xr > plot(xd[iN], re[iN], type="b", cex=1/4, main="rel.Error of log1pmx(x)", + xlab=quote(x), ylab=quote(rE(x)), sub = "(in relevant x-range)") > abline(h = (-2:2)*2^-52, lty=2, col=adjustcolor("gray30", 1/2)) > abline(v = c(xl,xr), col=colR, lty=2, lwd=2) > > plot(xd[iN], abs(re[iN]), type="b", cex=1/2, log="y", + main = "| relErr( log1pmx(x) ) | {via 'Rmpfr'}", + ylab=quote(abs(rE(x))), xlab=quote(x), + ylim = c(4e-17, max(abs(asNumeric(re)[iN])))) > abline(h = c(1:2,4)*2^-52, lty=2, col=adjustcolor("gray20", 1/2)) > mL1 <- eval(formals(log1pmx)$minL1) > abline(v = mL1, lwd=3, col=adjustcolor(2, 1/2)) > axis(3, at=mL1, "minL1", col.axis=2, col=2) > > mL1 <- -0.7; re2 <- asNumeric(relErrV(lg1pM.[iN], log1pmx(xd[iN], minL1 = mL1))) > lines(xd[iN], abs(re2), col=adjustcolor(4, 1/2), lwd=2) > abline(v = mL1, lwd=3, col=adjustcolor(4, 2/3), lty=3) > axis(3, line=-1, at=mL1, sprintf("mL1 = %g",mL1), col.axis=4, col=4) > R <- xd[iN] >= mL1; stopifnot(re2[R] == re[iN][R]) > > mL1 <- -0.66; re3 <- asNumeric(relErrV(lg1pM.[iN], log1pmx(xd[iN], minL1 = mL1))) > re3.2 <- asNumeric(relErrV(lg1pM.[iN], log1pmx(xd[iN], minL1 = mL1, eps2 = .02))) > print(max(abs(re3))) == # 4.818203e-16 + max(abs(re3.2)) # TRUE ! of course, eps2 does not matter as long as it is far from our x-range !! [1] 4.514185e-16 [1] TRUE > xd[iN][which.max(abs(re3))] # -0.5710449 [1] -0.65625 > lines(xd[iN], abs(re3), col=adjustcolor(6, 1/3), lwd=2) > abline(v = mL1, lwd=3, col=adjustcolor(6, 2/3), lty=3) > axis(3, line=-2, at=mL1, sprintf("mL1 = %g",mL1), col.axis=6, col=6) > lines(lowess(xd[iN], abs(re[iN]), f=1/50), col=adjustcolor("gray", 1/2), lwd=6) > lines(lowess(xd[iN], abs(re2), f=1/50), col=adjustcolor(4, 1/2), lwd=6) > lines(lowess(xd[iN], abs(re3), f=1/50), col=adjustcolor(6, 1/2), lwd=6) > R <- xd[iN] > mL1; stopifnot(re3[R] == re2[R]) > ## MM: for vignette, stop here? > ## ---> since max(|re4|) {below} == max(|re3|) > > mL1 <- -0.64; re4 <- asNumeric(relErrV(lg1pM.[iN], log1pmx(xd[iN], minL1 = mL1))) > max(abs(re4)) == max(abs(re3)) # TRUE ! [1] FALSE > lines(xd[iN], abs(re4), col=adjustcolor(7, 1/3), lwd=2) > abline(v = mL1, lwd=3, col=adjustcolor(7, 2/3), lty=3) > axis(3, line=-2, at=mL1, sprintf("mL1 = %g",mL1), col.axis=7, col=7) > lines(lowess(xd[iN], abs(re[iN]), f=1/50), col=adjustcolor("gray", 1/2), lwd=6) > lines(lowess(xd[iN], abs(re2), f=1/50), col=adjustcolor(4, 1/2), lwd=6) > lines(lowess(xd[iN], abs(re3), f=1/50), col=adjustcolor(6, 1/2), lwd=6) > lines(lowess(xd[iN], abs(re4), f=1/50), col=adjustcolor(7, 1/2), lwd=6) > R <- xd[iN] > mL1; stopifnot(re4[R] == re3[R]) > > re5 <- asNumeric(relErrV(lg1pM.[iN], log1pmx(xd[iN], minL1 = -0.6))) > max(abs(re5)) == max(abs(re3)) # TRUE !.. still not better [1] FALSE > lines(xd[iN], abs(re5), col=adjustcolor(8, 1/3), lwd=2) > abline(v = -0.6, lwd=3, col=adjustcolor(8, 2/3), lty=3) > axis(3, line=-1, at=-0.6, sprintf("mL1 = %g",mL1), col.axis=8, col=8) > lines(lowess(xd[iN], abs(re[iN]), f=1/50), col=adjustcolor("gray", 1/2), lwd=6) > lines(lowess(xd[iN], abs(re2), f=1/50), col=adjustcolor(4, 1/2), lwd=6) > lines(lowess(xd[iN], abs(re3), f=1/50), col=adjustcolor(6, 1/2), lwd=6) > lines(lowess(xd[iN], abs(re4), f=1/50), col=adjustcolor(7, 1/2), lwd=6) > lines(lowess(xd[iN], abs(re5), f=1/50), col=adjustcolor(8, 1/2), lwd=6) > R <- xd[iN] > -0.6; stopifnot(re5[R] == re4[R]) > ## -0.6 now is clearly too large, -0.7 was better {MM: why the > showProc.time() Time (user system elapsed): 0.08 0 0.08 > > > ##--- separate: is eps2 = 0.01 "optimal" / "good enough" ?? > > k. <- if(doExtras) 3 else 0 > str(xS <- unique(sort(c(seq(-1/32, 1/32, by=2^-(12+k.)), + seq(-1,1, by=2^-(7+k.))/2^(4+k.))))) ## 257 or 3841 values num [1:385] -0.0625 -0.062 -0.0615 -0.061 -0.0605 ... > plot(xS, log1pmx(xS), type="l", col=2, main = "log1pmx(x)") > abline(h=0, v = c(-.01, .01), lwd=3, col=adjustcolor(7, 2/3), lty=3) > ## nothing visible at +- .01 > > xSm <- Rmpfr::mpfr(xS, 1024) > xSM <- Rmpfr::mpfr(xS, 8192) > lg1pM. <- log1p(xSm) - xSm ## the direct formally using many bits ==> not much cancellation > summary(abs(asNumeric(relErrV(log1p(xSM) - xSM, lg1pM.))))# <= 4.1e-304 : 1024 is enough! Min. 1st Qu. Median Mean 3rd Qu. Max. 0.000e+00 6.609e-308 1.345e-307 4.574e-307 3.077e-307 1.695e-305 > reS <- asNumeric(relErrV(lg1pM., log1pmx(xS))) > summary(reS) ## Lnx 64b gcc 11.2.1, 20210728: Min. 1st Qu. Median Mean 3rd Qu. Max. -1.924e-16 -4.782e-17 4.595e-18 5.005e-18 5.794e-17 2.299e-16 > ## Min. 1st Qu. Median Mean 3rd Qu. Max. > ## -2.625e-16 -5.246e-17 1.973e-18 1.211e-18 5.286e-17 2.688e-16 > plot(xS, abs(reS), type="b", cex=1/2, log="y", + main = "| relErr( log1pmx() ) | {via 'Rmpfr'}" + , ylim = c(4e-17, max(abs(asNumeric(reS)))) + , panel.last= abline(h=0, v = c(-.01, .01), lwd=3, col=adjustcolor(7, 2/3), lty=3)) Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > ## no problem visible at +/- eps2 = +/- 0.01 > stopifnot(abs(reS) < 1e-15, mean(abs(reS)) < 6e-16) # seen 2.688e-16, 6.35e-17 > showProc.time() Time (user system elapsed): 0.25 0 0.25 > > ## in spite of the above; ... what's the approximation error of accurate log1pmx() ? > p.Err <- function(eps2 = .01, tol_logcf = 1e-17, xM=xSm) { + stopifnot(eps2 > 0, tol_logcf > 0, + inherits(xM, "mpfr"), (prec <- Rmpfr::getPrec(xM)) >= 64) + lg1pM <- log1p(xM) - xM # direct formula suffering from cancellation + lg1pM.<- log1pmx(xM, tol_logcf=tol_logcf, eps2=eps2) + sys.call() + reM <- asNumeric(relErrV(lg1pM., lg1pM)) + plot(asNumeric(xM), abs(reM), type="b", cex=1/2, log="y", xlab = quote(x), + ylim = quantile(abs(reM), c(1/20,1), names=FALSE), + sub = paste("min(getPrec(x)) =", min(prec)), + main = sprintf("relative error of R log1pmx(eps2=%g, tol_logcf=%g)", eps2, tol_logcf)) + abline(h=0, v = eps2*c(-1,1), lwd=3, col=adjustcolor(7, 2/3), lty=3) + invisible(reM) + } > > ### --- for tol_logcf = 1e-17 --------------------------------------------- > reSM <- p.Err() # aha! Here, eps2 = .01 was definitely too large! Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM001 <- p.Err(.001) # still too large Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > xM2 <- Rmpfr::mpfr(seq(-1,1, length=1+1024)/2^8, 1024) > reSM3_4 <- p.Err(3e-4, xM=xM2)# still too large Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM294 <- p.Err(2.9e-4, xM=xM2)# still Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM2854<- p.Err(2.85e-4, xM=xM2)# still (and practically identical to 2.9e-4) Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > ## cbind(reSM294, reSM2854)[reSM294 != reSM2854 , ] > ## reSM294 reSM2854 > ## [1,] 2.572818e-36 2.988004e-46 > ## [2,] -2.565617e-36 -2.977915e-46 > reSM284 <- p.Err(2.8e-4, xM=xM2)# now too small -- bad! Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM274 <- p.Err(2.7e-4, xM=xM2)# (ditto) too small Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > showProc.time() Time (user system elapsed): 3.47 0 3.47 > > ### --- for tol_logcf = 1e-14 == R's default! > reSM <- p.Err( tol = 1e-14) ## eps2=.01 is *still* too large Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM002 <- p.Err(.002, tol = 1e-14) # still too large Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM0017 <- p.Err(.0017, tol = 1e-14) # still .. Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM00165<- p.Err(.00165,tol = 1e-14) # still.. Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM00163<- p.Err(.00163,tol = 1e-14) # still.. <<<<<<<<<<<<< SHOULD WE CHANGE R TO USE THIS? Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM00162<- p.Err(.00162,tol = 1e-14) # already (very barely!) too small Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > reSM0016 <- p.Err(.0016, tol = 1e-14) # already (barely!) too small Warning message: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > showProc.time() Time (user system elapsed): 1.76 0.01 1.78 > > summary(warnings()) 1 identical warnings: In xy.coords(x, y, xlabel, ylabel, log) : 1 y value <= 0 omitted from logarithmic plot > > proc.time() user system elapsed 14.85 0.21 15.01