Re: [R] re cursive root finding

2008-08-09 Thread baptiste auguie
Hi all, with a lot more fiddling around, I've come up with this solution: x - seq(1, 15, length=100) y - jitter(cos(x), a=0.2) plot(x, y) findZero - function(x, y, guess = mean(range(x)), exclusion= 5*diff(range(x))/length(x)) { interval - c(guess - exclusion,

Re: [R] re cursive root finding

2008-08-08 Thread Hans W. Borchers
As your curve is defined by its points, I don't see any reason to artificially apply functions such as 'uniroot' or 'optim' (being a real overkill in this situation). First smooth the curve with splines, Savitsky-Golay, or Whittacker smoothing, etc., then loop through the sequence of points

Re: [R] re cursive root finding

2008-08-08 Thread baptiste auguie
On 8 Aug 2008, at 16:44, Hans W. Borchers wrote: As your curve is defined by its points, I don't see any reason to artificially apply functions such as 'uniroot' or 'optim' (being a real overkill in this situation). I probably agree with this, although the process of using a spline

Re: [R] re cursive root finding

2008-08-08 Thread Ravi Varadhan
. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of baptiste auguie Sent: Friday, August 08, 2008 1:25 PM To: Hans W. Borchers Cc: r-help@r-project.org Subject: Re: [R] re cursive root finding On 8 Aug 2008, at 16:44, Hans W. Borchers wrote: As your curve

Re: [R] re cursive root finding

2008-08-08 Thread baptiste auguie
:[EMAIL PROTECTED] ] On Behalf Of baptiste auguie Sent: Friday, August 08, 2008 1:25 PM To: Hans W. Borchers Cc: r-help@r-project.org Subject: Re: [R] re cursive root finding On 8 Aug 2008, at 16:44, Hans W. Borchers wrote: As your curve is defined by its points, I don't see any reason