# Plotting the solutions to a transcendental equation

I am trying, to no avail, to use Mathematica to produce a plot in (x, y)-space of the solutions to the equation

Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == Cos[x]


Neither NSolve nor InverseFunction seem to work for inverting the equation (probably because there are multiple solutions for y for each x). Does anyone know a way to make such a plot?

-
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) 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! – chris Apr 1 '13 at 6:41

You can plot curves defined by implicit equations using ContourPlot:

ContourPlot[
Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == Cos[x], {x, 0, 10}, {y, 0,
10}]


-
Yes! this is exactly what I wanted, thank you – mikefallopian Apr 1 '13 at 6:14
@mikefallopian, if this is exactly what you wanted, you should accept it as the answer to your question. – RunnyKine Apr 12 '13 at 8:20

Following Jens's answer, if you want the actual values from his implicit plot,

tt=ContourPlot[Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == Cos[x],{x, 0, 10}, {y, 0, 10}];
data=Cases[tt//Normal, Line[a_] :>  a, Infinity] // First;
ListLinePlot[data]


Note that it need not be a one to one function.

tt = ContourPlot[x^2 + y^2 == {1, 2, 3}, {x, -2, 2}, {y, -2, 2}] // Normal;
Cases[tt, Line[a_] :>  a, Infinity]//ListLinePlot[#, AspectRatio -> 1]&


-

Although perhaps less generalizable than the ContourPlot solutions, the approach below will work for many similar problems. You will have to guess a reasonable initial value for y, but that should usually not be a problem.

Plot[y /. FindRoot[Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == Cos[x], {y, 1}], {x, 0, 10}]


-

Not an answer, just showing a nice plot:

Show@Table[
ContourPlot[ Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y] == n Cos[x], {x, 0, 10}, {y, 0, 400}],
{n, 1/4, 5, 1/4}]


-
just because you felt like it? or is it an April fool in disguise? – chris Apr 1 '13 at 16:36
@chris Just because I liked the plot, and wanted to share it – Dr. belisarius Apr 1 '13 at 16:41
ParametricPlot[{ArcCos[Cos[Sqrt[y]] + Sin[Sqrt[y]]/Sqrt[y]], y}, {y, 1, 2},
AxesLabel -> {"x", "y"},
AxesOrigin -> {0, 1.6}]


-