### 7.1.6 Quantiles: quantile

Similar to quartiles, a quantile of a list is the number q such that a given fraction of the list numbers fall at or below q. The first quartile, for example, is the quantile with the fraction 0.25.

The command quantile takes a list of numbers and a value p between 0 and 1 as arguments and returns the pth quantile. For example,

A := [0,1,2,3,4,5,6,7,8,9,10,11]
quantile(A,0.1)

returns the quantile with p = 0.1 (the first decile):

1.0

Like quartile, the quantile command can take an argument representing weights of the list; the weights can be given as a second argument and then the value p will be the third. The command

quantile(A,A,0.25)

will return

6