!goto $wims_read_parm

:def
title=Weighted arithmetic mean
synonyme=weighted data mean, arithmetic mean weighted, weighted data arithmetic mean
input=data2d
!exit

:proc

pari_header=dmat=Mat([$fml2]);w=sum(x=1,$cnt,dmat[x,2]);
result=!exec pari print((dmat[,1]~*dmat[,2])/w);\
	print(w);
!distribute lines $result into result, totweight

!exit

:output

<center>
Weighted arithmetic mean =
!htmlmath $result
</center> <p>
Data: $cnt weighted numbers { $fml3 } (total weight = $totweight).
<p>
!exit

