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) > > > broydt <- function(x) { + n <- length(x) + f <- rep(NA, n) + #h <- 0.5 + h <- 2 + f[1] <- ((3 - h*x[1]) * x[1]) - 2*x[2] + 1 + tnm1 <- 2:(n-1) + f[tnm1] <- ((3 - h*x[tnm1]) * x[tnm1]) - x[tnm1-1] - 2*x[tnm1+1] + 1 + f[n] <- ((3 - h*x[n]) * x[n]) - x[n-1] + 1 + f + } > > > p0 <- rnorm(50) > ans.opt <- BBsolve(par=p0, fn=broydt) # note that the default doesn't work generally. Successful convergence. > > ans.opt$convergence [1] 0 > > z <- sum(ans.opt$par) > #good <- -352.9190956497645 > good <- -34.72104 > #on Windows > #on Linux64 > #on Linux32 -352.9190956497645 > print(z, digits=16) [1] -34.72104372934071 > if(any(abs(good - z) > 5e-1)) stop("BB test BBsolve FAILED") > > proc.time() user system elapsed 0.20 0.04 0.21