3
$\begingroup$

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?

$\endgroup$
1
  • 1
    $\begingroup$ 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! $\endgroup$
    – chris
    Apr 1, 2013 at 6:41

5 Answers 5

7
$\begingroup$

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}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Yes! this is exactly what I wanted, thank you $\endgroup$ Apr 1, 2013 at 6:14
4
$\begingroup$

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]

Mathematica graphics

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]&

Mathematica graphics

$\endgroup$
3
$\begingroup$

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}]

Mathematica graphics

$\endgroup$
2
$\begingroup$

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}]

Mathematica graphics

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

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.