Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2071 | zjchen | 1 | !goto $wims_read_parm |
2 | |||
3 | :def |
||
4 | title=Weighted data sum |
||
5 | synonyme=weighted sum, sum weighted |
||
6 | input=data2d |
||
7 | !exit |
||
8 | |||
9 | :proc |
||
10 | |||
11 | pari_header=dmat=Mat([$fml2]);w=sum(x=1,$cnt,dmat[x,2]); |
||
12 | result=!exec pari print((dmat[,1]~*dmat[,2]));\ |
||
13 | print(w); |
||
14 | !distribute lines $result into result, totweight |
||
15 | |||
16 | !exit |
||
17 | |||
18 | :output |
||
19 | |||
20 | <center> |
||
21 | Weighted sum = |
||
22 | !htmlmath $result |
||
23 | </center> <p> |
||
24 | Data: $cnt weighted numbers { $fml3 } (total weight = $totweight). |
||
25 | <p> |
||
26 | !exit |
||
27 |