Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
539 | bpr | 1 | !goto $wims_read_parm |
2 | |||
3 | :def |
||
4 | title=Arithmetic mean |
||
5 | synonyme=average, mean |
||
6 | input=data1d |
||
7 | !exit |
||
8 | |||
9 | :proc |
||
10 | |||
11 | cnt=!itemcnt $formula |
||
12 | !if $cnt>0 |
||
13 | result=!sum x for x in $formula |
||
14 | result=$[($result)/$cnt] |
||
15 | !else |
||
16 | result=0 |
||
17 | !endif |
||
18 | |||
19 | !exit |
||
20 | |||
21 | :output |
||
22 | |||
23 | <center> |
||
24 | Arithmetic mean = |
||
25 | !htmlmath $result |
||
26 | </center> <p> |
||
27 | Data: $cnt numbers { $formula } |
||
28 | <p> |
||
29 | The <em>arithmetic mean</em> of {<i>x</i><sub>1</sub>, |
||
30 | <i>x</i><sub>2</sub>, ..., <i>x<sub>n</sub></i>} is equal to |
||
31 | !set ins_align=middle |
||
32 | !instex $$$$ {1\over n}\sum_{i=1}^n x_i $$$$ |
||
33 | . |
||
34 | !exit |
||
35 |