freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/rosetta-code/averages-root-mean-square.c...

1.4 KiB
Raw Blame History

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