sammyny wrote:
> 
> 
> If someone could point me a correct working version of newton method for
> finding roots and its usage, that would be helpful.
> 

You mentioned in your original post that you had no idea how to use nleqslv.
nleqslv provides a Broyden and Newton method with several different global
search  strategies for "difficult" functions.

Here it is an example using your function (which is not particulary
difficult if you look at the plot):

library(nleqslv)

# starting value -2
nleqslv(-2,f)

# starting value 8
nleqslv(8,f)

# manual multistart
for( x in seq(-3,8,1)) { z <- nleqslv(x,f); print(c(z$x,z$fvec))}

These example all use the Broyden method.

If you want the Newton method then you can do

for( x in seq(-3,8,1)) { z <- nleqslv(x,f,method="Newton");
print(c(z$x,z$fvec))}


/Berend
-- 
View this message in context: 
http://r.789695.n4.nabble.com/newton-method-tp2306111p2306973.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to