# How to use FindRoot to solve Hypergeometric1F1 imaginary number solution？

I want to use FindRoot to solve Hypergeometric1F1 imaginary number solution.

First of all, I try to use NSolve to solve the equation, and have made the following attempts:

NSolve[x^2 + 1 == 0, x]
(* {{x -> 0. - 1. I}, {x -> 0. + 1. I}} *)

However, NSolve cannot solve the system at present.

NSolve[0 == Hypergeometric1F1[1 - x, 2, 2/x], x]

Therefore, I want to use FindRoot to solve the imaginary number solution of the function.

At present, I have tried ReImpPlot, but the effect is not very good.

How can I use FindRoot to solve all imaginary solutions of Hypergeometric1F1 function? Thanks.

There are countably infinitely many zeros of your $$f(x)$$, which we can enumerate as follows.

For small $$x$$, your function is approximated by $$e^{1/x} x \sinh(1/x)$$:

f[x_] = Hypergeometric1F1[1 - x, 2, 2/x];
g[x_] = E^(1/x) x Sinh[1/x];

ReImPlot[{f[I x], g[I x]}, {x, -0.1, 0.1}]

This approximation gives excellent starting points for numerical root-finding: for $$n\in\mathbb{Z}\setminus\{0\}$$ we have $$g[i/(n\pi)]=0$$, and find the $$n^{\text{th}}$$ zero of $$f$$ from this starting point:

zf[n_Integer /; n != 0] := x /. FindRoot[f[x], {x, I/(n*π)}]

Array[zf, 10] // Chop
(*    {0. + 0.458929 I, 0. + 0.173708 I,
0. + 0.110616 I, 0. + 0.0815787 I,
0. + 0.0647315 I, 0. + 0.0536934 I,
0. + 0.0458896 I, 0. + 0.0400755 I,
0. + 0.035574 I, 0. + 0.0319845 I}    *)

Much higher zeros can be found in this way:

zf[10^6]
(*    0. + 3.1831*10^-7 I    *)

For added stability we can extract more factors from $$g(x)$$ to regularize your $$f(x)$$ before nulling: notice that $$g(i/y) y e^{i y} = \sin y$$ with zeros at $$y_n=n\pi$$, and further that $$f(i/y) y e^{i y}\in\mathbb{R}$$ if $$y\in\mathbb{R}$$; and hence

zf2[n_Integer /; n != 0] :=
I/y /. FindRoot[Re[f[I/y] E^(I y) y], {y, n*π}]

zf2[10^6]
(*    0. + 3.1831*10^-7 I    *)

ReImPlot[{f[I/y] E^(I y) y, Sin[y]}, {y, 0, 50}]

If you restrict the domain, then NSolve can find solutions:

NSolve[0 == Hypergeometric1F1[1 - x, 2, 2/x] && Abs[x]<1, x]

{{x->0. -0.0227961 I},{x->0. -0.0290547 I},{x->0. -0.035574 I},{x->0. +0.035574 I},{x->0. -0.0400755 I},{x->0. -0.0458896 I},{x->0. +0.0458896 I},{x->0. +0.0536934 I},{x->0. -0.458929 I},{x->0. +0.458929 I}}