I am trying to use a solution given by Michael E2 in this topic:
Zeros[z_] = (BesselJ[0, z] - BesselJ[2, z])*(3*BesselI[1, z] +
BesselI[3, z]) - (BesselI[0, z] +
BesselI[2, z])*(3*BesselJ[1, z] - BesselJ[3, z]);
(zeros = First @ Last @ Reap @ Quiet @ NDSolve[
{y'[x] == Zeros'[x], y[0] == Zeros[0],
WhenEvent[y[x] == 0, Sow[FindRoot[Zeros[z], {z, x}]]]},
y, {x, 0, 40}, AccuracyGoal -> 1, PrecisionGoal -> 1]) // AbsoluteTiming
-- to find roots for my equation:
$$ J_1(a/z)\, Y_0(b/z)-J_0(a/z)\,Y_1(b/z)=0, \quad a=10, \;b=1, $$
but get an error
First::first: "{} has a length of zero and no first element."
The problem is that "y(x)=0" event doesn't happen. I understand that the functions are quite different, so I perform the following:
$$ J_1(a/z)\; Y_0(b/z)-J_0(a/z)\; Y_1(b/z)=0 \rightarrow\\ \rightarrow \left( J_1(a\tilde z)\; Y_0(b\tilde z)-J_0(a\tilde z)\; Y_1(b\tilde z) \right)\; e^{-100/\tilde z}=0, ~\tilde z = 1/z $$
to make my function to be more like the original one, but still get the error. Could anyone help, please?
My code (I mean, the original code with my function) is below.
Sigma = 1;
xi1 = 10;
Zeros[z_] =
(BesselJ[1, xi1*z]*BesselY[0, Sigma*z] -
BesselJ[0, Sigma*z]*BesselY[1, xi1*z])*Exp[-100/z];
(zeros = First@
Last@Reap@
Quiet@NDSolve[{y'[x] == Zeros'[x], y[0] == Zeros[0],
WhenEvent[y[x] == 0, Sow[FindRoot[Zeros[z], {z, x}]]]},
y, {x, 0, 10}, AccuracyGoal -> 10, PrecisionGoal -> 10]) // AbsoluteTiming