function [v,m]=weighted_variance(x,w)
%mean and variance of distribution with points x, weights w
% see also weighted_mean
m=sum(x.*w)/sum(w);
v=sum(w.*(x-m).^2)/sum(w);