# Any way to get Mathematica to Solve[Sin[Tan[x]]-Tan[Sin[x]]==0,x]?

Solve[Sin[Tan[x]] - Tan[Sin[x]] == 0, x]


It says it runs out of methods. After a very long time. Plotting the expression shows there are periodic solutions and some very nasty bits, too. NSolve does no better.

• Note that Reduce also returns an obviously wrong exact solution $x=884279719003555/140737488355328$. Commented Nov 21, 2021 at 20:25
• @BobHanlon, I am really not an expert in numerical methods, but if you increase the maximal possible precision: Block[{$MaxExtraPrecision = 200}, Table[...]], you see that the result is False. Commented Nov 21, 2021 at 21:15 • To add to @Domen's (accurate) comments, the fraction is the double-precision representation of$2\pi$: evaluate SetPrecision[N[2 Pi], Infinity]. It is slightly less than$2\pi$. Commented Nov 21, 2021 at 23:16 • Solve[{Sin[Tan[x]] - Tan[Sin[x]] == 0, 0 <= x <= 2 Pi }, x, Reals] finds all real solutions ! Commented Nov 22, 2021 at 9:07 • The incorrect rational approximation to 2 pi will be gone in the next release (I checked before submitting a bug report). Commented Nov 22, 2021 at 14:11 ## 2 Answers Perhaps this: Block[{$MaxExtraPrecision = 200},
Solve[Sin[Tan[x]] - Tan[Sin[x]] == 0, x, Reals]
]


If you want complex solutions, then you'll have to bound the domain probably — that is, more powerful methods exist on a bounded domain.

Block[{\$MaxExtraPrecision = 200},
Solve[Sin[Tan[x]] - Tan[Sin[x]] == 0 &&
0 <= Re@x < 2 Pi && -2 < Im[x] < 2, x]
]


One way I found (using Maxima, not Mathematica) but should be possible to do in Mathematica as well... convert the expression to complex exponentials, and factor it. One factor is exp(exp(I x)) + exp(exp(- I x)). setting this to zero and solving gives x=I log(-1) or x=0. I think this corresponds to a complete set, depending on how you feel about log(-1) (= ln(-1)) being multi-valued.

Another approach is to use Maxima's bf_find_root(f,x,a,b) (bigfloat version), which requires input of a function and 2 values where the sign of f(a) and f(b) differ. Finding a root between 1 and 6, with precision 100 decimal digits gives the root 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068b0

which agrees with the value of pi to all places. Thanks for your suggestions on different approaches, and bug fix promise. RJF

• FindRoot[Sin[Tan[x]] - Tan[Sin[x]] == 0, {x, 3}, WorkingPrecision -> 100] gives the same result as bf_find_root. Commented Dec 19, 2021 at 22:12