> Bonjour.
>
> Je ne trouve pas de commande dans Maxima pour trouver la variance et
> l?ecart-type d?une liste de valeurs accompagn?e de la liste de
> pond?ration, avec les options de sample et de population.
Hello,
Functions mean, var and std from package descriptive calculate the mean,
variance and standard deviation directly from the sample, so that
frequencies are obtained from data.
Here is a simple example of a function that calculates the mean from two
lists, observed values and frequencies:
(%i4) display2d : false $
(%i5) mean2(val, pon) :=
block([factor],
factor : 1 / apply("+", pon),
factor * apply("+", map("*", val, pon)) ) $
If you work with absolute frequencies:
(%i6) mean2([1, 2, 3], [4, 3, 5]);
(%o6) 25/12
With relative frequencies:
(%i7) mean2([1, 2, 3], [0.3, 0.3, 0.4]);
(%o7) 2.1
A similar function could be written for the variance.
--
Mario