Rev 3265 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !if $wims_read_parm!=slib_header |
2 | !goto proc |
||
3 | !endif |
||
4 | slib_title=Quadratic mean |
||
5 | slib_parms=1\ |
||
6 | ,[data] or [data],[weight] |
||
7 | slib_author=Adeline Grelot and Bernadette PERRIN-RIOU |
||
8 | slib_out=standard quadratic mean of data x_1,..,x_n = sum(x_i^2)/n |
||
9 | slib_comment=Data and weight can be recognized under many formats, \ |
||
10 | in particular as a matrix (with data before weight). |
||
11 | slib_example=[2,-7,6]\ |
||
12 | [2,1;-7,1;6,4]\ |
||
13 | [2,-7,6],[1,1,4]\ |
||
14 | [2,-7,6;1,1,4] |
||
15 | !exit |
||
16 | |||
17 | :proc |
||
18 | |||
19 | !readproc slib/stat/dataproc $wims_read_parm |
||
20 | !if $slib_cnt=0 |
||
21 | slib_out=0 |
||
22 | !else |
||
23 | !if $slib_weight =$empty |
||
24 | slib_out=!sum x^2 for x in $slib_data |
||
25 | slib_out=$[sqrt($slib_out/$slib_cnt)] |
||
26 | !else |
||
27 | slib_cnt=!itemcnt $slib_data |
||
28 | slib_out=!exec pari print(sqrt(sum(x=1,$slib_cnt,[$slib_weight][x]*([$slib_data][x])^2)/$slib_tw)) |
||
29 | |||
30 | !endif weight |
||
31 | !endif |
||
32 | |||
33 | slib_out=!trim $slib_out |