FindRoot in range

I am trying to find all roots in a range, using

y /. FindRoot[Sin[y] == 0, {y, #}] & /@ Range[7]


which gives

{0., 3.14159, 3.14159, 3.14159, 9.42478, 6.28319, 6.28319}


but I would like to get

{0., 3.14159, 6.28319}


What am I doing wrong?

• Reduce can often find all roots in an interval. Have you tried it? blog.wolfram.com/2008/12/18/… – Szabolcs Apr 20 '14 at 23:56
• If for some reasons you want to work with FindRoot (e.g. because it is much faster for a large class of transcendental equations) you may exploit the technique using RootIntervals as in this answer First positive root and instead of Sin[x] use the first terms of its Taylor series e.g. N@First@RootIntervals[Series[Sin[x], {x, 0, 15}] // Normal]. This information is all you may need to work out the solution. – Artes Apr 21 '14 at 0:02
• @Szabolcs - many thanks - solved with Reduce as you suggested :) – martin Apr 21 '14 at 2:56
• @martin I think you can answer your question using FindRoot as well even though I wouldn't use it here (Solve[Sin[x] == 0 && 0 <= x <= 2 Pi, x] works too ). For transcendental equations involving trigonometric functions as algebraic variables Reduce and Solve will work in general (look e.g. here How to get intersection values from a parametric graph? for a simple exception of Solve). – Artes Apr 21 '14 at 9:01
• You could also use NSolve[Sin[x] == 0 && 0 <= x <= 7, x] which gives the result {{x -> 0.}, {x -> 3.14159}, {x -> 6.28319}}. – Stephen Luttrell Apr 21 '14 at 11:01