Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to find roots of confluent hypergeometric function and I wonder if I can choose the initial guess by the choice of $\beta$.

eq[n_, \[Beta]_, \[Lambda]_] :=  
                              Hypergeometric1F1[1/4 (2 - \[Lambda]/\[Beta]), n + 1, \[Beta]]
ED[n_, \[Beta]_, k_Integer: 1] := \[Lambda] /. FindRoot[eq[n, \[Beta], \[Lambda]] == 0, 
                                       {\[Lambda], (4 k - 2) \[Beta]}]

My goal is to plot the function (x-axis:$\beta$ and y-axis:$\lambda$). To do that, I need good $\lambda$-values for each $\beta$. The problem is that for each $\beta$ we can have lots of roots, so I want to choose $\beta$ depends on the previous $\lambda$-value for initial guess to find the next root. For example, Start from $\beta=0$. For $\beta=0$, I want to find a root, $\lambda$, around $BesselJZero[n,k]^2$. Next, For $\beta=1$, I want to get a root around $\lambda$-value at $\beta=0$. Then, for $\beta=2$, I want to get a root around $\lambda$-value at $\beta=1$ and so on. For the iterative way I think I should use "for loop" or "if", but I am not sure how to use it. Could you help me out? Thank you.

share|improve this question
Isn't this the same as this question that you previously asked? If not, please clarify how this is different. –  rm -rf Sep 18 '12 at 4:50
This question seems to be closely related (except the form of eq[...]). Please see if the answer to that question is of any use. –  kguler Sep 18 '12 at 5:47
Yes, it is closely related, but when I use the previous method I had a problem. For example, for the small $\beta$ value, the code is worked perfectly, but I realized that for large $\beta$, roots are close to (4 k - 2) $\beta$. So, I wonder there is any other method to choose $\lambda$ by using iterative way of $\beta$. –  Sony Sep 18 '12 at 17:35

1 Answer 1

Is this close to what you have in mind:

rootslist[n_Integer, k_Integer, m_Integer] := 
 Rest@FoldList[ FindRoot[eq[n, #2, \[Lambda]] == 0, {\[Lambda], #1}][[1, 2]] &, 
    BesselJZero[n, k]^2, Range@m]

rootslist[3, 1, 8]
(* {35.1703, 30.5554, 26.8427, 24., 21.9816, 20.7285, 20.1685, 20.2179} *)
rootslist[5, 2, 7]
(* {142.68, 133.995, 126.185, 119.251, 113.189, 108., 103.682} *)

Please see this answer to a related question for alternative methods: While, NestWhile and NestWhileList.

share|improve this answer
This method solves my problem perfectly! Thank you. Also, I have one more question, it seems that the rootlist starts from $\beta$=1. Is there any way to find root starting from $\beta$=0? If I want to find roots for negative $\beta$ or negative n, then what should I change? –  Sony Sep 18 '12 at 19:11
@Sony, glad it worked. I picked 1 as the starting point for the list of betas because with \[Beta]=0, you get 1/0 in the first argument of HyperGeometric1F1. For negative n it should work as is. If you change m_Integer to blist_ on the LHS, and Range[m] to blist on the RHS, then you should be able to iterate over any blist that does not contain 0. –  kguler Sep 18 '12 at 19:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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