15.2.5 Root mean square:
rms
The
rms
command finds the room mean square of a list of numbers
X
=[
x
1
,
x
2
,…,
x
n
], which is defined by
RMS(
X
)=
√
n
∑
k
=1
|
x
k
|
2
n
.
rms
takes one argument:
X
, a list of real or complex numbers [
x
1
,
x
2
,…,
x
n
].
rms(
X
)
returns the root mean square of
X
.
Examples
Input:
rms([1,2,5,8,3,6,7,9,-1])
Output:
√
30
Input:
rms([1,1-i,2+3i,5-2i])
Output:
3
2
√
5