6
$\begingroup$

I need a contour plot of the function $f(x,y) = (x-1)^4 + (2x+y)^2$. Using Mathematica, I get

enter image description here

I thought this looks strange. The contour plot is supposed to show ellipses. After all, this is what the graph of $f$ looks like (elliptical paraboloid) using GeoGebra

graph of f using geogebra

I thought that I was doing something wrong with ContourPlot. But then I used Plot3D on that same function $f$, and I got this

enter image description here

So I don't know what's going on here. I don't understand why Plot3D doesn't generate the elliptical paraboloid that it is supposed to. But what I really need is the contour plot showing the ellipses.

Thanks in advance for any help, and sorry if the images in the body of the questions are too big.

New contributor
Sigma is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
10
$\begingroup$
Clear["Global`*"]

The default PlotRange is obscuring the detail that you want.

Plot3D[(x - 1)^4 + (2 x + y)^2, {x, -8, 8}, {y, -8, 8},
 PlotRange -> {0, 6},
 ClippingStyle -> None]

enter image description here

ContourPlot[(x - 1)^4 + (2 x + y)^2,
 {x, -8, 8}, {y, -8, 8},
 PlotRange -> {Full, Full, {0, 20}}]

enter image description here

$\endgroup$
4
$\begingroup$

To understand why the plot you made (which is correct although distorted) looks like it does and also see the region that really interests you without distortion, make use of the options AspectRatio and Contours. Like so:

ContourPlot[(x - 1)^4 + (2 x + y)^2, {x, -2, 4}, {y, -14, 9},
  AspectRatio -> Automatic,
  Contours -> 2^Range[-2, 6],
  ImageSize -> Large]

plot

Observe that the countours in the range around y = 0 become more and more vertical as z increases. That explains your result.

$\endgroup$

Your Answer

Sigma is a new contributor. Be nice, and check out our Code of Conduct.

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.