Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: List, FindRoot, Bessel

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33651] Re: List, FindRoot, Bessel
  • From: adam.smith at hillsdale.edu (Adam Smith)
  • Date: Thu, 4 Apr 2002 19:40:21 -0500 (EST)
  • References: <a8g3c5$b3e$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The construction {k->3.2},{k->5.2} is called a replacement rule in
Mathematica.  If you want to assign a value using your method then you
need to use the following construction k/.FindRoot[...].  Specifically
for your example:

n = 3;
For[m = 0, m < n,
 Print[
    k /. FindRoot[-k BesselJ[1, k] + 30 BesselJ[0, k] == 0, {k, 2.32 +
m Pi}]];
  m++]

Note:  I changed your counter "i" to "m".  This is a personal taste -
I try to avoid "i" so that I don't get it confused with the "I" symbol
defined in Mathematica to be the Sqrt[-1]

However, there is a better method using the Table[] command

n = 3;
myk = Table[
    k /. FindRoot[- k BesselJ[1, k] + 30 BesselJ[0, k] == 0, 
{k, 2.32 + m*Pi}], {m, 0, n}]

This then creates a list (I called it myk, you can pick any name you
want) which is n elements long with each element the specific
solutions form m=0,1,2,3.

{2.32614, 5.34098, 8.37707, 11.4221}

You can pick a specific element with the following construction:

In[13]:=
myk[[2]]
myk[[4]]

Out[13]=
5.34098

Out[14]=
11.4221

Hope that helps.


"Riadh Alimi" <alimir3 at cti.ecp.fr> wrote in message news:<a8g3c5$b3e$1 at smc.vnet.net>...
> 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


  • Prev by Date: Re: problems with ContourPlot
  • Next by Date: RE: problems with ContourPlot
  • Previous by thread: RE: List, FindRoot, Bessel
  • Next by thread: Unexpected result with RSolve?