# Tag Info

## New answers tagged regions

2

I reported this to WRI tech support. This is what I sent them I have encountered an issue when evaluating an example given in ref/ImplicitRegion. The example before I evaluated its code showed a circle. Evaluation should have redrawn the circle, but it actually produced a blank plot. I enclose a screen capture to illustrate the problem. screen capture ...

2

As someone else here mentioned there are no Log and LogLog versions of RegionPlot, so you can make them yourself. The answer above relies on the user being able to apply the Log function to the input in the correct fashion, but it isn't always obvious which arguments or variables should be given the Log function in the argument, and which should have their ...

4

There is no LogRegionPlot or LogLogRegionPlot, so if you want to make one you'll have to do the scaling yourself, and then supply the correct tick marks yourself using the undocumented (and sometimes poorly behaved) ChartingScaledTicks function: {RegionPlot[Exp[Abs[x]] <= y <= 100, {x, -6, 6}, {y, 0, 120}], RegionPlot[ Log@Exp[Abs[x]] <= y ...

3

curve[v_, g_] := ParametricPlot[{Chi[t[tau, v, g], x[tau, v, g]], Eta[t[tau, v, g], x[tau, v, g]]}, {tau, -50, 50}, PlotRange -> All, RegionFunction -> Function[{x, y, u}, Norm[{x, y}, 1] < .99999 Pi]] Show[RegionPlot[Norm[{x, y}, 1] <= Pi, {x, -Pi, Pi}, {y, -Pi, Pi}], curve[0.5, 2], PlotRange -> {{-Pi, Pi}, {-Pi, Pi}}, Frame -> ...

6

Using your definitions, let's derive a RegionMemberFunction that indicates whether a point lies on the boundary of the diamond-shaped region that you want to exclude from plotting: rmf = RegionMember@DiscretizeRegion@Line[{{-Pi, 0}, {0, -Pi}, {Pi, 0}, {0, Pi}, {-Pi, 0}}]; Notice that the first point must be repeated to obtain a closed line. Using that ...

0

rewi gives a workaround. But I notice the curve generated by RegionPlot is actually jiggling instead of smooth, this can be confirmed if we turned on Mesh->All reg = ImplicitRegion[x^2 + y^2 <= 1, {x, y}]; RegionPlot[reg, BoundaryStyle -> Darker, PlotStyle -> White, Mesh -> All] On the other hand, ContourPlot is designed for this kind ...

3

No, it doesn't. But this workaround helps: reg = ImplicitRegion[x^2 + y^2 <= 1, {x, y}] RegionPlot[reg, BoundaryStyle -> Darker, PlotStyle -> White]

0

I haven't been able to turn one into the other, but they can both be reduced to the most basic form, which is the same: exp1 = Reduce[x + y > 1 || x - y > 1 || y - x > 1 || -x - y > 1, {x, y}, Reals] exp2 = Reduce[Abs[x] + Abs[y] > 1, {x, y}, Reals] exp1 == exp2 (* x < -1 || (-1 <= x <= 0 && (y < -1 - x || y > 1 + ...

1

RegionPlot[ Or @@ {x + y > 1, x - y > 1, y - x > 1, -x - y > 1}, {x, -2, 2}, {y, -2, 2}] suffices

2

On my mac doesn't work either. But you can do << NDSolveFEM l = 10.; w = 10.; h = 5.; reg = Cuboid[{-l/2, -w/2, -h/2}, -{-l/2, -w/2, -h/2}]; mesh = ToElementMesh[reg, MaxCellMeasure -> {"Area" -> .1}] (*ElementMesh[{{-5., 5.}, {-5., 5.}, {-2.5, 2.5}}, {HexahedronElement[ "<" 16384 ">"]}]*) Somehow ImplicitRegion works like crap ...

2

With version 10.4.1 on Linux I get << NDSolveFEM l = 10.; w = 10.; h = 5.; reg = ImplicitRegion[-l/2. <= x <= l/2. && -w/2. <= y <= w/2. && -h/2. <= z <= h/2., {x, y, z}]; mesh = ToElementMesh[reg, MaxCellMeasure -> {"Area" -> .1}]; mesh["Bounds"] {{-5., 5.}, {-5., 5.}, {-2.5, 2.5`}} Other ...

3

Looks like you've uncovered a bug. I can confirm this behavior in 10.3.1 and 10.4. You can still discretize your region using DiscretizeGraphics though: r = DiscretizeGraphics@ RegionPlot[0 < Sin[u]/Cos[v] < 1 && 0 < Sin[v]/Cos[u] < 1, {u, 0, 2}, {v, 0, 2}] And if you want finer areas, use DiscretizeRegion: DiscretizeRegion[r, ...

1

It seems to me you can get the same result without invoking external packages or using an interpolation function, since you have a surface and you have a function defined at all points in space, Taking your region bdr, SliceContourPlot3D[ Sqrt[z^2 + y^2] Cos[ArcTan[y, z]] Sin[x π/2], bdr, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, ContourShading -> None, ...

5

I haven't done the upgrade to 10.4, this is still stuck in our IT department... Nevertheless, playing with different combinations of ToElementMesh, MeshRegion and RegionBoundary, I've come up with some reasonable results: For my still rather simple example I use a cylinder with a cut-out. reg1=Cylinder[{{-2,0,0},{2,0,0}},1]; ...

6

Since this question has a FEM tag, I assume that the mesh is for applying boundary conditions to a PDE. If that is the case, then the solution suggested by @RunnyKine can be improved. What you are looking for are the "PointMarkerFunction" and the "BoundaryMarkerFunction". Now, it is important to understand that markers can be applied to points for ...

5

Some of what is going on is that the region is numericized to the extent that the precision of the numbers in R is set to 7.. Then NIintegrate discretizes the region with dR = DiscretizeRegion[ ImplicitRegion[ 0 < Sech[v] Sinh[u] < 1.000000 && 0 < Sech[u] Sinh[v] < 1.000000 && u >= 0 && v >= 0, {u, v}], ...

7

You can first discretize the region as follows: reg = DiscretizeRegion[ ImplicitRegion[0 < Sinh[u]/Cosh[v] < 1 && 0 < Sinh[v]/Cosh[u] < 1, {{u, 0, 3}, {v, 0, 3}}]]; Now NIntegrate gives us better values: NIntegrate[1, Element[{u, v}, reg]] 1.23371 I don't know why putting Infinity as the limits ...

2

I think what you are using is an undocumented feature in these region objects, so I wouldn't expect it to work properly. You can see some of the properties by using: region["Properties"] The list is quite long so I won't be including it here. Now, both of your regions will show "EdgeLengths" as one of the properties, so you clearly see that this ...

11

Here is an approach using built-in functions: reg = DiscretizeRegion[Disk[{0, 0}, 0.5], MeshCellHighlight -> {{2, All} -> White}] Now, we obtain the outer points: int = MeshCellIndex[reg, {0, "Interior"}][[All,2]] (* interior points *) ext = Complement[MeshCellIndex[reg, 0][[All,2]], int] (* exterior points *) Finally, we set the properties of ...

3

As JM suggested, you can plot the complement of the region you are interested in, and assign a color to that: RegionPlot[{x^2 + y^2 <= 2, x^2 + y^2 > 2}, {x, -3, 3}, {y, -3, 3}, PlotRangePadding -> None, PlotStyle -> {Red, Blue}] If the complement of your region cannot be readily expressed, or more in general for multiple regions, you can ...

10

If you don't mind using undocumented stuff, you can access lots of useful properties by converting the BoundaryMeshRegion to a MeshObject. In this case "VertexVertexConnectivityRules" is useful. Here I start at vertex 1 and go up to 4 steps out along the mesh edges: r = BoundaryDiscretizeRegion[Ball[]]; vvcr = ...

7

Below you'll find the method I wrote myself, but it is terribly slow compared to this one, adapted from halmir's code here, so I will give the fast version first and post my own code below. See halmir's post for an explanation, ClearAll@graphToMesh graphToMesh[graph_?PlanarGraphQ] := Module[{nextCandidate, m, orderings, pAdj, rightF, s, t, initial, ...

2

I will show an approach that makes use of this α shapes code. The caveat here is that one needs to tune a parameter to achieve the "best" shape. But this could be achieved programmatically, if desired, by seeing how some property (e.g. area or volume) of the object changes as the α parameter is changed slightly. A region where that property doesn't change ...

Top 50 recent answers are included