1.4 KiB
1.4 KiB
title | id | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
Averages-Root mean square | 594da033de4190850b893874 | 5 | 平均值 - 均方根 |
Description
计算数字1到10(包括1和10)的均方根 。
均方根也以其首字母RMS(或rms)和二次均值来表示。
RMS计算为数字平方的平均值,平方根:
$$ x _ {\ mathrm {rms}} = \ sqrt {{{x_1} ^ 2 + {x_2} ^ 2 + \ cdots + {x_n} ^ 2} \ over n}。 $$
Instructions
Tests
tests:
- text: <code>rms</code>是一个功能。
testString: 'assert(typeof rms === "function", "<code>rms</code> is a function.");'
- text: '<code>rms([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])</code>应等于<code>6.2048368229954285</code> 。'
testString: 'assert.equal(rms(arr1), answer1, "<code>rms([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])</code> should equal <code>6.2048368229954285</code>.");'
Challenge Seed
function rms (arr) {
// Good luck!
}
After Test
console.info('after the test');
Solution
// solution required