1.9 KiB
1.9 KiB
id | title | challengeType | videoUrl |
---|---|---|---|
594d966a1467eb84194f0086 | 平均值 - 毕达哥拉斯指的是 | 5 |
--description--
计算整数1到10 (包括)的所有三个毕达哥拉斯方法 。
为这组正整数显示$ A(x_1,\ ldots,x_n)\ geq G(x_1,\ ldots,x_n)\ geq H(x_1,\ ldots,x_n)$ 。
这三种方法中最常见的算术平均值是列表的总和除以其长度: $ A(x_1,\\ ldots,x_n)= \\ frac {x_1 + \\ cdots + x_n} {n} $ 几何mean是列表产品的$ n $ th根: $ G(x_1,\\ ldots,x_n)= \\ sqrt \[n] {x_1 \\ cdots x_n} $ 调和平均值是$ n $除以总和列表中每个项目的倒数: $ H(x_1,\\ ldots,x_n)= \\ frac {n} {\\ frac {1} {x_1} + \\ cdots + \\ frac {1} {x_n}} $假设输入是包含所有数字的有序数组。
要获得答案,请按以下格式输出对象:
{ 值:{ 算术:5.5, 几何:4.528728688116765, 谐波:3.414171521474055 }, 测试:'是A> = G> = H?是' }
--hints--
pythagoreanMeans
是一种功能。
assert(typeof pythagoreanMeans === 'function');
pythagoreanMeans([1, 2, ..., 10])
应该等于上面相同的输出。
assert.deepEqual(pythagoreanMeans(range1), answer1);