Re: sorting list of roots af a transcendental function
- To: mathgroup at smc.vnet.net
- Subject: [mg65286] Re: [mg65260] sorting list of roots af a transcendental function
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 24 Mar 2006 00:59:43 -0500 (EST)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
a=200*Random[]
110.895
Duplicates can be removed with Union.
Union[
Table[
x/.FindRoot[Cot[x]==x/a-a/(4*x),{x,i}],
{i,50}],
SameTest->(Abs[#1-#2]<10^-6&)]
{3.03232,6.06528,9.09946,12.1354,15.1737,18.2148,21.2589,24.3065,27.3
576,30.\
4126,33.4713,36.5339,39.6003,42.6705,45.7443,48.8216}
However, the need for Union can be avoided by using better initial values for
FindRoot
Table[
x/.FindRoot[Cot[x]==x/a-a/(4*x),{x,i*Pi-0.1}],
{i,50/Pi+1}]
{3.03232,6.06528,9.09946,12.1354,15.1737,18.2148,21.2589,24.3065,27.3
576,30.\
4126,33.4713,36.5339,39.6003,42.6705,45.7443,48.8216}
%==%%
True
Bob Hanlon
>
> From: Dule <dule23 at gmx.de>
To: mathgroup at smc.vnet.net
> Subject: [mg65286] [mg65260] sorting list of roots af a transcendental function
>
> Dear group,
>
> 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?
> 2. How can i construct a list, where the values for x, which appear
> multiple are dropped?
>
> Thanks!
>
>