# Ranking polynomials based on global maxima

Suppose I have the following polynomials in an association i.e. <|...|>, they are:

x1 = <|"pol1" -> (354.070 x + 1139.013 x^2 + 2301.827 x^3 +
3772.240 x^4)/(354 x + 1143 x^2 + 2320 x^3 + 3811 x^4),
"pol2" -> (353.073 x + 1154.929 x^2 + 2345.483 x^3 +
3829.635 x^4)/(354 x + 1143 x^2 + 2320 x^3 + 3811 x^4)|>;


My problem is to rank them by global maxima, to do that I plotted them as:

Plot[x1 // Values, {x, 0, 1}, PlotLabels -> Placed[Automatic, Above]]


I used PlotLabels to manually see which curve is higher but then I get:

Seemingly I have to use Placed[{"...","..."}, Above] to have the labels correctly but I wonder if this can be automated using the association?

Also is there a way to ranked the polynomials in x1 between {x,0,1} without plotting them? I know one can use NMaximize[x1] but how does one specify x between 0 and 1.

• Plot[Evaluate[x1 // Values], {x, 0, 1}, PlotLabels -> Placed[Automatic, Above]] or Plot[Evaluate[x1 // Values], {x, 0, 1}, PlotLabels -> Placed[Keys[x1], Above]]? – kglr Jan 15 at 13:24
• That would put the polynomials as label instead of the corresponding Keys. – William Jan 15 at 13:26
• Oh the latter works :) Thank you – William Jan 15 at 13:27
• Is there a way to rank the polynomials based on their maxvalue between 0 and 1? – William Jan 15 at 13:31
• I used Table[FindMaxValue[x1[[i]], {x, 0.000001, 1}], {i, Length[xx1]}] // Quiet but how can I keep the association? – William Jan 15 at 13:33

SortBy[x1, - N @ ToRadicals @ MaxValue[{Rationalize @ #, 0 <= x <= 1}, x] &]

Plot[Evaluate[x1 // Values], {x, 0, 1}, PlotLabels -> Placed[Keys[x1], Above]]