1
$\begingroup$

I have three functions f_1, f_2, f_3 defined on 𝒟=[0,a]×[0,b] and I want to color in blue (resp. red, green) the region of points (x,y)∈𝒟 where f_1(x,y)=Max(f_1(x,y),f_2(x,y),f_3(x,y)) (resp. f_2(x,y)=Max(f_1(x,y),f_2(x,y),f_3(x,y)), f_3(x,y)=Max(f_1(x,y),f_2(x,y),f_3(x,y))). How to do that? I know that with only two functions, it is enough to use RegionPlot :

RegionPlot[f_1[x,y] < f_2[x,y], {x, 0, a}, {y, 0, b}]

But how to do this with three functions and not only two? Is there a simple solution?

$\endgroup$
0
2
$\begingroup$

Do you mean something like this?

f1[a_, b_] := Sin[a] Cos[b]
f2[a_, b_] := Sinc[a] Sin[b]
f3[a_, b_] := Cos[a] Sinc[b]

ContourPlot[
  Ordering[{f1[a, b], f2[a, b], f3[a, b]}, -1], {a, 0, 5}, {b, 0, 5}
  , PlotPoints -> 100
]

enter image description here

If so your question is a duplicate of Plot the plane so different condition has a different color

(which I couldn't find before posting)

$\endgroup$
1
  • $\begingroup$ Oh Yes! Thank you so much Mr.Wizard! $\endgroup$ – Richard May 31 '18 at 9:56

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