0
$\begingroup$

I'm trying to find the roots (a_n,b_n) of a system involving Bessel functions.

enter image description here

I tried to obtain a list of the n-first roots in mathematics with FindRoot, but I only get one root, how can I get the first n roots (an and bn) with n=20

B=1;
T=10;
K=0.5;
FindRoot[(BesselJ[0,K*a]+b*BesselY[0,K*a])*(1-T*a)-B*a*(BesselJ[1,K*a]+b*BesselY[1,K*a]);
(BesselJ[0,a]+b*BesselY[0,a])*(1-T*a)-B*a*(BesselJ[0,a]+b*BesselY[0,a])  ,{a,b ,20}]

and I have this result

{a->0.230331}  

Any help would be greatly appreciated. Thank you

$\endgroup$
7
  • 1
    $\begingroup$ The equations in the code are not the same as the LaTeX equations. You cannot use function brackets ([ ]) in place of parentheses. The syntax of the FindRoot is wrong. $\endgroup$
    – Bob Hanlon
    Aug 9, 2022 at 22:47
  • $\begingroup$ What do you mean by "it doesn't work"? Does it spit out the wrong roots? Not enough roots? Does it return unevaluated? Is there an error message that pops up? (If so, what is it?) Please provide more details. (Not in the comments, though. Please edit your original post with these extra details. Also, make sure to pay attention to the previous comment.) $\endgroup$
    – march
    Aug 10, 2022 at 0:08
  • $\begingroup$ @ Bob Hanlon. I corrected it but I only got one root. $\endgroup$ Aug 10, 2022 at 2:18
  • $\begingroup$ Why do you have two separate expressions separated by a semicolon in the argument of FindRoot? FindRoot will only search for roots of the second expression. Is that what you want? If so, what is the first expression for? Are you actually searching for where those two expressions are equal to each other? $\endgroup$
    – march
    Aug 10, 2022 at 2:18
  • 1
    $\begingroup$ The equations in the code still are not the same as the LaTeX equations. Correct one or the other. The syntax is still not correct for FindRoot. Look in the documentation for the correct syntax for a system of equations. $\endgroup$
    – Bob Hanlon
    Aug 10, 2022 at 3:27

1 Answer 1

3
$\begingroup$

I don't know why you define b if you are solving for it, but I am guessing that this is what you want.

B = 1;
T = 10;
K = 0.5;

fun = {(BesselJ[0, K*a] + b*BesselY[0, K*a])*(1 - T*a) - 
   B*a*(BesselJ[1, K*a] + b*BesselY[1, K*a]), (BesselJ[0, a] + 
      b*BesselY[0, a])*(1 - T*a) - 
   B*a*(BesselJ[0, a] + b*BesselY[0, a])}

FindRoot[fun, {a, 10}, {b, 10}]
(*{a -> 12.3465953036785, b -> 0.6207433546592956}*)

We can also do

FindRoot[fun, {a, 5}, {b, 5}]
(*{a -> 6.043180303897816, b -> 0.5791958099682194}*)

You can also use NSolve

NSolve[fun[[1]] == 0 && fun[[2]] == 0 && 0 <= a <= 20 && 0 <= b <= 20]
{{a -> 6.043180303897824, b -> 0.5791958099682254}, {a->12.3465953036785, 
  b -> 0.6207433546592946}}

With NSolve you can increase the range of a and b to get as many roots as you want, although when I do that, the value of a increases steadily, but the value of b does not change much. Specifying b with two equations, over specifies the problem.

$\endgroup$
1
  • $\begingroup$ Thank you very much $\endgroup$ Aug 10, 2022 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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