# Find all roots in the interval of nonlinear equation

I am struggling on how to find all the roots of 1+1/2^x+1/3^x==0 which lie in a given of real and imaginary interval.

Solve does not work, and FindRoot only returns one root. Is there a better way to get as many roots as possible? Thank you so much for your help.

If you restrict the domain where to look for roots, Reduce can often find them and will return Root objects which can be used in exact symbolic calculations. Even better, it guarantees to give you all roots in that domain.

Reduce[1 + 1/2^x + 1/3^x == 0 && Abs[x] < 5, x]
(* x == Root[{1 + 3^#1 + E^(-(Log - Log) #1) &, 0.4543970081950240272783427420109442288880772534469111379406 - 3.5981714939947587422049363529208471165604257466288393398421 I}] ||
x == Root[{1 + 3^#1 + E^(-(Log - Log) #1) &, 0.4543970081950240272783427420110 + 3.5981714939947587422049363529208 I}] *)


When looking for real roots, the typical way to restrict the domain is something similar to 0 < x < 1. We're looking for complex roots her so I used Abs[x] < 5.

Related:

To use the FindRoots2D function from the linked post, you need to break the equation into real and imaginary parts, as follows:

f[z_] := 1 + 1/2^z + 1/3^z

FindRoots2D[{Re@f[x + I y], Im@f[x + I y]}, {x, -5, 5}, {y, -5, 5}]

(* {{0.454397, -3.59817}, {0.454397, 3.59817}} *)

• I am trying your code. But it runs so long that I have not seen the result yet while I am replying to you. How long did u take to run this code? Thanks for your help. – user16023 Jun 19 '14 at 4:39
• Could you give me some basic instructions to use Wagon's FindAllCrossing2D[] function? – user16023 Jun 19 '14 at 4:52
• @user16023 It takes less than a second in both v8 and v9. FindAllCrossings2D finds the roots of a system of two equations on the reals (not complexes). You can break your equation into real and imaginary parts then follow the instructions from the post I linked. – Szabolcs Jun 19 '14 at 14:31

If you only need approximate numerical solution rather than the exact solution (i.e., Root object) you could use NSolve also with a constrained domain for x.

eqn = 1 + 1/2^x + 1/3^x == 0;

soln = NSolve[{eqn, Abs[x] <= 5}, x, WorkingPrecision -> 10]

(*  {{x -> 0.454397008 + 3.598171494 I}, {x -> 0.454397008 - 3.598171494 I}}  *)

And @@ (eqn /. soln)

(*  True  *)