Re: sorting list of roots af a transcendental function

• To: mathgroup at smc.vnet.net
• Subject: [mg65275] Re: sorting list of roots af a transcendental function
• From: Paul Abbott <paul at physics.uwa.edu.au>
• Date: Thu, 23 Mar 2006 06:58:40 -0500 (EST)
• Organization: The University of Western Australia
• References: <dvrcdq\$a6i\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In article <dvrcdq\$a6i\$1 at smc.vnet.net>, Dule <dule23 at gmx.de> wrote:

> for calculating a model i need values for x which are given by the
> transcendental function Cot[x] == x/a - a/(4*x). a is a parameter 0<a<200.
> i obtained the roots with Table and FindRoot:
> Table[FindRoot[Cot[x] == x/a - a/(4*x), {x, i}], {i, 1, 50}]]
>
> I have two questions:
> 1. Is there a better way to do this?

Yes. Have a look at the RootSearch package by Ted Ersek:

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

This package returns all the roots over a specified range as a list of
that appeared in "Finding Roots in an Interval" in The Mathematica
Journal 7(2), 1998).

> 2. How can i construct a list, where the values for x, which appear
> multiple are dropped?

Using RootSearch you will not get multiples. The simplest way of
removing repeated entries from a list is to use Union

Union[{a,b,c,a}]

{a, b, c}

If entries are not exactly the same then you can use the SameTest option
for Union.

Cheers,
Paul

_______________________________________________________________________
Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)
AUSTRALIA                               http://physics.uwa.edu.au/~paul

```

• Prev by Date: Re: Integration Bug
• Next by Date: Re: sorting list of roots af a transcendental function
• Previous by thread: Re: sorting list of roots af a transcendental function
• Next by thread: Re: sorting list of roots af a transcendental function