Following the comment of our friend @Bob Hanlon's in my post Plot all real and imaginary roots of FindRoot vrs `k`, which I would like to thank again for the assistance it gave, I'm creating a new post here. As I clarified with @BobHanlon, my problem is to solve a complicated algebraic equation including an integral and then plot all the real Re[x]
and imaginary Im[x]
parts of the roots x
versus k
, t
and a
parameters.
Equation to solve is
eq[x_,k_,t_,a_] := 1 -( k^2/x^2) -((t^2) /(2 BesselK[2, t] k^2))
NIntegrate[s Sqrt[s^2-1] ((1 + (a/x)) - (x /k) Sqrt[s^2/(s^2 - 1)] ((1 + (a/x))^2 - (
(s^2 - 1) k^2)/(s^2 x^2))ArcTanh[(Sqrt[(s^2 - 1)/s^2] k)/(x(1 + (a/x )))]) Exp[-t s],
{s,1, \[Infinity]}]
with 0.001 <= t <= 1000
, 0 <= k <= 100
and a = 25
To my knowledge, I suppose that this equation can only be solved by FindRoot
(SolveValues
gives nothing), which I do not master well, especially the choice of the initial value and precisions of the computations, ...
Here is my code
rootx[k_,t_,a_]:=FindRoot[1 -( k^2/x^2) -((t^2) /(2 BesselK[2, t] k^2))
NIntegrate[s Sqrt[s ^2 -1] ((1 + (a/x)) - (x /k) Sqrt[s^2/(s^2 - 1)] ((1 + (a/x))^2 - ((
s^2 - 1) k^2)/(s^2 x^2)) ArcTanh[(Sqrt[(s^2 - 1)/s^2] k)/(x(1 + (a/x)))]) Exp[-t s],
{s,1, \[Infinity]}]== 0, {x, 1 + 0.01 I}, WorkingPrecision -> $MachinePrecision]
(* Real root of x *)
rex[k_,t_,a_]:=Re[rootx[k,t,a]]
(* rex gives a one real root for a given (k,t,a) but I'm trying to plot all real roots *)
(* Imaginary root of x *)
imx[k_,t_,a_]:=Im[rootx[k,t,a]]
(* imx gives a one imaginary root for a given (k,t,a) but I'm trying to plot all imaginary roots *)
Please, how can I know if the initial value x=1+0.01 I
is the right value who gives the right roots? and how to plot all the Re
and Im
roots vrs k,t,a
?
THANKS