Hi, Does anyone know how to code newton's method for finding the roots of polynomial functions? im not sure whether i need to do this manually, or just code something with a loop to stop when it gets to the desired result thanks guys! _________________________________________________________________ Looking to move somewhere new this winter? Let ninemsn property help [[elided Hotmail spam]] =Domain_tagline&_m=EXT [[alternative HTML version deleted]]
Kon Knafelman wrote:> Hi, > > Does anyone know how to code newton's method for finding the roots of polynomial functions? im not sure whether i need to do this manually, or just code something with a loop to stop when it gets to the desired resultSee ?optim for optimization methods. Uwe Ligges> thanks guys! > > _________________________________________________________________ > Looking to move somewhere new this winter? Let ninemsn property help > > [[elided Hotmail spam]] > =Domain_tagline&_m=EXT > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
Finding polynomial roots is not a problem where one wants a quick and dirty code. There are a lot of pitfalls, especially if there are roots that are multiples, and there has been a lot of work on this problem. See http://en.wikipedia.org/wiki/Category:Root-finding_algorithms . And Uwe may not be aware that optim() is contra-recommended for functions of 1 variable, which seems to be the problem here. But there is ?polyroot JN Message: 130 Date: Tue, 12 May 2009 11:12:51 +0200 From: Uwe Ligges <ligges at statistik.tu-dortmund.de> Subject: Re: [R] newtons method To: Kon Knafelman <konk2001 at hotmail.com> Cc: r-help at stat.math.ethz.ch Message-ID: <4A093D93.1020702 at statistik.tu-dortmund.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Kon Knafelman wrote:> > Hi, > > > > Does anyone know how to code newton's method for finding the roots of polynomial functions? im not sure whether i need to do this manually, or just code something with a loop to stop when it gets to the desired result >See ?optim for optimization methods. Uwe Ligges