开发者

How to write an equivalent RankedMax function in Mma 7.0

开发者 https://www.devze.com 2023-02-04 15:35 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消