I've an issue with my code. I am basically trying to get the n-th root of a function. My code finds two roots correctly, but for others, which I think should be distinct, I get the two roots repeated in the output.
I use a simple shifting-sign algorithm to locate the zeros and then apply a search.
k = 2;
jauge = ff[k, 0.2];
n = 8(* n-th zero*);
l = 1;
x = 0.2;
eps = 1;
res = {};
While[l != n, While[ff[k, x]*jauge >= 0; x = x + eps]
jauge = ff[k, x]
AppendTo[res, y /. FindRoot[ff[k, y], {y, x - eps, x}]]; l++]
res
Output:{4.03114*10^-8, 3.99932*10^-8, 3.934*10^-8, 4.06604*10^-8, 3.80759, 3.80759, 3.80759}
Note that 3.08759 is ok and 4.03*10^-8 too .
FF is
ff[k_, x_] :=
f22[k, x]*(x^3*BesselJ[k - 3, x] + x^2*(4 - 3*k)*BesselJ[k - 2, x] +
x*k*(k*(1 + u) - 2)*BesselJ[k - 1, x] +
k^2*(1 - u)*(1 + k)*BesselJ[k, x]) +
f11[k, x]*(x^3*BesselI[k - 3, x] +
x^2*(4 - 3*k)*BesselI[k - 2, x] +
x*k*(k*(1 + u) - 2)*BesselI[k - 1, x] +
k^2*(1 - u)*(1 + k)*BesselI[k, x]);
f1 and f2 are
u = 0.33;
f11[k_, x_] := (x^2)*BesselJ[k - 2, x] +
x*(u - 2*k + 1)*BesselJ[k - 1, x] +
k*(k + 1)*(1 - u)*BesselJ[k, x];
f22[k_, x_] := (x^2)*BesselI[k - 2, x] +
x*(u - 2*k + 1)*BesselI[k - 1, x] +
k*(k + 1)*(1 - u)*BesselI[k, x] ;
ff
function? $\endgroup$