3
$\begingroup$

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}]
$\endgroup$
2
  • $\begingroup$ try RegionPlot3D i hope you code neat and nice so i could help further ! $\endgroup$
    – nufaie
    Apr 3, 2019 at 17:08
  • $\begingroup$ 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. $\endgroup$
    – annuk89
    Apr 3, 2019 at 17:11

2 Answers 2

3
$\begingroup$

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[[1]], _Equal][[1]]]] == 0, 
    cons = R[[1]] /. {_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]]
]

$\endgroup$
1
  • $\begingroup$ This works perfectly. Thank you! :) $\endgroup$
    – annuk89
    Apr 3, 2019 at 17:51
1
$\begingroup$

You could use DiscretizeRegion:

DiscretizeRegion[R, {{-1.5,1},{0,2},{0,3}}]

enter image description here

where R is your ImplicitRegion, and the bounds coming from your last 3 inequalities.

$\endgroup$
1
  • $\begingroup$ 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? $\endgroup$
    – annuk89
    Apr 3, 2019 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.