2

When I type

ContourPlot[x == Sin[6*Pi*y], {x, -1, 1}, {y, -2, 2}]

I get this

Penis

Now I'm not a particularly gifted mathematician, but I have a feeling this just might be wrong. How do I get Mathematica to plot it correctly?

Alexey Bobrick
  • 1,652
  • 1
  • 14
  • 23
user85798
  • 1
  • 2
  • 13
  • 1
    closely related: 31164 – Kuba Jan 31 '15 at 18:08
  • I'm gathering you're new to Mathematica. Is this plot truly what you were seeking? You're plotting a logical (Boolean) function--i.e., one that has output TRUE or FALSE. I suspect you wanted to plot $Sin[6 \pi y]$ or something like that. – David G. Stork Jan 31 '15 at 18:45
  • @DavidG.Stork Yes, I wanted to plot $x = Sin [6 \pi y]$, this should have worked in theory though – user85798 Jan 31 '15 at 19:42
  • @LTS A much better way is $Plot[Sin[6 \pi y], {y, -2,2}]$... You don't have to specify the range of the output; it generalizes to other functions immediately; it is understood by others better, and on and on. Another question to you: Do you really want to be the $.00001%$ of cases where you plot $x$ as a function of $y$, instead of the standard $y$ versus $x$ used in every textbook and technical presentation? – David G. Stork Jan 31 '15 at 20:02
  • @DavidG.Stork No, I want to plot the inverse of $\sin[6\pi x]$. I could write it as an explicit function of x, but that would be rather difficult since it's not a proper function. – user85798 Jan 31 '15 at 20:42
  • @LTS: If you want to plot the inverse, just use ArcSin[]. – David G. Stork Jan 31 '15 at 20:59
  • @DavidG.Stork But ArcSin has a restricted range in order to make it a valid function. I want the whole thing – user85798 Jan 31 '15 at 22:13
  • @DavidG.Stork Also if the function were more complicated I may not wish to go through the trouble of inverting it, if the function is even invertible, which this isn't. – user85798 Jan 31 '15 at 22:13
  • @Kuba I closed the question as a duplicate of the one you linked. If you (or anyone else) disagrees with this action please notify me with @Mr.Wizard. – Mr.Wizard Feb 01 '15 at 01:13

3 Answers3

1

ContourPlot is not as smart as you so you have to give it more PlotPoints to sample domain or use more suited for this job function:

ParametricPlot[{Sin[6*Pi*y], y}, {y, -2, 2}]

enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740
1
ContourPlot[x == Sin[6*Pi*y], {x, -1, 1}, {y, -2, 2}, PlotPoints -> 100]
Chris Degnen
  • 30,927
  • 2
  • 54
  • 108
1

Just increase MaxRecursion to track the curve correctly

ContourPlot[x == Sin[6*Pi*y], {x, -1, 1}, {y, -2, 2}, MaxRecursion -> 3]

enter image description here

Usually PlotPoints and MaxRecursion options solve almost all resolution problems.

ybeltukov
  • 43,673
  • 5
  • 108
  • 212