I'd like to plot the solutions of a function f(y)=k, when f(y) is non polynomial. This is the Mathematica script I have produced so far:
P = 1; a = 1;
f[y_] = ArcCos[P*Sin[Sqrt[y]*a]/(Sqrt[y]*a) + Cos[Sqrt[y]*a]]/a ;
roots[k_?NumericQ] := FindRoot[f[y] == k, {y, 0.1, 0.5}];
dataRoots = {roots[#], #} & /@ Range[0.01, \[Pi]/a, 0.01];
Show[ListPlot[dataRoots, PlotStyle -> {Red, PointSize[0.02]}]]
Where I have provided two starting (trial) values for y, 0.1 and 0.5. The problem is that the resulting plot is empty. Is there any smarter way to easily find and plot the roots?