The package rootoned on http://r-forge.r-project.org/R/?group_id=395 has an all-R version of zeroin (the algorithm of uniroot). This should also be in Rmpfr by Martin M., as it was set up for that use. I suspect it can be vectorized fairly easily. However, it may be simpler to write, or else abstract from that code, a vectorized false position or secant code (same formula, FP must have end points with opposite sign function values, so is `safer'). This avoids the bisection step and simplifies things, but may be a bit less efficient sometimes. JN Date: Fri, 9 Nov 2012 14:58:55 +0000 From: Ravi Varadhan <ravi.varadhan at jhu.edu> To: "'ivo.welch at gmail.com'" <ivo.welch at gmail.com> Cc: "r-help at r-project.org" <r-help at r-project.org> Subject: Re: [R] vectorized uni-root? Message-ID: <2F9EA67EF9AE1C48A147CB41BE2E15C32E8D67 at DOM-EB-MAIL1.win.ad.jhu.edu> Content-Type: text/plain Hi Ivo, The only problem is that uniroot() actually uses Brent's algorithm, and is based on the C code from netlib (there is also Fortran code available - zeroin.f). Brent's algorithm is more sophisticated than a simple bisection approach that you have vectorized. It combines bisection and secant methods along with some quadratic interpolation. The idea behind this hybrid approach (which by the way is a fundamental theme in all of numerical analysis) is to get faster convergence while not sacrificing the global convergence of bisection. So, the existing uniroot() will not be deprecated unless you can vectorize Brent's hybrid root-finding approach! Best, Ravi
vectorized uni-root?
1 message · John C Nash