MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: using FindRoot to find multiple answers in a domain?

  • To: mathgroup at
  • Subject: [mg69100] Re: using FindRoot to find multiple answers in a domain?
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Wed, 30 Aug 2006 06:33:03 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <ed0rn9$sm6$>
  • Sender: owner-wri-mathgroup at

akil wrote:
> I want to find all answers that exist in a certain domain, but FindRoot 
> gives only the first answer it finds (Using other methods like Solve,Reduce 
> etc takes too long, so Im stuck with using FindRoot). I give the problem I 
> have by example, the functions I use are really complex, but by solving the 
> problem for the example, I could solve t for the complex part.
> Example:
> Finding all intersections of Cos[x] and Sin[x] in the domain [0,10Pi]
> Doing:
> FindRoot[Cos[antwoord] == Sin[antwoord], {antwoord, 0, 0, 10Pi}]
> FindRoot[Cos[antwoord] == Sin[antwoord], {antwoord, %, %, 10Pi}]
> does not work the second FindRoot gives the exact same answer back. So using 
> this in a loop to find all intersections does not work.
> Doing FindRoot[Cos[antwoord] == Sin[antwoord], {antwoord, %+0.01, %+0.01, 
> 10Pi}] instead, also does not work.
> Any way to find all intersections in a specified domain?
> Akil
Hi Akil,

Have a look at Ted Ersek's _RootSearch_ package.

"RootSearch looks for all roots of an equation between xmin and xmax. A 
package is provided which defines a function called RootSearch. 
RootSearch[lhs==rhs,{x,xmin,xmax}] tries to find all roots in the 
specified range. The algorithm is very robust as demonstrated in the 
notebook (RootSearchExamples.nb). Options are provided to allow 
arbitrary precision convergence to roots. Installation instructions are 
provided in the notebook (RootSearchExamples.nb)."

Best regards,

  • Prev by Date: Re: Re: Numerical evaluation is Mathematica bottleneck?!
  • Next by Date: Re: Re: General--Exponential simplifications by default
  • Previous by thread: Re: using FindRoot to find multiple answers in a domain?
  • Next by thread: Minor gripe re Table formatting