Averages/Root mean square: Difference between revisions

m
imported>Arakov
 
(3 intermediate revisions by 3 users not shown)
Line 682:
<syntaxhighlight lang="e">? RMS(1..10)
# value: 6.2048368229954285</syntaxhighlight>
 
=={{header|EasyLang}}==
{{trans|C}}
<syntaxhighlight lang=easylang>
func rms v[] .
for v in v[]
sum += v * v
.
return sqrt (sum / len v[])
.
v[] = [ 1 2 3 4 5 6 7 8 9 10 ]
print rms v[]
</syntaxhighlight>
 
=={{header|EchoLisp}}==
Line 694 ⟶ 707:
=={{header|Elena}}==
{{trans|C#}}
ELENA 56.0x :
<syntaxhighlight lang="elena">import extensions;
import system'routines;
Line 702 ⟶ 715:
{
get RootMeanSquare()
= (self.selectBy::(x => x * x).summarize(Real.new()) / self.Length).sqrt();
}
Line 1,891 ⟶ 1,904:
=={{header|RPL}}==
≪ LIST→ → n
0 1 n '''START''' SQSWAP nSQ ROLL+ '''NEXT'''
2 n '''START''' + '''NEXT'''
n / √
≫ ≫ '<span style="color:blue">RMS</span>' STO
Line 1,902 ⟶ 1,914:
</pre>
{{works with|HP|48G}}
DUP ≪ SQ + DOLIST ∑LISTSTREAM LASTSWAP SIZE / √
≫ '<span style="color:blue">RMS</span>' STO
 
Line 2,311 ⟶ 2,323:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">var rms = ((1..10).reduce(0) { |acc, i| acc + i*i }/10).sqrt
System.print(rms)</syntaxhighlight>
 
Anonymous user