1
$\begingroup$

I started experimenting with Mathematica a few months ago in college (It's my first year in electronics engineering, so I'm not even close to an advanced user's profile yet).

My problem comes when I try to plot a 2D region that doesn't include (0,0) on it.

The region I'm having trouble with is:

region

{(x,y)\[Element]\[DoubleStruckCapitalR]^2:0<x^2+y^2/4<=1}

And I've tried to plot it using this:

m[x_, y_] := (x^2) + (y^2)/4      

RegionPlot[m[x, y] <= 1 && m[x, y] > 0, {x, -2, 2}, {y, -3, 3},   
 AspectRatio -> 1, Axes -> True, AxesStyle -> Dashed,   
 AxesLabel -> Automatic, PlotStyle -> {Blue, Opacity[0.3, Blue]}]

But, in spite of including both conditions on the RegionPlot[] statement, all I get is:

2D_Graph

As you can notice, (0,0) should not be shaded (but it is :( ).

Maybe this question looks too basic or obvious for some of you, but I've been searching throughout many websites, including Wolfram's official, without a clear answer yet.

I've been thinking about something like "Exclude[{{x,y}}]" for 2D regions but haven't found anything similar.

Some of the guys in class told me "Just place a white dot above it", that works, but it's not a real solution.

Do you think I might not be using the right statement?

$\endgroup$
  • 1
    $\begingroup$ A single point has zero area. What would you expect the region to look like if you removed a subregion of area zero? $\endgroup$ – mikado May 9 at 21:45
  • $\begingroup$ Yes, of course, I understand that a single point has zero area. However, in Mathematica a single point is represented by a small finite area (let's compare it to a pixel from an old monitor), so if we exclude it from a region, the shading should show a small empty space in (0,0), shouldn't it?.For the same reason, when we plot a point over the XY plane, we're able to see it. That's what my Calculus professor told me and what he wants to see in my document. Do you find it illogic?. Maybe the "area" that Mathematica shows when you plot a single point is "thicker" compared to points in region. $\endgroup$ – Alex May 9 at 22:20
  • $\begingroup$ I really apreciate your help. You're theoretically right against what my professor says, but now I'm trying to understand if it's just that the "single-point area" shown when using RegionPlot[ ] it's so small that you cannot see the "empty space" or it's just that I'm not using the proper statement. My calculus professor claims that others managed to "remove" the damn point, but he won't tell me how. That's why I'm asking Thanks. $\endgroup$ – Alex May 9 at 22:31
4
$\begingroup$

You are confusing Point which is a Graphics primitive for display purposes with the mathematical concept of a point. RegionPlot, of course, has no idea that you desire to display a small void at the origin for aesthetic or didactic purposes and merely proceeds mathematically.

You can decorate your plot with such a void to satisfy you desire. The Epilog option is used for making such decorations. Here are two ways to use it that can be applied to your problem. They differ in the way they represent the omitted point to the viewer.

m[x_, y_] := (x^2) + (y^2)/4     

Using the Point graphics primitive

RegionPlot[m[x, y] <= 1, {x, -1.1, 1.1}, {y, -2.1, 2.1},
  AspectRatio -> Automatic,
  Axes -> True,
  AxesStyle -> Dashed,
  AxesLabel -> Automatic,
  PlotStyle -> Opacity[0.3, Blue],
  Epilog -> {White, Point[{0, 0}]}]

plot_1

Using the RegularPolygon graphics primitive

Module[{r, pts},
  r = .02;
  pts = 10; 
  RegionPlot[m[x, y] <= 1, {x, -1.1, 1.1}, {y, -2.1, 2.1},
    AspectRatio -> Automatic,
    Axes -> True,
    AxesStyle -> Dashed,
    AxesLabel -> Automatic,
    PlotStyle -> Opacity[0.3, Blue],
    Epilog -> {EdgeForm[Black], FaceForm[White], RegularPolygon[r, pts]}]]

plot_2

My personal preference is for the 2nd version; I like having a border around the void.

$\endgroup$
  • $\begingroup$ Thank you m_goldberg, that's quite close to what I was looking for. As you mentioned, the fact of "removing a single point" from the shaded region has no mathematical sense, it's only a way for us to graphically see the idea (That's why I think I was kinda confused at first). I was trying RegionPlot[] to show an "empty or void space" that didn't exist for the program because of the contradiction to the mathematical definition of point. $\endgroup$ – Alex May 10 at 15:43

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.