MathGroup Archive 2008

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

Search the Archive

Re: Find roots in a limited interval

  • To: mathgroup at
  • Subject: [mg86767] Re: Find roots in a limited interval
  • From: "David Park" <djmpark at>
  • Date: Thu, 20 Mar 2008 02:56:46 -0500 (EST)
  • References: <frqpvr$5be$>


Ted Ersek has a very nice package called RootSearch that you can obtain from 

Although the Mathematica FindRoot function is more general, RootSearch is by 
far better and more convenient for cases of searching for a root of a single 
real function within an interval. These are probably 95% of root finding 
cases and why WRI doesn't make this a standard part of Mathematica is beyond 
me. Here is an example. All you have to do is give the equation and the 
interval in which you want the roots and Ted's routine will find all the 
roots in the interval in order.


f[x_] := 1/2 Sinc[x] - 2 Sinc[3 x]

xroots = x /. RootSearch[f[x] == 0, {x, 0, 5}]

Using the Presentations package, the following plots the function, the roots 
as small filled circles and marks the root values along the x-axis along 
with faint vertical grid lines marking the root locations. In Presentations, 
one can make believe one is plotting in the complex plane and give point 
locations as simple complex numbers.


 {xticks = CustomTicks[Identity, databased[xroots]]},
  {Draw[f[x], {x, 0, 5}],
   {Gray, ComplexLine[{0, 5}]},
   ComplexCirclePoint[#, 3, Black, White] & /@ xroots},
  Frame -> True,
  FrameTicks -> {xticks, Automatic, xticks // NoTickLabels,
  GridLines -> {CustomGridLines[Identity,
     databased@xroots, {LightGray}], None},
  PlotLabel -> Row[{"Roots of ", f[x]}],
  BaseStyle -> {FontSize -> 12},
  ImageSize -> 400]

David Park
djmpark at

<viktor.albers at> wrote in message news:frqpvr$5be$1 at
> Dear all,
> Being a Mathematica beginner I struggle to find a solution to a fairly
> simple problem. I have a function (superposition of several weighted
> sinc functions) which in principle has infinitely many roots.
> However I am interested only in lets say roots that are to be found
> within the limited interval between 0 and 5.
> I tried to define a system of inequalities of the type
> Solve[f[t] && t>0 && t<5, t] but no success.
> I played around with the function Reduce but did not have any success
> and I am also not sure if this is the right way forward.
> So the question: Is it possible to define an interval in Mathematica
> in which I am looking for the roots?
> Thank you for your time.
> Regards,
> Viktor

  • Prev by Date: Re: choose elements from list based on elements in different list
  • Next by Date: Re: choose elements from list based on elements in different list
  • Previous by thread: Re: Find roots in a limited interval
  • Next by thread: Exceptions Style Problem