Hi,
k->3.2 mean Rule[k,3.2] it can be used with ReplaceAll[] to get
3.2
if you use the correct syntax of For[] and ReplaceAll[] you "code"
looks like
n = 10;
For[i = 0, i < n, i++,
Print[k /.
FindRoot[-k BesselJ[1, k] + 30 BesselJ[0, k] == 0, {k, 2.32 + i
Pi}]
]
]
What you mean is probably
Block[{k},
(k /. FindRoot[-k BesselJ[1, k] + 30 BesselJ[0, k] == 0, {k,
2.32 + # Pi}]) & /@ Table[i, {i, 0, 9}]
]
that will return the list of the zeros.
Have you ever considered to read some pages in
the manual ?
It is incredible large and called "The Mathematica Book"
but it helps to find out the correct syntax of For[] and it
has an index where you can find what -> mean
Regards
Jens
Riadh Alimi wrote:
>
> 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