1
$\begingroup$

This code gives the roots (lambda-values) of eq1 by using iteration.

eq1[n_, β_, λ_] := Hypergeometric1F1[1/4 (2 - λ/β), n + 1, β]
rootslist[n_Integer, k_Integer, β_] := 
  Rest @ FoldList[FindRoot[eq1[n, #2, λ] == 0, {λ, #1}][[1, 2]] & 
    BesselJZero[n, k]^2, Range @ β]
Table[rootslist[n, 1, 30], {n, 0, 4}]

The table contains all the λ-values for each β from 1 to 30. Using this I want to know how to find a table with $\frac{\lambda}{\beta}$ values?

For example, I have produced the following table

{6., 6.63583, 7.64905, 8.97767, 10.5495, 12.2936, 14.1498, 16.0735, 18.0349, 20.0161, 22.0073, 24.0032, 26.0014, 28.0006, 30.0003, 32.0001, 34., 36., 38., 40., 42., 44., 46., 48., 50., 52., 54., 56., 58., 60.},

for $n=0$.

How can I get

$\{\frac{6.}{1}, \frac{6.63583}{2}, \frac{7.64905}{3}, \frac{8.97767}{4}, \frac{10.5495}{5}, \frac{12.2936}{6}, \frac{14.1498}{7}, \frac{16.0735}{8},\frac{ 18.0349}{9}, \frac{20.0161}{10}, \frac{22.0073}{11}, \frac{24.0032}{12}, \frac{26.0014}{13},\frac{ 28.0006}{14}, \frac{30.0003}{15},\frac{ 32.0001}{16}, \frac{34.}{17}, \frac{36.}{18}, \frac{38.}{19}, \frac{40.}{20}, \frac{42.}{21}, ..., \frac{60.}{30}\}\text{?}$

$\endgroup$
2
$\begingroup$

Try this one:

Rational@@@Thread[{#, Range[Length[#]]}]&@rootslist[0, 1, 30]
$\endgroup$
  • $\begingroup$ It worked! but I have one more question. I got a table with this form {{...},[0,1,30]} I keep getting [0,1,30] at the end of the table. Is there any way to get rid of this, [0,1,30]? $\endgroup$ – Keith Apr 29 '13 at 3:46
  • $\begingroup$ @Keith use Most. Also check again the list its impossible to have such an expression [0,1,30]. $\endgroup$ – Spawn1701D Apr 29 '13 at 4:00
2
$\begingroup$

I may be missing a subtlety in your question but if you just want the numeric values:

lst = {6., 6.63583, 7.64905, 8.97767, 10.5495, 12.2936, 14.1498, 16.0735, 18.0349, 
   20.0161, 22.0073, 24.0032, 26.0014, 28.0006, 30.0003, 32.0001, 34., 36., 38., 40., 42.,
    44., 46., 48., 50., 52., 54., 56., 58., 60.};

MapIndexed[#/#2[[1]] &, lst]
{6., 3.31792, 2.54968, 2.24442, 2.1099, 2.04893, 2.0214, 2.00919, 2.00388, 2.00161, 
 2.00066, 2.00027, 2.00011, 2.00004, 2.00002, 2.00001, 2., 2., 2., 2., 2., 2., 2., 2., 2., 
 2., 2., 2., 2., 2.}

If you want the visual appearance of fractions you can use Rational as Spawn did:

MapIndexed[Rational[#, #2[[1]]] &, lst]
{6./1, 6.63583/2, 7.64905/3, 8.97767/4, 10.5495/5, 12.2936/6, 14.1498/7, 16.0735/8, \
18.0349/9, 20.0161/10, 22.0073/11, 24.0032/12, 26.0014/13, 28.0006/14, 30.0003/15, \
32.0001/16, 34./17, 36./18, 38./19, 40./20, 42./21, 44./22, 46./23, 48./24, 50./25, \
52./26, 54./27, 56./28, 58./29, 60./30}
$\endgroup$
1
$\begingroup$

If what you want is just formatting your output in the described way, you can use Column/Grid.

MapIndexed[Column[{#1, #2[[1]]},
   Alignment -> Center,
   Dividers -> {False, {False, True, False}}] &,
 {6., 6.63583, 7.64905, 8.97767, 10.5495, 12.2936, 14.1498, 16.0735, 
  18.0349, 20.0161, 22.0073, 24.0032, 26.0014, 28.0006, 30.0003, 
  32.0001, 34., 36., 38., 40., 42., 44., 46., 48., 50., 52., 54., 56., 58., 60.}]

output

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.