MathGroup Archive 2001

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

Search the Archive

Re: roots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29392] Re: [mg29380] roots
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Sat, 16 Jun 2001 22:43:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

It seems to me that the easiest way is this. First of all, we know that the
roots will all be between -20<x<20 (since Abs[Cos[x]]<1). So start with
 In[5]:=
Plot[0.05 x +Cos[x],{x,-20,20}]

You will see all 13-teen roots. Now click on the graphic to select it.
Holding the Command key down on the Mac (I guess the Control key under
Windows?) click on the individual points where the curve intersects the x
axis and Copy. Paste the result into the FindRoot command (removing the
y-value) as below. You will get pretty good approximations to all the roots.
Here are just the first four values obtained in this way:

In[7]:=
FindRoot[0.05*x + Cos[x] == 0, {x, -18.8966}]
Out[7]=
{x -> -19.1433}
In[8]:=
FindRoot[0.05*x + Cos[x] == 0, {x, {-18.394}}]
Out[8]=
{x -> -18.4538}
In[9]:=
FindRoot[0.05*x + Cos[x] == 0, {x, -13.4688}]
Out[9]=
{x -> -13.4028}
In[10]:=
FindRoot[0.05*x + Cos[x] == 0, {x, -11.6596}]
Out[10]=
{x -> -11.6152}

-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/~andrzej/



on 01.6.16 3:47 PM, maarten.vanderburgt at icos.be at
maarten.vanderburgt at icos.be wrote:

> hallo,
> 
> What is the easiest solution to finding the 13 (real) roots of 0.05 x +
> Cos[x] == 0.
> I can be easily seen that there are 13 roots by plotting:
> Plot[{0.05 x,-Cos[x]},{x,-30,30}]
> but this is not sufficient for finding accurate numerical values.
> 
> FindRoot only gives one value and it is hard to predict which root it will
> find with a specified start value:
> 
> In[83]:= FindRoot[0.05 x  +Cos[x] == 0,{x,0}]
> 
> Out[83]= {x -> -4.96317}
> 
> There are three roots closer to 0 then x == -4.96317
> 
> An NSolve only works for polynomials.
> 
> Is there no simple way to find all roots of such an equation, eventually
> within a specified range.
> 
> thanks for your help
> 
> Maarten van der Burgt
> Leuven
> 
> 
> 
> 
> 
> 




  • Prev by Date: Re: Java, Graphics Output, MathCanvas
  • Next by Date: Roots of a function
  • Previous by thread: Re: roots
  • Next by thread: RE: roots