RE: List, FindRoot, Bessel

*To*: mathgroup at smc.vnet.net*Subject*: [mg33643] RE: [mg33628] List, FindRoot, Bessel*From*: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>*Date*: Thu, 4 Apr 2002 19:40:05 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

> -----Original Message----- > From: Riadh Alimi [mailto:alimir3 at cti.ecp.fr] To: mathgroup at smc.vnet.net > Sent: Thursday, April 04, 2002 1:09 AM > To: mathgroup at smc.vnet.net > Subject: [mg33643] [mg33628] List, FindRoot, Bessel > > > Hi ! > > I'm trying to find the first n roots of an equation involving Bessel > Functions and to create a List of them. > > The best thing I find so far is : > n = 10; > For[i = 0, i < n, > Print[FindRoot[- k BesselJ[1, k] + 30 BesselJ[0, k] == 0, {k, > 2.32 + i Pi}]]; > i++] > > And the result I get is : > > {k->3.2} > {k->5.2} > {k->8.3} > .... > > Does anyone know what {k->3.2} means ? And how I could get > only the value > 3.2 instead of {k->3.2} in order to create a list? > > Thank you > > > Riadh, with the expression ... In[4]:= sols = Function[i, FindRoot[-k BesselJ[1, k] + 30 BesselJ[0, k] == 0, {k, 2.32 + i Pi}]] /@ Range[0, 9] Out[4]= {{k -> 2.32614}, {k -> 5.34098}, {k -> 8.37707}, {k -> 11.4221}, {k -> 14.4748}, {k -> 17.5348}, {k -> 20.602}, {k -> 23.6762}, {k -> 26.7568}, {k -> 29.8435}} ... you get your solutions as a list of replacement rules. A list of values then simply is attained by: In[5]:= k /. sols However, quite often it is more convenient to use the rules, e.g. in In[6]:= Plot[-k BesselJ[1, k] + 30 BesselJ[0, k], {k, 0, 12\[Pi]}, Epilog -> {Hue[0], PointSize[.01], Point[{k, 0}] /. sols}] -- Hartmut