Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1834

Re: solution

From Peter <petsie@dordos.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: solution
Date 2011-04-22 09:40 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iorie2$o4e$1@smc.vnet.net> (permalink)
References <iojpp7$i52$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

solution amelia Jackson <meli.jacson@gmail.com> - 2011-04-19 10:56 +0000
  Re: solution "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-04-20 08:27 +0000
  Re: solution Gary Wardall <gwardall@gmail.com> - 2011-04-20 08:29 +0000
  Re: solution Peter <petsie@dordos.net> - 2011-04-22 09:40 +0000

csiph-web