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

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

```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)."

http://library.wolfram.com/infocenter/MathSource/4482/

Best regards,
Jean-Marc

```

• 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