4
$\begingroup$
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.

$\endgroup$
7
  • 5
    $\begingroup$ Note that Reduce also returns an obviously wrong exact solution $x=884279719003555/140737488355328$. $\endgroup$
    – Domen
    Commented Nov 21, 2021 at 20:25
  • 1
    $\begingroup$ @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. $\endgroup$
    – Domen
    Commented Nov 21, 2021 at 21:15
  • 1
    $\begingroup$ 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$. $\endgroup$
    – Michael E2
    Commented Nov 21, 2021 at 23:16
  • 1
    $\begingroup$ Solve[{Sin[Tan[x]] - Tan[Sin[x]] == 0, 0 <= x <= 2 Pi }, x, Reals] finds all real solutions ! $\endgroup$ Commented Nov 22, 2021 at 9:07
  • 1
    $\begingroup$ The incorrect rational approximation to 2 pi will be gone in the next release (I checked before submitting a bug report). $\endgroup$ Commented Nov 22, 2021 at 14:11

2 Answers 2

4
$\begingroup$

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]
 ]
$\endgroup$
2
$\begingroup$

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.