Re: solution
- To: mathgroup at smc.vnet.net
- Subject: [mg118324] Re: solution
- From: Peter <petsie at dordos.net>
- Date: Fri, 22 Apr 2011 05:40:15 -0400 (EDT)
- References: <iojpp7$i52$1@smc.vnet.net>
Am 19.04.2011 12:56, schrieb amelia Jackson:
> Dear MathGroup,
>
> I have a problem. I want to find solution:
> r := Table[
> k /. FindRoot[BesselJ[0, k] + k BesselJ[1, k] == 0, {k, n}], {n, 1, 100}]
>
> but I get about 30 roots. I need about 100 or more.
> I think that "step" "n" tend to Pi
>
> Please for help...
Hi Amelia,
FindRoot[f[k]==0,{k,kstart,k0,k1}] looks only in the interval [k0,k1]
for roots. Unfortunately it returns one of the boundaries when no root
is found. So we have to check if in that case the returned value is a
root by chance:
f[k_]=BesselJ[0,k]+k BesselJ[1,k];
Length[zeros=Block[{cnt=0,k0=2.,k},
NestWhileList[
(k0++;
(k /. FindRoot[f[k] == 0, {k, k0 + 1/2, k0, k0 + 1}]) /.
x:(k0 | k0 + 1) /; Chop[f[x]] != 0 :> Unevaluated@Sequence[])&,
{},
Length[{##}] <= 100 &, All]
] // Rest
] // Quiet
You can check if some roots have been left out using:
Plot[f[x]/Sqrt[x], {x, 3, Last[zeros] + .2}, Mesh -> {zeros},
MeshFunctions -> {#1 &}, MeshStyle -> Red, ImageSize -> 1200,
AspectRatio -> 1/10]
Peter