The code below is from "An Introduction to Programming with Mathematica". Try and see if you can follow it. I coded it for a particular value of a2 for x in the interval (0,10) and it picks out all the zeros. See if you can modify it to generate a table for some range of a2. Also, you know about the Mathematica forum at Drexel right? It's
Math Forum Discussions - comp.soft-sys.math.mathematica.
They are tops there and if you spend some time searching the archive and studying their answers, you'll quickly get good at Mathematica.
Code:
a2 = 2.5;
myPlot = Plot[-2 Cos[x] + Cos[a2 x] - 1, {x, -10, 10}];
(* Get the point coordinates in the graphics object myPlot*)
myPoints = Cases[myPlot, Line[{x__}] -> x, \[Infinity]];
(* Select the pairs that have a sign
change in the y-coordinate (Last[_]) *)
myPairs =
Select[Split[myPoints, Sign[Last[#2]] == -Sign[Last[#1]] &],
Length[#1] == 2 &]
(* take the first coordinates in each pair above.
This is the x-coordinates between which there is a sign change *)
myxvals = Map[First, myPairs, {2}]
(* Map the x-pairs from above to FindRoot *)
Map[FindRoot[-2 Cos[x] + Cos[a2 x] - 1 ==
0, {x, #[[1]], #[[2]]}] &, myxvals]