2
$\begingroup$

I want to plot the region in the $xy$-plane which satisfies $f(x,y,z) < 0$, where $z$ can take values in the range [-1, 1]. How do I do this in Mathematica?

$\endgroup$
  • 1
    $\begingroup$ Have you looked at RegionPlot3D? $\endgroup$ – m_goldberg Feb 19 '19 at 13:03
  • $\begingroup$ This example might be relevant. $\endgroup$ – Chip Hurst Feb 19 '19 at 19:18
  • $\begingroup$ Thanks, @m_goldberg. As Roman gave an explicit example of how to it. This will solve my problem for now! But I am wondering if I can do it in general for functions of more than 3 variables and I still want a 2D Regionplot. $\endgroup$ – Dipankar Das Feb 20 '19 at 10:46
3
$\begingroup$

In general, for each $z$ value, the projection of the contours of $f(x,y,z)$ onto the $xy$-plane will be different, so there is no single "region in the $xy$-plane which satisfies $f(x,y,z) < 0$". All you can do, I think, is look at contour plots for a sequence values of $z$. Here are two examples of how you might make such a sequence. Since you didn't supply an example of f, I will use this one:

f[x_, y_, z_] := x^2 + y^3 - z^2

SliceContourPlot3D

SliceContourPlot3D[
  f[x, y, z], {"ZStackedPlanes", 5},
  {x, -3, 3}, {y, -3, 3}, {z, -1, 1},
  RegionFunction -> (f[#1, #2, #3] < 0 &),
  AxesLabel -> {"X", "Y", "Z",}]

3d_plot

Projection onto 2D contour plots

GraphicsColumn[
  Table[
    ContourPlot[f[x, y, z], {x, -3, 3}, {y, -3, 3},
      PlotLabel -> Row[{"z = ", z, "\n"}],
      Contours -> Range[-5, 0],
      ContourShading -> None,
      ImageSize -> Medium],
   {z, Subdivide[-1, 1, 4] // N}]]

2d_plots

| improve this answer | |
$\endgroup$
1
$\begingroup$

As @mgoldberg says, do a RegionPlot3D and view it flat from above (projecting out the $z$-axis):

f[x_, y_, z_] = x^2 + y^3 - z^2;
RegionPlot3D[f[x, y, z] < 0, {x, -3, 3}, {y, -3, 3}, {z, 0, 1}, ViewPoint -> {0, 0, ∞}]

enter image description here

In this way you can see which $(x,y)$ values allow $f(x,y,z)<0$ for any $z\in[-1,1]$.

Using @ChipHurst's suggestion seems a bit more tricky and gives a poor quality plot:

Region[ImplicitRegion[Exists[z, 0<z<1 && f[x,y,z]<0], {x, y}],
  PlotRange -> {{-3,3},{-3,3}}]

enter image description here

| improve this answer | |
$\endgroup$

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.