Task[edit]
Compute the   Root mean square   of the numbers 1..10.



The   root mean square   is also known by its initials RMS (or rms), and as the quadratic mean.

The RMS is calculated as the mean of the squares of the numbers, square-rooted:



 




x


r
m
s



=







x

1




2


+



x

2




2


+
⋯
+



x

n




2



n



.


{\displaystyle x_{\mathrm {rms} }={\sqrt {{{x_{1}}^{2}+{x_{2}}^{2}+\cdots +{x_{n}}^{2}} \over n}}.}




See also
Tasks for calculating statistical measures



in one go
moving (sliding window)
moving (cumulative)

Mean
Arithmetic

Statistics/Basic
Averages/Arithmetic mean
Averages/Pythagorean means


Averages/Simple moving average




Geometric

Averages/Pythagorean means




Harmonic

Averages/Pythagorean means




Quadratic

Averages/Root mean square




Circular

Averages/Mean angle
Averages/Mean time of day




Median

Averages/Median




Mode

Averages/Mode




Standard deviation

Statistics/Basic



Cumulative standard deviation






IDENTIFICATION DIVISION.
PROGRAM-ID. QUADRATIC-MEAN-PROGRAM.
DATA DIVISION.
WORKING-STORAGE SECTION.
01  QUADRATIC-MEAN-VARS.
    05 N               PIC 99        VALUE 0.
    05 N-SQUARED       PIC 999.
    05 RUNNING-TOTAL   PIC 999       VALUE 0.
    05 MEAN-OF-SQUARES PIC 99V9(16).
    05 QUADRATIC-MEAN  PIC 9V9(15).
PROCEDURE DIVISION.
CONTROL-PARAGRAPH.
    PERFORM MULTIPLICATION-PARAGRAPH 10 TIMES.
    DIVIDE  RUNNING-TOTAL BY 10 GIVING MEAN-OF-SQUARES.
    COMPUTE QUADRATIC-MEAN = FUNCTION SQRT(MEAN-OF-SQUARES).
    DISPLAY QUADRATIC-MEAN UPON CONSOLE.
    STOP RUN.
MULTIPLICATION-PARAGRAPH.
    ADD      1         TO N.
    MULTIPLY N         BY N GIVING N-SQUARED.
    ADD      N-SQUARED TO RUNNING-TOTAL.