How to write an equivalent RankedMax function in Mma 7.0
I need to use something equivalent to RankedMax in Mma 8.0, but I only have version 7.0. Is this somethin开发者_开发技巧g doable, or it has to be done at the kernel/implementation level?
Many thanks!
According to the more information section of the 8.0 help page for RankedMax
, the function is equivalent to this:
RankedMax[list_, 1] := Max[list]
RankedMax[list_, n_] /; n == Length@list := Min[list]
RankedMax[list_, n_] := Module[{m=Length@list}, Quantile[list, (m - n + 1) / m]]
The Quantile
function is available in 7.0.
精彩评论