### 7.1.5 Quartiles: quartiles quartile1 quartile3

Recall that the quartiles of a list of numbers divide it into four equal parts; the first quartile is the number q1 such that one-fourth of the list numbers fall below q1; i.e., the median of that part of the list which fall at or below the list median. The second quartiles is the number q2 such that half of the list numbers fall at or below q2; more specifically, the median of the list. And of course the third quartile is the number q3 such that three-fourths of the list numbers fall at or below q3.

The function quartiles takes a list and returns a column vector consisting of the minimum of the list, the first quartile, the second quartile, the third quartile and the maximum. If you enter

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

you will get

[[0.0],[2.0],[5.0],[8.0],[11.0]]

You can get the individual entries of this vector with the commands min, quartile1, median, quartile2 and max.

Just as with median, the quartiles function can take a second argument consisting of weights for the first argument; for example,

quartiles(A,A)

would return

[0,6,8,10,11]