1
$\begingroup$

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}}]

enter image description here

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).

$\endgroup$
3
$\begingroup$

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[5], CapForm["Round"], JoinForm["Round"], Opacity[.5, Red]]},
 GridLines -> {Flatten @ Cases[{__?NumericQ}][β /. intersections], None}, 
 PlotLegends -> "Expressions", ImageSize -> Large]

enter image description here

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Andrea2810 Aug 17 at 15:52
  • 1
    $\begingroup$ I use the last answer to this topic ([link] mathematica.stackexchange.com/questions/91190/…), by using: breaks = Cases[ Last /@ (Min[d] // PiecewiseExpand)[[1]], _?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 $\endgroup$ – Andrea2810 Aug 17 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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