4
$\begingroup$

This question already has an answer here:

I have two equations like these. I want to create a for loop that gives to me all intersection points of the two equations. How can I do that?

 Plot[{x*BesselJ[1, x]*BesselK[0, Sqrt[
     22.295^2 - x^2]]/(BesselJ[0, x]*
      BesselK[1, Sqrt[22.295^2 - x^2]]), Sqrt[22.295^2 - x^2]}, {x, 0,
   23}]

Graph for my equations

$\endgroup$

marked as duplicate by Sascha, J. M. is away Apr 18 '17 at 9:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Function findAllRoots described in this answer does the job in OP problem. $\endgroup$ – Pinti Apr 18 '17 at 8:02
  • $\begingroup$ Also this: mathematica.stackexchange.com/q/5663/12 $\endgroup$ – Szabolcs Apr 18 '17 at 8:18
  • $\begingroup$ Use BesselJZero to generate starting points for FindRoot . $\endgroup$ – LouisB Apr 18 '17 at 8:52
  • $\begingroup$ @Pinti It also returns several "fake roots". $\endgroup$ – Szabolcs Apr 18 '17 at 10:20
0
$\begingroup$

try this

NSolve[{x*BesselJ[1, x]*
  BesselK[0, 
    Sqrt[22.295^2 - x^2]]/(BesselJ[0, x]*
     BesselK[1, Sqrt[22.295^2 - x^2]]) - Sqrt[22.295^2 - x^2]} == 
0 && 0 < x < 23, x]

{{x -> 2.30141}, {x -> 5.28092}, {x -> 8.27351}, {x -> 14.2381}, {x -> 17.1905}, {x -> 20.0892}}

EDIT

there is one more root x->11,2619

(see comments below)

$\endgroup$
  • $\begingroup$ This does not return all roots that the OP's plot is showing. $\endgroup$ – Szabolcs Apr 18 '17 at 10:11
  • $\begingroup$ @Szabolcs The "extra roots" are the asymtotes of this function $\endgroup$ – J42161217 Apr 18 '17 at 10:12
  • $\begingroup$ I meant the root near 11.2619479668904. $\endgroup$ – Szabolcs Apr 18 '17 at 10:17
  • $\begingroup$ Reduce does seem to work. It gives a warning that it couldn't prove that all roots were returned, but none seem to be missing: Reduce[x*BesselJ[1, x]* BesselK[0, Sqrt[22.295^2 - x^2]]/(BesselJ[0, x]* BesselK[1, Sqrt[22.295^2 - x^2]]) - Sqrt[22.295^2 - x^2] == 0 && 0 < x < 23, x] $\endgroup$ – Szabolcs Apr 18 '17 at 10:19
  • $\begingroup$ I just saw that! why do you think mathematica skipped that one? $\endgroup$ – J42161217 Apr 18 '17 at 10:24

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