On 31-05-2013, at 10:34, Martin Maechler <maech...@stat.math.ethz.ch> wrote:
….. > From the current feedbacks, I'd come to propose / further > discuss the following issues: > > 1) the goal is to remain with one function uniroot() > > 2) Instead of the 'Sig' = "sign(f'(x_0))" {not quite, but typically} > with 4 different value classes, namely > NULL, -1, 0, 1, (where +/- 1 are equivalent to any positive > or negative finite number respectively), > > we should either use a string with 4 different possible values > or a {logical or NULL}, say 'upcrossing' > (which also gives 4 values, NULL, NA, FALSE, TRUE). > > > 3) [I'm not sure about this:] > The new default of the 'Sig' replacement would correspond to > the current Sig = NULL which does extend the search > interval when that does not constitute a sign change. > > Alternatively, implicitly proposed by Ravi Varadhan, the > default would correspond to Sig = 0, i.e. to the current > uniroot() behavior which signals an error as soon as the initial > interval is not large enough. > > Further opinions and suggestions for '2)' and '3)' are still > very welcome! I agree with Ravi. Ravi's example shows what can go wrong. Let the default behaviour of a new uniroot() be the current behaviour. No harm will be done to any existent applications. An option would be to append a suggestion to the current error message: "Consider setting argument Sig to non-zero to expand the range of x" or something similar when Sig = 0 and uniroot can't find a solution. In addition I think that it should be possible to specify an absolute lower and upper limit for x in order to avoid evaluating a function for invalid values of its argument (e.g. log(x) for negative x) Silly example: xstart <- c(100,110) unirootS(f, xstart, Sig=10,trace=2) Berend ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel