I have an equation for a cylinder as $x^2+(y-b)^2=a^2$ for some $a$ and $b$. so I just plugged in $b=2$ and $a=1$ and tried to plot it using wolfram alpha, and the 3D plot looked like half a cylinder, like this.

Why am I not getting a 3D plot for a cylinder instead?

  • $\begingroup$ You typed the equation wrong in Wolfram. $\endgroup$ – Elliot G Apr 14 '16 at 7:43
  • $\begingroup$ @ElliotG I put it as $f=x^2+(y-2)^2-1$ which is the same thing right? just to test it I even tried to plot just $x^2+(y-2)^2$ and even then I'm getting like a half cylinder of some sort like this $\endgroup$ – aswa09 Apr 14 '16 at 7:47
  • $\begingroup$ You are plotting another surface. Namely, $z = x^2+(y-2)^2-1$. $\endgroup$ – Martín-Blas Pérez Pinilla Apr 14 '16 at 9:54
  • 1
    $\begingroup$ That plot is nothing like half a cylinder! It's a paraboloid. $\endgroup$ – TonyK Apr 14 '16 at 12:34
  • 1
    $\begingroup$ How on earth do you think that looks like half a cylinder O_O $\endgroup$ – djechlin Apr 14 '16 at 18:16

Expanding on my comment:

The equation you have is, for example, $x^2+(y-2)^2=1$. The graph you want is the set of all points $(x,y,z)$ which satisfy this equality. Note that $z$ is not in the equation, which means that $z$ can be anything as long as the $x$ and $y$ work.

If we looked at the same equation in two dimensions, we would say the graph is the set of all points $(x,y)$ that satisfy the equation. This would be a circle. In three dimensions, $z$ can be whatever it wants so the circle extends forever in the the $z$ direction and we get the infinite cylinder.

Here's the issue: this is not a function. It fails the vertical line test. A very similar analogy is the line $x=2$. Of course, in two dimensions this means the vertical line at $x=2$. However, there is no way to write this as a function of $x$.

Certain graphing programs are "smart" enough to figure out what you mean. The only real way to plot this is to parameterize it as a well-defined function.

  • 1
    $\begingroup$ It is a bug in WolframAlpha that one cannot specify this to be a request for a contour plot. WA can do contour plots fine in general, but it doesn't recognise requests for contour plots in 3D unless all three variables appear. $\endgroup$ – Patrick Stevens Apr 14 '16 at 7:59

The only way I've got for making WolframAlpha recognise this as a request for a 3D plot in which one variable happens to be absent, is:

plot [x^2]+[(y-2)^2] + 0.000000001z = 1

This will not quite produce the right plot, but it's very close; I've had to add a term which is nearly zero, to make WA understand the $z$ term.

I have reported as a bug the fact that ContourPlot3D[x^2+(y-2)^2==1, {x, -1, 1}, {y, 1, 3}, {z, -4, 4}] is not recognised correctly.

  • 4
    $\begingroup$ @tatan I refrained from using MathJax for a reason: the quoted text is verbatim text to type into WolframAlpha. $\endgroup$ – Patrick Stevens Apr 14 '16 at 13:25

Here is a parametrization using Mathematica. As @Patrick Stevens pointed out, you cannot plot this in Wolfram Alpha (yet).enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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