# Numerical Solution of Equation

How to solve the following equation for $x$ in Mathematica. I have no idea about the domain of $x$.

$1+e^{\sqrt{x^2-i x+5}} \text{erf}\left(1+i x-\sqrt{x^2-i x+5}\right)=0$

I have used NSolve.

NSolve[1 + E^Sqrt[x^2 - I x + 5] Erf[ 1 + I x - Sqrt[x^2 - I x + 5]] ==0,x]

But following error is coming

NSolve::nsmet: This system cannot be solved with the methods available to NSolve. >>

$\text{erf}$ is error function.

If NSolve[] doesn't work, you can use FindRoot[], which is more versatile, the downside is that as a Newtonian approximation, you need initial points to look at:

eq = 1 + E^Sqrt[x^2 - I x + 5] Erf[1 + I x - Sqrt[x^2 - I x + 5]];
list = Table[FindRoot[eq == 0, {x, i}], {i, -5, 5, 0.5}]


Plot of some of the solutions:

pos = Sqrt[Re[eq]^2 + Im[eq]^2] /. {x -> a + I b};
ap = Plot3D[pos, {a, -4, 4}, {b, 0, 1}, PerformanceGoal -> "Quality",
MaxRecursion -> 5, PlotPoints -> 50, PlotRange -> {-5, 30}];
bp = ListPointPlot3D[
Transpose[{Re[x /. list], Im[x /. list], ConstantArray[0, 21]}],
PlotStyle -> {Red, PointSize[0.01]}];
Show[ap, bp, PlotRange -> {{-4, 4}, {0, 1}, {-5, 30}}, ImageSize -> Large]


If you can get an idea about the domain of x, you might succeed:

NSolve[1 + E^Sqrt[5 - I x + x^2] Erf[1 + I x - Sqrt[5 - I x + x^2]] == 0 &&
-5 < Re[x] < 5 && -5 < Im[x] < 5,
x]
(* 35 solutions
{{x -> -4.98009 + 0.366527 I}, {x -> -4.63919 + 0.342862 I}, ...
{x -> 4.63919 + 0.342862 I}, {x -> 4.98009 + 0.366527 I}}
*)


Often, if not usually, transcendental equations can be solved if the domain is bounded. (There are computational limits, of course. It's more likely to succeed the smaller the domain.)