# Find the intervals where a piecewise is maximum

I have the following 3 piecewise functions and I would like to have the threshold of the upper envelope.

a = Piecewise[{{0.125 (0.1 + 0.1 (11.5 - 1 \[Beta])),
8 < \[Beta] < (11.4)}}]
b = Piecewise[{{0.375 (0.1 + 0.1 (10.5 - 1 \[Beta])),
8 < \[Beta] < (10.4)}}]
c = Piecewise[{{0.375 ((10.5 - 1 \[Beta])), (10.4) < \[Beta] < 12}}] In other words I would like to obtain the list {10.4,10.431}, Where 10.4 is the threshold between b and c (here there is no intersection between b and c) and 10.431 is the threshold between a and c (their intersection).

You can use Solve for the intersection for each pair of functions:

intersections = Quiet @ N @ Solve[Equal[##] && 8 < β < 12, β, Reals] & @@@
Subsets[Rationalize /@ {a, b, c}, {2}];

Grid[Transpose[{Subsets[{"a", "b", "c"}, {2}], intersections}],
Dividers -> All] // TeXForm


$$\begin{array}{|c|c|} \hline \{\text{a},\text{b}\} & \{\{\}\} \\ \hline \{\text{a},\text{c}\} & \{\{\beta \to 10.431\}\} \\ \hline \{\text{b},\text{c}\} & \{\{\beta \to 10.4\},\{\beta \to 10.5\}\} \\ \hline \end{array}$$

d = FullSimplify[PiecewiseExpand[Max[a, b, c]], 0 <= β <= 12];

Plot[{a, b, c, d}, {β, 9, 12}, Frame -> True, Axes -> False,
PlotStyle -> {Automatic, Automatic, Automatic,
Directive[AbsoluteThickness, CapForm["Round"], JoinForm["Round"], Opacity[.5, Red]]},
GridLines -> {Flatten @ Cases[{__?NumericQ}][β /. intersections], None},
PlotLegends -> "Expressions", ImageSize -> Large] • Thank you! However, here 10.5 is a useless intersection for the envelope. Is there a way to exclude these cases automatically? What do you think to keep just the points of beta where d is not linear? – Andrea2810 Aug 17 '19 at 15:52
• I use the last answer to this topic ([link] mathematica.stackexchange.com/questions/91190/…), by using: breaks = Cases[ Last /@ (Min[d] // PiecewiseExpand)[], _?NumericQ, {2}] // Union , gives as result {8, 10.4, 10.431}, it is exactly what I need, but I'm not sure what this command does. @kglr – Andrea2810 Aug 17 '19 at 16:12