- #1
maverick280857
- 1,789
- 5
To the moderator: Please shift this to an appropriate forum, if necessary.
Hi,
I am solving a QM problem which requires using Mathematica to solve two equations,
[tex]J_{\alpha}'(2\sqrt{\lambda}) = 0[/tex]
(derivative of Bessel function)
and
[tex]J_{\alpha}(2\sqrt{\lambda}) = 0[/tex]
(not simultaneously) where [itex]\alpha[/itex] is the unknown and [itex]\lambda[/itex] is known. I want to plot the dependence of [itex]\alpha^{2}[/itex] on [itex]\lambda[/itex].
First, I take [itex]x = 2\sqrt{\lambda}[/itex] and vary [itex]x[/itex] from 1 to 10 (so [itex]\lambda \in [0.25, 25][/itex]). Now, I use
FindRoot[0.5*(BesselJ(-1+alpha,x) - BesselJ(1+alpha,x)), {alpha,0}]
for different values of [itex]x[/itex] which are being keyed in by hand while typing this command. To automate it, I set up an array:
Array[SOL, 1000]
and then use a for loop
For[c=1;x=1,c<=1000;x<=100,c = c + 1; x=x+0.01, SOL[c] = {x,FindRoot[(BesselJ[-1+alpha,x] + BesselJ[1+alpha,x])/2, {alpha,0}]}]
so SOL[10] is of the form:
{1.09, {alpha -> 0.448962}}
I have the following questions:
1. The second element of the ordered pair above is of the form {alpha --> value}. How do I extract alpha from this? I want to store it in (x, alpha) form.
2. How do I plot some function of alpha^2 versus some function of x, from this data?
3. Is there an easier way to do all this?
I've been trying to figure this out for some time but I haven't had much success.
Thanks in advance.
Cheers
Vivek
Hi,
I am solving a QM problem which requires using Mathematica to solve two equations,
[tex]J_{\alpha}'(2\sqrt{\lambda}) = 0[/tex]
(derivative of Bessel function)
and
[tex]J_{\alpha}(2\sqrt{\lambda}) = 0[/tex]
(not simultaneously) where [itex]\alpha[/itex] is the unknown and [itex]\lambda[/itex] is known. I want to plot the dependence of [itex]\alpha^{2}[/itex] on [itex]\lambda[/itex].
First, I take [itex]x = 2\sqrt{\lambda}[/itex] and vary [itex]x[/itex] from 1 to 10 (so [itex]\lambda \in [0.25, 25][/itex]). Now, I use
FindRoot[0.5*(BesselJ(-1+alpha,x) - BesselJ(1+alpha,x)), {alpha,0}]
for different values of [itex]x[/itex] which are being keyed in by hand while typing this command. To automate it, I set up an array:
Array[SOL, 1000]
and then use a for loop
For[c=1;x=1,c<=1000;x<=100,c = c + 1; x=x+0.01, SOL[c] = {x,FindRoot[(BesselJ[-1+alpha,x] + BesselJ[1+alpha,x])/2, {alpha,0}]}]
so SOL[10] is of the form:
{1.09, {alpha -> 0.448962}}
I have the following questions:
1. The second element of the ordered pair above is of the form {alpha --> value}. How do I extract alpha from this? I want to store it in (x, alpha) form.
2. How do I plot some function of alpha^2 versus some function of x, from this data?
3. Is there an easier way to do all this?
I've been trying to figure this out for some time but I haven't had much success.
Thanks in advance.
Cheers
Vivek