       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
In:=
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:=
FindRoot[0.05*x + Cos[x] == 0, {x, -18.8966}]
Out=
{x -> -19.1433}
In:=
FindRoot[0.05*x + Cos[x] == 0, {x, {-18.394}}]
Out=
{x -> -18.4538}
In:=
FindRoot[0.05*x + Cos[x] == 0, {x, -13.4688}]
Out=
{x -> -13.4028}
In:=
FindRoot[0.05*x + Cos[x] == 0, {x, -11.6596}]
Out=
{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:= FindRoot[0.05 x  +Cos[x] == 0,{x,0}]
>
> Out= {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.
>
>
> 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