R Under development (unstable) (2026-02-18 r89435 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 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. > if(!require("BB"))stop("this test requires package BB.") Loading required package: BB > if(!require("setRNG"))stop("this test requires setRNG.") Loading required package: setRNG > > # Use a preset seed so test values are reproducable. > test.rng <- list(kind="Mersenne-Twister", normal.kind="Inversion", seed=1234) > old.seed <- setRNG(test.rng) > > troesch <- function(x) { + n <- length(x) + tnm1 <- 2:(n-1) + f <- rep(NA, n) + h <- 1 / (n+1) + h2 <- 10 * h^2 + f[1] <- 2 * x[1] + h2 * sinh(10 * x[1]) - x[2] + f[tnm1] <- 2 * x[tnm1] + h2 * sinh(10 * x[tnm1]) - x[tnm1-1] - x[tnm1+1] + + f[n] <- 2 * x[n] + h2 * sinh(10* x[n]) - x[n-1] - 1 + f + } > > > p0 <- matrix(runif(50), 5, 10) # 5 starting values, each of length 10 > #ans <- BBsolve(par=p0, fn=troesch) > ans <- multiStart(par=p0, fn=troesch) Parameter set : 1 ... Successful convergence. Parameter set : 2 ... Successful convergence. Parameter set : 3 ... Successful convergence. Parameter set : 4 ... Successful convergence. Parameter set : 5 ... Successful convergence. > ans$par [,1] [,2] [,3] [,4] [,5] [,6] [1,] 7.334505e-05 0.0002072649 0.0005125418 0.001241411 0.002996175 0.007227533 [2,] 7.333860e-05 0.0002072840 0.0005125398 0.001241385 0.002996190 0.007227555 [3,] 7.330212e-05 0.0002072497 0.0005125399 0.001241410 0.002996208 0.007227538 [4,] 7.335155e-05 0.0002072763 0.0005125371 0.001241404 0.002996218 0.007227563 [5,] 7.332926e-05 0.0002072850 0.0005125493 0.001241387 0.002996177 0.007227535 [,7] [,8] [,9] [,10] [1,] 0.01743732 0.04213119 0.1026836 0.2638176 [2,] 0.01743731 0.04213120 0.1026835 0.2638176 [3,] 0.01743725 0.04213114 0.1026835 0.2638176 [4,] 0.01743730 0.04213120 0.1026836 0.2638175 [5,] 0.01743730 0.04213120 0.1026835 0.2638176 > ans$info NULL > > # ans$convergence > > z <- sum(ans$par) > good <- 2.191639378551349 > #on Windows > #on Linux64 > #on Linux32 2.191639378551349 > print(z, digits=16) [1] 2.191639378551339 > if(any(abs(good - z) > 5e-9)) stop("BB test BBsolve Troesch FAILED") > > proc.time() user system elapsed 0.18 0.04 0.21