0
$\begingroup$

I have to plot the region shown in the image below. Although it's very simple, Mathematica is not able to plot it when I put the code

RegionPlot3D[{t < Min[1, (1 - r - s + Sqrt[(1 - r - s)^(2) - 4 s r])/(2 r)] &&
              Sqrt[r] + Sqrt[s] < 1}, {r, 0, 10}, {s, 0, 10}, {t, 0, 10}]

$$\left\{\sqrt{r} + \sqrt{s} < 1\,\land\,t<\min\left\{1,\frac{1-r-s+\sqrt{(1-r-s)^2-4rs}}{2r}\right\}\right\}$$

One of the reasons is that it says it cannot compare 1 with a complex number to find Min[]. In fact, I found that if the first condition is satisfied then (1 - r - s)^(2) - 4 s r is always greater than zero so a complex number won't arise inside Min[]. So I tried the following code to tell Mathematica to evaluate only when Sqrt[r] + Sqrt[s] < 1 is satisfied.

RegionPlot3D[If[Sqrt[r] + Sqrt[s] < 1,
                t < Min[1, (1 - r - s + Sqrt[(1 - r - s)^(2) - 4 s r])/(2 r)]],
             {r,0,10},{s,0,10},{t,0,10}]

Even then there are some problems with r=0case. Mathematica says it leads to infinity inside Min[] but when r=0 the numerator of (1-r-s+Sqrt[(1-r-s)^(2)-4s r])/(2 r) is also zero so there is no infinity. Any idea of how to plot these kinds of regions?

$\endgroup$
1
  • $\begingroup$ Have you checked Assumptions or Assuming? Also, $a<\min(b,c)$ is equivalent to $a<b$ and $a<c$ so you could also try this. $\endgroup$
    – anderstood
    May 16, 2020 at 21:27

1 Answer 1

1
$\begingroup$
Clear["Global`*"]

FunctionDomain[{(1 - r - s + Sqrt[(1 - r - s)^(2) - 4 s r])/(2 r), 
  r >= 0, s >= 0}, {r, s}]

(* r > 0 && s >= 0 && -2 r + r^2 - 2 s - 2 r s + s^2 >= -1 *)

RegionPlot3D[{
   t < Min[1, (1 - r - s + Sqrt[(1 - r - s)^(2) - 4 s r])/(2 r)] &&
      Sqrt[r] + Sqrt[s] < 1},
  {r, 10^-9, 1.1}, {s, 0, 1.1}, {t, 0, 1.1},
  AxesLabel -> Automatic,
  PlotPoints -> 50,
  MaxRecursion -> 2] //
 Quiet

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks for your answer. But when you define FunctionDomain[] won't it affect other regions? Because I have many other regions that will be plotted along with this in a single 3D plot? So won't FunctionDomain[] affect the other plots? $\endgroup$
    – Epsilon
    May 16, 2020 at 21:48
  • $\begingroup$ The calculation of FunctionDomain doesn't affect anything. Its output merely highlights that r must be greater than zero and resulted in setting the plot range to {r, 10^-9, 1.1} $\endgroup$
    – Bob Hanlon
    May 16, 2020 at 22:06

Your Answer

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

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