# Roots of a transcendental equation [closed]

I need to find the 50 first roots of a transcendental equation. I use Table and FindRoot, so I find repeated positives and negatives values in a list, but I want only the 50 first positives and differents roots. Somebody can help me?

## closed as off-topic by J. M. is away♦Aug 22 '15 at 12:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Apr 19 '15 at 16:28
• Please provide the code you are using, in order that readers can assist you with it. – bbgodfrey Apr 19 '15 at 16:28

For example, this is reasonably fast on the following example:

eqn = Sin[x] + 0.5 Cos[10 Pi x];

sols = FindRoot[eqn, {x, #}] & /@ Module[{n = 0},
Reap[
NDSolve[{y'[x] == D[eqn, x], y[0] == (eqn /. x -> 0),
WhenEvent[y[x] == 0, Sow[x]; If[++n >= 50, "StopIntegration"]]},
{}, {x, 0, Infinity}]
][[2, 1]]
]
(*  {{x -> 0.0534047}, {x -> 0.140935},..., {x -> 15.5391}}  *)

Plot[eqn, {x, 0, Max[x /. sols]}, Epilog -> {Red, Point[{x, 0} /. sols]}]


• (# - 2)^2 (# + .5)^2 - 625/256 &[x], it seems that not all the roots can be found for this function. – Αλέξανδρος Ζεγγ May 16 '17 at 8:13
• @AlexanderZeng Use NSolve for polynomial equations. (Why such a complicated example? It's pretty clear that any method that relies on sign change is going to fail on even-multiplicity roots, so (x-2)^2 is sufficient.) If you're looking for a similar approach for a transcendental equation, you might use f[x] * f'[x] and keep only those seeds for which Abs[f[x]] is small. – Michael E2 May 16 '17 at 11:07