# Plot implicit region in 3D not working

I'm having troubles plotting an implicit region R (the full expression will be given at the end of this message for sake of readability). This implicit region R is defined by both inequalities and equalities, for which I can separately use RegionPlot3D and ContourPlot3D without any problems. However, when I want to have a plot of the sole region where these two sets intersect, I have to use another command, and in particular I tried:

• Region[R]: returns an empty output.
• DiscretizeRegion[R]: returns the message "DiscretizeRegion was unable to discretize the region ImplicitRegion".
• Needs["NDSolveFEM "], ToElementMesh[R]: returns the message "BoundaryDiscretizeRegion: There is not a boundary representation that uniquely defines a region with region dimension 2 embedded in dimension 3".

I don't know what else to try. From the previously cited combination of RegionPlot3D and ContourPlot3D I see that the region exists and it should also be quite smooth to plot, so I really don't know what the problem could be. Any help would be highly appreciated!

The region R is the following:

ImplicitRegion[-((
S^2 (-1 + K + S) (S + (-1 + K) T))/(-T + (K + S) (S + K T))) > 0 &&
2 S > 0 && (1/((T - (K + S) (S + K T))^2))
2 S^2 (S^2 (1 + S (K + S)^2) +
S (-2 - S + (K + S) (-S + 2 (K + K S (K + S)))) T + (-1 +
K (K + S)) (-2 + K (2 + S (K + S))) T^2) - (
1/((T - (K + S) (S + K T))^2))
S^2 (-S ((-1 + K) K + 2 (-1 + K) S + S^2) - (K + K^3 +
K^2 (-2 + S) + 3 S - S^3 - K S (4 + S)) T + (2 - S +
K (-3 - S + (K + S)^2)) T^2) >
0 && (1/((T - (K + S) (S + K T))^4))
2 S^4 (S^2 (1 + S (K + S)^2) +
S (-2 - S + (K + S) (-S + 2 (K + K S (K + S)))) T + (-1 +
K (K + S)) (-2 + K (2 + S (K + S))) T^2) (-S ((-1 + K) K +
2 (-1 + K) S + S^2) - (K + K^3 + K^2 (-2 + S) + 3 S - S^3 -
K S (4 + S)) T + (2 - S + K (-3 - S + (K + S)^2)) T^2) - (
1/((T - (K + S) (S + K T))^4))
S^4 (-S ((-1 + K) K + 2 (-1 + K) S + S^2) - (K + K^3 +
K^2 (-2 + S) + 3 S - S^3 - K S (4 + S)) T + (2 - S +
K (-3 - S + (K + S)^2)) T^2)^2 + (
4 S^4 (-1 + K + S) (S + (-1 + K) T))/(-T + (K + S) (S + K T)) ==
0 && ((K < -1 && ((0 < S < (1 - K^2)/K && -(S/(-1 + K)) <
T < (-K S - S^2)/(-1 + K^2 + K S)) || ((1 - K^2)/K <= S <
1 - K && T > -(S/(-1 + K))) || (S > 1 - K &&
0 < T < -(S/(-1 + K))))) || (-1 <= K <
1 && ((0 < S < 1 - K && T > -(S/(-1 + K))) || (S > 1 - K &&
0 < T < -(S/(-1 + K)))))) && -1.5 <= K <= 1 &&
0.001 <= S <= 2 && 0.001 <= T <= 3, {K, S, T}]

• try RegionPlot3D i hope you code neat and nice so i could help further ! – Alrubaie Apr 3 '19 at 17:08
• Unfortunately RegionPlot3D doesn't work because, as I wrote, there are both inequalities and equalities in the definition of the region, and RegionPlot3D only accepts inequalities. – annuk89 Apr 3 '19 at 17:11

I was able to get the region to discretize over larger bounds. So one workaround is to clip this discretization:

DiscretizeRegion[
DiscretizeRegion[R, {{-1.5, 1}, {0, 2}, {0, 3}}, MaxCellMeasure -> .00001],
{{-1.5, 1}, {0.001, 2}, {0.001, 3}}
] With more work, we can invoke ContourPlot3D:

With[
{
equality = Numerator[Together[FirstCase[R[], _Equal][]]] == 0,
cons = R[] /. {_Equal -> True, K -> #1, S -> #2, T -> #3}
},
ContourPlot3D[{equality}, {K, -1.5, 1}, {S, 0.001, 2}, {T, 0.001, 3},
PlotPoints -> 60, RegionFunction -> Function[cons]]
] • This works perfectly. Thank you! :) – annuk89 Apr 3 '19 at 17:51

You could use DiscretizeRegion:

DiscretizeRegion[R, {{-1.5,1},{0,2},{0,3}}] where R is your ImplicitRegion, and the bounds coming from your last 3 inequalities.

• Thank you for your answer. This seems to work, however the two variables S and T should be greater than 0, and as soon as I take for instance {0.001,2},{0.001,3} in the DiscretizeRegion, I get again an error message - it only works if I put 0 instead (but then somehow these horizontal/vertical areas are not convincing). Any clue what could the issue be? – annuk89 Apr 3 '19 at 17:34